Re: [PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries

2024-01-17 Thread Pascal Hambourg

On 17/01/2024 at 17:48, Vladimir 'phcoder' Serbinenko wrote:

Le mer. 17 janv. 2024, 18:10, Pascal Hambourg  a
écrit :

On 17/01/2024 at 04:15, Vladimir 'phcoder' Serbinenko wrote:

+if [ "\$grub_platform" != "efi" ]; then


This is not the right check. Only "pc" platform supports chainloadin
boot sector. All other: coreboot, qemu, emu, ieee1275, xen and
non-x86. The only one which might is xen_pvh but this needs to be
checked


From 
:


"This is exactly what PVH is. It’s a fully PV kernel mode, running with 
paravirtualized disk and network, paravirtualized interrupts and timers, 
no emulated devices of any kind (and thus no qemu), no BIOS or legacy boot"


If I understand correctly, "no BIOS or legacy boot" implies no boot 
sector chainloading.



I expect os-prober to report boot type "chain" only on platforms which
support chainloading. Isn't it enough ?


Os-prober has no idea how system is booted. And one of my systems can boot
as any of coreboot, multiboot, EFI, PC or xen. Then I can run qemu version
using whole disk. This together means that the same disk can boot in any
way.


Fine, then assume that os-prober boot type "chain" actually means "BIOS 
boot sector" and show menu entries only if grub_target = pc ?


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


Re: [PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries

2024-01-17 Thread Vladimir 'phcoder' Serbinenko
Le mer. 17 janv. 2024, 18:10, Pascal Hambourg  a
écrit :

> On 17/01/2024 at 04:15, Vladimir 'phcoder' Serbinenko wrote:
> >>onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
> >>  cat << EOF
> >> +if [ "\$grub_platform" != "efi" ]; then
> >
> > This is not the right check. Only "pc" platform supports chainloadin
> > boot sector. All other: coreboot, qemu, emu, ieee1275, xen and
> > non-x86. The only one which might is xen_pvh but this needs to be
> > checked
>
> I expect os-prober to report boot type "chain" only on platforms which
> support chainloading. Isn't it enough ?

Os-prober has no idea how system is booted. And one of my systems can boot
as any of coreboot, multiboot, EFI, PC or xen. Then I can run qemu version
using whole disk. This together means that the same disk can boot in any
way.

> The goal is to hide "chain" menu
> entries when booting in EFI mode, no more.
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries

2024-01-17 Thread Pascal Hambourg

On 17/01/2024 at 04:15, Vladimir 'phcoder' Serbinenko wrote:

   onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
 cat << EOF
+if [ "\$grub_platform" != "efi" ]; then


This is not the right check. Only "pc" platform supports chainloadin
boot sector. All other: coreboot, qemu, emu, ieee1275, xen and
non-x86. The only one which might is xen_pvh but this needs to be
checked


I expect os-prober to report boot type "chain" only on platforms which 
support chainloading. Isn't it enough ? The goal is to hide "chain" menu 
entries when booting in EFI mode, no more.


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


Re: [PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries

2024-01-16 Thread Vladimir 'phcoder' Serbinenko
>   onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
> cat << EOF
> +if [ "\$grub_platform" != "efi" ]; then

This is not the right check. Only "pc" platform supports chainloadin
boot sector. All other: coreboot, qemu, emu, ieee1275, xen and
non-x86. The only one which might is xen_pvh but this needs to be
checked

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


[PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries

2024-01-06 Thread Pascal Hambourg

On systems which support both BIOS/legacy and EFI boot, it makes no
sense to show menu entries for EFI bootloaders when booted in
BIOS/legacy mode and show menu entries for BIOS/legacy boot loaders
when booted in EFI mode.

Show 'chain' menu entries only if not booted in EFI mode.
Show 'efi' menu entries only if booted in EFI mode.

This will allow os-prober to report both EFI and BIOS legacy boot
loaders regardless of the current boot mode on systems which support
both EFI and BIOS/legacy boot.

Note:
I did not change indentation to keep the patch minimal.

Signed-off-by: Pascal Hambourg 
---
 util/grub.d/30_os-prober.in | 4 
 1 file changed, 4 insertions(+)

diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 8e5cbb50e..a16f7549b 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -155,6 +155,7 @@ for OS in ${OSPROBED} ; do

  onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
   cat << EOF
+if [ "\$grub_platform" != "efi" ]; then
 menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os 
\$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
 EOF
   save_default_entry | grub_add_tab
@@ -179,6 +180,7 @@ EOF
   cat