diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index d4781ab469..7d63da76d4 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1781,6 +1781,7 @@ EfiBootManagerBoot ( EFI_EVENT LegacyBootEvent; EFI_INPUT_KEY Key; UINTN Index; + UINT8 *SecureBoot; if (BootOption == NULL) { return; @@ -1920,6 +1921,21 @@ EfiBootManagerBoot ( if (gST->ConOut != NULL) { gST->ConOut->ClearScreen (gST->ConOut); + // + // When UEFI Secure Boot is enabled, unsigned modules won't load. + // + SecureBoot = NULL; + GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, (VOID**)&SecureBoot, NULL); + if ((SecureBoot != NULL) && (*SecureBoot == SECURE_BOOT_MODE_ENABLE)) { + AsciiPrint ("SecureBoot is enabled.\n"); + } else { + AsciiPrint ("SecureBoot is disabled.\n"); + } + + if (SecureBoot != NULL) { + FreePool (SecureBoot); + } + AsciiPrint ( "Booting from '%s' failed; verify it contains a 64-bit UEFI OS.\n" "\nPress any key to continue booting...\n", diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h index ac866ac25f..b1b9c629aa 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h @@ -44,6 +44,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include +#include #include #include #include