All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
@ 2020-03-23 11:53 Tianjia Zhang
  2020-03-23 17:22 ` Paul Menzel
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tianjia Zhang @ 2020-03-23 11:53 UTC (permalink / raw)
  To: grub-devel

When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
commands instead of 'linux' and 'initrd'.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 util/grub.d/10_linux.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index e8b01c0d0..8c5c3dab7 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -138,10 +138,17 @@ linux_entry ()
     fi
     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
   fi
+  if [ "@GRUB_PLATFORM@" != "efi" ] ; then
+    linux_cmd="linux"
+    initrd_cmd="initrd"
+  else
+    linux_cmd="linuxefi"
+    initrd_cmd="initrdefi"
+  fi
   message="$(gettext_printf "Loading Linux %s ..." ${version})"
   sed "s/^/$submenu_indentation/" << EOF
 	echo	'$(echo "$message" | grub_quote)'
-	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+	${linux_cmd}	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
 EOF
   if test -n "${initrd}" ; then
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
@@ -152,7 +159,7 @@ EOF
     done
     sed "s/^/$submenu_indentation/" << EOF
 	echo	'$(echo "$message" | grub_quote)'
-	initrd	$(echo $initrd_path)
+	${initrd_cmd}	$(echo $initrd_path)
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF
-- 
2.17.1



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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-23 11:53 [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi Tianjia Zhang
@ 2020-03-23 17:22 ` Paul Menzel
  2020-03-23 18:26 ` Javier Martinez Canillas
  2020-03-25 17:38 ` Daniel Kiper
  2 siblings, 0 replies; 9+ messages in thread
From: Paul Menzel @ 2020-03-23 17:22 UTC (permalink / raw)
  To: Tianjia Zhang; +Cc: The development of GNU GRUB

Dear Tianjia,


Am 23.03.20 um 12:53 schrieb Tianjia Zhang:
> When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
> commands instead of 'linux' and 'initrd'.
> 
> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>   util/grub.d/10_linux.in | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
> index e8b01c0d0..8c5c3dab7 100644
> --- a/util/grub.d/10_linux.in
> +++ b/util/grub.d/10_linux.in
> @@ -138,10 +138,17 @@ linux_entry ()
>       fi
>       printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
>     fi
> +  if [ "@GRUB_PLATFORM@" != "efi" ] ; then
> +    linux_cmd="linux"
> +    initrd_cmd="initrd"
> +  else
> +    linux_cmd="linuxefi"
> +    initrd_cmd="initrdefi"
> +  fi
>     message="$(gettext_printf "Loading Linux %s ..." ${version})"
>     sed "s/^/$submenu_indentation/" << EOF
>   	echo	'$(echo "$message" | grub_quote)'
> -	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
> +	${linux_cmd}	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
>   EOF
>     if test -n "${initrd}" ; then
>       # TRANSLATORS: ramdisk isn't identifier. Should be translated.
> @@ -152,7 +159,7 @@ EOF
>       done
>       sed "s/^/$submenu_indentation/" << EOF
>   	echo	'$(echo "$message" | grub_quote)'
> -	initrd	$(echo $initrd_path)
> +	${initrd_cmd}	$(echo $initrd_path)
>   EOF
>     fi
>     sed "s/^/$submenu_indentation/" << EOF

What problem does your change address?


Kind regards,

