(real) Mainline U-boot finally works on SPI, boots SATA, throw away your SD cards NOW
#1
This is on Arch ARM* or Manjaro installed on RP64. If compiling on amd64 machine, set CROSS_COMPILE variables accordingly.


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
Build U-boot:


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




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)
Writing to SD card first to test it (from doc/README.rockchip in U-boot source, "Option 3: Package the image with TPL"):







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
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:




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


Possibly Related Threads…
Thread Author Replies Views Last Post
  enble boot after power loss/restore dkebler 18 16,000 12-04-2023, 12:14 PM
Last Post: ok38
  Mainline U-Boot with SPI, NVMe and SATA boot support sigmaris 108 161,935 09-25-2023, 12:46 AM
Last Post: ChriChri
Bug Broken boot: What am I missing? mkosarek 1 1,506 09-08-2023, 08:14 AM
Last Post: wdt
  Unable to boot Armbian on new RockPro64 mooseball 5 6,567 07-14-2023, 08:59 AM
Last Post: rockjonn
  no boot white led flashing moserwi 7 7,145 05-18-2023, 10:46 AM
Last Post: wdt
  u-boot locked on pine64pro ljones 1 2,342 09-06-2022, 10:32 AM
Last Post: ljones
  Cannot get my board to boot deutschlmao 11 12,270 09-05-2022, 04:23 PM
Last Post: ljones
  U-BOOT Tutorial hazz 0 1,705 07-19-2022, 10:48 PM
Last Post: hazz
  Installation Debian on emmc: which U-Boot and where? vongillus 3 4,363 07-02-2022, 09:24 AM
Last Post: dkebler
  ROCKPRO64 PCI SSD SD-boot Install pspgarret 0 1,806 06-09-2022, 10:56 AM
Last Post: pspgarret

Forum Jump:


Users browsing this thread: 1 Guest(s)