[Concept,00/15] riscv: Add EFI-application support

Message ID 20260212001410.1919749-1-sjg@u-boot.org
Headers
Series riscv: Add EFI-application support |

Message

Simon Glass Feb. 12, 2026, 12:13 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add support for building and running U-Boot as a 64-bit RISC-V EFI
application on top of UEFI firmware such as EDK2.

This includes build system changes (linker script, build flags, object
exclusions), runtime fixes (FDT relocation skip, global data pointer
handling, OF_BOARD_FIXUP disable), timer support via the firmware FDT,
board files and defconfig

It also provides QEMU integration in the build-efi script so it is easy
to try out.

Tested on QEMU riscv-virt with EDK2 firmware, boots to the U-Boot
prompt.


Simon Glass (15):
  board_f: Skip the FDT relocation when not relocating
  board_r: Skip set_gd() for RISC-V EFI applications
  riscv: Disable OF_BOARD_FIXUP for EFI applications
  riscv: timer: Read timebase frequency from the firmware FDT
  riscv: Add the EFI table field to arch_global_data
  riscv: Exclude -static -pie from LDFLAGS for EFI apps
  riscv: Add EFI application build flags
  riscv: efi: Exclude PLT relocations from the reloc loop
  riscv: Add EFI app linker script and build CRT objects
  riscv: Exclude start.o, mtrap.o, dram.o for EFI apps
  riscv: Skip prelink-riscv for EFI application builds
  riscv: Exclude unwanted startup code for EFI app builds
  efi: client: Build sync_dt for RISC-V EFI applications
  riscv: Add RISC-V EFI application board and defconfig
  scripts: build-efi: Add RISC-V architecture support

 Makefile                                  |   2 +
 arch/riscv/Kconfig                        |  10 +-
 arch/riscv/Makefile                       |   2 +
 arch/riscv/config.mk                      |  19 +++
 arch/riscv/cpu/Makefile                   |   7 +-
 arch/riscv/cpu/generic/Makefile           |   2 +
 arch/riscv/dts/efi-riscv_app.dts          |  49 ++++++++
 arch/riscv/include/asm/global_data.h      |   3 +
 arch/riscv/lib/Makefile                   |   2 +
 arch/riscv/lib/elf_riscv64_efi_app.lds    | 136 ++++++++++++++++++++++
 arch/riscv/lib/reloc_riscv_efi.c          |  12 +-
 board/efi/Kconfig                         |  42 ++++---
 board/efi/efi-riscv_app/Kconfig           |  26 +++++
 board/efi/efi-riscv_app/MAINTAINERS       |   7 ++
 board/efi/efi-riscv_app/Makefile          |   5 +
 board/efi/efi-riscv_app/board.c           |  51 ++++++++
 board/efi/efi-riscv_app/config.mk         |   6 +
 board/efi/efi-riscv_app/efi-riscv_app.env |  12 ++
 common/board_f.c                          |   3 +-
 common/board_r.c                          |   3 +-
 configs/efi-riscv_app64_defconfig         |  55 +++++++++
 drivers/timer/riscv_timer.c               |  13 +++
 include/asm-generic/global_data.h         |   8 ++
 lib/efi_client/Kconfig                    |   6 +-
 lib/efi_client/Makefile                   |   2 +
 lib/efi_client/efi_app.c                  |   3 +
 scripts/build-efi                         |  25 +++-
 scripts/build_helper.py                   |   7 +-
 28 files changed, 490 insertions(+), 28 deletions(-)
 create mode 100644 arch/riscv/dts/efi-riscv_app.dts
 create mode 100644 arch/riscv/lib/elf_riscv64_efi_app.lds
 create mode 100644 board/efi/efi-riscv_app/Kconfig
 create mode 100644 board/efi/efi-riscv_app/MAINTAINERS
 create mode 100644 board/efi/efi-riscv_app/Makefile
 create mode 100644 board/efi/efi-riscv_app/board.c
 create mode 100644 board/efi/efi-riscv_app/config.mk
 create mode 100644 board/efi/efi-riscv_app/efi-riscv_app.env
 create mode 100644 configs/efi-riscv_app64_defconfig