Difference between revisions of "Linux user guide"

From Rockchip open source Document
Jump to: navigation, search
Line 81: Line 81:
Linux: Please refer to [[Upgradetool|upgrade tool]] for how to flash image to device
Linux: Please refer to [[Upgradetool|upgrade tool]] for how to flash image to device
We have provide [https://github.com/rockchip-linux/build 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|board config]] and'' ''[http://opensource.rock-chips.com/wiki_FAQ#How_to_select_board_config how-to] to choose a most matching config as the foundation.
'''build debian rootfs image'''
It's better to download [http://opensource.rock-chips.com/wiki_Debian 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).
<pre>build/mk-image.sh -c rk3288 -t system -r rk-debian-build/linaro-rootfs.img
'''flash image'''
eMMC <small>(Ensure the board is in&nbsp;maskrom mode. [http://opensource.rock-chips.com/wiki_Rockusb#Maskrom_mode maskrom],&nbsp;Not [http://opensource.rock-chips.com/wiki_Rockusb#Miniloader_Rockusb.C2.A0mode rockusb]! )</small>:
<pre>build/flash_tool.sh -c rk3288 -p system -i out/system.img
SD Card:<br/> `d` is your target device
<pre>build/flash_tool.sh -c rk3288 -p loader -i out/u-boot/idbloader.img -d /dev/sdb
Please refer to [https://github.com/rockchip-linux/rkbin/tree/master/tools/AndroidTool_Release_v2.39 AndroidFlashTool]<small>&nbsp;</small>for flashing image on Windows.&nbsp;<small>(For the first time, it's recommended to use a linux host, to save the time.)</small>
Please note there is no&nbsp;parameter!&nbsp;The system image created by linux SDK is a pure&nbsp;GPT formatted image, burned to spefic offset in&nbsp;flash.
It's recommended to read&nbsp;'''[[Partitions|partition]], [[Rockusb|rockusb]], [[Boot_option|boot]]&nbsp;'''to understand how it works if you failed to flash image.
'''bringup(burn kernel, uboot, gpt)'''
<pre>build/mk-kernel.sh rk3288-firefly
build/mk-uboot.sh rk3288-firefly
build/mk-image.sh -c rk3288 -t system -r rk-debian-build/linaro-rootfs.img
build/flash_tool.sh -p system -i out/system.img</pre>
'''update kernel'''
<pre>build/mk-kernel.sh rk3288-firefly
build/flash_tool.sh -p boot -i out/boot.img
'''update uboot (armv7)'''
<pre>build/mk-uboot.sh rk3288-firefly
build/flash_tool.sh -p loader1 -i out/u-boot/idbloader.img -c rk3288
'''update uboot(armv8 with miniloader)'''
<pre>build/mk-uboot.sh rk3399-excavator
build/flash_tool.sh -p loader1 -i out/u-boot/idbloader.img -c rk3399
build/flash_tool.sh -p loader2 -i out/u-boot/uboot.img -c rk3399
build/flash_tool.sh -p atf -i out/u-boot/trust.img -c rk3399
Before asking questions, please, read&nbsp;references and follow&nbsp;the setp by setp guide to boot your device.
= &nbsp; =
== Booting the Board ==
== Booting the Board ==

Revision as of 16:44, 18 April 2018




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 https://github.com/rockchip-linux/repo
mkdir linux
cd linux

To download RK3399 Linux SDK: 

../repo/repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master -m rk3399_linux.xml 
../repo/repo sync

To download RK3288 Linux SDK: 

../repo/repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master -m rk3288_linux.xml
../repo/repo sync

To download RK3328 Linux SDK: 

../repo/repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master -m rk3328_linux.xml
../repo/repo sync

Build U-Boot

Please refer to U-Boot for how to build U-Boot

Building kernel

Please refer to kernel for how to build Kernel

Building rootfs

Debian: Please refer to Debian user guide for how to build Debian

Buildroot: Please refer to Buildroot for how to build Buildroot


Flash image

Windows: Please refer to AndroidTool for how to flash image to device

Linux: Please refer to upgrade tool for how to flash image to device

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