]> git.ipfire.org Git - thirdparty/grub.git/commit
templates: Check for EFI at runtime instead of config generation time
authorJavier Martinez Canillas <javierm@redhat.com>
Thu, 18 Aug 2022 17:50:11 +0000 (13:50 -0400)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 19 Aug 2022 22:23:18 +0000 (00:23 +0200)
commit0eb684e8bfb0a9d2d42017a354740be25947babe
tree1b27d1174fd39e91b7d945ea5460334368ec6638
parentdbc641ac923b588ed07a44cf2d7579b110526647
templates: Check for EFI at runtime instead of config generation time

The 30_uefi-firmware template checks if an OsIndicationsSupported UEFI var
exists and EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, to decide whether
a "fwsetup" menu entry would be added or not to the GRUB menu.

But this has the problem that it will only work if the configuration file
was created on an UEFI machine that supports booting to a firmware UI.

This for example doesn't support creating GRUB config files when executing
on systems that support both UEFI and legacy BIOS booting. Since creating
the config file from legacy BIOS wouldn't allow to access the firmware UI.

To prevent this, make the template to unconditionally create the grub.cfg
snippet but check at runtime if was booted through UEFI to decide if this
entry should be added. That way it won't be added when booting with BIOS.

There's no need to check if EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set,
since that's already done by the "fwsetup" command when is executed.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/grub.d/30_uefi-firmware.in