EmulatorPkg: Make the shell be the first boot option

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1649

Make the shell be the first boot option by default,
So it can boot into UEFI Internal Shell directly

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Zhiguang Liu 2019-05-06 09:37:02 +08:00 committed by Hao A Wu
parent ad9df93770
commit 0e92957eaa
1 changed files with 30 additions and 0 deletions

View File

@ -332,6 +332,35 @@ PlatformBdsRegisterStaticBootOptions (
PrintXY (10, 50, &White, &Black, L"Enter to boot directly.");
}
/**
Returns the priority number.
@param BootOption
**/
UINTN
BootOptionPriority (
CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
)
{
//
// Make sure Shell is first
//
if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
return 0;
}
return 100;
}
INTN
EFIAPI
CompareBootOption (
CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left,
CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right
)
{
return BootOptionPriority (Left) - BootOptionPriority (Right);
}
/**
Do the platform specific action after the console is connected.
@ -377,6 +406,7 @@ PlatformBootManagerAfterConsole (
PlatformBdsRegisterStaticBootOptions ();
PlatformBdsConnectSequence ();
EfiBootManagerRefreshAllBootOption ();
EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE)CompareBootOption);
break;
}
}