]> git.ipfire.org Git - thirdparty/grub.git/commit
arm64/efi/linux: Implement LoadFile2 initrd loading protocol for Linux
authorArd Biesheuvel <ardb@kernel.org>
Tue, 18 Oct 2022 19:05:06 +0000 (21:05 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 27 Oct 2022 18:09:05 +0000 (20:09 +0200)
commit75e8d0d98069294c725f4f1fff41f27cb577a040
tree56a9db1220f2808ecaa2b960e7bd19adfb8e45b8
parent7b0809bc3a7611419a5251de70cc522e48ff97b5
arm64/efi/linux: Implement LoadFile2 initrd loading protocol for Linux

Recent Linux kernels will invoke the LoadFile2 protocol installed on
a well-known vendor media path to load the initrd if it is exposed by
the firmware. Using this method is preferred for two reasons:
  - the Linux kernel is in charge of allocating the memory, and so it can
    implement any placement policy it wants (given that these tend to
    change between kernel versions),
  - it is no longer necessary to modify the device tree provided by the
    firmware.

So let's install this protocol when handling the "initrd" command if
such a recent kernel was detected (based on the PE/COFF image version),
and defer loading the initrd contents until the point where the kernel
invokes the LoadFile2 protocol.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/commands/efi/lsefi.c
grub-core/loader/arm64/linux.c
include/grub/efi/api.h