summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Leonardi <leonardi@redhat.com>2025-03-10 12:45:22 +0100
committerLiming Gao <gaoliming@byosoft.com.cn>2025-04-11 10:42:01 +0800
commit6ddfd378e58c2e92cb135791a55aa154c0a348ed (patch)
tree9fe0c19ed17fa01ba2a25001aa7f3c9998222006
parent7c6ef8eac2608e91d20c9df02930ae9b50e3fdd1 (diff)
downloadedk2-6ddfd378e58c2e92cb135791a55aa154c0a348ed.zip
edk2-6ddfd378e58c2e92cb135791a55aa154c0a348ed.tar.gz
edk2-6ddfd378e58c2e92cb135791a55aa154c0a348ed.tar.bz2
MdeModulePkg/BootManagerUiLib: hide UiApp from boot entries
After d433b4c8e4a6 ("OvmfPkg/PlatformBootManagerLib: Register UiApp as an optional boot option") UiApp can be found among the boot options without the LOAD_OPTION_HIDDEN flag set. This means that it can appear in the list of available entries. This can be confusing. Starting from the UiApp guid, add a check on the Device Path on all the available entries, if it matches, skip the entry. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
-rw-r--r--MdeModulePkg/Library/BootManagerUiLib/BootManager.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
index b752679..c2232e5 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
@@ -7,6 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "BootManager.h"
+#include <Protocol/LoadedImage.h>
UINT16 mKeyInput;
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
@@ -493,6 +494,9 @@ UpdateBootManager (
BOOLEAN IsLegacyOption;
BOOLEAN NeedEndOp;
UINTN MaxLen;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
DeviceType = (UINT16)-1;
@@ -537,6 +541,25 @@ UpdateBootManager (
EndLabel->Number = LABEL_BOOT_OPTION_END;
mKeyInput = 0;
NeedEndOp = FALSE;
+
+ //
+ // Get UiApp FilePath
+ //
+ Status = gBS->HandleProtocol (
+ gImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle);
+ ASSERT (DevicePath != NULL);
+
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ LoadedImage->FilePath
+ );
+
for (Index = 0; Index < BootOptionCount; Index++) {
//
// At this stage we are creating a menu entry, thus the Keys are reproduceable
@@ -551,6 +574,13 @@ UpdateBootManager (
}
//
+ // Don't display UiApp within the boot options
+ //
+ if (CompareMem (DevicePath, BootOption[Index].FilePath, GetDevicePathSize (DevicePath)) == 0) {
+ continue;
+ }
+
+ //
// Group the legacy boot option in the sub title created dynamically
//
IsLegacyOption = (BOOLEAN)(