Deep Dive: A Complete Automated Yocto-Linux Build Setup for RaspberryPi

By Atanas Rusev

Founder, Senior Embedded SW Engineer

TripleHelix Consulting

February 26, 2024

Blog

Deep Dive: A Complete Automated Yocto-Linux Build Setup for RaspberryPi
Raspberry P4 B board mounted on a Kuman touchscreen.

Triple Helix Consulting has released a complete Yocto Linux build for Raspberry Pi (RPI) to open source. With it, you can make a custom lightweight distribution for Embedded projects and products. The project comes with an extensive 30-page guide.

While the main tools for this have existed for years, taking the basic Yocto, RPI, Poky and OpenEmbedded layers and adapting them to a custom build is often a challenge. It requires deeper knowledge in both Yocto and Linux, in combination with Embedded / RPI specifics. To help with that, in this newly released project all the custom setup is already done. We also added scripts for automatic download and build, requiring the execution of only a few commands.

Why use Yocto-Linux for any Embedded Device

There are lots of reasons that Yocto is suitable for any Embedded Project. Yocto and BitBake provide a toolset to combine a custom set of basic tools, libraries, custom Linux Kernel, and custom application software, and Embedded and Real-Time devices often need to be customized.

Yocto supports cross-compilation by design, providing setup for many CPU and microcontroller architectures. It also supports multiple toolchains and build systems. It also allows porting an entire such setup to different hardware platforms via publicly available BSP layers. You can add any existing package, too, because design is fully modular.

As hardware vendors and big companies recognize Yocto’s unique capabilities, it is becoming widely supported by big names like AMD, Arm, AWS, Cisco, Intel, LG, BMW, Microsoft, RISC-V, NXP, ST, and many others. They all provide open source resources. GNU/Linux tools are supported by default, and custom lightweight versions exist for Embedded devices.

This build has been in use for years, so many frameworks and programming languages are also supported by default. These include Qt, Java, openssl, and X11. It’s important to know that any Linux-compatible software can be added to a Yocto build. Most big development board suppliers offer Yocto layers for their products. Apart from Raspberry Pi, there is also BeagleBone, Odroid and Khadas. Finally, Yocto provides mechanisms for handling multiple versions and dependencies. For any already setup packet, it handles them automatically.

Development and cost benefits

Any product based on Yocto benefits from the complete GNU/Linux ecosystem of development tools, free software, free packages, example projects, and full customization capabilities.

This means you don’t pay for compilers, libraries or other software. In addition, anything you share may be used, checked, and improved by hundreds of people, although of course no one must share any proprietary layer or software.

Yocto pros and cons

Yocto is complex. Without knowing the basics, you can get lost in its 4000-pages of documentation. That means that you will have to pay the cost of getting to know it, and of setting it up for your project. It is essential to remember that any toolchain will require an initial introduction, and many are equally complex.

This is where the released open source project helps, thanks to its complete and easy user guide.

The main packets used for the project are Linux 5.10/5.15, GNU-Tools/BusyBox, Ethernet, Shell, SSH, WLAN, GUI/X11 support and an IMGUI-Demo application.

To these, we added:

  1. dhcpcd, avahi, bluetooth, vi, CPU frequency reporting
  2. Explanations on Kernel versions, over 40 direct links to specific Yocto documentation locations
  3. Explanations on the image setup, layers descriptions, main board functions
  4. Helper scripts
  5. Basic usage instructions, example of integrated GUI application
  6. Basic instructions on how to modify the project
  7. The capability to build it for almost any Raspberry PI board
  8. Multiple short conceptual explanations of basic perspective for working with Yocto.

Building on Manjaro or other distributions

Yocto is officially supported only on a handful of major Linux distributions. Atans Rusev is author of the Manjaro Linux User Guide book, and Manjaro is also a top distribution, widely liked by online communities. Due to this, we added a short instruction on how to use Yocto on Manjaro. The project can be built on any regular end-user distribution after installing the required dependencies.

Why Raspberry Pi

Raspberry Pi is one of the most widely distributed development platforms around, with over 45 million units sold worldwide until the end of 2021. It adds tens of extension boards, hundreds of open source projects, and is one of the most beloved boards among hobbyists.

Project Links

GitHub: https://github.com/triplehelixconsulting/meta-thc-v1

Business use case: https://triplehelix-consulting.com/yocto-demo/

Atanas Rusev is a Senior Embedded SW Engineer with over 18 projects behind his back and the founder of TripleHelix Consulting - an embedded development company. He is also the author of the Manjaro Linux User Guide - a general linux book, presenting Linux usage for beginners and mid-level users through one of the top Arch-based distributions. As a Linux fan, he initiated and led a fully automated Open Source Yocto-Linux build for Raspberry Pi as a free resource.

More from Atanas