[edk2-devel] [PATCH] [edk2-staging] [PATCH] BaseTools/Bfm: Fix "-g" input FV is not BFV issue

Yang Jie posted 1 patch 1 year, 11 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/BfmLib/BinFileManager.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[edk2-devel] [PATCH] [edk2-staging] [PATCH] BaseTools/Bfm: Fix "-g" input FV is not BFV issue
Posted by Yang Jie 1 year, 11 months ago
FCE tool provides "-g" parameter to indicate which FV to insert
binaries. Current code logic has some defects when this FV is
not the last BFV, this patch is to fix this issue and enhance
this tool.

Signed-off-by: jie.yang <jie.yang@intel.com>

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/Source/C/BfmLib/BinFileManager.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/BfmLib/BinFileManager.c b/BaseTools/Source/C/BfmLib/BinFileManager.c
index 69521044b8..42953bfce5 100644
--- a/BaseTools/Source/C/BfmLib/BinFileManager.c
+++ b/BaseTools/Source/C/BfmLib/BinFileManager.c
@@ -2,7 +2,7 @@
 
  The main entry of BFM tool.
 
- Copyright (c) 2011-2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2011-2022, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -310,7 +310,10 @@ BfmImageAdd (
   do {
     if ((FvGuidExisted && mFvGuidIsSet && FvInFd->IsInputFvFlag) || ((!FvGuidExisted || (!mFvGuidIsSet)) && FvInFd->IsBfvFlag)) {
 
-      if (FvInFd->IsBfvFlag) {
+      if (FvInFd->IsBfvFlag && !FvGuidExisted) {
+        //
+        // No target FV is set, find the last BFV to insert Binary
+        //
         FvInFdTmp = FdData->Fv;
         while (FvInFdTmp != NULL) {
           if (FvInFdTmp->IsBfvFlag) {
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89902): https://edk2.groups.io/g/devel/message/89902
Mute This Topic: https://groups.io/mt/91204554/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] [edk2-staging] [PATCH] BaseTools/Bfm: Fix "-g" input FV is not BFV issue
Posted by Bob Feng 1 year, 11 months ago
Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Yang, Jie <jie.yang@intel.com> 
Sent: Thursday, May 19, 2022 4:22 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Yang, Jie <jie.yang@intel.com>
Subject: [PATCH] [edk2-staging] [PATCH] BaseTools/Bfm: Fix "-g" input FV is not BFV issue

FCE tool provides "-g" parameter to indicate which FV to insert binaries. Current code logic has some defects when this FV is not the last BFV, this patch is to fix this issue and enhance this tool.

Signed-off-by: jie.yang <jie.yang@intel.com>

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/Source/C/BfmLib/BinFileManager.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/BfmLib/BinFileManager.c b/BaseTools/Source/C/BfmLib/BinFileManager.c
index 69521044b8..42953bfce5 100644
--- a/BaseTools/Source/C/BfmLib/BinFileManager.c
+++ b/BaseTools/Source/C/BfmLib/BinFileManager.c
@@ -2,7 +2,7 @@
   The main entry of BFM tool. - Copyright (c) 2011-2019, Intel Corporation. All rights reserved.<BR>+ Copyright (c) 2011-2022, Intel Corporation. All rights reserved.<BR>  SPDX-License-Identifier: BSD-2-Clause-Patent  **/@@ -310,7 +310,10 @@ BfmImageAdd (
   do {     if ((FvGuidExisted && mFvGuidIsSet && FvInFd->IsInputFvFlag) || ((!FvGuidExisted || (!mFvGuidIsSet)) && FvInFd->IsBfvFlag)) { -      if (FvInFd->IsBfvFlag) {+      if (FvInFd->IsBfvFlag && !FvGuidExisted) {+        //+        // No target FV is set, find the last BFV to insert Binary+        //         FvInFdTmp = FdData->Fv;         while (FvInFdTmp != NULL) {           if (FvInFdTmp->IsBfvFlag) {-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90028): https://edk2.groups.io/g/devel/message/90028
Mute This Topic: https://groups.io/mt/91204554/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-