]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/PlatformBootManagerLib: register 's' as UEFI Shell hotkey
authorArd Biesheuvel <ard.biesheuvel@arm.com>
Thu, 28 May 2020 09:17:37 +0000 (11:17 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sat, 6 Jun 2020 07:49:42 +0000 (07:49 +0000)
In preparation of hiding the UEFI Shell boot option as an ordinary
boot option, make sure we can invoke it directly using the 's'
hotkey. Without ConnectAll() having been called, this results in
a shell that may have no block devices or other things connected,
so don't advertise the 's' in the console string that is printed
at boot - for novice users, we will go through the UiApp which
connects everything first. For advanced use, having the ability
to invoke the UEFI shell without any devices connected may be an
advantage, so let's keep this behavior as is for now.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c

index 4aca1382b042d366b63cffc8a09e6946d9ebc6fa..23c925bbdb9c0b4e827a782d6b4f56ef9bb84eb8 100644 (file)
@@ -357,7 +357,8 @@ VOID
 PlatformRegisterFvBootOption (\r
   CONST EFI_GUID                   *FileGuid,\r
   CHAR16                           *Description,\r
-  UINT32                           Attributes\r
+  UINT32                           Attributes,\r
+  EFI_INPUT_KEY                    *Key\r
   )\r
 {\r
   EFI_STATUS                        Status;\r
@@ -409,6 +410,9 @@ PlatformRegisterFvBootOption (
   if (OptionIndex == -1) {\r
     Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);\r
     ASSERT_EFI_ERROR (Status);\r
+    Status = EfiBootManagerAddKeyOptionVariable (NULL,\r
+               (UINT16)NewOption.OptionNumber, 0, Key, NULL);\r
+    ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);\r
   }\r
   EfiBootManagerFreeLoadOption (&NewOption);\r
   EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);\r
@@ -721,6 +725,7 @@ PlatformBootManagerAfterConsole (
   UINTN                         FirmwareVerLength;\r
   UINTN                         PosX;\r
   UINTN                         PosY;\r
+  EFI_INPUT_KEY                 Key;\r
 \r
   FirmwareVerLength = StrLen (PcdGetPtr (PcdFirmwareVersionString));\r
 \r
@@ -770,8 +775,10 @@ PlatformBootManagerAfterConsole (
   //\r
   // Register UEFI Shell\r
   //\r
+  Key.ScanCode     = SCAN_NULL;\r
+  Key.UnicodeChar  = L's';\r
   PlatformRegisterFvBootOption (\r
-    &gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE\r
+    &gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE, &Key\r
     );\r
 }\r
 \r