logo.png


This guide provides information that help you get started with rockchip opensource linux. If you have any questions, please report to us in github.
We are providing 3 way to build rootfs including prebuilt Debian, Yocto, Buildroot. You can choose your prefer one by yourself.


Config Per Board

Every Board has its device tree file and config file required by the kernel and uboot. Therefore, you will need to choose the correct dts and config to build the source.Below list various Boards and the matching file.

board kernel uboot dts
rk3288-evb rockchip_linux_defconfig evb-rk3288_defconfig rk3288-evb-act8846.dtb or rk3288-evb-rk808.dts
rk3288-fennec rockchip_linux_defconfig fennec-rk3288_defconfig rk3288-fennec.dts
rk3288-miniarm rockchip_linux_defconfig tinker-rk3288_defconfig rk3288-miniarm.dts
rk3288-firefly rockchip_linux_defconfig firefly-rk3288_defconfig rk3288-firefly.dts
rk3328-evb rockchip_linux_defconfig evb-rk3328_defconfig rk3328-evb.dts
rk3399-excavator rockchip_linux_defconfig rk3399_linux_defconfig && evb-rk3399_defconfig rk3399-sapphire-excavator-linux.dts
rk3036-kylin rockchip_linux_defconfig kylin-rk3036_defconfig rk3036-kylin.dts

Config Per Chip

chip Kernel eMMC index Kernel SD index Uboot eMMC index Uboot SD index Baud speed
rk3399 1 0 0 1 1500000
rk3288 2 0 0 1 115200
rk3036 2 0 0 - 115200

Getting the Boards

If you need the development board,you can through the following contact information.

Telephone: 4007700590     Email: service@rock-chips.com

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.

mkdir rk-linux
cd rk-linux

To initialize Linux SDK source tree
Debian

repo init -u https://github.com/rockchip-linux/manifests
repo sync

Yocto

repo init -u https://github.com/rockchip-linux/manifests -b yocto
repo sync

Beside the generic community Linux support, we have chip optimized Linux SDK and it's also opensource and can get source from github.
RK3399 optimized Debian & Buildroot

repo init -u https://github.com/rockchip-linux/manifests -m rk3399.xml
repo sync

Building the Sources

The steps below aren't suitable to all board, don't forget to choose correct option for your board!

Build environment

Please use GCC 5

$ sudo apt-get install git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu     mtools parted

Building kernel

Installing the build tools and download source

Please follow linux user guide to install the build tools and download source.

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

For ARM V8 (RK3399 optimized SDK)

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rockchip_linux_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rk3399-sapphire-excavator-linux.img -j4

Building uboot

Installing the build tools and download source

Please follow linux user guide to install the build tools and download source.

Compile the Uboot

You should choose your board defconfig from here. ie. we are using evb-rk3288.

CROSS_COMPILE=arm-linux-gnueabihf- make evb-rk3288_defconfig all

For RK3399 optimized SDK (rkproduct uboot)

CROSS_COMPILE=aarch64-linux-gnu- make rk3399_linux_defconfig all

Others

Now you can get u-boot SPL and u-boot image, but please notices that in some platform or station(like secure-os), we will not use the u-boot SPL.

There are two feasible way to boot to u-boot.
1. RK SPL bin(DDR.bin, miniloader)
2. official u-boot SPL

The following wiki is writed for using u-boot SPL. If you are using a miniloader, you might need modify the steps.

Building rootfs

Debian

Yu can download the prebuit image directly.

Baidu PanGoogle Drive

or you could use the rootfs-build-script from Rockchip to build rootfs yourselves.

Yocto

If you want to use Yocto to build your rootfs see yocto-user-guide for detail.

Buildroot

If you want to use Buildroot to build your rootfs see buildroot-user-guide for detail.


Booting the Board

(Not suitable for spefic chip optimized SDK)

Get Tool and Firmware

tools

Writing to the board with USB

For USB to work you must get your board into ROM boot mode, either by erasing
your MMC or holding the maskrom button when you boot the board.

rk3288(upgrade_tool)

