Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search


< Rock3‎ | dev
    ROCK 3 >  Development >  Build Debian

Rockchip Debian SDK

Below is the instructions of how to build image for ROCK 3 on a HOST PC.

Available boards:

  • ROCK 3A
  • ROCK 3B
  • Radxa CM3 IO
  • Radxa E23
  • Radxa E25
  • Radxa CM3 RASPCM4IO

Get the source code

You need Git to get multiple git repositories to build the image.

Install Git if you don't have it.

sudo apt-get update
sudo apt-get install git

Clone the source code

git clone -b stable-4.19-rock3
cd rockchip-bsp
git submodule init
git submodule update

You will get

build  kernel  rkbin  rootfs  u-boot

Directories usage introductions:

  • build:
    • Some script files and configuration files for building u-boot, kernel and rootfs.
  • kernel:
    • kernel source code, current version is 4.19.193.
  • rkbin:
    • Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).
  • rootfs:
    • Bootstrap a Debian based rootfs, support architechture armhf and arm64, support Debian Jessie, Stretch and Buster.
  • u-boot:
    • u-boot as the second stage bootloader

Update the source code

The rockchip-bsp will be updated all the time, so you can update the source before building the system image.

cd rockchip-bsp
git checkout stable-4.19-rock3
git fetch origin
git rebase origin/stable-4.19-rock3
git submodule update

Install toolchain from Linaro

sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz  -C /usr/local/

Add the following line to the end of file ~/.bashrc

export PATH="/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin:$PATH"

And source ~/.bashrc

source ~/.bashrc

Check if Linaro toolchain is the default choice:

which aarch64-linux-gnu-gcc

Install other build tools

sudo apt-get install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools
sudo apt-get install bc python dosfstools

Build u-boot

Need to checkout branch to stable-4.19-rock3.

Build u-boot with default rock-3-a-rk3568_defconfig.

./build/ rk3568-rock-3a     #For ROCK 3A

The generated images will be copied to out/u-boot folder

ls out/u-boot/
idbloader.img  rk356x_spl_loader_ddr1056_v1.10.111.bin  spi  u-boot.itb

Write u-boot

1. you shou check file in out/u-boot should be like this:

ls out/u-boot/
idbloader.img  rk356x_spl_loader_ddr1056_v1.06.110.bin  spi  u-boot.itb

2. flash u-boot to you storage

sudo dd if=./idbloader.img of=/path/to/storage/device bs=512 seek=64
sudo dd if=./u-boot.itb of=/path/to/storage/device bs=512 seek=16384

Build kernel

Need to checkout branch to stable-4.19-rock3.

Build kernel with default rockchip_linux_defconfig.

./build/ rk3568-rock-3a    #For ROCK 3A
Change kernel config(optional)

Optionally, if you want to change the default kernel config

cd kernel
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make rockchip_linux_defconfig
make menuconfig     # You can add/change your kernel modules
make savedefconfig
cp defconfig arch/arm64/configs/rockchip_linux_defconfig
cd ..
./build/ rk3568-rock-3a    #For ROCK 3A

You will get the kernel image and dtb file

ls out/kernel/
Image  rk3568-rock-3-a.dtb

Build kernel deb package (optional)

The kernel package build can pack the kernel, device tree, modules and firmware into Debian packages, which makes it easier to install on the ROCK 3.

./build/ -d rockchip_linux_defconfig -r 1 # rockchip_linux_defconfig: kernel defconfig; 1: release number

The generated packages will be copied to out/packages direcotry.

$ ls out/packages/

When you want to install specified kernel packages to your OS, try the following steps.

copy linux-image-4.19.193-1-rockchip-*_arm64.deb and linux-firmware-image-4.19.193-1-rockchip-*_arm64.deb to your ROCK 3.

Install them on ROCK 3.

# dpkg -i linux-headers-4.19.193-1-rockchip-*_arm64.deb
# dpkg -i linux-image-4.19.193-1-rockchip-*_arm64.deb

Make rootfs image

Check out the rootfs source. The repository is and the branch is rockchip-debian.

To build 32bit rootfs:

export ARCH=armhf

To build 64bit rootfs:

export ARCH=arm64

Building a base debian system by ubuntu-build-service from linaro.

cd rootfs
sudo apt-get install binfmt-support qemu-user-static cpio gdisk
sudo dpkg -i ubuntu-build-service/packages/*        # ignore the broken dependencies, we will fix it next step
sudo apt-get install -f
RELEASE=buster TARGET=desktop ARCH=arm64 ./

This will bootstrap a Debian Buster image, you will get a rootfs tarball named linaro-buster-alip-xxxx.tar.gz.

Building the rk-debian rootfs.

RELEASE=buster ARCH=arm64 ./

Creating the ext4 image(linaro-rootfs.img):


Combine everything into one image

./build/ -c rk3568 -t system -r rootfs/linaro-rootfs.img

This will combine u-boot, kernel and rootfs into one image and generate GPT partition table. Output is


Flash the image


1.For system image built from rockchip-bsp, what is the user name and password?

The user name is linaro and the password is linaro.

2.For kernel source code, debug serial console is disabled for ROCK 3 boards including ROCK 3A, ROCK 3B, Boards based on Radxa CM3 core board, etc.

To enable it, we need to add the following patch to your target dts.

&fiq_debugger {
    status = "okay";


Check ROCK 3 FAQs first, if it doesn't help, start a new post on the forum