efi: Improve command line initrd loader support
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | efi: libstub: Implement devicepath support for initrd commandline loaderdrivers/ drivers/ include/ | +87 | 0 replies | |
| 2/4 | efi: libstub: Permit mixed mode return types other than efi_status_tarch/ arch/ drivers/ | +26 | 0 replies | |
| 3/4 | efi: libstub: Add mixed mode support to command line initrd loaderarch/ drivers/ drivers/ +1 more | +84 | 0 replies | |
| 4/4 | efi: libstub: Undeprecate the command line initrd loaderdrivers/ | +8 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] efi: Improve command line initrd loader support
Given that the command line initrd loader can only load files from the same simple FS volume from which the kernel itself was loaded, it was not flexible enough for use in loaders such as GRUB that don't even implement the FS volume abstraction, and load images as anonymous buffers in memory. As x86 mixed mode was based on a GRUB specific EFI handover protocol, and the simple FS protocol method prototypes were not mixed mode safe, the initrd command line loader did not work for mixed mode at all.
For this reason, we support arch specific methods (bootparam, DT) as well, and have added support for a generic method based on the LoadFile2 protocol, which is much easier to implement and use.
However, there are cases where the command line loader is useful, especially when using fully generic loaders such as the UEFI shell. Here, it is generally not possible to use Linux specific structs or data structures, or implement the Linux specific LoadFile2 protocol implementation for initrd loading.
So let's fix the issues with the initrd command line loader:
- add the ability to use fully qualified device paths as the initrd= argument, so that the initrd image can reside on any simple FS volume, even if the kernel itself was not loaded from one;
- fix the mixed mode issues, by using the mixed mode wrappers for the protocol invocations, and defining some recipes for the prototypes that cannot be marshalled 1:1
The above means that mixed mode loaders that boot via the compat entry point (e.g., systemd-boot) can use the initrd= command line option as before to pass the initrd, if desired.
With those fixes in place, let's remove the deprecation notice, and permit the feature to be enabled on LoongArch and RISC-V as well.
Note that LoadFile2 is still preferred, and will continue to take precedence. It is also the only generic method that cannot be compiled out.
Ard Biesheuvel (4):
efi: libstub: Implement devicepath support for initrd commandline
loader
efi: libstub: Permit mixed mode return types other than efi_status_t
efi: libstub: Add mixed mode support to command line initrd loader
efi: libstub: Undeprecate the command line initrd loader
arch/x86/boot/compressed/efi_thunk_64.S | 6 -- arch/x86/include/asm/efi.h | 49 +++++---- drivers/firmware/efi/Kconfig | 13 ++- drivers/firmware/efi/libstub/efi-stub-helper.c | 2 +- drivers/firmware/efi/libstub/efistub.h | 112 ++++++++++++++------ drivers/firmware/efi/libstub/file.c | 105 +++++++++++++----- include/linux/efi.h | 6 ++ 7 files changed, 202 insertions(+), 91 deletions(-)
Signature · 1 line
2.35.1