Deep Dive: A Complete Automated Yocto-Linux Build Setup for RaspberryPi
February 26, 2024
Blog
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:
- dhcpcd, avahi, bluetooth, vi, CPU frequency reporting
- Explanations on Kernel versions, over 40 direct links to specific Yocto documentation locations
- Explanations on the image setup, layers descriptions, main board functions
- Helper scripts
- Basic usage instructions, example of integrated GUI application
- Basic instructions on how to modify the project
- The capability to build it for almost any Raspberry PI board
- 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/