Skip to content

EFI payload / application support

Leif Lindholm u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 of 9 patches 0 repliesNew

5 of 9 patches are in this archive. The cover letter announces 9.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
3/9efi_loader: Add PE image loader+0 -02 replies
4/9efi_loader: Add boot time services+0 -06 replies
6/9efi_loader: Add runtime services+0 -04 replies
8/9efi_loader: Add "bootefi" command+0 -00 replies
8/9efi_loader: Add "bootefi" command+0 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/9] EFI payload / application support
Quoted 13 lines · Alexander Graf

This is my Christmas present for my openSUSE friends :).

U-Boot is a great project for embedded devices. However, convincing everyone involved that only for "a few oddball ARM devices" we need to support different configuration formats from grub2 when all other platforms (PPC, System Z, x86) are standardized on a single format is a nightmare.

So we started to explore alternatives. At first, people tried to get grub2 running using the u-boot api interface. However, FWIW that one doesn't support relocations, so you need to know where to link grub2 to at compile time. It also seems to be broken more often than not. And on top of it all, it's a one-off interface, so yet another thing to maintain.

Quoted 6 lines

That led to a nifty idea. What if we can just implement the EFI application protocol on top of U-Boot? Then we could compile a single grub2 binary for uEFI based systems and U-Boot based systems and as soon as that one's loaded, everything looks and feels (almost) the same.

This patch set is the result of pursuing this endeavor.

Thanks, this is a very cool thing.
I meant to reply sooner, but Christmas got in the way.

Quoted 6 lines

- I am successfully able to run grub2 and Linux EFI binaries with this code.
- When enabled, the resulting U-Boot binary only grows by ~10kb, so it's very light weight.
- It works on 32bit ARM and AArch64.
- All storage devices are directly accessible
- No runtime services (all calls return unimplemented)

Yeah, this is a bit of a pain point. The time services, virtual memory services and reset being the key ones.

Quoted 1 line

- No EFI variables

This would obviously (from my point of view) be desirable, but at least initially, we can do most things without persistent variables.

Quoted 3 lines

Of course, there are still a few things one could do on top:

- Implement removable media booting (search for /efi/boot/boota{a64,rm}.efi)

Yeah, that would be top of my wishlist.

Quoted 3 lines

- Improve disk media detection (don't scan, use what information we have)
- Add EFI variable support using NVRAM
- Add GFX support

GFX support was actually never implemented for U-Boot GRUB, so from this p.o.v. it is not a shortcoming over the existing impementation.

Quoted 1 line

- Make EFI Shell work ;)

- Network device support.

I also spotted a couple of minor things while playing around (things like image exit being missing), but these will be easy to flush out.

I'll leave reviewing of the u-boot side of things to people who know the codebase better, and restrict myself to commenting on the UEFIness.

/
Leif

Quoted 52 lines

But so far, I'm very happy with the state of the patches. They completely eliminate potential arguments against U-Boot internally and give users the chance to run with the same level of comfort on all firmware types.

Alex

Alexander Graf (9):
disk/part.c: Expose a list of available block drivers include/efi_api.h: Add more detailed API definitions
efi_loader: Add PE image loader
efi_loader: Add boot time services
efi_loader: Add console interface
efi_loader: Add runtime services
efi_loader: Add disk interfaces
efi_loader: Add "bootefi" command
efi_loader: hook up in build environment

 arch/arm/cpu/armv8/u-boot.lds     |   8 +
 arch/arm/cpu/u-boot.lds           |  13 +
 arch/arm/lib/sections.c           |   2 +
 common/Makefile                   |   1 +
 common/cmd_bootefi.c              | 168 ++++++++
 disk/part.c                       |  25 ++
 include/efi_api.h                 | 197 +++++++--
 include/efi_loader.h              |  87 ++++
 include/part.h                    |   2 +
 include/pe.h                      | 277 +++++++++++++
 lib/Kconfig                       |   1 +
 lib/Makefile                      |   1 +
 lib/efi_loader/Kconfig            |   8 +
 lib/efi_loader/Makefile           |  11 +
 lib/efi_loader/efi_boottime.c     | 838 ++++++++++++++++++++++++++++++++++++++
 lib/efi_loader/efi_console.c      | 371 +++++++++++++++++
 lib/efi_loader/efi_disk.c         | 227 +++++++++++
 lib/efi_loader/efi_image_loader.c | 203 +++++++++
 lib/efi_loader/efi_runtime.c      |  59 +++
 19 files changed, 2462 insertions(+), 37 deletions(-)
 create mode 100644 common/cmd_bootefi.c
 create mode 100644 include/efi_loader.h
 create mode 100644 include/pe.h
 create mode 100644 lib/efi_loader/Kconfig
 create mode 100644 lib/efi_loader/Makefile
 create mode 100644 lib/efi_loader/efi_boottime.c
 create mode 100644 lib/efi_loader/efi_console.c
 create mode 100644 lib/efi_loader/efi_disk.c
 create mode 100644 lib/efi_loader/efi_image_loader.c
 create mode 100644 lib/efi_loader/efi_runtime.c
Signature · 1 line
2.1.4