summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg
diff options
context:
space:
mode:
Diffstat (limited to 'EmulatorPkg')
-rw-r--r--EmulatorPkg/Library/PlatformBmLib/PlatformBm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
index 191ce58cfb..03f6157ae8 100644
--- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
+++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
@@ -333,6 +333,35 @@ PlatformBdsRegisterStaticBootOptions (
}
/**
+ 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:
@@ -377,6 +406,7 @@ PlatformBootManagerAfterConsole (
PlatformBdsRegisterStaticBootOptions ();
PlatformBdsConnectSequence ();
EfiBootManagerRefreshAllBootOption ();
+ EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE)CompareBootOption);
break;
}
}