Paul


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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-23 11:53 [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi Tianjia Zhang
  2020-03-23 17:22 ` Paul Menzel
@ 2020-03-23 18:26 ` Javier Martinez Canillas
  2020-03-23 18:31   ` Julian Andres Klode
  2020-03-25 17:38 ` Daniel Kiper
  2 siblings, 1 reply; 9+ messages in thread
From: Javier Martinez Canillas @ 2020-03-23 18:26 UTC (permalink / raw)
  To: The development of GNU GRUB, Tianjia Zhang

On 3/23/20 12:53 PM, Tianjia Zhang wrote:
> When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
> commands instead of 'linux' and 'initrd'.
>

These two commands are added by most distros as a part of their Secure Boot
patch-set, but aren't present in upstream GRUB so this patch doesn't apply.
 
Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat



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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-23 18:26 ` Javier Martinez Canillas
@ 2020-03-23 18:31   ` Julian Andres Klode
  2020-03-23 18:50     ` Javier Martinez Canillas
  0 siblings, 1 reply; 9+ messages in thread
From: Julian Andres Klode @ 2020-03-23 18:31 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Tianjia Zhang

On Mon, Mar 23, 2020 at 07:26:59PM +0100, Javier Martinez Canillas wrote:
> On 3/23/20 12:53 PM, Tianjia Zhang wrote:
> > When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
> > commands instead of 'linux' and 'initrd'.
> >
> 
> These two commands are added by most distros as a part of their Secure Boot
> patch-set, but aren't present in upstream GRUB so this patch doesn't apply.

I was about to say that at least in Ubuntu, linux automatically loads
via EFI and then falls back to native grub kernel loading if that
does not work (and it's not on secure boot). Which IMO is the right
thing to do.

Also the other point is that this actually breaks stuff if you install
both MBR and EFI bootloaders. Which is something you actually should
be doing because you still want to be able to boot even if user switches
their BIOS from UEFI to BIOS or vice versa or other shenanigans.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-23 18:31   ` Julian Andres Klode
@ 2020-03-23 18:50     ` Javier Martinez Canillas
  0 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2020-03-23 18:50 UTC (permalink / raw)
  To: The development of GNU GRUB, Julian Andres Klode; +Cc: Tianjia Zhang

On 3/23/20 7:31 PM, Julian Andres Klode wrote:
> On Mon, Mar 23, 2020 at 07:26:59PM +0100, Javier Martinez Canillas wrote:
>> On 3/23/20 12:53 PM, Tianjia Zhang wrote:
>>> When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
>>> commands instead of 'linux' and 'initrd'.
>>>
>>
>> These two commands are added by most distros as a part of their Secure Boot
>> patch-set, but aren't present in upstream GRUB so this patch doesn't apply.
> 
> I was about to say that at least in Ubuntu, linux automatically loads
> via EFI and then falls back to native grub kernel loading if that
> does not work (and it's not on secure boot). Which IMO is the right
> thing to do.
> 

In Fedora also always 'linux' and 'initrd' is used nowadays. There's no need to
have separate linux16, linuxefi and linux commands although these are supported
for backward compatibility.

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat



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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-23 11:53 [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi Tianjia Zhang
  2020-03-23 17:22 ` Paul Menzel
  2020-03-23 18:26 ` Javier Martinez Canillas
@ 2020-03-25 17:38 ` Daniel Kiper
  2020-03-26  2:22   ` Tianjia Zhang
  2020-03-27 14:44   ` Konrad Rzeszutek Wilk
  2 siblings, 2 replies; 9+ messages in thread
From: Daniel Kiper @ 2020-03-25 17:38 UTC (permalink / raw)
  To: Tianjia Zhang; +Cc: grub-devel

On Mon, Mar 23, 2020 at 07:53:15PM +0800, Tianjia Zhang wrote:
> When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
> commands instead of 'linux' and 'initrd'.
>
> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>

Sorry, NAK! We do not want more "linuxefi" kinda commands in the GRUB upstream.

Daniel


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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-25 17:38 ` Daniel Kiper
@ 2020-03-26  2:22   ` Tianjia Zhang
  2020-03-27 14:44   ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 9+ messages in thread
From: Tianjia Zhang @ 2020-03-26  2:22 UTC (permalink / raw)
  To: The development of GNU GRUB, Daniel Kiper

I got it, Thanks for review.

Tianjia

On 2020/3/26 1:38, Daniel Kiper wrote:
> On Mon, Mar 23, 2020 at 07:53:15PM +0800, Tianjia Zhang wrote:
>> When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
>> commands instead of 'linux' and 'initrd'.
>>
>> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> 
> Sorry, NAK! We do not want more "linuxefi" kinda commands in the GRUB upstream.
> 
> Daniel
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 


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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-25 17:38 ` Daniel Kiper
  2020-03-26  2:22   ` Tianjia Zhang
@ 2020-03-27 14:44   ` Konrad Rzeszutek Wilk
  2020-03-27 15:58     ` Daniel Kiper
  1 sibling, 1 reply; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2020-03-27 14:44 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Tianjia Zhang

On Wed, Mar 25, 2020 at 06:38:54PM +0100, Daniel Kiper wrote:
> On Mon, Mar 23, 2020 at 07:53:15PM +0800, Tianjia Zhang wrote:
> > When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
> > commands instead of 'linux' and 'initrd'.
> >
> > Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> 
> Sorry, NAK! We do not want more "linuxefi" kinda commands in the GRUB upstream.

Are you saying that the existing 'linux' and 'initrd' should be fixed
to work under EFI?

Thanks.


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

* Re: [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi
  2020-03-27 14:44   ` Konrad Rzeszutek Wilk
@ 2020-03-27 15:58     ` Daniel Kiper
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Kiper @ 2020-03-27 15:58 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: The development of GNU GRUB, Tianjia Zhang

On Fri, Mar 27, 2020 at 10:44:09AM -0400, Konrad Rzeszutek Wilk wrote:
> On Wed, Mar 25, 2020 at 06:38:54PM +0100, Daniel Kiper wrote:
> > On Mon, Mar 23, 2020 at 07:53:15PM +0800, Tianjia Zhang wrote:
> > > When the platform is EFI platform, use 'linuxefi' and 'initrdefi'
> > > commands instead of 'linux' and 'initrd'.
> > >
> > > Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> > > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> >
> > Sorry, NAK! We do not want more "linuxefi" kinda commands in the GRUB upstream.
>
> Are you saying that the existing 'linux' and 'initrd' should be fixed
> to work under EFI?

Exactly, this is the plan for after 2.06 release.

Daniel


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

end of thread, other threads:[~2020-03-27 15:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 11:53 [PATCH] grub.d: Use linuxefi and initrdefi commands if platform is efi Tianjia Zhang
2020-03-23 17:22 ` Paul Menzel
2020-03-23 18:26 ` Javier Martinez Canillas
2020-03-23 18:31   ` Julian Andres Klode
2020-03-23 18:50     ` Javier Martinez Canillas
2020-03-25 17:38 ` Daniel Kiper
2020-03-26  2:22   ` Tianjia Zhang
2020-03-27 14:44   ` Konrad Rzeszutek Wilk
2020-03-27 15:58     ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.