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. Changes in v3: - Use the same copyright message as the original pci_rom.c file - Rewrite the commit message - Drop setting of EFI_LDS and rely on the CONFIG_SYS_LDSCRIPT value Changes in v2: - Depend on CONFIG_EFI_APP instead - Drop change to u-boot-elf rule - Mention '64-bit ARM' here, rather than just 'ARM' - Drop the word 'Sadly' - Mention '64-bit ARM' here, rather than just 'ARM' - Add new patch to rename VENDOR_EFI to ARCH_EFI - Update to use ARCH_EFI instead of VENDOR_EFI - Mention '64-bit ARM' here, rather than just 'ARM' - Mention '64-bit ARM' here, rather than just 'ARM' - Rework the commit message to clarify the relationship to link-scripts - Expand commit message to explains that EFI_APP skips relocation - Mention '64-bit ARM' here, rather than just 'ARM' - Document the x86 field better and add a comment for ARM too - Mention '64-bit ARM' here, rather than just 'ARM' - Put the EFI-app case first in setup_mon_len(), for clarity - Use ARCH_EFI instead of VENDOR_EFI - Merge the linker-script rules into Kconfig in this patch - Drop patch 'Select the EFI linker script for the app' Simon Glass (29): 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 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 treewide: Rename VENDOR_EFI to ARCH_EFI 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-level code when running as EFI app efi: arm: x86: 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: 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 | 4 +- Makefile | 6 + 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 | 6 +- arch/arm/dts/efi-arm_app.dts | 31 +++++ arch/arm/include/asm/global_data.h | 18 ++- 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/crt0_arm_efi.S | 2 +- arch/arm/lib/elf_aarch64_efi.lds | 49 +++++--- arch/riscv/lib/crt0_riscv_efi.S | 30 ++--- arch/x86/Kconfig | 4 +- arch/x86/cpu/efi/Makefile | 1 - arch/x86/include/asm/global_data.h | 9 +- board/efi/Kconfig | 44 ++++++- board/efi/efi-arm_app/Kconfig | 19 ++++ 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 | 6 +- 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 | 17 +-- 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 +- 48 files changed, 430 insertions(+), 250 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%) -- 2.43.0