Buildroot & Yocto: Which Platform to Choose for BSP Development
BSP development for Linux-based hardware platforms brings a question for software engineers: which build tool for embedded software would be the best — Buildroot or Yocto? In this article, we will compare these solutions: review their merits and drawbacks, provide examples of using Buildroot on Xilinx platforms and explain why Buildroot is the best choice when developing BSPs for hardware platforms built from scratch.
Whether you design your hardware platform as a general-purpose embedded Linux development board or as a device-specific custom solution, it requires a software or firmware part — a useful board support package (BSP) for application development to work properly.
A BSP enables basic software configuration and assembly. It contains the necessary drivers for the device's chipsets and a test set of software to demonstrate the available hardware capabilities.
As for BSP development for mass-produced platforms, engineers can add an automatic check system to test basic parameters in production:
- to check communication with existing chips on i2C/SPI buses, SATA/USB/PCI/Ethernet interfaces, etc.;
- to measure frequencies from the chip clocks on the board from which interfaces are clocked;
- carry out automatic ADC/DAC checks, in case they are available.
All of this significantly reduces the overhead costs of testing the manufactured hardware.
Our experience shows that hardware companies often do not have an extended software team to meet the challenges of Linux kernel and BSP development. And as for mass-produced development boards, time is crucial since engineers tend to choose a solution with a more advanced and user-friendly software package out of equal variants with the required features because such software will significantly speed up and simplify their work with the platform.
This is why some hardware companies focus on hardware development and outsource embedded Linux programming. And BSP development based on a Linux Buildroot is exactly that solution.
Buildroot-based BSP development. What is this?
Buildroot is an open-source embedded system for building distributions used in embedded applications like routers, switches, network cards, set-top boxes, and other SoC-based devices. Software engineers develop BSPs on their PCs when building embedded applications due to development usability and environment. Also, their development platform has a lot of additional debugging software.
The Buildroot main menu
The Buildroot system is based on the Makefile instructions, and most engineers involved in embedded Linux software development are familiar with the Makefile format. And even this part is hidden from the system's end user by the user-friendly Buildroot menu; even engineers with minimal experience can handle it.
Using the Buildroot menu is an easy way to integrate your developments into the build system. New drivers or software can be added by writing special instruction files that hide all internal information to give the user a simple and friendly interface with the ability to select and modify the required BSP's settings.
In this article, we would like to share our experience in embedded Linux system design and development, successfully used at Promwad to build client's Buildroot-based BSP for Xilinx SoC and hardware platforms from other vendors.
It is important to note here that Xilinx uses a specific Linux distribution for its BSP on Xilinx Zynq and Zynq MPSoC devices. It’s called PetaLinux, and it’s built on top of Xilinx Yocto layers using Yocto eSDK (extensible SDK) method.
PetaLinux is a toolset for software engineers to enable them to build, customise, and deploy embedded Linux systems on various processors designed by Xilinx. That's why you can find a lot of "petalinux/yocto" engineering notes on the Xilinx website and forums, but only a few publications on using Buildroot on custom Xilinx boards.
This focus on Xilinx hardware and the availability of vendor support helps a lot when prototyping devices on Xilinx boards, but when you are using any software or hardware modules outside of the Xilinx ecosystem in your project then Buildroot is a great alternative that gives you the flexibility and independence you need.
Benefits of a Buildroot-based BSP
Buildroot has strong advantages that should be considered when choosing a platform for BSP development:
- Buildroot is a free software.
- Community support and the ability to include configuration files for your hardware as a standard package from buildroot.org.
- Buildroot is easy to use and allows you to develop BSP for your specific hardware quickly and with minimum operations. “Take it easy” is our way in BSP development.
- Popularity with the masses: many developers worldwide are familiar with the Buildroot build system and Buildroot-based custom kernels. This shortens the time to market for your final product: there is no need to spend time learning about unfamiliar development solutions.
- You can concentrate on developing the hardware platforms, and the software development company will maintain BSP for your devices: preparing and editing its DTS files, debugging, porting, and writing drivers.
While Buildroot has its advantages, there are also limitations:
- Often, you need to add extra scripts to implement the functionality you need, whereas vendor-supported build systems already provide a complete solution.
- Buildroot does not support all vendor development boards by default, which can lengthen the timeline for the first launch of applications based on off-the-shelf development boards.
- Limited support from hardware vendors and board manufacturers.
Linux kernel Buildroot vs Yocto/PetaLinux: pros and cons
We will now break down the features of Yocto-based PetaLinux, compare it to Buildroot and identify the advantages and disadvantages of each for different types of projects.
PetaLinux is an open-source build system specially designed for building Linux systems. PetaLinux is not built on top of the Yocto platform but uses it as the base build system and is compatible with many of its layers, thus inheriting some of the benefits and drawbacks of Yocto.
With PetaLinux, the Linux kernel and boot loader can be configured and supported for various devices and drivers specific to Xilinx hardware.
The user interface for PetaLinux configuration
PetaLinux includes the following tools and functions:
- pre-configured templates and samples for Xilinx platforms;
- an easy-to-use graphical interface for configuring and building Linux systems;
- software packages and libraries optimised for Xilinx platforms, such as hardware acceleration libraries for video and image processing.
What are the advantages of PetaLinux?
- Compatibility with a wide range of Xilinx hardware platforms, including Zynq and Zynq UltraScale+ MPSoC devices.
- Ability to create a device tree and loader configuration based on the Vivado hardware export file, including configuration for PL IP blocks and PS pause numbers.
- Multiple hardware configurations are supported via the user-friendly UI, which allows easy customisation of many parameters, e.g. DDR memory addresses or QSPI flash memory size.
- Extensive documentation on the Xilinx website, including a wiki and forum that contain examples and step-by-step guides for the most common tasks and problems encountered when running PetaLinux on Xilinx platforms.
- Most hardware vendors provide a pre-configured PetaLinux BSP for their dev boards, reducing the time required to run a PetaLinux-based system.
- Compliance with the Yocto build system allows the system to be easily extended with additional software packages using third-party Yocto layers.
Based on this list of benefits, PetaLinux is a powerful and versatile build system well-suited for building custom Linux systems for Xilinx SoC-based embedded platforms, with a user-friendly graphical interface, pre-configured templates and support for a wide range of software packages.
However, it's more complex. PetaLinux has several features which can play a crucial role when choosing a build system for a BSP:
- PetaLinux is limited to Xilinx SoC-based embedded platforms, so it is not as flexible as other build systems.
- Compared to Buildroot, it is a more complex build system and requires in-depth training.
Building a system with PetaLinux will take longer and require more disk space.
Stocking a hardware and software platform based on PetaLinux can be more complex and resource-intensive than other build systems. And the focus of PetaLinux on Xilinx hardware limits its use for other embedded systems.
By using tools from Xilinx, we limit ourselves in advance to their toolkit; otherwise, we will lose support from the manufacturer. This choice works fine for standard development boards when we use Xilinx hardware for prototyping and developing BSP based on Petalinux. In this case, we are assured that our BSP is 100% adapted to the specific hardware platform, and if we have any questions, we can ask Xilinx for support. This saves both us and the customer time: the prototype is faster and cheaper.
However, PetaLinux is inferior to Buildroot when developing a BSP for hardware developed from scratch or based on an off-the-shelf solution with hardware and software components from third parties.
Often, we create a BSP for a board where the changes are so significant that all that is left of the native Xilinx Petalinux is its name. Nothing will likely work if the Petalinux uses a kernel from Analog Devices instead of the Xilinx one. That's why we develop a BSP based on Buildroot for such projects. Let's see how it works in practice.
BR2_EXTERNAL mechanism in Buildroot-based developments
When creating a BSP, we use the standard BR2_EXTERNAL mechanism, described in detail in the Buildroot documentation.
The process of creating a boot.bin file in the BR2_EXTERNAL mechanism
The idea of the mechanism is that it is possible not to make any changes at all to the specific Buildroot delivery itself and, thus, quickly update the version. All changes, board descriptions and additional software are in a separate directory and are subject to specific rules. With this approach, upgrading a Buildroot version to a newer one takes a few minutes plus time for testing. By the way, testing can be automated, for example, in Jenkins.
Working on the BR2_EXTERNAL mechanism, we use a separate directory stored separately from the Buildroot sources in Git and containing specific software and hardware descriptions.
For example, we use one directory for all Promwad projects, which contains the configuration of all our projects. But this doesn't prevent you from maintaining a separate Git for each project. Some customers want a separate Git with parameters only for their hardware, and some ask to use a third-party or personal service for the version control system. In any case, the Buildroot based on BR2_EXTERNAL allows for a fairly flexible approach to dealing with such issues.
Promwad's experience in Buildroot-based development
Promwad's Linux engineering team has extensive experience in board support package development to meet our customers' requirements:
- We integrate the SoC of most manufacturers into the Buildroot build system: we apply Buildroot on ARM and use Linux kernel Buildroot on Xilinx Zynq and other FPGA CPUs.
- We automate the building process of the PS part (operating system, loaders) and PL part (FPGA bitstream).
- We are engaged in Linux kernel development and Linux device driver development at the boot level for many chips. This saves time for our client: we already have drivers for chips to use them in BSPs under development.
- We develop documentation for end users.
- We create automatic testing systems for production: equipment interfaces and chip testing. For clock chips, we conduct verification of generated frequencies.
- We provide end-user support.
Buildroot can be used to build firmware for different types of boards, for example, for ZCU111, ZCU102, and ZCU106 from Xilinx.
The ZCU106 dev board by Xilinx. Photo: xilinx.com
An off-the-shelf BSP usually performs all the necessary functions. However, you may require additional software for full functionality. We can adapt any software to a specific BSP, whether developed by our client, purchased from a third-party manufacturer or ordered from us. Whatever it is, we will add the new software as a standard package and make it part of the board support package.
On a recent project, we successfully implemented Buildroot-based BSP development for the Xilinx Zynq Ultrascale+ platform. Our BSP development for this processor family allows you to have a complete Image to boot via JTAG or SPI/eMMC flash.
While creating BSP, we also prepare basic FPGA and develop necessary PL-side and IP cores taking into account our customer's hardware wiring diagram.
The result is a complete BSP with a fully automatic build system and integration with the latest Buildroot version available.
Contact us if you want to develop or upgrade your BSP based on the Linux kernel Buildroot — our embedded software engineers will help you with that!