| Table of Contents─────────────────
 1 Preparation.. 1.1 Toolchain
 .. 1.2 Tools
 .. 1.3 Put your device into loader mode
 2 U-Boot
 .. 2.1 Compile U-Boot
 .. 2.2 Flash U-Boot
 3 Parameter file
 4 Kernel
 .. 4.1 Compile Kernel
 .. 4.2 Flash Kernel
 5 Linux rootfs
 6 Initramfs
 7 Reboot
 8 FAQ
 .. 8.1 Where're my paritions in eMMC storage?
 .. 8.2 What currently works in mainline kernel
 .. 8.3 What currently not work in mainline kernel
 .. 8.4 Mainline & sdk kernel difference
 
 
 1 Preparation═════════════
   Suppose your working directory is "~/proj/linux-rockchip"   ╭────│ mkdir -p ~/proj/linux-rockchip
 ╰────
 1.1 Toolchain
 ─────────────
   Then copy the Android prebuilt directory to it:   ╭────│ cd ~/proj/linux-rockchip
 │ cp -rl ANDROID_SDK/prebuilts .
 ╰────
   We're using arm-eabi-4.6 and arm-eabi-4.7 in"prebuilts/gcc/linux-x86/arm/".
   U-Boot prefers arm-eabi-4.7 than arm-eabi-4.6, and kernel usesarm-eabi-4.6.
 1.2 Tools
 ─────────
   Install• rkflashtool: [https://github.com/linux-rockchip/rkflashtool]
 • rkflashkit: [https://github.com/linuxerwang/rkflashkit]
 • rk_upgrade_tool:
 RK3288_SDK/RKTools/linux/Linux_Upgrade_Tool_v1.2/upgrade_tool
 1.3 Put your device into loader mode
 ────────────────────────────────────
   Check[http://wiki.t-firefly.com/index.php/Firefly-RK3288/Flash_image/en] .
 2 U-Boot
 ════════
 2.1 Compile U-Boot──────────────────
   Compile U-Boot first:╭────
 │ cd ~/proj/linux-rockchip
 │ git clone https://github.com/linux-rockchip/u-boot-rockchip.git u-boot
 │ cd u-boot
 │ make rk3288_defconfig
 │ make -j4
 ╰────
   If U-Boot is built succeesfully, the last lines of the build processare:
 ╭────
 │   LD      u-boot
 │   OBJCOPY u-boot.bin
 │   OBJCOPY u-boot.srec
 │ ./tools/boot_merger --subfix ".01.bin" ./tools/rk_tools/RKBOOT/RK3288.ini
 │ out:RK3288UbootLoader.bin
 │ fix opt:RK3288UbootLoader_V2.19.01.bin
 │ merge success(RK3288UbootLoader_V2.19.01.bin)
 ╰────
   "RK3288UbootLoader_V2.19.01.bin" is the newly built u-boot which isready to flash using rk_upgrade_tool:
 2.2 Flash U-Boot
 ────────────────
   ╭────│ sudo rk_upgrade_tool ul RK3288UbootLoader_V2.19.01.bin
 ╰────
 3 Parameter file
 ════════════════
   You need the kernel partition to hold main line kernel image, and anoptional boot partition to hold initramfs (if you use it).
   Below is the default dual boot parameter, which is sufficient to testthe main line kernel:
 ╭────
 │ FIRMWARE_VER:4.4.2
 │ MACHINE_MODEL:rk30sdk
 │ MACHINE_ID:007
 │ MANUFACTURER:RK30SDK
 │ MAGIC: 0x5041524B
 │ ATAG: 0x60000800
 │ MACHINE: 3066
 │ CHECK_MASK: 0x80
 │ PWR_HLD: 0,0,A,0,1
 │ #KERNEL_IMG: 0x62008000
 │ #FDT_NAME: rk-kernel.dtb
 │ #RECOVER_KEY: 1,1,0,20,0
 │ CMDLINE:console=ttyFIQ0 androidboot.hardware=rk30board androidboot.console=ttyFIQ0 board.ap_has_alsa=0 root=/dev/block/mtd/by-name/linuxroot rw rootfstype=ext4 init=/sbin/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(misc),0x00008000@0x00006000(resource),0x00008000@0x0000e000(kernel),0x00010000@0x00016000(boot),0x00010000@0x00026000(recovery),0x0001a000@0x00036000(backup),0x00040000@0x00050000(cache),0x00002000@0x00090000(kpanic),0x00180000@0x00092000(system),0x00002000@0x00212000(metadata),0x00200000@0x00214000(userdata),0x00620000@0x00414000(linuxroot),-@0x00a34000(user)
 ╰────
   To fetch the parameter file of your device, run:╭────
 │ sudo rkflashkit backup @parameter parameter.txt
 ╰────
   To flash the new parameter file to your device, run:╭────
 │ sudo rkflashkit flash @parameter parameter.txt
 ╰────
 4 Kernel
 ════════
   This is naobsd's linux-next tree with Firefly-RK3288 develpment boardsupport:
 [https://github.com/naobsd/linux/tree/naobsd/next-20141231]
 4.1 Compile Kernel
 ──────────────────
   First, fetch the sources:╭────
 │ cd ~/proj/linux-rockchip
 │ git clone -b naobsd/next-20141231 https://github.com/naobsd/linux.git kernel
 ╰────
   kerne.img can be made with following commands:╭────
 │ cd ~/proj/linux-rockchip/kernel
 │ export ARCH=arm
 │ export CROSS_COMPILE=$PWD/../prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
 │ make rk3288_defconfig
 │ make -j4 zImage
 │ make rk3288-firefly.dtb
 │ cat arch/arm/boot/zImage arch/arm/boot/dts/rk3288-firefly.dtb > zImage-dtb
 │ rkcrc -k zImage-dtb kernel.img
 ╰────
 4.2 Flash Kernel
 ────────────────
   ╭────│ sudo rkflashkit erase @resource
 │ sudo rkflashkit flash @kernel kernel.img
 ╰────
 5 Linux rootfs
 ══════════════
   Put your rootfs to the first partition of your SD-card.   If you want to change the root path, please change CONFIG_CMDLINE inthe kernel configuration file:
   ╭────│ CONFIG_CMDLINE="console=ttyS2,115200 earlyprintk init=/sbin/init root=/dev/mmcblk0p1 rootwait"
 ╰────
 6 Initramfs
 ═══════════
   If you want to use initramfs, please use rkcrc to pack it first, thenflash it to boot partition
   ╭────│ rkcrc -k initramfs.img boot.img
 │ sudo rkflashkit flash @boot boot.img
 ╰────
 7 Reboot
 ════════
   Insert the SD-card, and reboot the device with:   ╭────│ sudo rkflashkit reboot
 ╰────
 8 FAQ
 ═════
 8.1 Where're my paritions in eMMC storage?──────────────────────────────────────────
   The main line kernel does not support rk style partition scheme whichuses command line to specify partition layout.
 8.2 What currently works in mainline kernel
 ───────────────────────────────────────────
   • USB• TF-CARD
 8.3 What currently not work in mainline kernel
 ──────────────────────────────────────────────
   • Ethernet• HDMI
 • WiFi
 8.4 Mainline & sdk kernel difference
 ────────────────────────────────────
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━mainline    sdk
 console  /dev/ttyS2  /dev/ttyFIQ0
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 |