[PATCH v6 00/27] efi: Improvements to U-Boot running on top of UEFI

Simon Glass sjg at chromium.org
Fri Dec 17 20:40:32 CET 2021


At present U-Boot can be built as an EFI app, but it is really just for
testing, with very few features. Instead, the payload build is used for
booting on top of UEFI, where U-Boot takes over the machine immediately
and supplies its own drivers.

But the app could be made more useful.

This series provides access to EFI block devices and the video console
within U-Boot. It also restructures the app to make it possible to boot
a kernel, although further work is needed to implement this.

This can be thought of as making U-Boot perform a little like 'grub', in
that it runs purely based on UEFI-provided services.

Of course a lot more work is required, but this is a start.

Note: It would be very useful to include qemu tests of the app and stub
in CI.

This is available at u-boot-dm/efi-working

Changes in v6:
- Add comment for dm_scan_other()
- Add comment for free_memory()
- Drop setup_disks() as U-Boot does not support it
- Fix 'have have' typo
- Fix 'stuff' typo in comment
- Fix Alo typo in commit message
- Fix comment style in setup_info_table()
- Fix typo in function comment
- Reword commit message
- Update comment for UCLASS_EFI_MEDIA (within space constraints)
- Update comment format for devpath_is_partition()
- Update comment to UCLASS_EFI_LOADER
- Update to 'This function' in comment
- Use 'U-Boot' instead of 'ARP' typo

Changes in v5:
- Add new patch to avoid setting up global_data again with EFI
- Add new patch to avoid using the 64-bit link script for the EFI app
- Add new patch to build the 64-bit app properly
- Add new patch to resolve EFI/EFI_LOADER conflict
- Add new patch to round out the link script for 64-bit EFI
- Add new patch to set the correct link flags for the 64-bit EFI app
- Add new patch to tweak the code used for the 64-bit EFI app
- Add various patches to fix up the 64-bit app so that it boots
- Fix grammar in commit message

Changes in v3:
- Add new patch to show the system-table revision
- Drop comments that confuse sphinx
- Move device_path path change to its own patch

Changes in v2:
- Add MAINTAINERS entry
- Add a better boot command too
- Add a sentence about what the patch does
- Add new patch to support the efi command in the app
- Don't export efi_bind_block()
- Drop mention of partitions from the commit message
- Fix 'as' typo
- Only bind devices for media devices, not for partitions
- Show devices that are processed
- Show the correct interface type with 'part list'
- Store device path in struct efi_media_plat
- Update documentation
- Update the commit message to explain things better
- Use log_info() instead of printf()

Simon Glass (27):
  efi: Rename UCLASS_EFI and IF_TYPE_EFI
  efi: Add EFI uclass for media
  efi: Add a media/block driver for EFI block devices
  efi: Locate all block devices in the app
  efi: serial: Support arrow keys
  x86: Allow booting a kernel from the EFI app
  x86: Don't process the kernel command line unless enabled
  x86: efi: Add room for the binman definition in the dtb
  efi: Drop device_path from struct efi_priv
  efi: Add comments to struct efi_priv
  efi: Fix ll_boot_init() operation with the app
  efi: Add a few comments to the stub
  efi: Share struct efi_priv between the app and stub code
  efi: Move exit_boot_services into a function
  efi: Check for failure when initing the app
  efi: Mention that efi_info_get() is only used in the stub
  efi: Show when allocated pages are used
  efi: Allow easy selection of serial-only operation
  x86: efi: Update efi_get_next_mem_desc() to avoid needing a map
  efi: Support the efi command in the app
  x86: efi: Show the system-table revision
  x86: efi: Don't set up global_data again with EFI
  x86: efi: Tweak the code used for the 64-bit EFI app
  x86: efi: Round out the link script for 64-bit EFI
  x86: efi: Don't use the 64-bit link script for the EFI app
  x86: efi: Set the correct link flags for the 64-bit EFI app
  efi: Build the 64-bit app properly

 MAINTAINERS                        |   3 +
 Makefile                           |   4 +-
 arch/sandbox/dts/test.dts          |   4 +
 arch/x86/config.mk                 |  15 +-
 arch/x86/cpu/config.mk             |   2 +-
 arch/x86/cpu/efi/payload.c         |  17 +-
 arch/x86/cpu/x86_64/cpu.c          |   5 +
 arch/x86/dts/Makefile              |   2 +-
 arch/x86/lib/Makefile              |   5 +-
 arch/x86/lib/bootm.c               |  11 +-
 arch/x86/lib/elf_x86_64_efi.lds    |   5 +-
 arch/x86/lib/relocate.c            |   2 +
 arch/x86/lib/zimage.c              |  13 +-
 cmd/Makefile                       |   2 +-
 cmd/efi.c                          |  78 +++++----
 common/board_r.c                   |   5 +-
 disk/part.c                        |   5 +-
 doc/develop/uefi/u-boot_on_efi.rst |   6 +-
 doc/develop/uefi/uefi.rst          |   8 +-
 drivers/block/Kconfig              |  33 ++++
 drivers/block/Makefile             |   4 +
 drivers/block/blk-uclass.c         |   6 +-
 drivers/block/efi-media-uclass.c   |  15 ++
 drivers/block/efi_blk.c            | 115 ++++++++++++
 drivers/block/sb_efi_media.c       |  20 +++
 drivers/serial/serial_efi.c        |  11 +-
 include/blk.h                      |   3 +-
 include/configs/efi-x86_app.h      |  25 +++
 include/dm/uclass-id.h             |   3 +-
 include/efi.h                      | 113 +++++++++++-
 include/efi_api.h                  |  15 ++
 include/init.h                     |   2 +-
 lib/efi/efi.c                      |  97 +++++++++++
 lib/efi/efi_app.c                  | 269 +++++++++++++++++++++++++++--
 lib/efi/efi_stub.c                 |  95 ++++------
 lib/efi_driver/efi_block_device.c  |   8 +-
 lib/efi_driver/efi_uclass.c        |   8 +-
 test/dm/Makefile                   |   1 +
 test/dm/efi_media.c                |  24 +++
 39 files changed, 901 insertions(+), 158 deletions(-)
 create mode 100644 drivers/block/efi-media-uclass.c
 create mode 100644 drivers/block/efi_blk.c
 create mode 100644 drivers/block/sb_efi_media.c
 create mode 100644 test/dm/efi_media.c

-- 
2.34.1.173.g76aa8bc2d0-goog



More information about the U-Boot mailing list