grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add --noefistub option for linux
@ 2024-05-16 18:43 Vladimir Serbinenko
  2024-06-14 17:08 ` Daniel Kiper
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Serbinenko @ 2024-05-16 18:43 UTC (permalink / raw
  To: grub-devel; +Cc: 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
---
 grub-core/loader/efi/linux.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index bfbd95aee..0bf9d9cbb 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -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");
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add --noefistub option for linux
  2024-05-16 18:43 Vladimir Serbinenko
@ 2024-06-14 17:08 ` Daniel Kiper
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Kiper @ 2024-06-14 17:08 UTC (permalink / raw
  To: Vladimir Serbinenko; +Cc: grub-devel

On Thu, May 16, 2024 at 09:43:46PM +0300, Vladimir Serbinenko wrote:
> 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 | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
> index bfbd95aee..0bf9d9cbb 100644
> --- a/grub-core/loader/efi/linux.c
> +++ b/grub-core/loader/efi/linux.c
> @@ -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_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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Add --noefistub option for linux
@ 2024-06-17 11:51 Vladimir Serbinenko
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Serbinenko @ 2024-06-17 11:51 UTC (permalink / raw
  To: grub-devel; +Cc: 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

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/loader/efi/linux.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index bfbd95aee..279599514 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -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;
+  bool force_legacy = false;
 
   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");
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-17 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 11:51 [PATCH] Add --noefistub option for linux Vladimir Serbinenko
  -- strict thread matches above, loose matches on Subject: below --
2024-05-16 18:43 Vladimir Serbinenko
2024-06-14 17:08 ` Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).