LinuxIntermediate

Build Mainline U-Boot for Rockchip (RK3588, RK3568, RK3399)

Build a mainline U-Boot image with TF-A and the Rockchip DDR blob, then write it to SD, eMMC or SPI flash.

Applies to: RK3588 RK3588S RK3568 RK3566 RK3399

Mainline U-Boot supports many Rockchip boards and produces a single image, u-boot-rockchip.bin, containing TPL, SPL, TF-A (BL31) and U-Boot proper. See the boot process guide for how the stages fit together.

1. Get the pieces

sudo apt install -y gcc-aarch64-linux-gnu bison flex python3-setuptools \
  python3-pyelftools swig libssl-dev libgnutls28-dev device-tree-compiler git
git clone https://source.denx.de/u-boot/u-boot.git
git clone https://github.com/rockchip-linux/rkbin.git

2. Choose BL31

Either build open-source TF-A (supported for RK3399 and RK3568, with RK3588 support landing upstream) or use the BL31 blob from rkbin:

# Option A: TF-A from source (example for RK3568)
git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
cd trusted-firmware-a
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3568 bl31
export BL31=$PWD/build/rk3568/release/bl31/bl31.elf

# Option B: rkbin blob (example for RK3588)
export BL31=$PWD/rkbin/bin/rk35/rk3588_bl31_v1.xx.elf

3. DDR init (TPL)

RK3568, RK3566 and RK3588 need the DDR init blob from rkbin. RK3399 can use U-Boot's open-source TPL.

export ROCKCHIP_TPL=$PWD/rkbin/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.xx.bin

Use the exact file matching your SoC and memory type; version numbers change over time, so list the directory and pick the latest.

4. Build

cd u-boot
make CROSS_COMPILE=aarch64-linux-gnu- rock5b-rk3588_defconfig
make CROSS_COMPILE=aarch64-linux-gnu- -j"$(nproc)"
ls u-boot-rockchip*.bin
# u-boot-rockchip.bin       (SD / eMMC, write at sector 64)
# u-boot-rockchip-spi.bin   (SPI NOR, write at offset 0)

Find your board's defconfig under configs/*rk35* or configs/*rk33*.

5. Install

# SD card or eMMC (from a host or a running system)
sudo dd if=u-boot-rockchip.bin of=/dev/sdX seek=64 conv=notrunc,fsync

# SPI NOR from a running Linux (if exposed as an MTD device)
sudo flashcp -v u-boot-rockchip-spi.bin /dev/mtd0

# Or via rkdeveloptool in MaskROM
rkdeveloptool db rk3588_spl_loader_v1.xx.bin
rkdeveloptool wl 64 u-boot-rockchip.bin

Tips

  • Keep a known-good SD card: on most boards SD has lower boot priority than SPI/eMMC, so erase the higher-priority media or use MaskROM for recovery.
  • Mainline uses bootstd/distro boot: an extlinux/extlinux.conf on the first bootable partition is all you need.
  • Enable CONFIG_CMD_BOOTMENU and keep a serial console attached during bring-up.

Spotted an error or have something to add? Suggest an improvement.

Related guides

Building a Rockchip-based product?

From hardware design to Linux, Android and AI integration, get engineering support for your Rockchip project.