public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: xianhu2x <xianhuix.liu@intel.com>
To: edk2-devel@lists.01.org
Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Boot Option Fix
Date: Fri,  3 Aug 2018 15:23:57 +0800	[thread overview]
Message-ID: <20180803072357.6980-1-xianhuix.liu@intel.com> (raw)

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



                 reply	other threads:[~2018-08-03  7:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180803072357.6980-1-xianhuix.liu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox