mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 08:34:07 +02:00
MdeModulePkg/BDS: Do not pass unnecessary option to boot option
BDS puts a special GUID in boot option optional data for auto-discovered boot option. But when launching that boot option, the BDS core unconditionally pass the special GUID to the executable. A good written application/OS loader can ignore the unexpected parameters, but BDS core should still avoid passing the unnecessary GUID. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19007 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
81438fe8d0
commit
404bd44294
@ -52,6 +52,28 @@ EfiBootManagerRegisterLegacyBootSupport (
|
|||||||
mBmLegacyBoot = LegacyBoot;
|
mBmLegacyBoot = LegacyBoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return TRUE when the boot option is auto-created instead of manually added.
|
||||||
|
|
||||||
|
@param BootOption Pointer to the boot option to check.
|
||||||
|
|
||||||
|
@retval TRUE The boot option is auto-created.
|
||||||
|
@retval FALSE The boot option is manually added.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
BmIsAutoCreateBootOption (
|
||||||
|
EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if ((BootOption->OptionalDataSize == sizeof (EFI_GUID)) &&
|
||||||
|
CompareGuid ((EFI_GUID *) BootOption->OptionalData, &mBmAutoCreateBootOptionGuid)
|
||||||
|
) {
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For a bootable Device path, return its boot type.
|
For a bootable Device path, return its boot type.
|
||||||
|
|
||||||
@ -1814,8 +1836,10 @@ EfiBootManagerBoot (
|
|||||||
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);
|
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
ImageInfo->LoadOptionsSize = BootOption->OptionalDataSize;
|
if (!BmIsAutoCreateBootOption (BootOption)) {
|
||||||
ImageInfo->LoadOptions = BootOption->OptionalData;
|
ImageInfo->LoadOptionsSize = BootOption->OptionalDataSize;
|
||||||
|
ImageInfo->LoadOptions = BootOption->OptionalData;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clean to NULL because the image is loaded directly from the firmwares boot manager.
|
// Clean to NULL because the image is loaded directly from the firmwares boot manager.
|
||||||
@ -2231,9 +2255,7 @@ EfiBootManagerRefreshAllBootOption (
|
|||||||
for (Index = 0; Index < NvBootOptionCount; Index++) {
|
for (Index = 0; Index < NvBootOptionCount; Index++) {
|
||||||
if (((DevicePathType (NvBootOptions[Index].FilePath) != BBS_DEVICE_PATH) ||
|
if (((DevicePathType (NvBootOptions[Index].FilePath) != BBS_DEVICE_PATH) ||
|
||||||
(DevicePathSubType (NvBootOptions[Index].FilePath) != BBS_BBS_DP)
|
(DevicePathSubType (NvBootOptions[Index].FilePath) != BBS_BBS_DP)
|
||||||
) &&
|
) && BmIsAutoCreateBootOption (&NvBootOptions[Index])
|
||||||
(NvBootOptions[Index].OptionalDataSize == sizeof (EFI_GUID)) &&
|
|
||||||
CompareGuid ((EFI_GUID *) NvBootOptions[Index].OptionalData, &mBmAutoCreateBootOptionGuid)
|
|
||||||
) {
|
) {
|
||||||
//
|
//
|
||||||
// Only check those added by BDS
|
// Only check those added by BDS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user