board/pc/linux.config: enable CONFIG_EFI_STUB

When the Linux Kernel image does not include the EFI stub [1],
Grub2 EFI linux loader fallback to the legacy i386 loading.
See [2] [3]. Grub 2.14 enabled the NX compatible for the EFI
image in [4].

When booting a Linux Kernel without the EFI stub with Grub 2.14 with
NX flag, the boot fails before starting the kernel with a EDK2 page
fault error [5]:

!!!! X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID - 00000000 !!!!
ExceptionData - 0000000000000003  I:0 R:0 U:0 W:1 P:1 PK:0 SS:0 SGX:0

This commit adds CONFIG_EFI_STUB to board/pc/linux.config to make sure
grub will load the Kernel using its efi loading code.

This commit is needed with EDK2 with NX protection enabled and
Grub 2.14 also enabling NX.

[1] https://docs.kernel.org/admin-guide/efi-stub.html
[2] https://gitlab.freedesktop.org/gnu-grub/grub/-/blob/grub-2.14/grub-core/loader/efi/linux.c#L532
[3] https://gitlab.freedesktop.org/gnu-grub/grub/-/blob/grub-2.14/grub-core/loader/i386/linux.c#L675
[4] f5bb766e68
[5] https://github.com/tianocore/edk2/blob/edk2-stable202602/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c#L273

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Julien Olivain
2026-05-05 23:36:04 +02:00
committed by Thomas Petazzoni
parent 1681beaba3
commit 1c1fa6ce67

View File

@@ -5,6 +5,7 @@ CONFIG_SMP=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y