[edk2-devel] [edk2-staging/FceFmmt][PATCH] BaseTools/FCE: Fix multiple FVs with SEC module issue

Feng, YunhuaX posted 1 patch 3 days ago
Failed in applying to current master (apply log)
BaseTools/Source/C/BfmLib/BinFileManager.c | 11 +++++++++++
1 file changed, 11 insertions(+)

[edk2-devel] [edk2-staging/FceFmmt][PATCH] BaseTools/FCE: Fix multiple FVs with SEC module issue

Posted by Feng, YunhuaX 3 days ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2527

One BIOS image may have more than FVs with SEC module.
FCE tool should find the latest FV with SEC module as BFV image.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Yunhua  Feng<yunhuax.feng@intel.com>
---
 BaseTools/Source/C/BfmLib/BinFileManager.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/BaseTools/Source/C/BfmLib/BinFileManager.c b/BaseTools/Source/C/BfmLib/BinFileManager.c
index 9b4e0929f5..69521044b8 100644
--- a/BaseTools/Source/C/BfmLib/BinFileManager.c
+++ b/BaseTools/Source/C/BfmLib/BinFileManager.c
@@ -251,10 +251,11 @@ BfmImageAdd (
   BOOLEAN                     FfsLevelFoundFlag;
   CHAR8                       *OutputFileName;
   CHAR8                       *FvId;
   BOOLEAN                     FirstInFlag;
   BOOLEAN                     FvGuidExisted;
+  FV_INFORMATION              *FvInFdTmp;
 
   NewFvLength                 = 0;
   FvEncapLevel                = 0;
   NewAddedFfsLevel            = 0;
 
@@ -269,10 +270,11 @@ BfmImageAdd (
   TemDir                      = NULL;
   LocalEncapDataTemp          = NULL;
   OutputFileName              = NULL;
   FvId                        = NULL;
   FvGuidExisted               = FALSE;
+  FvInFdTmp                   = NULL;
 
   //
   // Get the size of ffs file to be inserted.
   //
   NewFfsLength = GetFileSize(NewFile);
@@ -306,10 +308,19 @@ BfmImageAdd (
   //
   FvInFd = FdData->Fv;
   do {
     if ((FvGuidExisted && mFvGuidIsSet && FvInFd->IsInputFvFlag) || ((!FvGuidExisted || (!mFvGuidIsSet)) && FvInFd->IsBfvFlag)) {
 
+      if (FvInFd->IsBfvFlag) {
+        FvInFdTmp = FdData->Fv;
+        while (FvInFdTmp != NULL) {
+          if (FvInFdTmp->IsBfvFlag) {
+            FvInFd = FvInFdTmp;
+          }
+          FvInFdTmp = FvInFdTmp->FvNext;
+        }
+      }
       Status = LibLocateBfv (FdData, &FvId, &FvInFd);
 
       if (EFI_ERROR (Status)) {
         printf("Error while locate BFV from FD.\n");
         LibBfmFreeFd(FdData);
-- 
2.12.2.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54457): https://edk2.groups.io/g/devel/message/54457
Mute This Topic: https://groups.io/mt/71274996/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-