diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c b/MdeModulePkg/Application/UiApp/FrontPage.c index 47044943ff..1914fe8768 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.c +++ b/MdeModulePkg/Application/UiApp/FrontPage.c @@ -527,6 +527,46 @@ SMBIOS_STRUCTURE_POINTER GetSmbiosTableFromType ( return SmbiosTableN; } +STATIC +VOID +WarnNoBootableMedia ( + VOID + ) +{ + CHAR16 *String; + EFI_STRING_ID Token; + EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; + UINTN BootOptionCount; + UINTN Index; + UINTN Count = 0; + + String = AllocateZeroPool (0x60); + BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot); + + for (Index = 0; Index < BootOptionCount; Index++) { + // + // Don't count the hidden/inactive boot option + // + if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) { + continue; + } + + Count++; + } + + EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount); + + if (Count == 0) { + StrCatS (String, 0x60 / sizeof (CHAR16), L"Warning: No bootable media found"); + } else { + StrCatS (String, 0x60 / sizeof (CHAR16), L""); + } + + Token = STRING_TOKEN (STR_NO_BOOTABLE_MEDIA); + HiiSetString (gFrontPagePrivate.HiiHandle, Token, String, NULL); + FreePool(String); +} + /** Update the banner information for the Front Page based on Smbios information. @@ -543,6 +583,8 @@ UpdateFrontPageBannerStrings ( SMBIOS_TABLE_ENTRY_POINT *EntryPoint; SMBIOS_STRUCTURE_POINTER SmbiosTable; + WarnNoBootableMedia (); + Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &Table); if (EFI_ERROR (Status) || Table == NULL) { return; diff --git a/MdeModulePkg/Application/UiApp/FrontPageStrings.uni b/MdeModulePkg/Application/UiApp/FrontPageStrings.uni index dc4a648156..1ca0a21729 100644 --- a/MdeModulePkg/Application/UiApp/FrontPageStrings.uni +++ b/MdeModulePkg/Application/UiApp/FrontPageStrings.uni @@ -17,4 +17,5 @@ #string STR_BOOT_DEFAULT_PROMPT #language en-US "Boot Default" #string STR_BOOT_DEFAULT_HELP #language en-US "Boot the default entry" #string STR_MISSING_STRING #language en-US "Missing String" +#string STR_NO_BOOTABLE_MEDIA #language en-US "" #string STR_EMPTY_STRING #language en-US "" diff --git a/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr b/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr index 592c40996a..dc3fd383fb 100644 --- a/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr +++ b/MdeModulePkg/Application/UiApp/FrontPageVfr.Vfr @@ -34,6 +34,9 @@ formset // label LABEL_END; + subtitle text = STRING_TOKEN(STR_EMPTY_STRING); + subtitle text = STRING_TOKEN(STR_NO_BOOTABLE_MEDIA); + endform; endformset;