[PATCH v2 0/3] Fix binman_sym functionality on RISC-V port

Yao Zi ziyao at disroot.org
Wed Apr 16 18:25:30 CEST 2025


It's found that BINMAN_SYMBOLS_OK always evaluates to false on RISC-V,
because our linkerscripts don't define symbol __image_copy_start, on
which binman depends for determining the base address of an entry.
Binman simply bails out in case of missing the symbol.

This series contains three main changes,

1. Correct the entry type used for proper U-Boot, ensuring binman could
   find it, which is mandatory since SPL_BINMAN_UBOOT_SYMBOLS defaults
   to Y on RISC-V
2. Mark the SPL image of StarFive VisionFive2 as "no-write-symbols",
   since the SPL and proper U-Boot are split into two images.
3. Finally provide __image_copy{start,end} in RISC-V linkerscripts of
   both SPL and proper U-Boot, fixing functionality of binman_sym

I've tested building with
  - ae350_rv64_defconfig
  - ae350_rv64_spl_defconfig
  - bananapi-f3_defconfig
  - k230_canmv_defconfig
  - microchip_mpfs_icicle_defconfig
  - milkv_duo_defconfig

and booting successfully on
  - qemu-riscv64_smode_defconfig
  - qemu-riscv64_defconfig
  - sifive_unleashed_defconfig
  - starfive_visionfive2_defconfig
with either real hardware or QEMU.

Thank you Jonas Karlman for pointing out the root cause of binman
failures with SPL_BINMAN_UBOOT_SYMBOLS enabled. I'm looking forward to
further reviews.

Changed from v2
- Drop the patch which disables SPL_BINMAN_UBOOT_SYMBOLS by default on
  RISC-V
- Add patch to correct entry type of proper U-Boot in default binman
  configuration for RISC-V
- Add patch to prevent binman from relocating SPL of VisionFive 2
- Fix typo (one missing underscore) in linkerscript and collect Simon's
  r-b tag.
- Link to v1: https://lore.kernel.org/u-boot/20250407033744.4025-1-ziyao@disroot.org/

Yao Zi (3):
  riscv: dts: binman.dtsi: Switch to u-boot-nodtb entry for proper
    U-Boot
  riscv: dts: starfive: Prevent binman from relocating symbols in SPL
  riscv: Provide __image_copy_{start_end} symbols in linkerscript

 arch/riscv/cpu/u-boot-spl.lds                   | 2 ++
 arch/riscv/cpu/u-boot.lds                       | 3 +++
 arch/riscv/dts/binman.dtsi                      | 2 +-
 arch/riscv/dts/starfive-visionfive2-binman.dtsi | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.49.0



More information about the U-Boot mailing list