From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01b.ixn.mail.zen.net.uk (smarthost01b.ixn.mail.zen.net.uk [212.23.1.21]) by mx.groups.io with SMTP id smtpd.web11.4109.1646475280659933587 for ; Sat, 05 Mar 2022 02:14:41 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.21, mailfrom: sean@starlabs.systems) Received: from [51.148.147.4] (helo=sean-StarBook.lan) by smarthost01b.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nQRQq-0003x1-7a; Sat, 05 Mar 2022 10:14:36 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: Sean Rhodes , Guo Dong , Ray Ni , Maurice Ma , Benjamin You Subject: [PATCH] UefiPayloadPkg: Make Boot Manager Key configurable Date: Sat, 5 Mar 2022 10:14:34 +0000 Message-Id: <761adf234fa5ca4fd3e6b3abc608927df1372251.1646475274.git.sean@starlabs.systems> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Originating-smarthost01b-IP: [51.148.147.4] Feedback-ID: 51.148.147.4 Content-Transfer-Encoding: quoted-printable Provide a build option to use [Esc] instead of [F2] for devices such as Chromebooks that don't have F-keys. Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Signed-off-by: Sean Rhodes --- .../PlatformBootManager.c | 44 +++++++++++++------ .../PlatformBootManagerLib.inf | 1 + UefiPayloadPkg/UefiPayloadPkg.dec | 3 ++ UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= ger.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c index a8ead775ea..0eb577313a 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c @@ -164,7 +164,7 @@ PlatformBootManagerBeforeConsole ( )=0D {=0D EFI_INPUT_KEY Enter;=0D - EFI_INPUT_KEY F2;=0D + EFI_INPUT_KEY CustomKey;=0D EFI_INPUT_KEY Down;=0D EFI_BOOT_MANAGER_LOAD_OPTION BootOption;=0D EFI_STATUS Status;=0D @@ -186,13 +186,22 @@ PlatformBootManagerBeforeConsole ( Enter.UnicodeChar =3D CHAR_CARRIAGE_RETURN;=0D EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);=0D =0D - //=0D - // Map F2 to Boot Manager Menu=0D - //=0D - F2.ScanCode =3D SCAN_F2;=0D - F2.UnicodeChar =3D CHAR_NULL;=0D + if (FixedPcdGetBool (PcdBootManagerEscape)) {=0D + //=0D + // Map Esc to Boot Manager Menu=0D + //=0D + CustomKey.ScanCode =3D SCAN_ESC;=0D + CustomKey.UnicodeChar =3D CHAR_NULL;=0D + } else {=0D + //=0D + // Map Esc to Boot Manager Menu=0D + //=0D + CustomKey.ScanCode =3D SCAN_F2;=0D + CustomKey.UnicodeChar =3D CHAR_NULL;=0D + }=0D +=0D EfiBootManagerGetBootManagerMenu (&BootOption);=0D - EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe= r, 0, &F2, NULL);=0D + EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe= r, 0, &CustomKey, NULL);=0D =0D //=0D // Also add Down key to Boot Manager Menu since some serial terminals do= n't support F2 key.=0D @@ -251,12 +260,21 @@ PlatformBootManagerAfterConsole ( //=0D PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", L= OAD_OPTION_ACTIVE);=0D =0D - Print (=0D - L"\n"=0D - L"F2 or Down to enter Boot Manager Menu.\n"=0D - L"ENTER to boot directly.\n"=0D - L"\n"=0D - );=0D + if (FixedPcdGetBool (PcdBootManagerEscape)) {=0D + Print (=0D + L"\n"=0D + L"Esc or Down to enter Boot Manager Menu.\n"=0D + L"ENTER to boot directly.\n"=0D + L"\n"=0D + );=0D + } else {=0D + Print (=0D + L"\n"=0D + L"F2 or Down to enter Boot Manager Menu.\n"=0D + L"ENTER to boot directly.\n"=0D + L"\n"=0D + );=0D + }=0D }=0D =0D /**=0D diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf index 9c4a9da943..80390e0d98 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf @@ -73,3 +73,4 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity=0D gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits=0D gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape=0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayload= Pkg.dec index e9204d1168..4051172caf 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -86,6 +86,9 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x= 72, 0xcf, 0x80, 0xab, 0 # Above 4G Memory=0D gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|TRUE|BOOLEAN|= 0x00000019=0D =0D +# Boot Manager Key=0D +gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE|BOOLEAN|0x0000002= 0=0D +=0D ## FFS filename to find the default variable initial data file.=0D # @Prompt FFS Name of variable initial data file=0D gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0= x42, 0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 }|VOI= D*|0x00000025=0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 4fe81a61d6..558513baf1 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -34,6 +34,7 @@ DEFINE SECURITY_STUB_ENABLE =3D TRUE=0D DEFINE SMM_SUPPORT =3D FALSE=0D DEFINE ABOVE_4G_MEMORY =3D TRUE=0D + DEFINE BOOT_MANAGER_ESCAPE =3D FALSE=0D #=0D # SBL: UEFI payload for Slim Bootloader=0D # COREBOOT: UEFI payload for coreboot=0D @@ -401,6 +402,7 @@ !endif=0D =0D gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_= MEMORY)=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE= )=0D =0D [PcdsPatchableInModule.X64]=0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)= =0D --=20 2.32.0