Home - Mind We're hiring !

Linux and Open Source Solutions for Embedded Systems

Linux and Open Source Solutions for Embedded Systems

Recent evolutions in Buildroot

Arnout Vandecappelle

Buildroot is a tool that simplifies and automates the process of building a complete Linux embedded system.

In order to achieve this, Buildroot is able to generate a cross-compilation toolchain, a root filesystem, a Linux kernel image and a bootloader for your target. Buildroot can be used for any combination of these options, independently (you can for example use an existing cross-compilation toolchain, and build only your root filesystem with Buildroot).

Buildroot is useful mainly for people working with embedded systems. Embedded systems often use processors that are not the regular x86 processors everyone is used to having in his PC. This is why cross-compilation is important: it makes it possible to create the software binaries for the embedded system on a fast build computer rather than the slow target.

A number of other embedded system build systems exist: OpenWRT, Yocto (OpenEmbedded), emDebian, etc. Compared to these, Buildroot has four distinguishing characteristics.

  • It can build very small systems, down to a few megabytes.
  • It builds fast.
  • It gives you maximum control over what is installed on the system.
  • It is simple, both simple to use and easily hackable.

This document reviews where Buildroot comes from, what has happened in recent years and what's in store for the future.

This text is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported license. It contains parts of the Buildroot manual and the Buildroot presentation at ELC 2012 by Thomas Petazzoni.

1. Ancient history

Buildroot was started in 2001 as a way of testing uClibc, a small standard C library for embedded Linux systems. It quickly grew into a project of its own that could be used to compile uClibc together with additional programs and libraries.

It got picked up and was used to build some embedded products. It grew in size over the years as many packages were added to it and as it became necessary to handle all kinds of specific cases. At some point, Buildroot was used as the basis for an open wireless router project - which eventually became OpenWRT as we know it now.

However, between 2005 and 2009, there was no central maintainer to take care of the quality of the project. It was still evolving since many people had commit access, but the code quality was suffering.

In January 2009, Peter Korsgaard stepped up as the maintainer of the project. He made a huge effort to clean up the code base, he added infrastructure to make it much easier to add packages, and in doing so he revived interest in the project. He also started a rolling release scheme, where every three months a release is tagged that is considered stable.

Nowadays, there is a very active Buildroot community, with several hundred contributions per month from about 50 different people, an active mailing list, an IRC channel, and three developer meetings per year.

2. Evolution in Buildroot features

The main changes in buildroot these days are updates of existing packages from upstream and the addition of new packages. In addition, there is continuous testing of random configurations, which leads to numerous fixes of the packages included in Buildroot. These fixes are also sent to the maintainers of the package so that it can also benefit from the automatic testing.

In addition, some major new features have been added recently.

  • You can choose from several standard C libraries: uClibc (the default), glibc (which is used in most "large" systems), and musl (an alternative that aims to be more secure and more standard-compliant than glibc). The standard C library is very important because it is part of the cross-compilation toolchain.
  • The toolchain can be built by Buildroot, or an existing toolchain can be installed (e.g. Sourcery, Linaro, or a chip-vendor supplied toolchain, ...). It is also possible to build a toolchain with Buildroot once and then use the same toolchain for several boards.
  • Buildroot can generate an overview of all the licenses that are used on the target embedded system (the "legal info"). It also collects all the sources to simplify compliance to the GNU Public License.
  • There is a very extensive manual, which is part of the Buildroot sources and also published on the website: http://buildroot.org/manual.html. It covers both how to configure and build your system with Buildroot, and how to add new packages to Buildroot.
  • Buildroot contains many checks to avoid configuring a system that will not work. For instance, many packages will only work with glibc as the standard C library, or with specific Linux kernel versions. Buildroot will check for that and warn you that the package can't be built unless the requirements are met.
  • There are many ways to extend Buildroot without having to touch the Buildroot sources themselves:

    • The BR2_EXTERNAL environment variable points to a directory with local packages that are added to Buildroot's configuration menus. This allows you to include and configure your proprietary packages in the same way as any other, without cluttering the buildroot sources.
    • The <pkg>_OVERRIDE_SRCDIR variable makes it possible to build a locally modified copy of some package rather than downloading the original source. This is particularly useful for e.g. a bootloader, which usually requires board-specific changes.
    • Similarly, the BR2_GLOBAL_PATCH_DIR allows you to make additional changes to some packages.
    • The filesystem overlay makes it easy to add any file to your root filesystem.
    • It is possible to run custom scripts before or after building a package, or after everything has been built. In these scripts, you can basically do anything, including fetching and building additional programs, or deploying the build to the target board.
  • An Eclipse plugin exists to make it easy to develop code with the Buildroot cross-compiler.
  • Buildroot supports both traditional "SysV init" and systemd as init system.
  • For many development boards, Buildroot includes a basic configuration that creates a minimal bootable system out of the box. It is often pretty complicated to deploy images to the target boards, because the SD card has to be partitioned in a specific way or the boot loader has to be written at a specific location. Buildroot makes this simpler; for instance, for the Wandboard, you just need to do "make wandboard_defconfig; make" and an SD card image is created.
  • Buildroot is often the first build system to support new processor architectures, e.g. aarch64 (ARMv8, the 64-bit ARM variant) or ARC (a configurable processor architecture from Synopsys).

3. Future directions

Development in Buildroot is very active. However, it is generally felt that Buildroot is pretty good as it is and no major new features are needed to make it more useful. Here are a few examples of smaller things that we would like to see implemented.

  • Run-time testing of packages. Currently, tests are limited to verifying that the packages can be built. However, there is currently no automatic test if the generated program will actually run on the target device. Run-time testing will improve the stability of the Buildroot releases.
  • Reducing the time of a build. Two big improvements are possible: by using ccache (ccache support already exists in Buildroot but is not 100% reliable when building for several platforms), and by building several packages in parallel (also possible already but currently risks that the resulting binaries will be different depending on the order of compilation).
  • Improve the support for development workflows. However, it is not very clear what is needed here, since current development workflows that are used in the industry differ so much. The approach is that Buildroot will take improvements from contributors that show some benefit, as long as it doesn't make the infrastructure overly complicated.

In these evolutions of Buildroot, a specific effort is made to make it easier for people to migrate from an older version of Buildroot to the current one. This is done by adding warnings that the way of doing things has changed. It should not take you a lot of effort to update current Buildroot to a future version.

4. Conclusions

Buildroot is a simple system that allows you to quickly configure and develop your embedded system - whether it is based on an existing board or using a custom design. It gives you complete freedom to put what you need on the system (and remove what you don't need), while making sure that the build is fast and reproducible. The active community takes care of updating packages, adding new packages, and improving the infrastructure. It is used for many products. The feedback and contributions of the developers of these products keep evolving the Buildroot project.

© copyright 2002 - 2017 Mind NV. [ home ] [ contact ]
All registered Trade Marks are the property of their owners.