public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Boot Option Fix
@ 2018-08-03  7:23 xianhu2x
  0 siblings, 0 replies; only message in thread
From: xianhu2x @ 2018-08-03  7:23 UTC (permalink / raw)
  To: edk2-devel

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-03  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03  7:23 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Boot Option Fix xianhu2x

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox