From FriendlyELEC WiKi
Jump to: navigation, search


1 Introduction to Buildroot

Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation. It contains a boot-loader, kernel, rootfs, various libraries and utilities(e.g. qt, gstreamer, busybox etc).

FriendlyELEC's Buildroot is based on Rockchip's version which is made with linux-sdk and maintained with git. FriendlyELEC's version is synced with Rockchip's version;

Here is what Buildroot for rockchip looks like

  • Rk3399-buildroot-home.jpg
  • Rk3399-buildroot-console.jpg

  • Rk3399-buildroot-camera.jpg
  • Rk3399-buildroot-player.jpg

2 Download Images of Trial Version

2.1 Buildroot for RK3568

Visit Download LinkDownload:

Image Files
rk3568-sd-buildroot-5.10-arm64-YYYYMMDD.img.gz OS image booting from SD card
rk3568-eflasher-buildroot-YYYYMMDD.img.gz Image used to flash to eMMC

2.2 Buildroot for RK3399

Visit Download LinkDownload:

Image Files OS image booting from SD card
rk3399-eflasher-buildroot-4.19-arm64-YYYYMMDD.img.gz Image used to flash to eMMC

2.3 Buildroot for RK3328

Visit Download LinkDownload:

Image Files OS image booting from SD card
rk3328-eflasher-buildroot-4.19-arm64-YYYYMMDD.img.gz Image used to flash to eMMC

After extract the file you can use either dd or the win32image utility to flash the image to an SD card.

3 User Name and Password

User name: root
Password: rockchip

To change the password, please modify the following file:


4 Connect WiFi

  • Edit /etc/wpa_supplicant.conf, fill in the ssid and psk with the WiFi information you want to connect to
  • Start the wpa_supplicant process with the following command
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
  • If there is no error, you can check the ip address with the command 'ifconfig wlan0'

5 Obtain Source Code

5.1 Install repo Utility

Install the repo utility:

git clone --depth 1
sudo cp repo/repo /usr/bin/

5.2 Download Source Code

You can retrieve a project's source code in either of the following two ways. The first works better with Mainland Chinese users:

5.2.1 1: Retrieve Repo Package from NetDrive

Download link: RK3568 RK3399 RK3328
File location: '07_Source codes'/buildroot-rkXXXX-YYYYMMDD.tar (YYYYMMDD stands for the data when the package is generated)
After you get a tar package, untar it and run the following command to extract it:

tar xvf /path/to/netdrive/'07_Source codes'/buildroot-rkXXXX-YYYYMMDD.tar
cd buildroot-rkXXXX
repo sync -l --no-clone-bundle

If you want to get the latest official source code you can run the following commands:

cd buildroot-rkXXXX
repo sync --no-clone-bundle

5.2.2 2: Retrive Repo Package from Github Buildroot for RK3568
mkdir buildroot-rk3568
cd buildroot-rk3568
repo init -u \
    -b rockchip-kernel4.19 -m rk3568.xml --repo-url= \
repo sync -c --no-clone-bundle Buildroot for RK3399
mkdir buildroot-rk3399
cd buildroot-rk3399
repo init -u \
    -b rockchip-kernel4.19 -m rk3399.xml --repo-url= \
repo sync -c --no-clone-bundle Buildroot for RK3328
mkdir buildroot-rk3328
cd buildroot-rk3328
repo init -u \
    -b rockchip-kernel4.19 -m rk3328.xml --repo-url= \
repo sync -c --no-clone-bundle

5.2.3 Get Latest Version with Sync

repo sync -c --no-clone-bundle

If your network connection is broken during sync you can run the following script to do it:

#! /bin/bash
repo sync -c --no-clone-bundle
while [ $? -ne 0 ]; 
    repo sync -c --no-clone-bundle

6 Compile Source Code

6.1 Setup Development Environment

You need a host PC running a 64-bit Ubuntu 18.04 system and run the following command on the PC:

wget -O - | bash

6.2 Build buildroot in Docker container

Please use the Docker image provided by this link, for details, please refer to the README document:

6.3 Get Help Info

Run the script without any options it will print the help information:


Let's take RK3399 as an example, the help information will be presented as follows:

