summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg
diff options
context:
space:
mode:
authorZhiguang Liu <zhiguang.liu@intel.com>2019-05-06 09:37:02 +0800
committerHao A Wu <hao.a.wu@intel.com>2019-05-10 10:49:45 +0800
commit0e92957eaa50be08ebbd8f0fd4e989b380704466 (patch)
tree6d353a00bd865a32a2ef6cff98a5a4cf35beb02f /EmulatorPkg
parentad9df9377028c90154608de5efef628454cb6f83 (diff)
downloadedk2-0e92957eaa50be08ebbd8f0fd4e989b380704466.tar.gz
edk2-0e92957eaa50be08ebbd8f0fd4e989b380704466.tar.bz2
edk2-0e92957eaa50be08ebbd8f0fd4e989b380704466.zip
EmulatorPkg: Make the shell be the first boot option
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1649 Make the shell be the first boot option by default, So it can boot into UEFI Internal Shell directly Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
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;
}
}