}\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
EfiBootManagerGetBootManagerMenu (&BootOption);\r
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL);\r
\r
+ //\r
+ // Make Shell as the first boot option\r
+ //\r
+ EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE) CompareBootOption);\r
+\r
PlatformBootManagerDiagnostics (QUICK, TRUE);\r
\r
PrintXY (10, 10, &White, &Black, L"F2 to enter Boot Manager Menu. ");\r