USAGE: ./ <parameter>
# Select Board Type:
# Select Module:
  ./ all                -compile all
  ./ uboot              -compile uboot
  ./ kernel             -compile kernel
  ./ buildroot          -compile buildroot
  ./ sd-img             -generate an image for an sd card
  ./ emmc-img           -generate an image for emmc (the generated image should be flased to an SD card and then flashed to emm with this SD card)
# Clean:
  ./ clean              -remove old images
  ./ cleanall

6.4 Auto Compile

For a first time compilation you need to select an board. Let's take the NanoPi R4S as an example:


After the script is done successfully all components including a u-boot, a kernel and a buildroot will be compiled, and an image file will be generated.

6.5 Compile Individual Component

6.5.1 kernel

./ kernel

6.5.2 u-boot

./ uboot

6.5.3 buildroot

./ buildroot

6.6 Generate Image for SD Card

sudo ./ sd-img

If an img file is generated successfully you will see the following messages. You can use the "dd" command to flash the img file to an SD card. Note: you will need to replace "/dev/sdX" with the actual device name which your system recognizes the device as:

Run the following for sdcard install:
    sudo dd if=out/Buildroot_20211213_NanoPi-R4S_arm64_sd.img bs=1M of=/dev/sdX

6.7 Generate emmc (eflasher) Image

sudo ./ emmc-img

If an img file is generated successfully you will see the following messages. You can use the "dd" command to flash the img file to an SD card. Note: you will need to replace "/dev/sdX" with the actual device name which your system recognizes the device as:

Run the following for sdcard install:
    sudo dd if=out/Buildroot_20211213_NanoPi-R4S_arm64_eflasher.img bs=1M of=/dev/sdX

Use this SD card to boot the eflasher system and run eflasher commands to install an OS to emmc. After installation is done, take off the SD card of the board and boot your system buildroot will load from eMMC.

7 Customize Buildroot

7.1 Structure of Directories

├── buildroot-xxyyzz
│   ├── buildroot -> buildroot's source code
│   └── toolchain -> cross-compiler, used for compiling a u-boot and kernel
│   ├── -> build script
│   ├── device/friendlyelec -> configuration file for friendlyelec boards
│   ├── kernel -> kernel
│   └── u-boot -> u-boot
│   └── app -> rockchip app
│   └── external -> rockchip buildroot package
│   └── rkbin -> rockchip loader binaries
│   └── scripts -> script files for generating an img

7.1.1 Update Buildroot Configurations

  • List Available Configurations
cd buildroot
make list-defconfigs

The configuration of FriendlyELEC RK3399:
friendlyelec_rk3399_defconfig - Build for friendlyelec_rk3399

  • Update Configurations Using menuconfig
make friendlyelec_rk3399_defconfig
make menuconfig
make savedefconfig
diff .defconfig configs/friendlyelec_rk3399_defconfig 
cp .defconfig configs/friendlyelec_rk3399_defconfig
  • Recompile
cd ../
./ buildroot

7.2 Customize File System

Put the file in device/friendlyelec/rk3399/common-files, then repackage the img:

sudo ./ sd-img
sudo ./ emmc-img

7.3 Update U-boot and Kernel

You can do it by directly updating the files in the u-boot and kernel directories.

7.4 Use Cross Compiler in SDK

export PATH=$PWD/buildroot/output/rockchip_rk3399/host/bin/:$PATH
aarch64-buildroot-linux-gnu-g++ -v

Version information:
gcc version 6.4.0 (Buildroot 2018.02-rc3-g4f000a0797)

7.5 Cross Compile Qt Program

git clone
cd QtE-Demo

You can auto-run your Qt program on system boot. For example you want to auto-run a QtE-Demo program. Firstly you can copy the QtE-Demo to your board, open and edit the S50launcher file under the "/etc/init.d/" directory, replace "/usr/local/QLauncher/QLauncher &" with the full path of your QtE-Demo program.

8 Q&A

8.1 Generate Image File for Flashing with USB Type-C

After you run the " emmc-img" command a "buildroot" directory will be generated under the "scripts/sd-fuse" directory. You can use the android_tools to load all the files under this "buildroot" directory.

9 Report bug


10 Update Log

10.1 2022-07-20

  • add support for rk3568
  • update buildroot

10.2 2021-12-23

  • Simplify the build script and update buildroot

10.3 May-16-2019

  • Released English version