67f07b7c9e
- Add luks2 to GRUB_MODULES - 20-grub-install: Create a symvers.gz symbolic link - 20-grub-install: Always use fedora as the boot entry --class Resolves: rhbz#1957014 - grub.macros: Install font in /boot/grub2 instead of the ESP Resolves: rhbz#1739762 - grub.macros: Use consistent file mode for legacy and EFI Resolves: rhbz#1965794 - Drop grub2 prelink configuration Resolves: rhbz#1659675 - Remove triggers needed to upgrade from legacy GRUB - Don't harcode grub2 in the spec file - Update to unifont-13.0.06 Resolves: rhbz#1939125 - 20-grub-install: Use relative paths for btrfs in BLS snippets Resolves: rhbz#1906191 - Don't update the cmdline when generating legacy menuentry commands - Suppress gettext error message Resolves: rhbz#1592124 - grub-boot-success.timer: Only run if not in a container Resolves: rhbz#1914571 - grub-set-password: Always use /boot/grub2/user.cfg as password default Resolves: rhbz#1955294 - Remove outdated URL for BLS document Resolves: rhbz#1926453 - templates: Check for EFI at runtime instead of config generation time Resolves: rhbz#1823864 - efi: Print an error if boot to firmware setup is not supported Resolves: rhbz#1823864 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
64 lines
2.4 KiB
Diff
64 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
Date: Tue, 6 Jul 2021 00:38:40 +0200
|
|
Subject: [PATCH] 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.
|
|
|
|
Resolves: rhbz#1823864
|
|
|
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
---
|
|
util/grub.d/30_uefi-firmware.in | 21 ++++++++-------------
|
|
1 file changed, 8 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in
|
|
index d344d3883d7..b6041b55e2a 100644
|
|
--- a/util/grub.d/30_uefi-firmware.in
|
|
+++ b/util/grub.d/30_uefi-firmware.in
|
|
@@ -26,19 +26,14 @@ export TEXTDOMAINDIR="@localedir@"
|
|
|
|
. "$pkgdatadir/grub-mkconfig_lib"
|
|
|
|
-EFI_VARS_DIR=/sys/firmware/efi/efivars
|
|
-EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
|
|
-OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE"
|
|
+LABEL="UEFI Firmware Settings"
|
|
|
|
-if [ -e "$OS_INDICATIONS" ] && \
|
|
- [ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = 1 ]; then
|
|
- LABEL="UEFI Firmware Settings"
|
|
+gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
|
|
|
|
- gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
|
|
-
|
|
- cat << EOF
|
|
-menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
|
|
- fwsetup
|
|
-}
|
|
-EOF
|
|
+cat << EOF
|
|
+if [ "\$grub_platform" = "efi" ]; then
|
|
+ menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
|
|
+ fwsetup
|
|
+ }
|
|
fi
|
|
+EOF
|