- Introduction
- Target audience
- Prerequisites
- Setting up a Linux build environment
- Download the source code
Introduction
This guide describes how to work on RK3036 Kylin Board. RK3036 Kylin board support Ubuntu, Android, Brillo, Chromeium OS. If you want to develop your own application, drivers on RK3036 Kylin board, you're in the right place.
Target audience
The target audience of this guide is anyone who wants to obtain, build, or contribute to RK3036 SDK. That includes new developers who are interested in the project and who simply want to browse through the RK3036 SDK source code, as well as developers who have been working on RK3036 for a long time.
Prerequisites
You must have Linux to develop on RK3036 SDK. Any recent or up-to-date distribution should work. However, we can't support everyone and Linux distro, so the only official supported environment is listed below. If you encounter issues with other setups, patches are generally welcomed, but please do not expect us to figure out your distro.
Ubuntu Linux (version 14.04 - Trusty)
Most developers working on RK3036 are using Trusty (the LTS version of Ubuntu). It is possible that things will work if you're running a different Linux distribution, but you will probably find life easier if you're on this one.
an x86_64 64-bit system for performing the build
an account with sudo access
You need root access to run the chroot command, modify the mount table, flash images. NOTE: Do not run any of the commands listed in this document as root – the commands themselves will run sudo to get root access when needed.
4 GB of RAM
While it may be technically possible to build with less, linking the browser uses 4GB, and swapping to disk will make the build prohibitively slow.
You will have a much nicer time if you also have:
a fast multi-processor machine with lots of memory
The build system is optimized to make good use of all processors, and an 8 core machine will build nearly 8x faster than a single core machine. If you are building the full Chromium OS including Chrome (the browser), your machine should have at least 4GB of RAM, and 8GB is better. If you only have 4GB of RAM make sure you have at least 4GB of swap. There have been reports of even getting by with 2GB of RAM on a Linux box not running a GUI.
a good Internet connection
This will help for the initial download (minimum of about 2GB) and any further updates.
Setting up a Linux 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
Configure git
Setup git now. If you don't do this, you may run into errors/issues later. Replace moc.elpmaxe|uoy#moc.elpmaxe|uoy and Your Name with your information:
git config —global user.email "moc.elpmaxe|uoy#moc.elpmaxe|uoy"
git config —global user.name "Your Name"
Download the source code
The RK3036 SDK source tree is located in multi Git repository hosted by Github, Google. RK3036 SDK uses repo to sync down source code. repo is a wrapper for the git that helps deal with a large number of git repositories. You already installed repo when you setup Linux build enviroment.
Create an empty directory to hold your working files.
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
To initialize Linux source tree
$ repo init -u https://github.com/rockchip-linux/manifests
To initialize Android source tree
$ repo init -u https://github.com/rockchip-linux/manifests -m android.xml
To initialize Brillo source tree
$ repo init -u https://github.com/rockchip-linux/manifests -m brillo.xml
To initialize Chromium OS source tree
$ repo init -u https://github.com/rockchip-linux/manifests -m chrome.xml
To synchronize the source code
$ repo sync
The RK3036 SDK source files will be located in your working directory under their project names. The initial sync operation will take a while to complete.
Build rkflashtool
rkflashtool is a open source tool used to flash image through Rockusb protocol.
In your your working directory.
$ cd rkflashtool
$ make
Build U-boot
In your your working directory.
$ ./build/mkuboot
image/kylin-rk3036-uboot.bin is the u-boot image.
Build kernel
In your your working directory.
$ ./build/mkkernel
image/kernel.uimg is the kernel image
Make a ubuntu core rootfs
$ ./build/mkrootfs
image/ubuntu.img is the ubuntu rootfs image
Enter Rockusb maskrom mode
RK3036 will automatic go to maskrom mode(AKA DFU mode) when boot loader not exist in the boot media(eMMC, SPI flash, SD card, nand, in RK3036 Kylin board, we can use eMMC or SD card as boot media) or boot loader corrupted. Rockchip use a protocol called Rockusb to flash bootloader to boot media in maskrom mode.
1. Press MASKROM key(no release).
2. Short press reboot key and release reboot key
3. Count 3 second, release MASKROM key
Now you are in the Rockusb maskrom mode. use lsusb command you should see a USB device with VID 0x2207 and PID 301a in your computer.
$ lsusb
Bus 002 Device 062: ID 2207:301a
Flash U-boot
Enter Rockusb maskrom mode first. Then got to your your working directory.
$ ./rkflashtool/flashuboot
Enter fastboot mode
Fastboot is a protocol that can be used to re-flash partitions on your device (update the flash file system in Android devices). It is this small tool that comes with the Android SDK (Software Developer Kit), which is an alternative to the Recovery Mode for doing installations and updates.
There are three way to enter fastboot mode
1. use fastboot key: press fastboot key without release, short press reboot key, count 3 second, release fastboot key. you will enter fastboot mode.
2. When you see anything like "Hit any key to stop autoboot". Hit any key in 3 second, you will enter U-boot console. Use "fastboot 0" command in U-boot console to enter fastboot mode.
3. Use "reboot fastboot" command to enter fastboot in kernel console.
Now you are in the fastboot mode. use lsusb command you should see a USB device with VID 0x2207 and PID 0006 in your computer.
$ lsusb
Bus 002 Device 063: ID 2207:0006
You can also use fastboot command to list devices
$ sudo fastboot -i 0x2207 devices
???????????? fastboot
Flash kernel
Enter fastboot mode first. Then got to your your working directory.
sudo fastboot -i 0x2207 flash boot_a ./system/kernel.uimg
Flash ubuntu core image
Enter fastboot mode first. Then got to your your working directory.
sudo fastboot -i 0x2207 flash system_a .system/ubuntu.img