REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1649
Make the shell be the first boot option by default,
So it can boot into UEFI Internal Shell directly
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
---
EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
index 191ce58cfb..03f6157ae8 100644
--- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
+++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
@@ -332,6 +332,35 @@ PlatformBdsRegisterStaticBootOptions (
PrintXY (10, 50, &White, &Black, L"Enter to boot directly.");
}
+/**
+ Returns the priority number.
+
+ @param BootOption
+**/
+UINTN
+BootOptionPriority (
+ CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
+ )
+{
+ //
+ // Make sure Shell is first
+ //
+ if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
+ return 0;
+ }
+ return 100;
+}
+
+INTN
+EFIAPI
+CompareBootOption (
+ CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left,
+ CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right
+ )
+{
+ return BootOptionPriority (Left) - BootOptionPriority (Right);
+}
+
/**
Do the platform specific action after the console is connected.
@@ -377,6 +406,7 @@ PlatformBootManagerAfterConsole (
PlatformBdsRegisterStaticBootOptions ();
PlatformBdsConnectSequence ();
EfiBootManagerRefreshAllBootOption ();
+ EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE)CompareBootOption);
break;
}
}
--
2.21.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#40014): https://edk2.groups.io/g/devel/message/40014
Mute This Topic: https://groups.io/mt/31515769/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: Liu, Zhiguang
> Sent: Monday, May 6, 2019 10:06 AM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Andrew Fish
> <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [Patch V2 2/2] EmulatorPkg: Make the shell be the first boot option
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1649
>
> Make the shell be the first boot option by default, So it can boot into UEFI
> Internal Shell directly
>
> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> ---
> EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 30
> ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> index 191ce58cfb..03f6157ae8 100644
> --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> @@ -332,6 +332,35 @@ PlatformBdsRegisterStaticBootOptions (
> PrintXY (10, 50, &White, &Black, L"Enter to boot directly."); }
>
> +/**
> + Returns the priority number.
> +
> + @param BootOption
> +**/
> +UINTN
> +BootOptionPriority (
> + CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
> + )
> +{
> + //
> + // Make sure Shell is first
> + //
> + if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
> + return 0;
> + }
> + return 100;
> +}
> +
> +INTN
> +EFIAPI
> +CompareBootOption (
> + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left,
> + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right
> + )
> +{
> + return BootOptionPriority (Left) - BootOptionPriority (Right); }
> +
> /**
> Do the platform specific action after the console is connected.
>
> @@ -377,6 +406,7 @@ PlatformBootManagerAfterConsole (
> PlatformBdsRegisterStaticBootOptions ();
> PlatformBdsConnectSequence ();
> EfiBootManagerRefreshAllBootOption ();
> + EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot,
> + (SORT_COMPARE)CompareBootOption);
> break;
> }
> }
> --
> 2.21.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#40025): https://edk2.groups.io/g/devel/message/40025
Mute This Topic: https://groups.io/mt/31515769/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.