]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Support the initrd autodetection mechanism in newer Linux kernels 895/head
authorMichael Brown <mcb30@ipxe.org>
Wed, 15 Feb 2023 15:48:31 +0000 (15:48 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 15 Feb 2023 17:36:47 +0000 (17:36 +0000)
commit6a004be0cceab5d669eedb5a2e6ee2feab31d5bd
tree433b4f9bb316d977b23d1e6bc7cec8467435c1d5
parentcf9ad00afcd6d8873fbefbbaf1f0813948a796ba
[efi] Support the initrd autodetection mechanism in newer Linux kernels

Linux 5.7 added the ability to autodetect an initrd by searching for a
handle via a fixed vendor-specific "Linux initrd device path" and then
locating and using the EFI_LOAD_FILE2_PROTOCOL instance on that
handle.

This maps quite naturally onto our existing concept of a "magic
initrd" as introduced for EFI in commit e5f0255 ("[efi] Provide an
"initrd.magic" file for use by UEFI kernels").

Add an EFI_LOAD_FILE2_PROTOCOL instance to our EFI virtual files
(backed by simply calling the existing EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
method to read from the file), and install the protocol instance for
the "initrd.magic" virtual file onto a new device handle that also
provides the Linux initrd device path.

The design choice in Linux of using a single fixed device path makes
this unfortunately messy to support, since device paths must be unique
within a system.  When multiple bootloaders are used (e.g. GRUB
loading iPXE loading Linux) then only one bootloader can ever install
the device path onto a handle.  Subsequent bootloaders must locate the
existing handle and replace the load file protocol instance with their
own.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_file.c