mirror of https://github.com/acidanthera/audk.git
OvmfPkg: Add a runtime switch for PlatformRegisterFvBootOption
Add a new parameter to selectively enable or disable the BootOption. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
This commit is contained in:
parent
b8f3199595
commit
07bb226542
|
@ -86,7 +86,8 @@ VOID
|
||||||
PlatformRegisterFvBootOption (
|
PlatformRegisterFvBootOption (
|
||||||
EFI_GUID *FileGuid,
|
EFI_GUID *FileGuid,
|
||||||
CHAR16 *Description,
|
CHAR16 *Description,
|
||||||
UINT32 Attributes
|
UINT32 Attributes,
|
||||||
|
BOOLEAN Enabled
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
@ -138,9 +139,15 @@ PlatformRegisterFvBootOption (
|
||||||
BootOptionCount
|
BootOptionCount
|
||||||
);
|
);
|
||||||
|
|
||||||
if (OptionIndex == -1) {
|
if ((OptionIndex == -1) && Enabled) {
|
||||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
} else if ((OptionIndex != -1) && !Enabled) {
|
||||||
|
Status = EfiBootManagerDeleteLoadOptionVariable (
|
||||||
|
BootOptions[OptionIndex].OptionNumber,
|
||||||
|
LoadOptionTypeBoot
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
EfiBootManagerFreeLoadOption (&NewOption);
|
EfiBootManagerFreeLoadOption (&NewOption);
|
||||||
|
@ -1842,7 +1849,8 @@ PlatformBootManagerAfterConsole (
|
||||||
PlatformRegisterFvBootOption (
|
PlatformRegisterFvBootOption (
|
||||||
&gUefiShellFileGuid,
|
&gUefiShellFileGuid,
|
||||||
L"EFI Internal Shell",
|
L"EFI Internal Shell",
|
||||||
LOAD_OPTION_ACTIVE
|
LOAD_OPTION_ACTIVE,
|
||||||
|
TRUE
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1851,7 +1859,8 @@ PlatformBootManagerAfterConsole (
|
||||||
PlatformRegisterFvBootOption (
|
PlatformRegisterFvBootOption (
|
||||||
&gGrubFileGuid,
|
&gGrubFileGuid,
|
||||||
L"Grub Bootloader",
|
L"Grub Bootloader",
|
||||||
LOAD_OPTION_ACTIVE
|
LOAD_OPTION_ACTIVE,
|
||||||
|
TRUE
|
||||||
);
|
);
|
||||||
|
|
||||||
RemoveStaleFvFileOptions ();
|
RemoveStaleFvFileOptions ();
|
||||||
|
|
Loading…
Reference in New Issue