From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01b.sbp.mail.zen.net.uk (smarthost01b.sbp.mail.zen.net.uk [212.23.1.3]) by mx.groups.io with SMTP id smtpd.web12.60828.1643786195132424089 for ; Tue, 01 Feb 2022 23:16:35 -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.3, mailfrom: sean@starlabs.systems) Received: from [51.148.147.4] (helo=sean-StarBook.lan) by smarthost01b.sbp.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nF9sT-0001RL-Nj; Wed, 02 Feb 2022 07:16:29 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: guo.dong@intel.com, Sean Rhodes Subject: [PATCH] UefiPayloadPkg: Make Boot Manager Key configurable Date: Wed, 2 Feb 2022 07:16:16 +0000 Message-Id: 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. Signed-off-by: Sean Rhodes --- .../PlatformBootManager.c | 44 +++++++++++++------ .../PlatformBootManagerLib.inf | 1 + UefiPayloadPkg/UefiPayloadPkg.dec | 3 ++ UefiPayloadPkg/UefiPayloadPkg.dsc | 4 ++ 4 files changed, 39 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 551f0a4915..f2fcdf6a74 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -83,6 +83,9 @@ gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSi= ze|0x04000000|UINT32|0x =0D gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0= xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 }|VOI= D*|0x00000018=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 1ce96a51c1..5e1892458e 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -33,6 +33,8 @@ DEFINE UNIVERSAL_PAYLOAD =3D FALSE=0D DEFINE SECURITY_STUB_ENABLE =3D TRUE=0D DEFINE SMM_SUPPORT =3D FALSE=0D + DEFINE BOOT_MANAGER_ESCAPE =3D FALSE=0D + DEFINE PLATFORM_BOOT_TIMEOUT =3D 3=0D #=0D # SBL: UEFI payload for Slim Bootloader=0D # COREBOOT: UEFI payload for coreboot=0D @@ -399,6 +401,8 @@ gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask | 0x1=0D !endif=0D =0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE= )=0D +=0D [PcdsPatchableInModule.X64]=0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)= =0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER= )=0D --=20 2.32.0