[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Boot Option Fix

xianhu2x posted 1 patch 5 years, 7 months ago
Failed in applying to current master (apply log)
.../PlatformBootManagerLib/PlatformBootOption.c    | 51 ++++++++++------------
1 file changed, 22 insertions(+), 29 deletions(-)
[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Boot Option Fix
Posted by xianhu2x 5 years, 7 months ago
Detect if EFI Shell file is present before adding boot option for it.

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: xianhu2x <xianhuix.liu@intel.com>
---
 .../PlatformBootManagerLib/PlatformBootOption.c    | 51 ++++++++++------------
 1 file changed, 22 insertions(+), 29 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PlatformBootManagerLib/PlatformBootOption.c b/Platform/BroxtonPlatformPkg/Common/Library/PlatformBootManagerLib/PlatformBootOption.c
index c77b20f686..0eec6ca081 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/PlatformBootManagerLib/PlatformBootOption.c
+++ b/Platform/BroxtonPlatformPkg/Common/Library/PlatformBootManagerLib/PlatformBootOption.c
@@ -272,35 +272,34 @@ CreateFvBootOption (
 
   EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);
 
-  if (!CompareGuid (&gUefiShellFileGuid, FileGuid)) {
+  Status = gBS->HandleProtocol (
+                  gImageHandle,
+                  &gEfiLoadedImageProtocolGuid,
+                  (VOID **) &LoadedImage
+                  );
+  if (!EFI_ERROR (Status)) {
     Status = gBS->HandleProtocol (
-                    gImageHandle,
-                    &gEfiLoadedImageProtocolGuid,
-                    (VOID **) &LoadedImage
+                    LoadedImage->DeviceHandle,
+                    &gEfiFirmwareVolume2ProtocolGuid,
+                    (VOID **) &Fv
                     );
     if (!EFI_ERROR (Status)) {
-      Status = gBS->HandleProtocol (
-                      LoadedImage->DeviceHandle,
-                      &gEfiFirmwareVolume2ProtocolGuid,
-                      (VOID **) &Fv
+      Buffer  = NULL;
+      Size    = 0;
+      Status  = Fv->ReadSection (
+                      Fv,
+                      FileGuid,
+                      EFI_SECTION_PE32,
+                      0,
+                      &Buffer,
+                      &Size,
+                      &AuthenticationStatus
                       );
-      if (!EFI_ERROR (Status)) {
-        Buffer  = NULL;
-        Size    = 0;
-        Status  = Fv->ReadSection (
-                        Fv,
-                        FileGuid,
-                        EFI_SECTION_PE32,
-                        0,
-                        &Buffer,
-                        &Size,
-                        &AuthenticationStatus
-                        );
-        if (Buffer != NULL) {
-          FreePool (Buffer);
-        }
+      if (Buffer != NULL) {
+        FreePool (Buffer);
       }
     }
+  }
     if (EFI_ERROR (Status)) {
       return EFI_NOT_FOUND;
     }
@@ -309,12 +308,6 @@ CreateFvBootOption (
                    DevicePathFromHandle (LoadedImage->DeviceHandle),
                    (EFI_DEVICE_PATH_PROTOCOL *) &FileNode
                    );
-  } else {
-    DevicePath = AppendDevicePathNode (
-                   BdsCreateShellDevicePath (),
-                   (EFI_DEVICE_PATH_PROTOCOL *) &FileNode
-                   );
-  }
 
   Status = EfiBootManagerInitializeLoadOption (
              BootOption,
-- 
2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel