Hello,
My understanding is that u-boot has its own limited UEFI provider
implementation unlike some other boot loaders bundling open source UEFI
payloads.
Has anyone tried to use u-boot's UEFI provider implementation on arm64 with
EFI applications systemd-boot and systemd-stub?
Using AI, I mapped all the API calls done by these programs to UEFI service
/ protocol. Most of the text input output functionality and graphics
functionality is irrelevant for my purposes.
ASCII text mapping table below:
systemd-boot
+----------------------------+------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| UEFI service/protocol area | Sub-service or protocol | Method
| Dependency | Purpose
|
+----------------------------+------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| Boot Services | Memory Allocation Services | AllocatePool,
FreePool | CORE | Manage general loader
data. |
| Boot Services | Protocol Handler Services | HandleProtocol
| CORE | Obtain required protocols.
|
| Boot Services | Image Services | LoadImage
| CORE | Load selected EFI image.
|
| Boot Services | Image Services | StartImage
| CORE | Start selected EFI image.
|
| Boot Services | Miscellaneous Boot Services | CopyMem,
SetMem | CORE | Perform basic memory
operations. |
| Console Support Protocols | Simple Text Output Protocol | OutputString,
TestString | CORE | Display text and test
glyphs. |
| Console Support Protocols | Simple Text Output Protocol | QueryMode,
SetMode | CORE | Query/select console
mode. |
| Console Support Protocols | Simple Text Output Protocol | SetAttribute,
ClearScreen | CORE | Format and redraw the
display. |
| Console Support Protocols | Simple Text Output Protocol |
SetCursorPosition | CORE | Position
menu text. |
| Console Support Protocols | Simple Text Output Protocol | EnableCursor,
Reset | CORE | Initialize console
presentation. |
| Media Access Protocols | Simple File System Protocol | OpenVolume
| CORE | Open the ESP filesystem.
|
| Media Access Protocols | File Protocol | Open, Read,
Close | CORE | Read configuration and
EFI files. |
| Media Access Protocols | File Protocol | GetInfo
| CORE | Read file/directory
metadata. |
| Device Path Protocols | Device Path Protocol | Data fields;
no method | CORE | Construct path passed to
LoadImage. |
| Loaded Image Protocols | Loaded Image Protocol | Data fields;
no method | CORE | Obtain device, path and
image data. |
+----------------------------+------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| Boot Services | Memory Allocation Services |
AllocatePages, FreePages | PATH (kernel/initrd/DT) | Manage
aligned page allocations. |
| Boot Services | Protocol Handler Services |
LocateDevicePath | PATH (partition/initrd) | Resolve
path to device handle. |
| Boot Services | Protocol Handler Services |
LocateHandleBuffer | PATH (device discovery) | Enumerate
protocol providers. |
| Boot Services | Protocol Handler Services | OpenProtocol
| PATH (HTTP/network boot) | Open network LoadFile
provider. |
| Boot Services | Protocol Handler Services |
ConnectController | PATH (driver/partition scan) | Connect
drivers to controllers. |
| Boot Services | Image Services | UnloadImage
| PATH (failed image cleanup) | Release an unsuccessfully
run image. |
| Boot Services | Event/Timer/TPL Services | CreateEvent,
CloseEvent | PATH (interactive menu) | Manage menu timeout
event. |
| Boot Services | Event/Timer/TPL Services | SetTimer,
WaitForEvent | PATH (interactive menu) | Wait for timeout or
key input. |
| Boot Services | Event/Timer/TPL Services | CheckEvent
| PATH (interactive menu) | Check whether input is
available. |
| Boot Services | Miscellaneous Boot Services | Stall
| PATH (delay/beep/error) | Delay, beep or pause
before reboot. |
| Boot Services | Miscellaneous Boot Services |
SetWatchdogTimer | PATH (interactive menu) | Manage
watchdog during input waits. |
| Boot Services | Miscellaneous Boot Services | CalculateCrc32
| PATH (GPT discovery) | Validate GPT headers and
entries. |
| Boot Services | Miscellaneous Boot Services |
InstallConfigurationTable | PATH (DT/random-seed handoff) | Publish
data to the next image. |
| Runtime Services | Miscellaneous Runtime | ResetSystem
| PATH (reset/poweroff/setup) | Perform requested system
reset. |
| | Services |
| |
|
| Console Support Protocols | Simple Text Input Protocol | Reset,
ReadKeyStroke | PATH (interactive menu) | Process keyboard
input. |
| Console Support Protocols | Simple Text Input Protocol | WaitForKey
| PATH (interactive menu) | Wait for keyboard input.
|
| Media Access Protocols | File Protocol | SetPosition
| PATH (offset/PE reads) | Seek within a file.
|
| Media Access Protocols | Block I/O Protocol | Media fields;
no method | PATH (GPT/BitLocker) | Inspect media geometry
and ID. |
| Media Access Protocols | Disk I/O Protocol | ReadDisk
| PATH (GPT/BitLocker) | Read raw disk metadata.
|
| Media Access Protocols | Load File Protocol | LoadFile
| PATH (HTTP/network boot) | Load a network boot
entry. |
+----------------------------+------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| Boot Services | Protocol Handler Services | LocateProtocol
| OPTIONAL | Discover optional
interfaces. |
| Boot Services | Miscellaneous Boot Services |
GetNextMonotonicCount | OPTIONAL | Add input
to random-seed evolution. |
| Runtime Services | Variable Services | GetVariable
| OPTIONAL | Read configuration and
state. |
| Runtime Services | Variable Services | SetVariable
| OPTIONAL | Persist selection and
state. |
| Runtime Services | Time Services | GetTime
| OPTIONAL | Add input to random-seed
evolution. |
| Console Support Protocols | Simple Text Input Ex Protocol|
ReadKeyStrokeEx | OPTIONAL | Read richer
key information. |
| Console Support Protocols | Graphics Output Protocol | Blt
| OPTIONAL | Draw graphical splash.
|
| Console Support Protocols | EDID Discovered Protocol | Data fields;
no method | OPTIONAL | Inspect display
identification. |
| Media Access Protocols | File Protocol | Write, Flush,
SetInfo | OPTIONAL | Save seed, secret and
counters. |
| Device Path Protocols | Device Path To Text Protocol |
ConvertDevicePathToText | OPTIONAL | Format
paths for diagnostics. |
| PCI Bus Support Protocols | PCI I/O Protocol | Pci.Read
| OPTIONAL | Detect VirtIO console
hardware. |
| HII Protocols | HII Database Protocol |
GetKeyboardLayout | OPTIONAL | Discover
firmware keyboard layout. |
| RNG Protocols | RNG Protocol | GetRNG
| OPTIONAL | Obtain entropy.
|
| Memory Attribute Protocols | Memory Attribute Protocol |
SetMemoryAttributes | OPTIONAL | Apply
read-only/NX protection. |
| Memory Attribute Protocols | Memory Attribute Protocol |
ClearMemoryAttributes | OPTIONAL | Remove
conflicting attributes. |
| TCG EFI Protocols | TCG2 Protocol | GetCapability
| OPTIONAL | Discover TPM capabilities.
|
| TCG EFI Protocols | TCG2 Protocol |
HashLogExtendEvent | OPTIONAL | Measure
boot data into PCRs. |
| TCG EFI Protocols | CC Measurement Protocol | GetCapability
| OPTIONAL | Discover CC measurement
support. |
| TCG EFI Protocols | CC Measurement Protocol |
MapPcrToMrIndex | OPTIONAL | Map PCRs to
CC registers. |
| TCG EFI Protocols | CC Measurement Protocol |
HashLogExtendEvent | OPTIONAL | Measure
data into CC registers. |
| PI Architectural Protocols | Security Arch Protocol |
FileAuthenticationState hook | OPTIONAL | Support
validation with old shim. |
| PI Architectural Protocols | Security2 Arch Protocol |
FileAuthentication hook | OPTIONAL | Support
validation with old shim. |
| Platform Extensions | Console Control Protocol | GetMode,
SetMode | OPTIONAL | Switch text/graphics
mode. |
| Platform Extensions | Device Tree Fixup Protocol | Fixup
| OPTIONAL | Let firmware adjust a
device tree. |
| Shim Vendor Protocols | Shim Lock Protocol | shim_verify
| OPTIONAL | Verify image with older
shim. |
+----------------------------+------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| Boot Services | Protocol Handler Services |
InstallMultipleProtocol- | PROVIDED | Publish
systemd's initrd protocols. |
| | | Interfaces
| |
|
| Boot Services | Protocol Handler Services |
UninstallMultipleProtocol- | PROVIDED | Remove
systemd's initrd protocols. |
| | | Interfaces
| |
|
| Media Access Protocols | Load File 2 Protocol | LoadFile
| PROVIDED | Serve initrd data to
Linux. |
+----------------------------+------------------------------+-------------------------------+-------------------------------+--------------------------------------+
systemd-stub
+----------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------------+
| UEFI service/protocol area | Sub-service or protocol | Method
| Dependency | Purpose
|
+----------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------------+
| Boot Services | Memory Allocation Services | AllocatePool,
FreePool | CORE | Allocate UKI processing
data. |
| Boot Services | Protocol Handler Services | HandleProtocol
| CORE | Obtain Loaded Image
protocol. |
| Boot Services | Miscellaneous Boot Services | CopyMem,
SetMem | CORE | Copy and initialize
payload data. |
| Loaded Image Protocols | Loaded Image Protocol | Data fields;
no method | CORE | Locate PE sections and
load options. |
+----------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------------+
| Boot Services | Memory Allocation Services |
AllocatePages, FreePages | PATH (direct kernel loader) | Allocate
memory for inner kernel. |
| Boot Services | Image Services | LoadImage
| PATH (shim/firmware loader) | Load inner kernel
through firmware. |
| Boot Services | Image Services | StartImage
| PATH (shim/firmware loader) | Start firmware-loaded
inner kernel. |
| Boot Services | Image Services | UnloadImage
| PATH (shim loader cleanup) | Clean up failed inner
image. |
| Boot Services | Miscellaneous Boot Services |
InstallConfigurationTable | PATH (device-tree handoff) | Install
embedded/addon device tree. |
| Device Path Protocols | Device Path Protocol | Data fields;
no method | PATH (kernel/initrd handoff) | Describe inner
kernel/initrd path. |
+----------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------------+
| Boot Services | Protocol Handler Services | LocateProtocol
| OPTIONAL | Find optional firmware
protocols. |
| Boot Services | Protocol Handler Services |
LocateDevicePath | OPTIONAL | Find a
previously supplied initrd. |
| Boot Services | Miscellaneous Boot Services |
GetNextMonotonicCount | OPTIONAL | Add input
to random-seed update. |
| Runtime Services | Variable Services | GetVariable
| OPTIONAL | Read Secure Boot and
boot state. |
| Runtime Services | Variable Services | SetVariable
| OPTIONAL | Export state and update
seed data. |
| Runtime Services | Time Services | GetTime
| OPTIONAL | Add input to random-seed
update. |
| Console Support Protocols | Simple Text Output Protocol | OutputString,
SetAttribute | OPTIONAL | Display diagnostics.
|
| Console Support Protocols | Graphics Output Protocol | Blt
| OPTIONAL | Draw embedded splash.
|
| Media Access Protocols | Simple File System Protocol | OpenVolume
| OPTIONAL | Open filesystem for
sidecars. |
| Media Access Protocols | File Protocol | Open, Read,
Close | OPTIONAL | Read addons and
sidecars. |
| Media Access Protocols | File Protocol | GetInfo,
SetPosition | OPTIONAL | Inspect and seek
within files. |
| UEFI Shell Protocols | Shell Parameters Protocol | Data fields;
no method | OPTIONAL | Obtain shell-provided
arguments. |
| RNG Protocols | RNG Protocol | GetRNG
| OPTIONAL | Obtain entropy and
refresh seed. |
| Memory Attribute Protocols | Memory Attribute Protocol |
SetMemoryAttributes | OPTIONAL | Mark
loaded sections read-only/NX. |
| Memory Attribute Protocols | Memory Attribute Protocol |
ClearMemoryAttributes | OPTIONAL | Permit
required executable access. |
| TCG EFI Protocols | TCG2 Protocol | GetCapability
| OPTIONAL | Discover TPM capabilities.
|
| TCG EFI Protocols | TCG2 Protocol |
HashLogExtendEvent | OPTIONAL | Measure
UKI data into PCRs. |
| TCG EFI Protocols | CC Measurement Protocol | GetCapability
| OPTIONAL | Discover CC measurement
support. |
| TCG EFI Protocols | CC Measurement Protocol |
MapPcrToMrIndex | OPTIONAL | Map PCRs
to CC registers. |
| TCG EFI Protocols | CC Measurement Protocol |
HashLogExtendEvent | OPTIONAL | Measure
UKI data into CC registers. |
| PI Architectural Protocols | Security Arch Protocol |
FileAuthenticationState hook | OPTIONAL | Support
validation with old shim. |
| PI Architectural Protocols | Security2 Arch Protocol |
FileAuthentication hook | OPTIONAL | Support
validation with old shim. |
| Platform Extensions | Console Control Protocol | GetMode,
SetMode | OPTIONAL | Switch mode for
splash display. |
| Platform Extensions | Device Tree Fixup Protocol | Fixup
| OPTIONAL | Let firmware adjust
embedded DT. |
| Shim Vendor Protocols | Shim Lock Protocol | shim_verify
| OPTIONAL | Verify inner image with
older shim. |
+----------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------------+
| Boot Services | Protocol Handler Services |
InstallMultipleProtocol- | PROVIDED | Publish
assembled initrd protocol. |
| | | Interfaces
| |
|
| Boot Services | Protocol Handler Services |
UninstallMultipleProtocol- | PROVIDED | Remove
assembled-initrd handle. |
| | | Interfaces
| |
|
| Media Access Protocols | Load File 2 Protocol | LoadFile
| PROVIDED | Serve assembled initrd
to Linux. |
+----------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------------+