]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmulatorPkg: Make the shell be the first boot option
authorZhiguang Liu <zhiguang.liu@intel.com>
Mon, 6 May 2019 01:37:02 +0000 (09:37 +0800)
committerHao A Wu <hao.a.wu@intel.com>
Fri, 10 May 2019 02:49:45 +0000 (10:49 +0800)
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>
EmulatorPkg/Library/PlatformBmLib/PlatformBm.c

index 191ce58cfbd11fe61cebed6eb4cb4585efb217dd..03f6157ae856ce7921555cdda741cf1089f60980 100644 (file)
@@ -332,6 +332,35 @@ PlatformBdsRegisterStaticBootOptions (
   PrintXY (10, 50, &White, &Black, L"Enter to boot directly.");\r
 }\r
 \r
+/**\r
+  Returns the priority number.\r
+\r
+  @param BootOption\r
+**/\r
+UINTN\r
+BootOptionPriority (\r
+  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption\r
+  )\r
+{\r
+  //\r
+  // Make sure Shell is first\r
+  //\r
+  if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {\r
+    return 0;\r
+  }\r
+  return 100;\r
+}\r
+\r
+INTN\r
+EFIAPI\r
+CompareBootOption (\r
+  CONST EFI_BOOT_MANAGER_LOAD_OPTION  *Left,\r
+  CONST EFI_BOOT_MANAGER_LOAD_OPTION  *Right\r
+  )\r
+{\r
+  return BootOptionPriority (Left) - BootOptionPriority (Right);\r
+}\r
+\r
 /**\r
   Do the platform specific action after the console is connected.\r
 \r
@@ -377,6 +406,7 @@ PlatformBootManagerAfterConsole (
     PlatformBdsRegisterStaticBootOptions ();\r
     PlatformBdsConnectSequence ();\r
     EfiBootManagerRefreshAllBootOption ();\r
+    EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE)CompareBootOption);\r
     break;\r
   }\r
 }\r