Linux user guide

From Rockchip open source Document
Revision as of 15:19, 18 April 2018 by Admin (talk | contribs)
Jump to: navigation, search



This guide provides information which will help you get started with rockchip opensource linux. If you have any questions, please report to us on github project issue page.

We are providing 2 kind of rootfs. prebuilt Debian and Buildroot. You can choose the way you prefer. 

  • Buildroot: An easy and small embedded Linux system. Recommend for your product development. 
  • Prebuilt Debian: A generic desktop Distro. Only for your evaluation. 

You will need below firmware/image for a full Linux OS and flash them to different locations:

  • Rockchip miniloader: This is the first level boot loader
  • U-Boot: This is the second level boot loader
  • Trusted: ARM Trusted Firmware
  • Resource: Kernel dtb, It is only used for development. 
  • Kernel: Kernel image, It is only used for development. 
  • Boot: It is Android boot image format. Pack kernel dtb and image to one partition. Use it for production. 
  • System: Rootfs


Please use Ubuntu 16.04 or later version. The early version can't work.

Here are some necessary packages for building the project.

$ sudo apt-get install repo git-core gitk git-gui u-boot-tools device-treecompiler mtools parted libudev-dev libusb-1.0-0-dev lib32gcc-7-dev python-linaro-image-tools linaro-image-tools gcc-4.8-multilib-arm-linux-gnueabihf gcc-arm-linuxgnueabihf gcc-aarch64-linux-gnu g++-7 libstdc++-7-dev autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio python unzip rsync file bc wget libncurses5 libqt4-dev libglib2.0-dev libgtk2.0-dev libglade2-dev cvs git mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz python-matplotlib libssl-dev pv e2fsprogs fakeroot devscripts

If you insist on developing on your own environment, please make sure the version of gcc-arm-linux-gnueabihf and gcc-aarch64-linux-gnu is less than 6.

Getting the Sources

The rockchip linux SDK source tree is located in multi Git repository hosted by Github. The SDK uses repo to sync down source code.
Create an empty directory to hold your working files.

git clone
mkdir linux
cd linux

To down RK3399 Linux SDK: 

../repo/repo init --repo-url= -u -b master -m rk3399_linux.xml 
../repo/repo sync

To down RK3288 Linux SDK: 

../repo/repo init --repo-url= -u -b master -m rk3288_linux.xml
../repo/repo sync

To down RK3328 Linux SDK: 

../repo/repo init --repo-url= -u -b master -m rk3328_linux.xml
../repo/repo sync

Quick start

We have provide build scripts which essentially wraps the commands, so you can quickly start your development by them.

Please note that those scripts are assumed your directory structure is same with the one created by manifest.

choose/add board-config

We use rk3288-firefly as example. You can change rk3288-firefly to any other board supported.

Before starting to develop, please refer to board config and how-to to choose a most matching config as the foundation.

compile kernel

This command will compile kernel and copy kernel-image/dtb to "out/kernel" and create a fat image "out/boot.img" which contains kernel-image/dtb/extlinux.conf.

build/ rk3288-firefly

compile uboot

This command will compile u-boot and copy all binarys to "out/u-boot".

If u-boot is stuck in SPL, please choose a most matching board-config!  If it's still stuck in SPL, please use old ddr.bin to replace u-boot SPL.

Please see u-boot page for more infos.

build/ rk3288-firefly

build debian rootfs image

It's better to download prebuilt debian image at first, and build rootfs later, since many users have complain to us that they waste a lot of time to build debian image(mostly environment problem).

Pack all parts to a complete image

`s` is size in Mbyte, `r` is your rootfs image location. Here we use rk3288 as example. You can change it to any other supported chips(ie. rk3399, rk3328).

build/ -c rk3288 -t system -r rk-debian-build/linaro-rootfs.img

flash image

eMMC (Ensure the board is in maskrom mode. maskrom, Not rockusb! ):

build/ -c rk3288 -p system -i out/system.img

SD Card:
`d` is your target device

build/ -c rk3288 -p loader -i out/u-boot/idbloader.img -d /dev/sdb

Please refer to AndroidFlashTool for flashing image on Windows. (For the first time, it's recommended to use a linux host, to save the time.)

Please note there is no parameter! The system image created by linux SDK is a pure GPT formatted image, burned to spefic offset in flash.

It's recommended to read partition, rockusb, boot to understand how it works if you failed to flash image.

bringup(burn kernel, uboot, gpt)

build/ rk3288-firefly
build/ rk3288-firefly
build/ -c rk3288 -t system -r rk-debian-build/linaro-rootfs.img
build/ -p system -i out/system.img

update kernel

build/ rk3288-firefly
build/ -p boot -i out/boot.img

update uboot (armv7)

build/ rk3288-firefly
build/ -p loader1 -i out/u-boot/idbloader.img -c rk3288

update uboot(armv8 with miniloader)

build/ rk3399-excavator
build/ -p loader1 -i out/u-boot/idbloader.img -c rk3399
build/ -p loader2 -i out/u-boot/uboot.img -c rk3399
build/ -p atf -i out/u-boot/trust.img -c rk3399

Before asking questions, please, read references and follow the setp by setp guide to boot your device.

Step By Step

Building the sources

Building uboot

In your linux SDK root directory. enter to U-Boot directory. 

cd u-boot

For RK3399 sapphire-excavator board, VS-RK3399 board, Rock960 board. Use below command to build the U-Boot: 

./ evb-rk3399

For firefly-rk3399 board. Use below command to build the U-Boot: 

./ firefly-rk3399

For firefly-rk3288 board. Use below command to build the U-Boot: 

./ firefly-rk3288

For rk3288-evb-act8846 board. Use below command to build the U-Boot: 

./ evb-rk3288

For rk3288-evb-rk808 board. Use below command to build the U-Boot: 

./ fennec-rk3288

For rk3288 tinker board. Use below command to build the U-Boot: 

./ tinker-rk3288

For phytec-rk3288 board. Use below command to build the U-Boot: 

./ phycore-rk3288

For rk3288 miqi board. Use below command to build the U-Boot: 

./ miqi-rk3288

It will generate 3 binary image:, trust.img, uboot.img. Rockchip miniloader. rk3xxx is the part number of the chip. is the version number. Please flash this binary to miniloader partition. 

trust.img: ARM Trusted Firmware

uboot.img: The U-Boot image

├── rk3399_loader_v1.09.112.bin
├── trust.img
└── uboot.img

Rockchip now only offically support miniloader+U-Boot boot to simplify the customer product design.  You can refer to boot option page for more boot path. But do remember that you should do it all by your own. Rockchip won't provide technical support for these boot option. 

Building kernel

Compile the kernel:

For ARM v7

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rockchip_linux_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4

For ARM V8

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rockchip_linux_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4

You can get zImage/Image and dtbs when build complete, we will use these files to generate boot.img for boot partition.

See Rockchip kernel for more detail.

Building rootfs


See debian-guide for detail.

You should get xxx-rootfs.img.


See yocto-user-guide for detail.

You should get xxx.ext4 rootfs image.


See buildroot-user-guide for detail.

You should get rootfs.img in this step for the Linux OS.

Booting the Board

Then you can chose a suitable way for you to boot the board with flash all the image to media device.

See also

U-Boot guide

Rockchip kernel guide

Yocto guide

Buildroot guide