summaryrefslogtreecommitdiffstats
path: root/Nt32Pkg
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2016-07-25 22:00:28 +0800
committerLiming Gao <liming.gao@intel.com>2016-08-01 12:58:43 +0800
commit3d8fab5719a52d67cd4666bd08f63a21fe97c480 (patch)
treee21ea85918570d7b2c85db8d6d4c1cb7647a5c13 /Nt32Pkg
parente2e9b3b433210bb05500e948f37f6522a120d302 (diff)
downloadedk2-3d8fab5719a52d67cd4666bd08f63a21fe97c480.tar.gz
edk2-3d8fab5719a52d67cd4666bd08f63a21fe97c480.tar.bz2
edk2-3d8fab5719a52d67cd4666bd08f63a21fe97c480.zip
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>
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. ");