Skip to contentSkip to conversation

Add --noefistub option for linux

PATCH In review Vladimir Serbinenko 2 participants 2 messages May 16, 2024 – Jun 14, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add --noefistub option for linux

In some cases like loading kernel from native disk (e.g. nvme) not supported by EFI in question efi stub is not an option. Allow user to disable efi stub and fallback to older protocol

---
 grub-core/loader/efi/linux.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
grub-core/loader/efi/linux.c +9 -1
index bfbd95aee..0bf9d9cbb 100644
@@ -459,10 +459,18 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   grub_file_t file = 0;
   struct linux_arch_kernel_header lh;
   grub_err_t err;
+  int force_legacy = 0;
 
   grub_dl_ref (my_mod);
 
-  if (grub_is_shim_lock_enabled () == true)
+  if (argc > 0 && grub_strcmp(argv[0], "--noefistub") == 0)
+    {
+      force_legacy = 1;
+      argv++;
+      argc--;
+    }
+
+  if (grub_is_shim_lock_enabled () == true || force_legacy)
     {
 #if defined(__i386__) || defined(__x86_64__)
       grub_dprintf ("linux", "shim_lock enabled, falling back to legacy Linux kernel loader\n");
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw
Quoted 3 lines · Vladimir Serbinenko

In some cases like loading kernel from native disk (e.g. nvme) not supported by EFI in question efi stub is not an option. Allow user to disable efi stub and fallback to older protocol

I think this patch should be considered together with NVMe patch.

Missing SOB.

grub-core/loader/efi/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 462

Quoted 13 lines
---
 grub-core/loader/efi/linux.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
grub-core/loader/efi/linux.c +1 -0
index bfbd95aee..0bf9d9cbb 100644
@@ -459,10 +459,18 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   grub_file_t file = 0;
   struct linux_arch_kernel_header lh;
   grub_err_t err;
+  int force_legacy = 0;

I would use bool here.

grub-core/loader/efi/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 473

Quoted 11 lines
grub-core/loader/efi/linux.c +8 -1
   grub_dl_ref (my_mod);
 
-  if (grub_is_shim_lock_enabled () == true)
+  if (argc > 0 && grub_strcmp(argv[0], "--noefistub") == 0)
+    {
+      force_legacy = 1;
+      argv++;
+      argc--;
+    }
+
+  if (grub_is_shim_lock_enabled () == true || force_legacy)

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel