linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] efi: Improve command line initrd loader support
@ 2022-09-27  8:58 Ard Biesheuvel
  2022-09-27  8:58 ` [PATCH 1/4] efi: libstub: Implement devicepath support for initrd commandline loader Ard Biesheuvel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2022-09-27  8:58 UTC (permalink / raw)
  To: linux-efi
  Cc: Ard Biesheuvel, Huacai Chen, Palmer Dabbelt, Jeremy Linton,
	Atish Patra, Lennart Poettering, Ilias Apalodimas

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.

Cc: Huacai Chen <chenhuacai@loongson.cn>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Atish Patra <atishp@atishpatra.org>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>

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(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-27  8:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27  8:58 [PATCH 0/4] efi: Improve command line initrd loader support Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 1/4] efi: libstub: Implement devicepath support for initrd commandline loader Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 2/4] efi: libstub: Permit mixed mode return types other than efi_status_t Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 3/4] efi: libstub: Add mixed mode support to command line initrd loader Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 4/4] efi: libstub: Undeprecate the " Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).