When is Yocto Right for You?

When is Yocto Right for You?

Embedded systems are more complicated than they’ve ever been. Modern devices have multiple connectivity stacks; they run heterogeneous software written in many different languages written by third parties; they perform machine learning and send telemetry to the cloud and receive OTA updates. A single-threaded bare-metal OS won’t satisfy these complex requirements, but Linux will. The Yocto Project was created to manage the details of deploying Linux in modern embedded environments.

What is Yocto?

Yocto is a toolkit for creating platform-specific Linux OSes. It’s not a Linux distro like Ubuntu or Fedora: it’s how you create your own distro, tailored to your chosen hardware platform. Every aspect of the system can be customized: bootloader; kernel configuration; init system; file system; application libraries; GUI frameworks and connectivity stacks.

The basic unit of Yocto is the recipe, a text description of how a software component should be built. Recipes are composed of tasks, each of which performs one step in the build process: download the repo; configure it; compile; create a package; and several other steps as well. Recipes can use classes to handle common idioms, such as fetching from a Git forge; building with meson or CMake; or building a Linux kernel module. 

Recipes are grouped into layers. There are over 100 layers available at the OpenEmbedded layer index containing thousands of recipes, covering everything from Python library collections to board support packages to security and hardware optimizations which cut across module boundaries.

Bitbake is the build system for recipes and the tool you use to work with Yocto. Bitbake lets you build disk images for deployment, generate SBOMs and auditing material, and debug the build process when something goes wrong.

There are also third-party tools to automate the process of downloading layers and configuring Bitbake. The most popular of these are repo and kas.

Advantages of Yocto

Compared to off the shelf distros such as Debian, Fedora, or Alpine, Yocto has the following benefits:

  • Embedded focus: Most mainstream distros are developed with laptops or desktops in mind. Yocto was meant for embedded systems, first and foremost. You won’t be surprised by unexpected desktop features in your default install, such as printer drivers or media players: but if you want those features, recipes are available!
  • SoC vendor support: Most hardware vendors publish Yocto layers as part of  their BSPs: meta-freescale, meta-ti, meta-qcom (Qualcomm), meta-altera, meta-amd. You can start with a kernel that has been tuned for your chosen hardware, instead of a generic aarch64 kernel that probably won’t recognize your vendor’s SerDes module or GPU.

Compared to other build-your-own-distro tools (most prominently buildroot), Yocto has:

  • Package system: You can keep track of your own modules using dpkg/apt or rpm/dnf instead of using ad-hoc install scripts.
  • Larger package collection: With such a comprehensive library, the odds are that the modules you need are already packaged for Yocto. 
  • Regular update cycle: Yocto minor releases appear every 6 months, containing the latest updated packages and security fixes. LTS releases occur every 2 years.

Challenges

Building a system from components is much more complicated than downloading a one-size-fits-most bootable image. Yocto and bitbake reflect that complexity, but they also have their own specific foibles:

  • Complicated recipe syntax: Recipe variables can be expanded “immediately” (i.e. when the recipe is parsed) or at “expansion time” (when the recipe is running). Recipe tasks can be written in sh (which can be any shell, not necessarily bash!) or in Python, or both. Strings in recipes are similar to strings in shell languages, but not exactly the same!
  • Buried errors: Bitbake is written in Python and has ample logging for every phase of every task of every recipe. When a task fails, you get a Python stack trace. Getting through all that to find the build output of the failing module can be tedious.
  • Stale/incomplete documentation: Yocto documentation tends to be both overwhelming and incomplete. This problem is so well known that the official Yocto docs include a note titled “What I wish I’d known about Yocto Project”! To make matters worse, search engines and AI tools often base their responses on outdated editions of the Yocto docs, giving misleading results.

Is Yocto right for my project?

If your project requires multiple software services, large on-device storage, cloud connectivity, complex UI/UX elements, or all of the above, Yocto can be just what you need to meet your goals. As a leading expert in embedded systems, Dojo Five offers the knowledge and experience to make your vision come to life.

Discover why Dojo Five EmbedOps is the embedded enterprise choice for build tool and test management.

Sign up to receive a free account to the EmbedOps platform and start building with confidence..

  • Connect a repo
  • Use Dev Containers with your Continuous Integration (CI) provider
  • Analyze memory usage
  • Integrate and visualize static analysis results
  • Perform Hardware-in-the-Loop (HIL) tests
  • Install the Command Line Interface for a developer-friendly experience

Subscribe to our Monthly Newsletter

Subscribe to our monthly newsletter for development insights delivered straight to your inbox.

Interested in learning more?

Best-in-class embedded firmware content, resources and best practices

What is TLS?

What is TLS and When Can It Be Used?

Transport Layer Security (TLS) is a cryptographic protocol that provides secure communication over computer networks. It is the successor to the Secure Sockets Layer (SSL) protocol and has become the de facto standard for securing data transmission across the internet. How TLS Works TLS operates through a handshake process where a secure connection is established between two parties. First a key exchange occurs between the client and server using an asymmetric algorithm such as RSA or Elliptic Curve Diffie-Hellman (ECDH).

Read More »
Addressing the CRA SBOM Mandate

Addressing the CRA SBOM Mandate: How to Achieve Compliance

Written by: Joe Schneider The EU Cyber Resilience Act (CRA) has fundamentally changed embedded software development by mandating proof of a product’s secure operation and ability to remain safe throughout its lifecycle. Despite being an EU regulation, the CRA is applicable to any globally manufactured product targeting EU markets and has led many other jurisdictions to introduce similar cybersecurity initiatives. These include the USA’s Executive Order 14028, Japan’s METI’s Cybersecurity Management Guidelines and the UK’s Product Security and Telecommunications Infrastructure

Read More »
Get gui showing commit messages

Using a Git GUI Isn’t All Bad (And Sometimes Pretty Useful)

While not the popular opinion of CLI git users, I’ve gotten a ton of mileage from my git GUI. Using the CLI rather than a GUI provides a lot of value: seeing the bigger picture of your code and being able to navigate through different branches, commits or history can become clean and easy to understand with a little help from your friendly GUI. As a recap on what each term means, here is a description of git, CLI and

Read More »