From 1c1fa6ce67448ef8bab16d795623be730ff658ea Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Tue, 5 May 2026 23:36:04 +0200 Subject: [PATCH] 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] https://gitlab.freedesktop.org/gnu-grub/grub/-/commit/f5bb766e688b1180e0ace3417d4947a934957a31 [5] https://github.com/tianocore/edk2/blob/edk2-stable202602/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c#L273 Signed-off-by: Julien Olivain Signed-off-by: Thomas Petazzoni --- board/pc/linux.config | 1 + 1 file changed, 1 insertion(+) diff --git a/board/pc/linux.config b/board/pc/linux.config index 43b15c94be..cbc4f5a6b0 100644 --- a/board/pc/linux.config +++ b/board/pc/linux.config @@ -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