Compile Buildroot firmware

This chapter describes the compilation and use of the Buildroot firmware.


Download source code

Download repo tools:

mkdir linux
cd linux
git clone

Download Linux-SDK:

mkdir linux-sdk
cd linux-sdk

# Init repo.git
../repo/repo init --repo-url -u -b linux-sdk -m rk3288/rk3288_linux_release.xml

# Synchronous source code
../repo/repo sync -c


Install the tools needed to compile and ensure that the tools are properly installed:

  • Ubuntu 14.04 software package installation:

$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip tar curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 cmake tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 lzop lib32stdc++6
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/ /usr/lib/i386-linux-gnu/
  • Ubuntu 16.04 software package installation:

sudo apt-get install git gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler mtools \
parted libudev-dev libusb-1.0-0-dev python-linaro-image-tools linaro-image-tools libssl-dev \
autotools-dev libsigsegv2 m4 libdrm-dev curl sed make binutils build-essential gcc g++ bash \
patch gzip bzip2 perl tar cpio python unzip rsync file bc wget libncurses5 libglib2.0-dev openssh-client lib32stdc++6
  • Install the software package related to ARM cross-compiling toolchain and compiling the kernel

$ sudo apt-get install gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu device-tree-compiler lzop libncurses5-dev \
libssl1.0.0 libssl-dev

Compile SDK


Select the configuration file corresponding to the development board. The configuration file will be linked to device/rockchip/, which will be checked to confirm the currently used configuration file:


# file path: `device/rockchip/rk3288/`

The .mk file is configured by default to compile the Buildroot firmware. The following describes the Buildroot configuration:

# Buildroot config
export RK_CFG_BUILDROOT=rockchip_rk3288     # Buildroot root filesystem configuration file

# file path: `buildroot/configs/rockchip_rk3288_defconfig`
# Recovery config
export RK_CFG_RECOVERY=rockchip_rk3288_recovery     # Root filesystem configuration file in recovery mode (can be omitted)

# file path: `buildroot/configs/rockchip_rk3288_recovery_defconfig`
# rootfs image path
export RK_ROOTFS_IMG=buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.$RK_ROOTFS_TYPE   # Buildroot root filesystem mirror path

# In this case, the file path is in `buildroot/output/rockchip_rk3288/images/rootfs.ext4`
# Note: This file path will be generated after the root filesystem is first compiled.

When the compile command is executed, it will be compiled according to the .mk file.

Automatic compilation

The automatic compilation will compile and package the firmware update.img, generate firmware directory rockdev/:


Partial compilation

  • kernel

./ kernel
  • u-boot

./ uboot
  • rootfs

Compile the Buildroot root filesystem and generate the compiled output directory in buildroot/output:

./ buildroot

# Note: Be sure to compile the Buildroot root filesystem as a normal user to avoid unnecessary errors.
# The required packages are automatically downloaded during the compilation process, please stay connected.

Package firmware


Image the parts of the rockdev directory into firmware update.img:

./ updateimg

Introduce Buildroot


The Buildroot compilation output is saved in the output directory. The specific directory is determined by the configuration file. This example is saved in the buildroot/output/rockchip_rk3288 directory. You can then execute make to compile the root filesystem in this directory.

When fully automated, the buildroot/output/rockchip_rk3288_recovery directory is generated by default, which is the compiled output directory of recovery.

Subdirectory description:

  • build/ contains all source files, including the required host tools and selected packages for Buildroot. This directory contains all Module source code.

  • host/ Tools required for host-side compilation include cross-compilation tools.

  • images/ contains a compressed root filesystem image file.

  • staging/ This directory is similar to the directory structure of the root file system. It contains all the header files and libraries generated by the compiler, as well as other development files, but they are not tailored and are too large to be used for the target filesystem.

  • target/ contains the complete root filesystem. Compared to staging/, it has no development files, no header files, and the binary files are strip processed.

Customize Buildroot

Configure module

The default compiled root filesystem does not necessarily meet our needs. We may need to add some third-party packages or modify the configuration options of the package. Buildroot supports graphical configuration to select configurations:

cd buildroot/output/rockchip_rk3288/

# Enter the graphical configuration interface, select the required module, save and exit
make menuconfig

# Save configuration to configuration file 'buildroot/configs/rockchip_rk3288_defconfig'
make savedefconfig

#Compile the Buildroot root filesystem

What you need to know is:

  • When compiling, Buildroot will automatically get related packages from the network according to the configuration, including some third-party libraries, plug-ins, utilities, etc., placed in the dl/ directory.

  • The package will be extracted in the output/build/ directory and compiled.

  • If you want to modify the source code of the package, you can modify it by patching it. The patch is placed in the package/ directory, and Buildroot will patch it when unpacking the package.

Modify busybox

The command tool that busybox uses to manage the system can be modified as follows:

cd buildroot/output/rockchip_rk3288/

# Enter the graphical configuration interface, select the required module, save and exit
make busybox-menuconfig

# Save configuration to configuration file `board/rockchip/common/base/busybox.config`
make busybox-update-config


Overlay root filesystem

A filesystem overlay is a tree of files that are copied directly over the target filesystem after it has been built. In this way, we can simply add or modify some files:

  • private overlays path buildroot/board/rockchip/rk3288/fs-overlay

  • public overlays path buildroot/board/rockchip/common

Example: buildroot/board/rockchip/rk3288/fs-overlay/etc/firmware will overwrite the filesystem’s /etc/firmware.

Buildroot website

More detailed and specific development techniques can be learned from the Buildroot website.

Buildroot website

Buildroot development manual