grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/2] Improve logic to check for fwsetup support


From: Javier Martinez Canillas
Subject: [PATCH 0/2] Improve logic to check for fwsetup support
Date: Tue, 6 Jul 2021 11:02:13 +0200

The fwsetup command can be used for rebooting to the firmware setup UI but
this can only be used on machines that have support for this feature.

Curently, this is achieved by checking in the 30_uefi-firmware template if
OsIndicationsSupported is present and has EFI_OS_INDICATIONS_BOOT_TO_FW_UI
set. This is again checked in the efifwsetup module init function and the
fwsetup command is only registered if that condition is meet.

But this logic has a comple of problems, since it assumes that the config
file is always generated in the same machine than the one that's booted.

If that's not the case, any of the following situations could happen:

* A config file generated on a non-EFI machine, will not have the fwsetup
  menu entry even when booting with EFI.
* A config file generated on an EFI machine, will have a fwsetup even when
  is not booted with EFI.
* A config file generated on an EFI machine that supports rebooting to the
  firmware setup, will have the fwsetup even if booting on an EFI machine
  that does not support that feature.

To prevent these, let's change when the check is done. Instead of doing it
at config generation time, do it at runtime with grub_platform == "efi" and
when the command is executed. That way, the 30_uefi-firmware template won't
make any assumption about the firmware support of the machine that's booted.

Best regards,
Javier


Javier Martinez Canillas (2):
  templates: Check for EFI at runtime instead of config generation time
  efi: Print an error if boot to firmware setup is not supported

 grub-core/commands/efi/efifwsetup.c | 43 +++++++++++++++--------------
 util/grub.d/30_uefi-firmware.in     | 21 ++++++--------
 2 files changed, 31 insertions(+), 33 deletions(-)

-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]