Nt32Pkg: Make Shell as the first boot option

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Liming Gao 2016-07-25 22:00:28 +08:00
parent e2e9b3b433
commit 3d8fab5719
1 changed files with 34 additions and 0 deletions

View File

@ -114,6 +114,35 @@ PlatformBootManagerBeforeConsole (
}
}
/**
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.
@ -156,6 +185,11 @@ PlatformBootManagerAfterConsole (
EfiBootManagerGetBootManagerMenu (&BootOption);
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL);
//
// Make Shell as the first boot option
//
EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE) CompareBootOption);
PlatformBootManagerDiagnostics (QUICK, TRUE);
PrintXY (10, 10, &White, &Black, L"F2 to enter Boot Manager Menu. ");