From: Ruiyu Ni Date: Fri, 23 Oct 2015 07:28:18 +0000 (+0000) Subject: MdeModulePkg: Update UiApp to not display itself X-Git-Tag: edk2-stable201903~8706 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=d4bf294e0ed2a6cdc1e128df512df1d5e56cfc4d MdeModulePkg: Update UiApp to not display itself Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Jiewen Yao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18657 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Application/UiApp/BootMngr/BootManager.c b/MdeModulePkg/Application/UiApp/BootMngr/BootManager.c index 986413c19b..4390deef24 100644 --- a/MdeModulePkg/Application/UiApp/BootMngr/BootManager.c +++ b/MdeModulePkg/Application/UiApp/BootMngr/BootManager.c @@ -219,7 +219,9 @@ EnumerateBootOptions ( VOID ) { + EFI_STATUS Status; UINTN Index; + EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; UINTN BootOptionCount; EFI_STRING_ID Token; @@ -240,6 +242,9 @@ EnumerateBootOptions ( DeviceType = (UINT16) -1; + Status = gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageDevicePathProtocolGuid, (VOID **) &ImageDevicePath); + ASSERT_EFI_ERROR (Status); + // // for better user experience // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option @@ -289,6 +294,13 @@ EnumerateBootOptions ( continue; } + // + // Don't display myself + // + if (CompareMem (BootOption[Index].FilePath, ImageDevicePath, GetDevicePathSize (ImageDevicePath)) == 0) { + continue; + } + // // Group the legacy boot option in the sub title created dynamically // diff --git a/MdeModulePkg/Application/UiApp/Ui.h b/MdeModulePkg/Application/UiApp/Ui.h index 413266d815..8159878007 100644 --- a/MdeModulePkg/Application/UiApp/Ui.h +++ b/MdeModulePkg/Application/UiApp/Ui.h @@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#include #include #include #include diff --git a/MdeModulePkg/Application/UiApp/UiApp.inf b/MdeModulePkg/Application/UiApp/UiApp.inf index 36d292e676..9553c7bab5 100644 --- a/MdeModulePkg/Application/UiApp/UiApp.inf +++ b/MdeModulePkg/Application/UiApp/UiApp.inf @@ -123,6 +123,7 @@ gEfiPciIoProtocolGuid ## CONSUMES gEfiDevicePathToTextProtocolGuid ## CONSUMES gEfiBootLogoProtocolGuid ## CONSUMES + gEfiLoadedImageDevicePathProtocolGuid ## CONSUMES [FeaturePcd]