Skip to content

Improve logic to check for fwsetup support

Javier Martinez Canillas grub-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2templates: Check for EFI at runtime instead of config generation timeutil/grub.d/30_uefi-firmware.in+8 -131 reply
2/2efi: Print an error if boot to firmware setup is not supportedgrub-core/commands/efi/efifwsetup.c+23 -202 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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(-)
Signature · 1 line
2.31.1