Firefly RK3399

Device info

Device specs

Boot sequence

Partition scheme

This device has NVME port. It cannot be used for storing kernel files, but works fine as root device.

UART tty address is /dev/ttyS2 with baud rate 1500000. You can instruct kernel to send debug messages to this port and run agetty on it

Installation process

The following section assumes you use SD card as your boot device. By default the board attempts to start from eMMC with preinstalled Android. In order to avoid it either control boot process using UART adapter (the board UART port uses baud rate 1500000, see device info for examples of chips supporting this rate) or shorten eMMC at first boot (be careful, i’ve broken my eMMC by occasion). After you’ve started Artix from SD you can use it to install it on eMMC.

U-Boot

For this section you need arm-none-eabi-gcc and uboot-tools packages. To build and install u-boot you have to perform the following steps:

Build ATF

This step is nessesary, otherwise board will not boot

Build U-Boot

Installation

Create partitions

You have to keep in mind the following:

Flash U-Boot

Run two commands (assuming /dev/sdb is sdcard):

dd if=idbloader.img of=/dev/sdb seek=64
dd if=u-boot.itb of=/dev/sdb seek=16384

It will be wise to run sync after that

Prepare boot data

U-boot searches for boot script in / and /boot directories of filesystems it can read from. Assuming you have created separate /boot partition and copied kernel image, ramdisk and device tree blob on it, run the following command to create ramdisk image available for u-boot:

mkimage -A arm -T ramdisk -d <path to initramfs> mkinitramfs-linux.uimg

Next, you have to create u-boot script u-boot.cmd with following contents:

setenv bootargs "consoleblank=0 root=/dev/<partname> rw rootwait console=ttyS2,1500000n8 earlycon=uart8250,mmio32,0xff1a0000 console=tty1"
load mmc 1:1 ${fdt_addr_r} /dtbs/rockchip/rk3399-firefly.dtb
load mmc 1:1 ${kernel_addr_r} /Image
load mmc 1:1 ${ramdisk_addr_r} /initramfs-linux.uimg
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

Now, run

mkimage -A arm -T ramdisk -d boot.cmd boot.scr

boot.scr will be loaded by u-boot and run kernel

If you have done everything properly, board will boot now. On running system you can use the same steps (without rebuilding images) to install system on eMMC