How to apply Firefly Rk3288 - Planet15/linux GitHub Wiki
Welcome to the applying FireFly-RK3288 wiki!
We test rt-test for community on firefly board for Rk3288. If you are interested in things like Realtime linux for RK3288, Please contact us.
Before start what you need:
- Firefly RK3288 development board
- Image file
- Host PC
- Good Micro USB OTG Cable
We provide multiple partition image, like kernel, boot, RFS. And we provide a simple page divided into the user's guide and development guide
This page describes how to flash the image file from the host to the Firefly board's eMMC flash memory and sdcard, via the Micro USB OTG cable. Please choose the right way according to image file type.
- Board Parameter
- Boot Loader
- Kernel
- RFS (Root File System)
Flash partition images:
sudo upgrade_tool di -b boot.img
sudo upgrade_tool di -k kernel.img
sudo upgrade_tool di -p paramater # flash parameter
sudo upgrade_tool ul bootloader.bin # flash bootloader
You need more details, please refer to the Flash Image of Firefly
RFS image Copy to target sdcard:
You can download RFS image and must be modified etc/inittab file for rk3288 serial port on Rockchip.
- 1:2345:respawn:/sbin/getty 38400 tty1
+ S0:2345:respawn:/sbin/getty 115200 ttyS2
And you use the rootfs on sdcard, copy to image. (sdcard located /dev/sdb1)
$ mount /dev/sdb1 /mnt/sd
$ cp –av <Project DIR>/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-minimal/1.0-r0/rootfs /mnt/sd
The Plinux build(Firefly-RK3288 Rockchip) is routinely tested in-house on recent versions of Ubuntu LTS(14.04), but most distributions should have the required build tools available. We welcome reports of successes or failure on other distributions.
This section describes how to set up your local work environment to build the Plinux files for Firefly-RK3288 board. You need to use Linux (Ubuntu 14.04). Building under Windows is not currently supported.
Installing required packages (Ubuntu 14.04) You will need a 64-bit version of Ubuntu. Ubuntu 14.04 is recommended.
$ sudo apt-get install build-essential lzop libncurses5-dev libssl-dev git minicom python-gtk2 \
gawk wget git-core diffstat unzip texinfo gcc-multilib chrpath socat
For 64-bit version
$ sudo apt-get install libc6:i386
Installing required packages (Fedora version 22) You will need a 64-bit version of Fedora. Fedora 22 is recommended.
$ sudo yum install gawk glibc-devel make wget tar bzip2 gzip python unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat \
findutils which SDL-devel xterm
For 64-bit version
$ sudo yum install glibc-devel.i686
Upgrade_tool
Rockchip provides a command line utility named “upgrade_tool” under Linux, which support flashing of both update.img and partition images. We have two choices with regard to open source tools:
- Rkflashtool: https://github.com/Galland/rkflashtool_rk3066
- Rkflashkit: https://github.com/linuxerwang/rkflashkit
Both of them only support flashing partition images, not update.img. There is no need to install device driver. (ref. http://wiki.t-firefly.com/index.php/Firefly-RK3288/Flash_image/en)
Download Linux_Upgrade_Tool, and install it to host filesystem.
$ tar xf Linux_Upgrade_Tool_v1.2_tar.gz
$ cd Linux_Upgrade_Tool_v1.2
$ sudo mv upgrade_tool /usr/local/bin
$ sudo chown root:root /usr/local/bin/upgrade_tool
Serial Debugging
Firefly-RK3288 use the following serial parameters:
Baud rate: 115200
Data bit: 8
Stop bit: 1
Parity check: none
Flow control: none
If you want more information, you will visit Firefly RK3288 Serial Debug wiki.
RK3288 has flexible boot modes. Under normal circumstance. Under hardware is damaged, Firefly-RK3288 development board will never become brick (brick means not able to boot or flash). If accident happens during upgrading firmware, bootloader is broken, making it impossible to upgrade again. The device can enter into MaskRoom mode as the last resort. If you need more information, you visit Firefly RK3288 wiki page.
RK3288 use u-boot source code. Rockchip provides u-boot source code.
$ git clone https://github.com/linux-rockchip/u-boot-rockchip
U-boot of rockchip was modified some source code to the operation of the board because it is included in the contents of the boot according to the terms and Android read the magic code. Modified the source code as follows
diff --git a/common/cmd_bootrk.c b/common/cmd_bootrk.c
index 42abb73..7321315 100755
--- a/common/cmd_bootrk.c
+++ b/common/cmd_bootrk.c
@@ -348,7 +348,7 @@ static void rk_commandline_setenv(const char *boot_name, rk_boot_img_hdr *hdr, b
/* bootrk [ <addr> | <partition> ] */
int do_bootrk(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- char *boot_source = "boot";
+ char *boot_source = "kernel";
`rk_boot_img_hdr *hdr = NULL;
`const disk_partition_t* ptn = NULL;
`bootm_headers_t images;
Building everything with make. Select the default RK3288 configuration.
$ make rk3288_defconfig
$ make
Use the Linux_Upgrade_Tool, then uploading the board.
$ sudo upgrade_tool ul RK3288UbootLoader_V2.19.01.bin
After a successful uploading to RK3288 board can see the following message.
Found devices:
0x2207:0x320a
============= 2015-06-24 19:48:33 ============
Loading partition information
PARM▒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:rootdelay=1 console=ttyS2,115200 earlyprintk root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/sbin/init mtdparts=rk29xxnand:0x00008000@0x00002000(kernel),0x00621ba0@0x000a000(rootfs),-@0x00622ba0(user) ip=off
Partitions:
kernel (0x00008000 @ 0x00002000) 16 MiB
rootfs (0x00621ba0 @ 0x0000a000) 3139 MiB
※ The Parameter of RK3288 board modification method
Backup the board from the parameter setting value.
$ sudo rkflashkit backup @parameter parameter.txt
Modify the parameter to the desired setting.
CMDLINE:rootdelay=1 console=ttyS2,115200 earlyprintk root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/sbin/init mtdparts=rk29xxnand:0x00008000@0x00002000(kernel),0x00621ba0@0x000a000(rootfs),-@0x00622ba0(user) ip=off
Uploading parameter setting value.
$ sudo rkflashkit flash @parameter parameter.txt
The Plinux kernel source tree is located in a git repository hosted by github. This document describes how to download the source tree for a specific target device. The kernel is basically using a common kernel contents of Plinux (version 3.14)
If you have already downloaded the kernel source code and cross compiling toolchain. Please skip to next step. If not, please download the kernel source code and arm-eabi-4.6 cross compiling toolchain.
Download the arm-eabi-4.6 source code:
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7
Setup environment value:
$ sudo mv arm-eabi-4.7 /usr/local/bin
$ export ARCH=arm
$ export CROSS_COMPILE=/usr/local/bin/arm-eabi-4.7/bin/arm-eabi-
Download the kernel source code:
$ git clone https://github.com/Planet15/rk3288_rt.git
$ git checkout pllinux
Building everything with make. GUN make can handle parallel tasks with a –jN argument, and it’s common to use a number of tasks N that’s between 1 and 2 times the number of hardware threads on the computer being used for the build. In the kernel source directory, execute:
$ make firefly-rk3288_defconfig
$ make menuconfig
$ 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
If you want choose kernel optioin, you can choose CONFIG_PREEMPT_RT. (Please read this artical: https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO) This follow create the rk3288-firefly.dtb, and merges the contents. (zIamge and rk3288-firefly.dtb) Add CRC value and made of the image.
Use the rkflashkit to upgrade the kernel
$ sudo rkflashkit flash @kernel kernel.img
※ If you are not making rkcrc, please download the rk-tools source code and use.
$ git clone https://github.com/rk3066/rk-tools.git
The Planet15 linux is needed the sdcard. You can download complied image, uncompress and copy to image
Building the rootfs
Rootfs is using yocto project. Yocto Project home page that describe in detail how to use the system. The basic Yocto Project can be used by following the instructions in the Yocto Project Quick Start found at Yocto Project.
Downloading the yocto project:
$ git clone –b fido git://git.yoctoproject.org/poky.git
$ cd poky
If you want the other project version, please refer to Yocto Site
Setup settings value:
$ source oe-init-build-env
Modified the configuration code as follows:
--- local.conf.org 2015-08-12 11:23:33.948560945 +0900
+++ local.conf 2015-07-10 19:41:22.384734636 +0900
@@ -27,14 +27,14 @@
# There are also the following hardware board target machines included for
# demonstration purposes:
#
-#MACHINE ?= "beaglebone"
+MACHINE ?= "beaglebone"
#MACHINE ?= "genericx86"
#MACHINE ?= "genericx86-64"
#MACHINE ?= "mpc8315e-rdb"
#MACHINE ?= "edgerouter"
#
# This sets the default machine to be qemux86 if no other machine is selected:
-MACHINE ??= "qemux86"
+#MACHINE ??= "qemux86"
#
# Where to place downloads
You can use BitBake to generate the tarball inside an existing Building Directory.
$ bitbake core-image-minimal
And you must be modified etc/inittab file for rk3288 serial port on Rockchip.
- 1:2345:respawn:/sbin/getty 38400 tty1
+ S0:2345:respawn:/sbin/getty 115200 ttyS2
You use the rootfs on sdcard, copy to image. (sdcard located /dev/sdb1)
$ mount /dev/sdb1 /mnt/sd
$ cp –av <Project DIR>/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-minimal/1.0-r0/rootfs /mnt/sd