From dea47ed9cd258e7aafd3f06d5929bd590fe7ae28 Mon Sep 17 00:00:00 2001 From: Doug Flick Date: Tue, 4 Feb 2025 13:36:30 -0800 Subject: [PATCH] Updating UefiBootManager to handle Fv Files and Files that are not valid --- .../Library/UefiBootManagerLib/BmBoot.c | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index efb34ff54e..79d09c81a5 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1919,6 +1919,20 @@ EfiBootManagerBoot ( return; } + // MU_CHANGE [BEGIN] + // + // 0. Determine if the file path exists. (I.E we can't load it if it doesnt) + // + FilePath = BootOption->FilePath; + Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &FilePath, &ImageHandle); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: LocateDevicePath Failed (%r)\n", __func__, Status)); + BootOption->Status = Status; + return; + } + + // MU_CHANGE [END] + // // 1. Create Boot#### for a temporary boot if there is no match Boot#### (i.e. a boot by selected a EFI Shell using "Boot From File") // @@ -1962,7 +1976,16 @@ EfiBootManagerBoot ( if (BmIsBootManagerMenuFilePath (BootOption->FilePath)) { DEBUG ((DEBUG_INFO, "[Bds] Booting Boot Manager Menu.\n")); BmStopHotkeyService (NULL, NULL); - } else { + } + // MU_CHANGE [BEGIN] + else if (BmIsFvFilePath (BootOption->FilePath)) { + // + // Do nothing. This file originates from a measured FV and is an extension of the BDS environment + // We should not signal ready to boot. + // We will still need to load / start it. + } + // MU_CHANGE [END] + else { PERF_EVENT_SIGNAL_BEGIN (&gEfiEventPreReadyToBootGuid); // MU_CHANGE EfiEventGroupSignal (&gEfiEventPreReadyToBootGuid); // MU_CHANGE PERF_EVENT_SIGNAL_END (&gEfiEventPreReadyToBootGuid); // MU_CHANGE @@ -2044,6 +2067,10 @@ EfiBootManagerBoot ( ); } + // MU_CHANGE [BEGIN] + DEBUG ((DEBUG_ERROR, "%a: LoadImage returned %r\n", __func__, Status)); + // MU CHANGE [END] + if (FileBuffer != NULL) { FreePool (FileBuffer); }