From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=xianhuix.liu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 447B8210C515D for ; Fri, 3 Aug 2018 00:24:01 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Aug 2018 00:24:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="scan'208";a="78375159" Received: from xianhu2x-mobl.ccr.corp.intel.com ([10.239.196.136]) by orsmga001.jf.intel.com with ESMTP; 03 Aug 2018 00:23:59 -0700 From: xianhu2x To: edk2-devel@lists.01.org Date: Fri, 3 Aug 2018 15:23:57 +0800 Message-Id: <20180803072357.6980-1-xianhuix.liu@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Boot Option Fix X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 07:24:01 -0000 Detect if EFI Shell file is present before adding boot option for it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: xianhu2x --- .../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