Author: Corey Minyard, MontaVista Software

At MontaVista, we have talked to many engineers and developers who are using Ubuntu or Centos as a base for building an embedded system. Despite its advantages, this has some disadvantages that are not obvious from the beginning.

For the record, we at MontaVista support Yocto, Centos, Rocky, Ubuntu and other Linux distributions. Therefore, we don’t have a vested interest in any particular solution. But neither do we want to see our customers suffering in the long term with decisions they made in the short term. This blog will provide some insights into both Yocto and a Linux Distro to help you make a well-informed decision on which build system would be best for your embedded Linux project.

Why Use a Distro?

A distro is easy to get started with for engineers who are accustomed to using Linux. You just install it on your system, compile things on your system while you are working, and everything will just work. Then install the packages as you need them for your project.

On the other hand, Yocto can give you some frustration if you’ve never used something like it before. For instance, you have to specify what you need, understand packaging and how you do things. It’s not hard, but it’s different. The learning curve is often one of the reasons why people, especially beginners, don’t want to use Yocto.

So What’s the Problem with a Distro?

So after you start developing and playing with things when working on your system, you will realize you need to have some discipline in managing the operating system (OS). Developers have their own distro, and they are different. You will have problems when you try to get everything working together.

So to have disciplined management of the OS, you develop a “gold” image that someone is appointed to manage. Then you will have a procedure for creating it if you are really disciplined. For example, anyone who wants to add a package to the product has to go through a procedure to add it to the gold image.

Your build system must be able to take a gold image and build everything into that image to install onto the target system.

After that, you release your system to the field and start working on the next release. In this case, you will have to manage an old gold image along with the new gold image. Then the maintenance team has to manage bug fixes and security updates for the original release. You suddenly have chains of gold images. If a customer is using an older version, you will have to be able to go back to those gold images for reproduction and fixes. It is easy to see that maintenance of the images could become a very complicated task.

As your software grows, compiling everything on the target will become a bottleneck. You need dedicated hardware for builds, which makes managing the build environment complex. If you are targeting ARM, for instance, you might have to have special dedicated faster hardware for building.

And finally, designers often want development software on the target for debugging and testing - debuggers, strace, valgrind, and things of that nature. But having those things on the final target can lead to bloat and possible security issues. So you will need two gold images, one for development and one for release, and you have to keep them in sync. What if you miss something? It means more complexity.

So How Does Yocto Help?

The following table shows a comparison of Yocto and distro based systems. The section below will go into more detail.

Table 1. Yocto and Linux distro bases system comparison
Yocto Distro
Easy turn-key build Complicated build
Build on standard PC hardware Must build on the target architecture
No root access required for build Root required for install
Build output can be directly installed An installation process is required, generally
You have to manage some of the update process Updates are handled for you
Not as easy for an IT person to manage Familiar to an IT person
Configuration can be managed in git Configuration is complex and hard to automate

Managing Build Complexity

Yocto allows you to create a system where everything can be built from scratch by everyone based upon a single small package description. It can pull things, based upon specific versions, from git repositories, tarballs, mercurial, or anything else like that. Yocto has ways to automatically store things locally so you don’t have to worry about things going away on the internet.

You get a complete bootable image out of Yocto as a filesystem, which makes deployment easier for most embedded targets.  

In addition, you can manage your description of your system with git or another version management tool. Users can make branches and do their work and then get them merged, just like they do normal software development. You can also tag releases so they are easy to reproduce.

In general, Yocto makes it easy to manage a complex build environment. Build configuration is managed by standard version management tools. Building happens on standard off the shelf hardware, or in the cloud on demand, making management of the build system simpler. Targets are freed for testing and development. Plus builds can run on fast hardware, speeding up build time.

Once you have learned Yocto, building will become easier in the end.

Customization and Fully Functional Builds

If you have a customized kernel, Yocto will make your job easier. You can specify the kernel configuration changes as part of the system description.

In fact, Yocto is designed to help you easily customize almost everything, including changing out config files, adjusting components, removing specific unneeded parts of packages, or pretty much anything else. You can also build something that comes out of the build fully functional without adjustment.

Yocto has ways to specify what goes into the build based upon the type of build it is. You could build a development build and a final build out of the same configuration, just set a flag to switch between them.

Yocto, of course, can use packaging systems like RPM; it can automatically generate them so you can manage software on the target.

Other Reasons To Use Yocto

If your target system is just too small to reasonably build on (storage space, memory, compute), you must build on another system. Yocto makes this easier, certainly much easier than doing it yourself.

Yocto lets you build a target system without having to have root access. This makes builds more secure, as you don’t need systems with root to be able to create images.

Reasons To Use a Distro

Nevertheless, Yocto does have some disadvantages. If your system goes into something that will be maintained by IT personnel, they will be much more comfortable with a standard distro type of configuration. For something that is only semi-embedded, a distro may make more sense.

Sometimes you are using software that is only supported on a distro. Then, of course, you are stuck.

In case of rapid prototyping, if you don’t know Yocto, it’s going to slow you down. However, if you are building your software using standard tools like cmake, ninja, or autotools, good news is that Yocto knows how to deal with those things.  And if you are building and using the packaging system (RPM, debian, etc.), you should know all your dependencies. Making a transition is easy. Don’t be lazy and fall into the trap of just having some makefiles (though Yocto can deal with that, too), building on the target, and not using the packaging system. The faster you make the transition, the better off you will be!

Furthermore, distros can manage the update process for you. You can just do “yum install” or “apt install” and update. Of course, there is testing, too, if you need to test after updates, you will need to manage that yourself. With Yocto, you must take part in the process. You will get the updates as package updates and then have to build your system and distribute the updates. There are several companies and tools that help you do this and manage getting the data out, including some that manage the servers, but they may add a burden for you.


So when should you use a distro versus Yocto?

Many things do not differ between Yocto and a Linux Distro. You will have standard over-the-air (OTA) update options. You can use systemd on both (though you can also use init on Yocto). You can get a turn-key bill of materials (BOM) (though I’m not sure how distros do this; in Yocto it’s out of the build automatically). Beyond how it’s built, Yocto can also generate a fairly normal Linux installation, including full development software or actually anything else. Yocto can generate a really small embedded image or anything in between. Moreover, you can use containers and have normal RPM repositories in both Yocto and a Linux Distro.

Are you building a fully embedded system that is not managed by normal IT personnel? (Note that I don’t mean management remotely for IOT, but in a server room type of thing.) Do you need the ability to easily automate and recreate builds that can be installed directly and not through an installer? Do you want a “press one button and you get a build” that anyone can do? If so, you should strongly consider using Yocto. It will make your life easier in the long run.

Are you doing a quick hack that will never be used in the field? Are you building something that will go into more of an IT type of environment? Do you have constraints on the software that require you to use a distro? Then a distro may be a better choice.

Additionally, if you fall into the category of using Yocto, you need to schedule a little time up front for learning. Yocto has a learning curve, but that will pale in comparison to what you have to do eventually to manage build and support.

Let MontaVista experts help you!

As a leader in Linux commercialization, backed by over 20 years of experience with hundreds of companies and embedded applications, MontaVista stands as a reliable partner for Linux support and long-term maintenance. Our expertise spans various embedded Linux system projects and issues in diverse markets. From MontaVista Linux to CentOS, Rocky Linux, Yocto and other embedded Linux distributions, MontaVista Professional Services, known as MVXpert, will bridge the gap between general purpose technology and your specific use case, ensuring your project requirements are met. 

Contact us today if you’re interested in leveraging MVXpert services in your projects.