User:Admin

From Rockchip open source Document
Jump to: navigation, search


 

Overall

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 3 ways to build rootfs including prebuilt Debian, Yocto, Buildroot. You can choose the way you prefer. (Please check the Software Status because different chips have a different support)

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

  • U-Boot SPL/Rockchip miniloader 
    *U-Boot 
    *boot(including kernel, dtb and config file) 
    *rootfs(Debian, Ubuntu, etc.) 

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

 

Environment

Note that our development environment is Ubuntu, you can use 16.04 or later version(with downgraded arm gcc).

Debian-9  and Docker-Rockchip are also available.

Ubuntu 14.04 is deprecated, we don't guarantee that Linux SDK can work on it.

Here are some necessary packages for building the project.

$ 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 libudev-dev libusb-1.0-0-dev libssl-dev pv e2fsprogs build-essential 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.

 

mkdir rk-linux<br/> cd rk-linux<br/> 

To initialize Linux SDK source tree, you need to get repo first

 

 

sudo apt-get install repo<br/> 

Basic Linux SDK(standalone kernel/u-boot/rootfs)

 

 

repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master<br/> repo sync<br/> 

Yocto

 

 

repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto<br/> repo sync<br/> 

Buildroot

 

 

repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b buildroot<br/> repo sync<br/> 

 

Below guides are based on basic Linux SDK, guides for yocto/buildroot could be found in the separate page.

 

Quick start

ref : partition, rockusb, boot

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. We use rk3288-firefly as example. You can change rk3288-firefly to any other board supported(ie. rk3399-firefly)

compile kernel

 

build/mk-kernel.sh rk3288-firefly<br/> 

compile uboot

 

 

build/mk-uboot.sh rk3288-firefly<br/> 

 

Pack all parts to a complete image

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

build/mk-image.sh -c rk3288 -t system -r rk-debian-build/linaro-rootfs.img<br/> 

flash image

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

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

SD Card:
`d` is your target device

build/flash_tool.sh -c rk3288 -p loader -i out/u-boot/idbloader.img -d /dev/sdb<br/> 

bringup(burn kernel, uboot, gpt)

 

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

update kernel

 

 

build/mk-kernel.sh rk3288-firefly<br/> build/flash_tool.sh -p boot -i out/boot.img<br/> 

update uboot (armv7)

 

 

build/mk-uboot.sh rk3288-firefly<br/> build/flash_tool.sh -p loader1 -i out/u-boot/idbloader.img<br/> 

update uboot(armv8 with miniloader)

 

 

build/mk-uboot.sh rk3399-excavator<br/> build/flash_tool.sh -p loader1 -i out/u-boot/idbloader.img<br/> build/flash_tool.sh -p loader2 -i out/u-boot/uboot.img<br/> build/flash_tool.sh -p atf -i out/u-boot/trust.img<br/> 

 

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

It's better if you can study those build scripts.

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

Step By Step

Building the sources

Building uboot

Installing the build tools and download source

Compile the Uboot

CROSS_COMPILE=arm-linux-gnueabihf- make evb-rk3288_defconfig all<br/> 

You can get spl/u-boot-spl.bin(if there is) and u-boot.bin when build complete, we will use these files to generate idb.img or uboot.img

See U-Boot page for more detail.

There are two feasible ways to boot to U-Boot.
1. RK SPL bin(DDR.bin, miniloader)
2. U-Boot SPL

See boot option page for more detail.

 

Building kernel

Compile the kernel:

For ARM v7

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rockchip_linux_defconfig<br/> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4<br/> 

For ARM V8

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rockchip_linux_defconfig<br/> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4<br/> 

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

It's recommend to download prebuilt debian image for bringup.

Debian

See debian-guide for detail.

You should get xxx-rootfs.img.

Yocto

See yocto-user-guide for detail.

You should get xxx.ext4 rootfs image.

Buildroot

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

 

Drivers

Display:

Graphic:

USB:

Storage:

Audio:

Connectivity:

Others:

 

Customization

Boot_Time

Boot_Logo

Image_Size

Firmware_Upgrade