How to apply FirePrime Rk3128 - Planet15/linux GitHub Wiki

Welcome to the applying FirePrime-RK3128 wiki!

We test rt-test for community on firefly board for Rk3128. If you are interested in things like Realtime linux for RK3128, Please contact us.

Before start what you need:

  • FirePrime RK3128 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

User 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.

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

Development Guide

Downloading and Building

The Plinux build(FirePrime-RK3128 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.

1. Initializing the Build Environment

This section describes how to set up your local work environment to build the Plinux files for FirePrime-RK3128 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:

Both of them only support flashing partition images, not update.img. There is no need to install device driver. If you need more details, you visit FirePrime Flash Image Page.

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

FirePrime-RK3128 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 FirePrime Serial Debug Page.

2. Downloading and Building Boot-loader

FirePrime RK3128 has flexible boot modes. Under normal circumstance. Under hardware is damaged, FirePrime-RK3128 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. (ref.http://wiki.t-firefly.com/index.php/FirePrime/Boot_mode/en)

RK3128 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 RK3128 configuration.

$ make rk3128_defconfig
$ make

Use the Linux_Upgrade_Tool, then uploading the board.

$ sudo upgrade_tool ul RK3128UbootLoader_V2.19.01.bin

After a successful uploading to RK3128 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 RK3128 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
⚠️ **GitHub.com Fallback** ⚠️