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

Feng, YunhuaX posted 1 patch 31 weeks 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 31 weeks 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]
-=-=-=-=-=-=-=-=-=-=-=-

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

Posted by Liming Gao 31 weeks ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng@intel.com>
> Sent: Friday, February 14, 2020 5:15 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Zhang, Hongbin1 <hongbin1.zhang@intel.com>
> Subject: [edk2-staging/FceFmmt][PATCH] BaseTools/FCE: Fix multiple FVs with SEC module issue
> 
> 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 (#54638): https://edk2.groups.io/g/devel/message/54638
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]
-=-=-=-=-=-=-=-=-=-=-=-