summaryrefslogtreecommitdiffstats
path: root/Nt32Pkg
diff options
context:
space:
mode:
Diffstat (limited to 'Nt32Pkg')
-rw-r--r--Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c34
1 files changed, 34 insertions, 0 deletions
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
@@ -115,6 +115,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.
Such as:
@@ -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. ");