logo.png

This guide provides information that help you get started with rockchip opensource linux.

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
rk3036-kylin rockchip_linux_defconfig rk3036-kylin.dts

Building the Sources

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

Build environment

$ sudo apt-get install git-core gitk git-gui subversion curl gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache   libgl1-mesa-dev libxml2-utils xsltproc unzip vim-gtk ctags minicom cmake android-tools-adb android-tools-fastboot gcc-arm-linux-gnueabi u-boot-tools device-tree-compiler libusb-1.0-0-dev phablet-tools openjdk-7-jdk libssl-dev

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

If you want to get the latest rootfs, you can use rootfs-build-script to build.

Download Rootfs Image

Baidu PanGoogle Drive

Booting the Board

Booting from emmc

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

Booting from sdcard

Flash uboot

To write an image that boots from an SD card (assumed to be /dev/sdb)

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 dd if=out of=/dev/sdb seek=64 conv=notrunc

Format sdcard

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

gpt write mmc 1 $partitions
ums 0 mmc 1

Now the board will act as an USB-drive.
In host:
sudo mkfs.fat /dev/sdb6

Flash kernel and rootfs

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/mmcblk0p7 rootfstype=ext4 init=/sbin/init

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

Boot

Now, press maskrom and your board will boot from sd-card.

Booting from udisk

Same as boot-from-sdcard, but please note that u-boot aren't allowed to boot from usb-disk because of the maskrom's limition, only kernel and rootfs can load from usb-disk.

Difference:

label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/sda1 rootfstype=ext4 init=/sbin/init
gpt write usb 0 $partitions
ums 0 usb 0

Developer Guide

Kernel Drivers Guide

Userspace Application Guide