MdeModulePkg/UiApp: Add warning if no bootable options found
This commit is contained in:
@ -527,6 +527,46 @@ SMBIOS_STRUCTURE_POINTER GetSmbiosTableFromType (
|
|||||||
return SmbiosTableN;
|
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.
|
Update the banner information for the Front Page based on Smbios information.
|
||||||
@ -543,6 +583,8 @@ UpdateFrontPageBannerStrings (
|
|||||||
SMBIOS_TABLE_ENTRY_POINT *EntryPoint;
|
SMBIOS_TABLE_ENTRY_POINT *EntryPoint;
|
||||||
SMBIOS_STRUCTURE_POINTER SmbiosTable;
|
SMBIOS_STRUCTURE_POINTER SmbiosTable;
|
||||||
|
|
||||||
|
WarnNoBootableMedia ();
|
||||||
|
|
||||||
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &Table);
|
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &Table);
|
||||||
if (EFI_ERROR (Status) || Table == NULL) {
|
if (EFI_ERROR (Status) || Table == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -17,4 +17,5 @@
|
|||||||
#string STR_BOOT_DEFAULT_PROMPT #language en-US "Boot Default"
|
#string STR_BOOT_DEFAULT_PROMPT #language en-US "Boot Default"
|
||||||
#string STR_BOOT_DEFAULT_HELP #language en-US "Boot the default entry"
|
#string STR_BOOT_DEFAULT_HELP #language en-US "Boot the default entry"
|
||||||
#string STR_MISSING_STRING #language en-US "Missing String"
|
#string STR_MISSING_STRING #language en-US "Missing String"
|
||||||
|
#string STR_NO_BOOTABLE_MEDIA #language en-US ""
|
||||||
#string STR_EMPTY_STRING #language en-US ""
|
#string STR_EMPTY_STRING #language en-US ""
|
||||||
|
@ -34,6 +34,9 @@ formset
|
|||||||
//
|
//
|
||||||
label LABEL_END;
|
label LABEL_END;
|
||||||
|
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
subtitle text = STRING_TOKEN(STR_NO_BOOTABLE_MEDIA);
|
||||||
|
|
||||||
endform;
|
endform;
|
||||||
|
|
||||||
endformset;
|
endformset;
|
||||||
|
Reference in New Issue
Block a user