To create a suitable image and write it to the board:
default : with CONFIG_ROCKCHIP_SPL_BACK_TO_BROM

tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin out
cat u-boot-dtb.bin >> out
sudo upgrade_tool db  ../rkbin/rk32/RK3288UbootLoader_V2.30.06.bin
sudo upgrade_tool wl 64 out
sudo upgrade_tool rd

others : firefly(Recommend using sd card)

rk3036

To create a suitable image and write it to the board:

tools/mkimage -n rk3036 -T rksd -d spl/u-boot-spl-dtb.bin out
cat u-boot-dtb.bin >> out
sudo upgrade_tool db  ../rkbin/rk30/RK3036MiniLoaderAll_V2.19.bin
sudo upgrade_tool wl 64 out
sudo upgrade_tool rd

rk3399

cd ..
./rkbin/tools/trust_merger ./rkbin/tools/RK3399TRUST.ini
cd uboot

../rkbin/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img

sudo upgrade_tool UL   ../rkbin/rk33/RK3399MiniLoaderAll_V1.05.bin
sudo upgrade_tool DI uboot uboot.img  ../rkbin/tools/rk3399_parameter.txt 
sudo upgrade_tool DI trust ../trust.img  ../rkbin/tools/rk3399_parameter.txt
sudo upgrade_tool rd

Flash kernel and rootfs

Enter into the uboot and issue the following command on uboot: (otg should be connected)

gpt write mmc 0 $partitions
ums 0 mmc 0

Now the board will act as an USB-drive.
In host: (assuming sdb is ur device)
sudo mkfs.fat /dev/sdb6

Copy zimage and dts file to dev/sdb6
cp arch/arm/boot/zImage /media/chen/9F35-9565/
cp arch/arm/boot/dts/rk3288-fennec.dtb /media/chen/9F35-9565/rk3288-fennec.dtb

Add extlinux/extlinux.conf to dev/sdb6
(Please notice "mmcblk2p7" and "115200n8" is decide on your chip, Please refer to config table)

label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    append  earlyprintk console=tty1 console=ttyS2,115200n8 rw root=/dev/mmcblk2p7 rootfstype=ext4 init=/sbin/init

Flash rootfs
sudo dd if=linaro-rootfs.img of=/dev/sdb7 conv=notrunc

Using build sciprt

(Not suitable for spefic chip optimized SDK)

The above steps are really inconvenient, so we have provided some build scripts which essentially wraps those commands.

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

compile kernel

build/mk-kernel.sh firefly

compile uboot

build/mk-uboot.sh firefly

pack kernel and extlinux as boot.img

`extlinux.conf` template is under `build/extlinux`.

build/mk-image.sh -c rk3288 -t boot

pack one image

`s` is size in Mbyte, `r` is your rootfs image location.

build/mk-image.sh -c rk3288 -t system -s 3000 -r rk-debian-build/linaro-rootfs.img

flash image

Please note that you must flash system image before burning the other single image. (To write gpt partitions)
`p` is the target partiton which is defined in partition.sh, `i` is your image location.

eMMC:
You must get your board into ROM boot mode.
If your board can't easily enter maskrom(e.g. firefly), you'd better use sd-card.
If your board is packed, i recommend to use ums or fastboot(issuing "reboot ums" when in linux).

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

SD Card:
`d` is your target device

build/flash_tool.sh -c rk3288 -p loader  -i  out/u-boot.out -d /dev/sdb

Some cases

first using

build/mk-kernel.sh firefly
build/mk-uboot.sh firefly
build/mk-image.sh -c rk3288 -t boot
build/mk-image.sh -c rk3288 -t system -s 3000 -r rk-debian-build/linaro-rootfs.img
build/flash_tool.sh -p system -i out/system.img

update kernel

build/mk-kernel.sh firefly
build/mk-image.sh -c rk3288 -t boot
build/flash_tool.sh -p boot -i out/boot.img

update uboot

build/mk-uboot.sh firefly

build/flash_tool.sh -p loader -i out/u-boot.out

Developer Guide

Kernel Drivers Guide

Userspace Application Guide

Others