On 2/3/25 18:41, Simon Glass wrote:
The original x86 EFI-app was written back in 2015, about a year before
the EFI-loader was introduced. At that point, ARM mostly used U-Boot and
FIT (Flat Image Tree).
Today, sadly, there are a few efforts to re-invent FIT poorly, to cater
to more primitive boot-environments than U-Boot. One justification for
this re-invetion has been that EDK2 did not support FIT.
EDK2 does now support FIT but only for the firmware stage. Even then,
vendors tend to use their own forks, so any new features are slow to
make it into the market.
EDK2 also supports the ext4 filesystem, but many devices don't include
that feature, so most distros make use of FAT for storing their boot
files. Since FAT is not journalled, it is not particularly reliable in
the face of reset, power failure, etc.
As an interim measure, we can use U-Boot as an EFI app running on top of
whatever EDK2 fork is in use. This allows use of modern features such as
FIT and filesystems other than FAT. So far this only supports x86, but
recent ARM laptops are making use of EFI too.
So this series adds an EFI app for 64-bit ARM.
Note: Since U-Boot does not support EFI's GOP 'blt-only' mode, the
vidconsole does not operate, but it can still be used, since EDK2
handles drawing instead of U-Boot. As a result, the U-Boot logo is not
shown.
Thank you Simon for going through this effort to generalize the EFI app.
The EFI app should build on all EFI architecture. Will you add RISC-V
support, too?
Best regards
Heinrich
Simon Glass (32):
Convert build-efi script to Python
Makefile: Avoid using TEXT_BASE if not present
video: Move vesa_setup_video_priv() into its own file
video: Use a local mode_info struct in the EFI driver
lib: Provide fdtdec_get_pci_bar32() only with PCI enabled
scripts: Update build-efi to support building U-Boot
scripts: Update build-efi to support arm64
efi: Rename app and payload to include x86
efi: Allow board/efi Kconfig to be used outside x86
efi: x86: Move EFI SDRAM-handling into a common file
efi: x86: Rework VENDOR_EFI option to permit other archs
efi: x86: Allow setting the global_data pointer with EFI
efi: Tidy up setup of global_data
efi: Rename ImageBase to image_base
efi: lmb: Avoid access to _start
efi: arm: Don't do the EL2 switch when running under EFI
efi: arm: Avoid allocating page tables when running under EFI
efi: arm: Avoid enabling caches when running under EFI
efi: arm: Implement access to global_data for EFI
efi: arm: Omit the ARM start-up code in the EFI app
efi: arm: Drop exception code when running as an EFI app
efi: arm: Allow use of the EFI table in the app
efi: arm: Disable --gc-sections for the app
efi: arm: Drop startup code from the app
efi: arm: Adjust how the monitor length is calculated
efi: arm: Select the EFI linker script for the app
efi: arm: Provide startup and relocation code
efi: Generate the app as a shared library
efi: arm: Disable STATIC_RELA for the EFI app
efi: arm: Use EFI flags for all compilation with the app
efi: arm: Simplify the crt0 file and update link script
efi: arm: Add an EFI app for arm64
Kconfig | 1 +
MAINTAINERS | 6 +-
Makefile | 8 +-
arch/Kconfig | 2 +
arch/arm/Kconfig | 6 +-
arch/arm/Makefile | 2 +
arch/arm/config.mk | 12 ++
arch/arm/cpu/armv8/Makefile | 4 +-
arch/arm/cpu/armv8/config.mk | 7 +-
arch/arm/dts/efi-arm_app.dts | 31 +++
arch/arm/include/asm/global_data.h | 16 +-
arch/arm/lib/Makefile | 12 +-
arch/arm/lib/bootm.c | 7 +-
arch/arm/lib/cache.c | 3 +
arch/arm/lib/crt0_aarch64_efi.S | 158 +++-----------
arch/arm/lib/elf_aarch64_efi.lds | 49 +++--
arch/riscv/lib/crt0_riscv_efi.S | 28 +--
arch/x86/Kconfig | 4 +-
arch/x86/cpu/efi/Makefile | 1 -
arch/x86/include/asm/global_data.h | 7 +
board/efi/Kconfig | 41 +++-
board/efi/efi-arm_app/Kconfig | 16 ++
board/efi/efi-arm_app/MAINTAINERS | 13 ++
board/efi/efi-arm_app/Makefile | 5 +
board/efi/efi-arm_app/board.c | 18 ++
board/efi/efi-arm_app/efi-arm_app.env | 11 +
board/efi/efi-x86_payload/Kconfig | 2 +-
common/board_f.c | 4 +-
common/board_r.c | 9 +-
configs/efi-arm_app64_defconfig | 51 +++++
configs/efi-x86_app32_defconfig | 4 +-
configs/efi-x86_app64_defconfig | 4 +-
configs/efi-x86_payload32_defconfig | 4 +-
configs/efi-x86_payload64_defconfig | 4 +-
doc/develop/uefi/u-boot_on_efi.rst | 21 +-
drivers/pci/pci_rom.c | 32 ---
drivers/video/Makefile | 2 +
drivers/video/efi.c | 1 +
drivers/video/vesa_helper.c | 41 ++++
include/asm-generic/sections.h | 2 +
include/vesa.h | 2 +
lib/efi/Kconfig | 2 +-
lib/efi/Makefile | 1 +
lib/efi/efi_app.c | 13 +-
{arch/x86/cpu => lib}/efi/sdram.c | 1 -
lib/fdtdec.c | 2 +
lib/lmb.c | 3 +-
scripts/build-efi.py | 293 ++++++++++++++++++++++++++
scripts/build-efi.sh | 207 ------------------
49 files changed, 719 insertions(+), 454 deletions(-)
create mode 100644 arch/arm/dts/efi-arm_app.dts
create mode 100644 board/efi/efi-arm_app/Kconfig
create mode 100644 board/efi/efi-arm_app/MAINTAINERS
create mode 100644 board/efi/efi-arm_app/Makefile
create mode 100644 board/efi/efi-arm_app/board.c
create mode 100644 board/efi/efi-arm_app/efi-arm_app.env
create mode 100644 configs/efi-arm_app64_defconfig
create mode 100644 drivers/video/vesa_helper.c
rename {arch/x86/cpu => lib}/efi/sdram.c (94%)
create mode 100755 scripts/build-efi.py
delete mode 100755 scripts/build-efi.sh