Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OvmfPkg: Introduce UEFI config support for fw_cfg v2 #10668

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

luigix25
Copy link
Contributor

Description

This PR is linked to #6494. This is to disable the UEFI config using fw_cfg from QEMU cli.

The approach is to change the default BootManagerMenu from UiApp to BootManagerMenuApp.
UiApp, if enabled, is added as a boot entry.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Run QEMU on X86-64 with and without the fw_cfg flag set.
For reference qemu -fw_cfg name=opt/org.tianocore/FirmwareSetupSupport=no

Integration Instructions

N/A

@luigix25 luigix25 force-pushed the disable_uiapp_v2 branch 5 times, most recently from 1ffe864 to 4f21032 Compare January 30, 2025 12:17
@luigix25 luigix25 marked this pull request as ready for review February 3, 2025 09:27
@ardbiesheuvel
Copy link
Member

It is not clear at all from the patches why any of this is needed. And commits with no text at all are really not done.

So please add some text to every commit why it is needed. And don't worry about duplication, each commit should make sense by itself, so if there is some underlying goal that gets documented numerous times, that is perfectly fine.

kraxel and others added 7 commits February 3, 2025 13:28
Add BootManagerMenuApp to all OvmfPkg dependencies.

To make UiApp optional, switch from UiApp to BootManagerMenuApp
as default BootManagerMenu.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Luigi Leonardi <[email protected]>
This is part of the effort to enable/disable firmware configuration (UiApp)
from the QEMU CLI.

Because the UiApp can be disabled at runtime and it's currently the default
BootManagerMenu, change the default from UiApp to BootManagerMenuApp.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Luigi Leonardi <[email protected]>
Setting the LOAD_OPTION_CATEGORY_APP flag for EFI Shell prevents the boot
loader from using it as a fallback if all other entries fail to boot.

With a boot manager menu available, it can be annoying to enter the EFI Shell
directly, because from the menu, the user can try to boot again (e.g.
temporary network problem) or enter the shell/firmware config only if
necessary.

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Luigi Leonardi <[email protected]>
…tion

Introduce gUiAppFileGuid: it has the same value of UiApp guid defined in
the .inf file. This is used to register UiApp as a boot entry in the
BootManagerMenu.

This registration is done in PlatformBootManagerBeforeConsole because
it must be done before the hotkeys are registered. This is because
in a system with hotkeys still bound to UiApp, but with firmware disabled,
you can still boot into the latter by hitting ESC or F2 during boot.

UiApp can be enabled/disabled using fw_cfg option FirmwareSetupSupport

Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Luigi Leonardi <[email protected]>
gUiAppFileGuid, which is used to register EFI Firmware Config as a boot option,
has the same value as UiApp guid.

This would trigger a duplicate guid error from the CI pipeline, but because these
two guids are necessary, this commit adds a duplicate exception.

Signed-off-by: Luigi Leonardi <[email protected]>
OvmfFindLoadOption behaves like EfiBootManagerFindLoadOption, it searches for
an entry in the array: an entry is found if the two paths are equal.

This removes possible duplicates in the boot entries: two entries with
the same path and different attributes are not detected as equal by
EfiBootManagerFindLoadOption.
In this case, the old entry is deleted and replaced by the new one.

Signed-off-by: Luigi Leonardi <[email protected]>
…etup

Document FirwareSetup fw_cfg option for QEMU CLI: it allows to enable/disable
UiApp at runtime.

Signed-off-by: Luigi Leonardi <[email protected]>
@luigix25
Copy link
Contributor Author

luigix25 commented Feb 3, 2025

@ardbiesheuvel Commits messages are now more verbose, please let me know if you want me to change anything!

I rebased on lastest master, code is unchanged.

Copy link
Contributor

@tlendacky tlendacky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not completely familiar with this path/function of the code, but all looks very reasonable.

Copy link
Contributor

@mxu9 mxu9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants