diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c index 9fc13d4add..660e369ae6 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c @@ -484,6 +484,7 @@ UpdateBootManager ( BOOLEAN IsLegacyOption; BOOLEAN NeedEndOp; UINTN MaxLen; + UINTN OptionCount; DeviceType = (UINT16) -1; @@ -526,6 +527,7 @@ UpdateBootManager ( EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; EndLabel->Number = LABEL_BOOT_OPTION_END; + mKeyInput = 0; NeedEndOp = FALSE; for (Index = 0; Index < BootOptionCount; Index++) { @@ -541,6 +543,8 @@ UpdateBootManager ( continue; } + OptionCount++; + // // Group the legacy boot option in the sub title created dynamically // @@ -596,6 +600,10 @@ UpdateBootManager ( ); } + if (OptionCount == 0) { + HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NO_BOOTABLE_MEDIA), 0, 0, 0); + } + if (NeedEndOp) { HiiCreateEndOpCode (StartOpCodeHandle); } diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManagerStrings.uni b/MdeModulePkg/Library/BootManagerUiLib/BootManagerStrings.uni index f6aad5fb44..c280fd9f87 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManagerStrings.uni +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManagerStrings.uni @@ -21,4 +21,5 @@ #string STR_BM_BANNER #language en-US "One Time Boot" #string STR_BOOT_MANAGER_HELP #language en-US "Boot an entry one time" #string STR_ANY_KEY_CONTINUE #language en-US "Press any key to continue..." +#string STR_NO_BOOTABLE_MEDIA #language en-US "No bootable media found" #string STR_EMPTY_STRING #language en-US ""