[edk2-devel] [PATCH v3 15/46] Intel/BoardModulePkg: sort load option in the first boot

Nate DeSimone nathaniel.l.desimone at intel.com
Thu Apr 1 19:28:21 UTC 2021


Hi Ling,

This appears to be a duplicate of a patch that has already been applied: 

https://github.com/tianocore/edk2-platforms/commit/abf4c54

Was this message sent in error?

Thanks,
Nate

> -----Original Message-----
> From: Ling Jia <jialing at phytium.com.cn>
> Sent: Friday, March 12, 2021 3:01 AM
> To: devel at edk2.groups.io
> Cc: Leif Lindholm <leif at nuviainc.com>; Peng Xie
> <xiepeng at phytium.com.cn>; Yiqi Shu <shuyiqi at phytium.com.cn>; Liu,
> Zhiguang <zhiguang.liu at intel.com>; Dong, Eric <eric.dong at intel.com>;
> Liming Gao <gaoliming at byosoft.com.cn>; Desimone, Nathaniel L
> <nathaniel.l.desimone at intel.com>; Agyeman, Prince
> <prince.agyeman at intel.com>; Ni, Ray <ray.ni at intel.com>; Gao, Zhichao
> <zhichao.gao at intel.com>
> Subject: [PATCH v3 15/46] Intel/BoardModulePkg: sort load option in the first
> boot
> 
> From: "Liu, Zhiguang" <Zhiguang.Liu at intel.com>
> 
> Currently, load option is only sorted when setup is the first priority in boot
> option. However, Below change in UefiBootManagerLib puts setup in the
> end, which causes the sort function won't be called.
>   MdeModulePkg/UefiBootManagerLib: Put BootMenu at the end of
> BootOrder
>   SHA-1: 7f34681c488aee2563eaa2afcc6a2c8aa7c5b912
> 
> This patch will set a NV variable in the first boot, and sort the boot option in
> first boot.
> 
> Reviewed-by: Eric Dong <eric.dong at intel.com>
> Cc: Liming Gao <gaoliming at byosoft.com.cn>
> Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
> Cc: Prince Agyeman <prince.agyeman at intel.com>
> Reviewed-by: Ray Ni <ray.ni at intel.com>
> Cc: Zhichao Gao <zhichao.gao at intel.com>
> 
> Signed-off-by: Zhiguang Liu <zhiguang.liu at intel.com>
> ---
> 
> Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLi
> b.c | 72 ++++++++++----------
>  1 file changed, 37 insertions(+), 35 deletions(-)
> 
> diff --git
> a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> index d7612fb80a95..a37139a0074e 100644
> ---
> a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> Lib.c
> +++
> b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook
> +++ Lib.c
> @@ -20,6 +20,8 @@
>   #include "BoardBdsHook.h" +#define IS_FIRST_BOOT_VAR_NAME
> L"IsFirstBoot"+ GLOBAL_REMOVE_IF_UNREFERENCED EFI_BOOT_MODE
> gBootMode; BOOLEAN                                        gPPRequireUIConfirm; extern
> UINTN                                   mBootMenuOptionNumber;@@ -992,37 +994,6 @@
> ConnectSequence (
>    EfiBootManagerConnectAll (); } --/**-  The function is to consider the boot
> order which is not in our expectation.-  In the case that we need to re-sort
> the boot option.--  @retval  TRUE         Need to sort Boot Option.-  @retval
> FALSE        Don't need to sort Boot Option.-**/-BOOLEAN-
> IsNeedSortBootOption (-  VOID-  )-{-  EFI_BOOT_MANAGER_LOAD_OPTION
> *BootOptions;-  UINTN                         BootOptionCount;--  BootOptions =
> EfiBootManagerGetLoadOptions (&BootOptionCount,
> LoadOptionTypeBoot);--  //-  // If setup is the first priority in boot option, we
> need to sort boot option.-  //-  if ((BootOptionCount > 1) &&-    (((StrnCmp
> (BootOptions->Description, L"Enter Setup", StrLen (L"Enter Setup"))) == 0)
> ||-    ((StrnCmp (BootOptions->Description, L"BootManagerMenuApp",
> StrLen (L"BootManagerMenuApp"))) == 0))) {-    return TRUE;-  }--  return
> FALSE;-}-- /**   Connects Root Bridge  **/@@ -1332,6 +1303,9 @@
> BdsAfterConsoleReadyBeforeBootOptionCallback (
>    ) {   EFI_BOOT_MODE                 LocalBootMode;+  EFI_STATUS
> Status;+  BOOLEAN                       IsFirstBoot;+  UINTN                         DataSize;
> DEBUG ((DEBUG_INFO, "Event
> gBdsAfterConsoleReadyBeforeBootOptionEvent callback starts\n"));   //@@
> -1376,14 +1350,42 @@ BdsAfterConsoleReadyBeforeBootOptionCallback (
>        //       // PXE boot option may appear after boot option enumeration
> //++      EfiBootManagerRefreshAllBootOption ();+      DataSize = sizeof
> (BOOLEAN);+      Status = gRT->GetVariable (+
> IS_FIRST_BOOT_VAR_NAME,+                      &gEfiCallerIdGuid,+
> NULL,+                      &DataSize,+                      &IsFirstBoot+                      );+      if
> (EFI_ERROR (Status)) {+        //+        // If can't find the variable, see it as the
> first boot+        //+        IsFirstBoot = TRUE;+      }++      if (IsFirstBoot) {+        //+
> // In the first boot, sort the boot option+        //+
> EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot,
> CompareBootOption);+        IsFirstBoot = FALSE;+        Status = gRT-
> >SetVariable (+                        IS_FIRST_BOOT_VAR_NAME,+
> &gEfiCallerIdGuid,+                        EFI_VARIABLE_NON_VOLATILE |
> EFI_VARIABLE_BOOTSERVICE_ACCESS,+                        sizeof (BOOLEAN),+
> &IsFirstBoot+                        );+      }+       break;   }    Print (L"Press F7 for
> BootMenu!\n"); -  EfiBootManagerRefreshAllBootOption (); -  if
> (IsNeedSortBootOption()) {-    EfiBootManagerSortLoadOptionVariable
> (LoadOptionTypeBoot, CompareBootOption);-  } }--
> 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73621): https://edk2.groups.io/g/devel/message/73621
Mute This Topic: https://groups.io/mt/81361267/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