From 3d8fab5719a52d67cd4666bd08f63a21fe97c480 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Mon, 25 Jul 2016 22:00:28 +0800 Subject: Nt32Pkg: Make Shell as the first boot option Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao Reviewed-by: Ruiyu Ni --- .../PlatformBootManagerLib/PlatformBootManager.c | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'Nt32Pkg') diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c index e2c3a4e5f4..4b23eb1602 100644 --- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c +++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c @@ -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. "); -- cgit v1.2.3