]> git.ipfire.org Git - thirdparty/grub.git/commit
efi: Use generic EFI loader for x86_64 and i386
authorArd Biesheuvel <ardb@kernel.org>
Tue, 23 May 2023 15:31:45 +0000 (17:31 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 25 May 2023 14:48:00 +0000 (16:48 +0200)
commitcfbfae1aef0694b416aa199291cfef7596cdfc20
tree48491b823febb676049abbc88fde3d0290d8cc3c
parentdf16fe97b22873018ed2b7f9001940e4fca625f3
efi: Use generic EFI loader for x86_64 and i386

Switch the x86 based EFI platform builds to the generic EFI loader,
which exposes the initrd via the LoadFile2 protocol instead of the
x86-specific setup header. This will launch the Linux kernel via its EFI
stub, which performs its own initialization in the EFI boot services
context before calling ExitBootServices() and performing the bare metal
Linux boot.

Given that only Linux kernel versions v5.8 and later support this initrd
loading method, the existing x86 loader is retained as a fallback, which
will also be used for Linux kernels built without the EFI stub. In this
case, GRUB calls ExitBootServices() before entering the Linux kernel,
and all EFI related information is provided to the kernel via struct
boot_params in the setup header, as before.

Note that this means that booting EFI stub kernels older than v5.8 is
not supported even when not using an initrd at all. Also, the EFI
handover protocol, which has no basis in the UEFI specification, is not
implemented.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/Makefile.core.def
grub-core/loader/efi/linux.c
grub-core/loader/i386/linux.c
include/grub/efi/efi.h