In any embedded project, a fundamental question arises: how should the operating system for the board be created?
There are essentially four main options available for accomplishing this task. In this article, I will present the pros and cons of each option, providing a detailed examination to aid in the decision-making process.
Written by Bo Thorsen
2024/1/19
Introduction
The four options are:
- Yocto
- Board manufacturer image
- Standard Linux distro
- Embedded Linux distro
Table of Contents
When we look at these, the biggest difference is that with Yocto you have to build a lot from scratch, where the others are less hands on.
I am not considering things like build options, over the air updates, security updates, and so on. The reason for that is that these are mostly the same challenges with all of the options, although some embedded Linux distros do help you with it. And don’t get me wrong – these parts are a lot of work. But they mostly do not have an impact on the question of whether to go with Yocto or not.
Option 1: Yocto
Going with Yocto means building a Linux that is specifically targeted for your system. This is the big payoff: You get something that is customized to suit exactly your needs.
The image can be built in a way that suits your delivery method and contain only what is necessary for the application. The list of pros for Yocto is actually quite easy to write:
- Customized
- Compact
- Optimized
When it comes to cons, the list is a lot larger. That is because while Yocto is a very viable option, there are a lot of things to consider before using it to build the OS.
-
Con 1: Workload
Building a Yocto image is a lot of work in itself. It's a huge effort you need to do while at the same time building your application. It's quite common to have a small team that focus entirely on building the image, although I do think it's a good idea that there is at least an overlap with the team doing the application.
-
Con 2: Maintenance
The herculean effort in creating the system actually leads to the second problem: Maintenance. I have seen quite a lot of Viking Software customers who have a great Yocto setup - some built by us, some by themselves - but fail to provide the effort of keeping this updated. The reason for this is that updating parts of the system often leads to a cascade where you end up updating the entire image. And with the customizations built for your Yocto, this means it is a lot of ongoing work for the whole lifetime of the system. However, this also leads to an unexpected pro not included on the list above: You have the option of keeping it up to date. Some of the alternative options for building the operating system are almost impossible to continue on, should the vendor cut the support. This will not happen with a Yocto based image.
-
Con 3: Drivers
It's very hard to do optimized drivers for stuff like OpenGL application. And sometimes even just for the screens added to the box. And drivers is just a specific example of the cost associated with the customization: You have to make the right choices - and there are a huge amount of choices.
-
Con 4: Knowledge
It is hard to find people who know Yocto very well. But I do think that as long as you find people who truly understand Linux, then they will quickly learn Yocto itself. In customer projects I have never seen learning Yocto as something the customers had a hard time doing. So work around this by having people with Linux skills.
-
Con 5: Resources
Other than the human resources mentioned in problems 1, 2 and 4 above, going with Yocto means your automated build system will need to be many times beefier than if you "only" use it for the application. Building a Yocto image takes a very, very long time. Having a CI/CD system with automated builds and unit tests is in my opinion necessary for any software project. But for a Yocto image, it's crucial. You can not do this without such a system. And you probably don't want to pay Github or Gitlab for the builds, so you need to set this up in-house.
-
Con 6: Time to market
This may not be a large consideration, if the development of the Yocto image can happen in parallel with everything else. But even in this case, the time to market for updates may be a problem.
Option 2: Board manufacturer's image
If your board comes with a prebuilt image, this is usually the way to go. It’s no effort for you, and the only cons are if the drivers have problems or if the manufacturer does not maintain it properly. And those just mean you then have to switch to doing one of the others. Do this if you can, you need a very good reason not to.
Option 3: Standard Linux distro
This choice is taking a Linux distribution like Debian, Alpine or even the bigger (in many ways) desktop distros Ubuntu, SUSE, Redhat etc.
It always surprises everyone how big an effort it is to do an image based on these. What you gain compared to Yocto is that someone else maintains the packages and handles updating those. The loss is less control over what goes in the image, as there are dependencies on packages you may not need.
We have done this some times for customers, and it actually works quite well. The effort is spent in creating an automated image builder and handling drivers, but compared to Yocto it takes minutes to create an image in the build system where Yocto takes many hours.
The biggest con with these is that you are at the mercy of the distro when it comes to maintaining the packages. Even the LTS versions of these are nowhere near enough for many embedded products. The product life can be ten or even twenty years, but the support time of most Linux distros is usually a couple of years – maybe five if you are lucky. Once you hit this, the upgrade path is very hard, and in some cases can’t be done – we hit this with a 32 bit Alpine based image for a customer, for example.
Yocto is more work initially and during maintenance. But it has a higher probability of being supported for the entire lifecycle of your product. Only you can decide which of these is more important.
Option 4: Embedded Linux Distro
There are a lot of specialized embedded distributions of Linux, many of these commercial with a per item cost. This is usually the biggest downside of the option. Because other than that, these have a lot going for them. The drivers are usually much more optimized for what you will likely need, the image is built with fewer dependencies (usually). And they even often come with lifecycle handling, like over the air updates (which is a very large effort in itself).
This is a great choice, but it usually comes at a monetary cost. And if there’s one thing companies dislike even more than paying for per developer tools, it’s paying for per device embedded licenses.
Summary of the 4 options
-
Option 1: Yocto
Customizable Linux build for precise needs but requires extensive effort in development, maintenance, and knowledge of Linux. Offers control over updates, but is resource-intensive and affects time to market.
-
Option 2: Board Manufacturer Image
Simplest, requiring no effort. Risks include potential driver issues and reliance on manufacturer maintenance. Suitable unless significant problems arise.
-
Option 3: Standard Linux Distro
Less control but easier than Yocto, with maintenance outsourced. Building images is faster but dependent on distro lifecycle, posing long-term support challenges.
-
Option 4: Embedded Linux Distro
Optimized for embedded use with better drivers and fewer dependencies, often including OTA updates. Main con is the cost of commercial licenses.
Conclusion
Going with Yocto is a seductive choice. You can’t beat the control and accuracy of this. But the cost, in terms of initial effort and stagnating builds owing to missing update resources, is very high.
Yocto may be the right choice for you, or it may not. I can’t tell you whether this is the case. You have to weigh the pros and cons of each of the options available for your specific situation.
If you need someone to do some rubberducking with you on this problem, give me a call.