[edk2-devel] [PATCH 1/2] EmulatorPkg: Make the shell be the first boot option

Ni, Ray ray.ni at intel.com
Sun May 5 03:23:32 UTC 2019


Please run ecc to make sure your coding style is proper.

> -----Original Message-----
> From: Liu, Zhiguang <zhiguang.liu at intel.com>
> Sent: Monday, April 29, 2019 1:25 PM
> To: devel at edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen at intel.com>; Andrew Fish
> <afish at apple.com>; Ni, Ray <ray.ni at intel.com>
> Subject: [PATCH 1/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,
> when run the emulator if user don't change boot order.
> 
> Signed-off-by: Zhiguang Liu <zhiguang.liu at intel.com>
> 
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Andrew Fish <afish at apple.com>
> Cc: Ray Ni <ray.ni at intel.com>
> ---
>  EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 31
> ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> index 2a97e385be..459ac5c4b5 100644
> --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> @@ -388,6 +388,34 @@ PlatformBootManagerChangeDevicePath (
>      }
>    }
>  }
> +/**
> +  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.
> @@ -432,9 +460,10 @@ PlatformBootManagerAfterConsole (
>    default:
>      PlatformBdsDiagnostics (IGNORE, TRUE);
>      PlatformBootManagerChangeDevicePath(&FirstBoot);
> -    PlatformBdsRegisterStaticBootOptions ();
>      PlatformBdsConnectSequence ();
>      EfiBootManagerRefreshAllBootOption ();
> +    PlatformBdsRegisterStaticBootOptions ();
> +    if(FirstBoot)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 (#39987): https://edk2.groups.io/g/devel/message/39987
Mute This Topic: https://groups.io/mt/31380242/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list