X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Nt32Pkg%2FLibrary%2FPlatformBootManagerLib%2FPlatformBootManager.c;fp=Nt32Pkg%2FLibrary%2FPlatformBootManagerLib%2FPlatformBootManager.c;h=4b23eb1602ef3138be07eaa3850f84a349d54c4c;hp=e2c3a4e5f4bb0a98cd13c400c4d7ee11215a61e8;hb=3d8fab5719a52d67cd4666bd08f63a21fe97c480;hpb=e2e9b3b433210bb05500e948f37f6522a120d302 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. ");