
A limitation of the EFI loader at present is that it does not build with sandbox. This makes it hard to write tests, since sandbox is used for most testing in U-Boot.
This series enables the EFI loader feature. It allows sandbox to build and run a trivial function which calls the EFI API to output a message.
Also included in v8 is support for running the full EFI self tests. These run OK with some tweaks to a few parts of the code.
With v9, various EFI patches have been applied which change things. This series includes a partial review of one, which makes 'bootefi test' work. But there are still problems with 'bootefi selftest':
$ sandbox/u-boot -D -c "bootefi selftest" ... Executing 'block device' /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest_block_device.c(385): TODO: Wrong volume label 'xxa1', expected 'U-BOOT TEST' map_to_sysmem: Added map from 00007ffd0782d2a0 to 8000000 phys_to_virt: Used map from 8000000 to 00007ffd0782d2a0 writing /u-boot.txt find_tag: Used map from 00007ffd0782d2a0 to 8000000 phys_to_virt: Used map from 8000000 to 00007ffd0782d2a0 /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest_block_device.c(458): ERROR: Unexpected file content /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest.c(109): ERROR: Executing 'block device' failed
...
Executing 'simple network protocol' DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest_snp.c(311): ERROR: Timeout occurred /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest.c(109): ERROR: Executing 'simple network protocol' failed
This series is at u-boot-dm/efi-working
Changes in v9: - Add comments to bootefi_test_prepare() about the memset()s - Add revert for "efi_loader: Rename sections to allow for implicit data" - Drop fdt_end variable in efi_install_fdt() - Fix 'thi' typo
Changes in v8: - Drop 'efi: Adjust memory handling to support sandbox' - Drop 'efi: sandbox: Add relocation constants' - Drop 'sandbox: smbios: Update to support sandbox' - Expand series substantially to support bootefi selftest - Rebase to master - Rebase to master, bringing in all EFI changes
Changes in v7: - Drop an unnecessary comment - Drop patch "efi: Init the 'rows' and 'cols' variables" - Drop patches previous applied - Update patch subject s/builder/build/
Changes in v6: - Warn about building sandbox EFI support on something other than __x86_64__
Changes in v5: - Add new patch to disallow CMD_BOOTEFI_SELFTEST on sandbox - Drop call to efi_init_obj_list() which is now done in do_bootefi() - Introduce load_options_path to specifyc U-Boot env var for load_options_path - Rebase to master
Changes in v4: - Rebase to master - Update SPDX tags
Changes in v3: - Add new patch to rename bootefi_test_finish() to bootefi_run_finish() - Add new patch to split out test init/uninit into functions - Add patch to create a function to set up for running EFI code - Init the 'rows' and 'cols' vars to avoid a compiler error (gcc 4.8.4) - Rebase to master
Changes in v2: - Rebase to master
Alexander Graf (1): efi_loader: Pass address to fs_read()
Simon Glass (17): Revert "efi_loader: Rename sections to allow for implicit data" efi: Don't allow CMD_BOOTEFI_SELFTEST on sandbox efi: sandbox: Add distroboot support efi: sandbox: Enable EFI loader build for sandbox efi: Split out test init/uninit into functions efi: sandbox: Add a simple 'bootefi test' command efi: Create a function to set up for running EFI code efi: Rename bootefi_test_finish() to bootefi_run_finish() sandbox: Align RAM buffer to the machine page size sandbox: Try to start the RAM buffer at a particular address sandbox: Add support for calling abort() sandbox: Enhance map_to_sysmem() to handle foreign pointers efi: Add a call to exit() along with why we can't use it efi: Relocate FDT to 127MB instead of 128MB efi: sandbox: Tidy up copy_fdt() to work with sandbox efi: Add more debugging for memory allocations efi: sandbox: Enable selftest command
arch/sandbox/config.mk | 3 - arch/sandbox/cpu/cpu.c | 141 ++++++++++++++++-- arch/sandbox/cpu/os.c | 17 ++- arch/sandbox/cpu/state.c | 8 + arch/sandbox/cpu/u-boot.lds | 9 +- arch/sandbox/include/asm/state.h | 21 +++ cmd/bootefi.c | 242 +++++++++++++++++++++---------- configs/sandbox_defconfig | 1 + include/config_distro_bootcmd.h | 11 ++ include/efi_loader.h | 3 + include/os.h | 4 + lib/efi_loader/Kconfig | 12 +- lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_boottime.c | 15 ++ lib/efi_loader/efi_file.c | 5 +- lib/efi_loader/efi_memory.c | 22 ++- lib/efi_loader/efi_test.c | 26 ++++ 17 files changed, 439 insertions(+), 102 deletions(-) create mode 100644 lib/efi_loader/efi_test.c