This is a guide for booting RockPro64 computer ( without using any proprietary blobs. RockPro64 is based on Rockchip’s rk3399 SoC, so if you have some other rk3399 board, you might still find this guide useful.

I’m using Gentoo GNU/Linux in this guide but steps should be quite similar on other distributions.

Overview of boot sequence

Before we proceed with detailed instructions, let us briefly describe how rk3399 boots.

rk3399 chip has two types of internal memory that is inside the chip itself:

  • 32 KiB BootROM which is read only.
  • 200 KiB SRAM (Static RAM).

When rk3399 is powered on, CPU loads BootROM code into SRAM (at this stage main system RAM is not yet initialized). BootROM is a fairly small program baked into hardware that is responsible for loading initial bootloader. It supports booting from SPI, eMMC, SD and supports downloading next bootloader over USB OTG interface. Since it is quite small and baked onto the chip itself, for the purposes of this guide we will consider it as hardware, not software.

So, BootROM loads U-Boot TPL into SRAM. Since SRAM is quite small, we cannot load the full U-Boot bootloader into it, so only a small part called TPL is loaded. Its main job is to initialize main system RAM (RockPro64 has up to 4 GiB of LPDDR4 based RAM).

Then U-Boot TPL hands control back to BootROM which then loads a slightly bigger part of U-Boot called U-Boot SPL. At this stage SPL loads ATF (Arm Trusted Firmware: and U-Boot Proper into memory. Then ATF starts and finally runs U-Boot.

U-Boot can boot payloads from a variety of sources including, eMMC, SD, USB as well as do network boot. Also, U-Boot has support for UEFI booting specification, so it can boot EFI binaries located on ESP partitions. Even though U-Boot can load Linux kernel directly, I personally find it more convenient to first load Grub2 and then load Linux kernel.

Compiling required components


First of all you need to install required toolchain. If you are following this guide on RockPro64 itself or other ARM64 system, you can just use gcc. If you are not on ARM64, you can use crossdev ( to install ARM64 cross-compiler (other distributions often ship cross compiler binaries too, e.g. on Debian GNU/Linux you can use

In addition to ARM64 compiler, you also need ARM32 cross-compiler:

crossdev --target arm-none-eabi -s4

At the moment on my system I have cross-arm-none-eabi/gcc-8.3.0-r1 with USE="cxx graphite jit multilib pgo".

Arm Trusted Firmware

As mentioned before, source code for ATF can be downloaded from

Building ATF is quite easy but you might want to first remove some blobs (alternatively, removal of blobs is available in my git fork

find . -name '*.bin' -exec rm -rf {} \;
make PLAT=rk3399

This should produce build/rk3399/release/bl31/bl31.elf. Now, we can make the path to bl31.elf binary known to U-Boot build process

export BL31=path/to/arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf


U-Boot only gained support for training LPDDR4 memory in v2019.10 which is not released yet, so for now we will get U-Boot from git:

git clone

Let’s use default configuration. I also tried tweaking configuration a bit to enable HDMI display inside U-Boot but so far I was not successful.

cd u-boot
make rockpro64-rk3399_defconfig

This should produce idbloader.img which contains U-Boot TPL and SPL and u-boot.itb which contains U-Boot Proper. We can install those with the following script

#!/bin/sh -e

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

Optionally you might want to create two 4 MiB partitions that start at sectors 64 and 16384 and use those with dd without seek. Before running commands above, make sure that your eMMC or SD card is represented by /dev/mmcblk1 block device. I have only tested booting from eMMC and did not try SD card myself.

At this stage you can use any of the boot methods supported by U-Boot. In this guide I’ll be using UEFI boot to load GNU GRUB.


Let’s get GRUB2 from package manager:

emerge sys-boot/grub

On my eMMC card I have created EFI System Partition (which should be FAT32 formatted). Then add moutpoint /boot/efi to /etc/fstab. GRUB should then be installed to ESP:


# mount /boot/efi # you might needs this if /boot/efi is not mounted
grub-install /dev/mmcblk1 --removable
grub-mkconfig -o /boot/grub/grub.cfg

The script above should have created /boot/efi/EFI/BOOT/BOOTAA64.EFI

Compiling kernel

In this guide I’ll use mainline kernel with a few patches. Support for RockPro64 is not yet complete in the mainline kernel, so it is essential to use the latest kernel. At the time of writing this is 5.3.

Configuring kernel is out of scope for this blog post, there are other guides online. You can use my configuration from Copy config file into your kernel source directory and rename it to .config. However, for UEFI boot as described in this blog, you need to enable CONFIG_EFI_STUB=y in your kernel config.

Let’s download kernel sources. First of al, we’ll apply a few patches. Download the patches from and put them to /etc/portage/patches/gentoo-sources/. Note that the last patch 0003-arm64-dts-rockchip-Add-PWM-fan-for-RockPro64.patch will be included in Linux 5.4. The other two patches fix booting from eMMC and terrible IPv6 performance.

emerge gentoo-sources

To achieve fully blobless boot we can deblob the kernel:

cd /usr/src/linux # assuming that is where you unpacked your kernel
chmod +x deblob-5.3 deblob-Pcheck
PYTHON=python2.7 ./deblob-5.3

To compile the kernel, simply run

make -j$(nproc)

Then kernel can be installed with

make zinstall
make modules_install
make dtbs_install

The last command will install device tree files to /boot/dtbs/kernel_version/rockchip. In particular this directory should contain rk3399-rockpro64.dtb. Copy this file to ESP partition, so that it is available to U-Boot when it is loading Grub.

Copying this dtb file is in principle optional. If it is missing, then kernel will simply use dtb from U-Boot which is mostly good enough, but kernel usually has slightly more up to date device tree file. At the moment I was not able to get HDMI working if I skip this step. This is possibly related to my failure of getting screen to work in U-Boot itself

mkdir -p /boot/efi/dtb/rockchip
cp /boot/dtbs/${kernel_version}/rockchip/rk3399-rockpro64.dtb /boot/efi/dtb/rockchip

Don’t forget to generate initramfs, for example you can use dracut

dracut --xz -H /boot/initramfs-${kernel_version}.img $kernel_version
grub-mkconfig -o /boot/grub/grub.cfg

At this stage your can reboot and if everything goes fine, you’ll hopefully boot into fully free system.

If you grab latest mesa package with panfrost driver you can even use accelerated KDE Plasma desktop or play some 3D games.

Configuring fan with fancontrol

The last patch we applied to the kernel exposes fan interface to the kernel. At the moment this makes fan spin at full speed. You can control it with e.g. fancontrol from sys-apps/lm-sensors package. I use the following /etc/fancontrol configuration file:


fancontrol can be started with systemctl enable fancontrol; systemctl start fancontrol


Unfortunately, on my system booting is not reliable yet. I’m not yet sure why. Sometimes U-Boot Proper fails to initialize eMMC card (typing boot until it succeeds usually fixes the problem), occasionally boot fails in other U-Boot stages.

Update: This seems to be specific to some eMMC cards. Maybe related to command queue support (see kernel patch that I applied to my kernel that was also disabling command queueing on eMMC cards).

Booting from SPI

U-Bootalso supports booting from on-board SPI flash. Version 2020.01 can boot U-Boot TPL and U-Boot SPL stages from SPI flash. In order to also boot U-Boot Proper, you need to patch boot order and use adjust U-Boot config (see provided defconfig in the following link)

You can flash these stages with the following script:

#!/bin/sh -e
cd u-boot

tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin "${image_name}"
padsize=$((0x60000 - 1))

image_size=$(wc -c < "${image_name}")
[ $image_size -le $padsize ] || exit 1
dd if=/dev/zero of=${image_name} conv=notrunc bs=1 count=1 seek=${padsize}
cat ${image_name} u-boot.itb > "${combined_name}"

dd if="${combined_name}" of=/dev/mtdblock0


If you prefer to run binaries but do not want to compile them yourself, you can get them from

Become a patron Donate using Liberapay Bitcoin: bc1qe2dfqjwgse5v6cl6rhtk352ru90t0hnve45f2c

8 thoughts on “Blobless boot with RockPro64

  1. Hi Andrius,

    I’m using Gentoo on my desktop for a long time. Well versed with GPT, UEFI, GRUB2.

    Since you seem to be using Gentoo too, I was wondering if you can clarify for me a few things for me, mainly about partioning.:

    Just got my RockPro64 and I’d like to install Gentoo on eMMC (NVME or SSD will come later when I get my hands dirty).

    On a bare bones machine I usually create an EFI partition and a root partition, then I boot SystemRescueCD on USB and use that to start Gentoo installation from stage3.

    For the RockPro64 I installed Manjaro on SD card and can use that as my starting point for Gentoo installation on eMMC.

    1. Will GPT partioning scheme work?

    2. Is this layout all right?
    – EFI partition, 2 GB, fat32 (with GRUB2)
    – root partition, 32 GB, ext4 or btrfs (for Gentoo system)
    – data partittion, 90 GB, ext4 or btrfs (for /home)

    3. Will the board be able to boot the above eMMC without me touching the U-Boot or SPI that came with it?

    Thank you,

    • 1. Yes, GPT partitioning scheme works as it is supported by U-Boot.

      2. This would work, although I don’t know why you need 2 GB for EFI partittion. Grub.efi is about 300K large. I think my EFI partition is 112 MiB on RockPro64 and even that is too much.
      Root and data partitions are alright (especially if you use ext4). Personally, I would use a single btrfs with subvolumes for / and /home. That way your free space is not partitioned, but subvolumes still allow some separation.

      3. No. The board does not come with U-Boot on SPI or eMMC. It comes completely empty. You need to install U-boot to either SPI (and full SPI boot needs not yet released U-Boot v2020.07) or eMMC.

      • I will reduce the EFI partition to a few MiB, then apply the info in this blog to install U-boot on eMMC.
        I may also reduce the size of / and home to make room for a future install of FreeBSD.
        Really appreciate your answer!

  2. I think one can remove one more blob with
    rm plat/rockchip/rk3399/drivers/dp/hdcp.bin
    just before building ATF with
    make PLAT=rk3399
    and HDMI still works. Maybe some DRMed content won’t be displayed, I haven’t tried, but that’d be a feature, wouldn’t it?
    In reality I didn’t try it exactly so. I additionaly removed code from ATF for other hardware (just because I didn’t want to browse it looking for blobs). But that paranoia should not be needed.

  3. Hi,

    I’m trying to follow your guide inside a Gentoo chroot on ayufan’s Ubuntu build on the Rock Pro 64.
    When building the ATF I always get the following error:

    ld.bfd: build/rk3399/release/bl31/bl31.elf section `.pmusram' will not fit in region `PMUSRAM'
    ld.bfd: region `PMUSRAM' overflowed by 104 bytes

    When I change the “-O3” in plat/rockchip/rk3399/drivers/m0/Makefile to “-Os” it gets a litte smaller:

    ld.bfd: build/rk3399/release/bl31/bl31.elf section `.pmusram' will not fit in region `PMUSRAM'
    ld.bfd: region `PMUSRAM' overflowed by 96 bytes

    That happens with both gcc 9.2.0-r2 and 8.3.0-r2.

    Do you have an idea / suggestion how to fix this?


    • Hmm, at some point I had this error too. Unfortunately, I don’t remember when exactly it went away.
      My cross-arm-none-eabi/gcc has the following USE flags:
      cxx graphite jit lto multilib pgo

      and sys-devel/gcc has
      cxx d fortran go graphite lto nls nptl objc objc++ objc-gc openmp pch pgo pie sanitize ssp vtv

      I’m on gcc 9.2.0-r2 at the moment.

      What about ubuntu toolchain? Can it compile ATF?

      • Stupid me…I haven’t tried the Ubuntu toolchain. Yes it does work with Ubuntu’s compilers. For reference what I did was:

        # apt-get install gcc-arm-none-eabi

        The system (aarch64) compiler is:
        gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
        The embedded compiler (arm-none-eabi-gcc) is:
        gcc version 6.3.1 20170620 (15:6.3.1+svn253039-1build1)



Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 


Time limit is exhausted. Please reload CAPTCHA.