This is on Arch ARM* or Manjaro installed on RP64. If compiling on amd64 machine, set CROSS_COMPILE variables accordingly.
Build ATF:
Build U-boot:
Here are the changed variables in .config, but don't just copy them to your .config - search for them in menuconfig and change there, the menu will take care of dependencies.
Writing to SD card first to test it (from doc/README.rockchip in U-boot source, "Option 3: Package the image with TPL"):
Flashing to SPI is much simpler nowadays, see doc/board/rockchip/rockchip.rst in U-boot source. Create a partition with FAT filesystem on the same SD card, place u-boot-rockchip-spi.bin on it, reboot, get to U-boot cmdline and:
If sf probe returns an error or booting from SPI fails, short pins 23 and 25 on GPIO to temporarily disable SPI. After booting disconnect them again and erase SPI to at least get SD boot working.
U-boot environment section on SPI might be empty, broken or contain wrong variables. To get default environment for installed version of U-boot, remove situational partitions variable and save the environment to SPI, run in U-boot cmdline:
Then create EFI partition on SATA disk and proceed like with a regular UEFI machine. U-boot from SPI will also scan SATA partitions for extlinux/extlinux.conf, boot.scr and other U-boot-specific boot configs.
* On Arch, pacman -U these 3 pkgs from Manjaro (choose a mirror close to you) to build ATF:
https://mirror.truenetwork.ru/manjaro/ar...kg.tar.zst
https://mirror.truenetwork.ru/manjaro/ar...kg.tar.zst
https://mirror.truenetwork.ru/manjaro/ar...kg.tar.zst
PS Screw this forum software inserting copious newlines on every press of preview button.
Build ATF:
Code:
git clone --depth=1 -b v2.13.0 https://github.com/ARM-software/arm-trusted-firmware.git
make -j $(nproc) CC=gcc PLAT=rk3399 bl31
Code:
git clone --depth=1 -b v2025.04 https://source.denx.de/u-boot/u-boot.git
export BL31=/path/to/built/bl31.elf
make mrproper && make rockpro64-rk3399_defconfig
make menuconfig
Code:
CONFIG_BOOTDELAY=20
CONFIG_BOOTCOMMAND="bootflow scan -lbm"
CONFIG_CMD_ERASEENV=y
CONFIG_CMD_NVEDIT_LOAD=y
CONFIG_NO_NET=y
CONFIG_BAUDRATE=115200
CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="usb start"
CONFIG_PREBOOT_DEFINED=y
make -j $(nproc)
Code:
dd if=idbloader.img of=/dev/sdX seek=64
dd if=u-boot.itb of=/dev/sdX seek=16384
sync
Flashing to SPI is much simpler nowadays, see doc/board/rockchip/rockchip.rst in U-boot source. Create a partition with FAT filesystem on the same SD card, place u-boot-rockchip-spi.bin on it, reboot, get to U-boot cmdline and:
Code:
sf probe
load mmc 1:1 $kernel_addr_r u-boot-rockchip-spi.bin
sf update $fileaddr 0 $filesize
U-boot environment section on SPI might be empty, broken or contain wrong variables. To get default environment for installed version of U-boot, remove situational partitions variable and save the environment to SPI, run in U-boot cmdline:
Code:
env default -a
env delete partitions
env save
Then create EFI partition on SATA disk and proceed like with a regular UEFI machine. U-boot from SPI will also scan SATA partitions for extlinux/extlinux.conf, boot.scr and other U-boot-specific boot configs.
* On Arch, pacman -U these 3 pkgs from Manjaro (choose a mirror close to you) to build ATF:
https://mirror.truenetwork.ru/manjaro/ar...kg.tar.zst
https://mirror.truenetwork.ru/manjaro/ar...kg.tar.zst
https://mirror.truenetwork.ru/manjaro/ar...kg.tar.zst
PS Screw this forum software inserting copious newlines on every press of preview button.