ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)
It checkes whether AndroidFastbootApp exists in boot menu.
If it exists, add hotkey 'F' to AndroidFastbootApp.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 61ab61c..54c297c 100644
--- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -389,6 +389,31 @@ PlatformRegisterFvBootOption (
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
}
+STATIC
+UINTN
+PlatformFindBootOptionByDescription (
+ IN CHAR16 *Description
+ )
+{
+ UINTN BootOptionCount;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN Index;
+ UINTN OptionIndex;
+
+ OptionIndex = LoadOptionNumberUnassigned;
+ BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
+
+ for (Index = 0; Index < BootOptionCount; Index++) {
+ if (StrnCmp (Description, BootOptions[Index].Description, StrLen (BootOptions[Index].Description)) == 0) {
+ OptionIndex = BootOptions[Index].OptionNumber;
+ break;
+ }
+ }
+
+ EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
+ return OptionIndex;
+}
+
STATIC
VOID
@@ -400,7 +425,9 @@ PlatformRegisterOptionsAndKeys (
EFI_INPUT_KEY Enter;
EFI_INPUT_KEY F2;
EFI_INPUT_KEY Esc;
+ EFI_INPUT_KEY KeyF;
EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
+ UINTN OptionNumber;
//
// Register ENTER as CONTINUE key
@@ -427,6 +454,19 @@ PlatformRegisterOptionsAndKeys (
NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
);
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
+
+ //
+ // Map F to "Android Fastboot App"
+ //
+ KeyF.ScanCode = SCAN_NULL;
+ KeyF.UnicodeChar = 'f';
+ OptionNumber = PlatformFindBootOptionByDescription (L"Android Fastboot");
+ if (OptionNumber != LoadOptionNumberUnassigned) {
+ Status = EfiBootManagerAddKeyOptionVariable (
+ NULL, (UINT16) OptionNumber, 0, &KeyF, NULL
+ );
+ ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
+ }
}
--
2.7.4
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.