Mender Blog

Yocto and OTA software updates in an IoT project | Mender

Written by Kristian Amlie | Jul 5, 2021 4:00:00 AM

The Yocto Project is an open-source project that allows you to create a custom operating system image tailored to your needs. With The Yocto Project, you can build an entire OS image from the source, giving you complete control over the components and features included. This flexibility makes The Yocto Project particularly well-suited for embedded systems, where minimalism and customization are critical for security and success. Although The Yocto Project requires users to build the distribution themselves, the result is a highly customizable, lightweight, and streamlined OS image that can be fine-tuned for your hardware. Unlike more feature-rich distributions like Ubuntu, The Yocto Project includes only the essentials, ensuring your system remains as efficient and focused as possible. You can learn how to prepare a Yocto Project environment from scratch or go further and create custom images using the Yocto Project here.

Build The Yocto Project from the ground up

The Yocto Project is a far-encompassing Linux build system that allows users to make highly customizable distributions. The Yocto Project is ideal for embedded projects because it can be tailored as your use cases grow, starting small and scaling up regardless of the need. Once a need is identified, the user builds an image from the ground up using The Yocto Project. Consider the customization of The Yocto Project with this analogy: When you insert a USB device into your laptop, you typically expect it to work automatically because the necessary drivers are already included in the factory OS. Ubuntu works similarly. However, this isn’t usually the case with The Yocto Project. If you insert a USB device, it likely won’t work immediately because the required driver isn’t included by default—you would need to include it when building your custom image specifically.

For an embedded engineer who wants to start with a base minimal image, The Yocto Project provides the proper customization according to user needs. The Yocto Project is far from minimal, but it can build minimal images if the user chooses to do so. For example, if you want to use Bluetooth, you will have an easier time finding a Bluetooth driver for Ubuntu, but not with The Yocto Project. Ubuntu might be more practical from the perspective of readily available tools. But depending on the functionality you want to add, The Yocto Project is probably a better way to do it, as it’s more modular. Due to the customizable nature of The Yocto Project, the skill ceiling is much higher than that of a traditional Linux distribution. However, the learning can pay off exponentially by providing the perfect tailored architecture for an IoT project. 


The Yocto Project as source code for embedded image vs pre-compiled

The Yocto Project is the ideal tool for building an image for embedded devices due to its ease of customization from source code. Debian is the pre-compiled alternative for stability, although users sacrifice customization for ease of use. With lots of software, everything is combined into binary code, which can be modified, ultimately providing a predictable embedded image. The predictability of Debian has a much smaller learning curve, which is enticing for an out-of-the-box distribution. However, The Yocto Project is much more flexible for embedded systems. The Yocto Project places a lot of emphasis on ensuring that build parameters are the same across systems once proper setup occurs. Ubuntu and Debian come with some sensitivities. If you download a specific release, the image you get will remain the same until the next official release. Ubuntu and Debian follow a fixed release model, meaning that updates and patches are applied through package updates, not by changing the image itself. Therefore, you don’t have to worry about rolling releases, where the system is constantly updated with new changes. Due to their pre-compiled nature, Debian and Ubuntu offer predictable architecture, which requires much less preparation and knowledge. Still, the lack of customization can often affect scalability, creating problems down the line for IoT projects. 

The advantage of an image built with The Yocto Project is the customization and stability in what you can build once the proper groundwork has taken place. Through The Yocto Project, with confidence, you can move to a more recent release once you have decided the time is right for your IoT project.

The benefits of The Yocto Project

The Yocto Project offers significant advantages, particularly in its ability to create highly customizable and optimized operating systems. Unlike Ubuntu, which tends to be more general-purpose, The Yocto Project allows architects to tailor the OS specifically to hardware and software needs, leading to much smaller and more efficient images. For example, Yocto images can be as small as 600 megabytes, compared to the smallest Ubuntu images, around 3 gigabytes. This size reduction is crucial for devices with limited memory and for performing software updates over cellular networks, where bandwidth is a concern. Additionally, The Yocto Project supports cross-compilation, enabling you to build software on a more powerful development machine, which is essential for embedded systems with limited processing power. Thanks to its detailed build process, The Yocto Project's consistency and reproducibility ensure reliable performance in production environments. Furthermore, The Yocto Project's layered architecture allows for modular development and maintenance, making it easier to manage different components of the system. The Yocto Project can be tailored for multiple hardware architectures, including x86 and ARM, coupled with its large ecosystem of pre-built layers and recipes, which significantly accelerates development and compatibility when coupled with the proper preparations. The Yocto Project's vendor-neutral design and active community make it a versatile and powerful choice for creating custom Linux distributions for embedded systems.

Next steps

For more information, consider reading these other articles on The Yocto Project: