public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: GenFds get the Size info for FV image in the FD region
@ 2017-03-15  1:22 Yonghong Zhu
  2017-03-15  5:46 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2017-03-15  1:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

When the FV size is specify in the FD region, Tool generate the FV file
may not use the correct size.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=387
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/Fv.py     |  3 ++-
 BaseTools/Source/Python/GenFds/GenFds.py | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index ab3f8b2..f6ccb59 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -1,9 +1,9 @@
 ## @file
 # process FV generation
 #
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
 #  http://opensource.org/licenses/bsd-license.php
@@ -48,10 +48,11 @@ class FV (FvClassObject):
         self.InfFileName = None
         self.FvAddressFileName = None
         self.CapsuleName = None
         self.FvBaseAddress = None
         self.FvForceRebase = None
+        self.FvRegionInFD = None
         
     ## AddToBuffer()
     #
     #   Generate Fv and add it to the Buffer
     #
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index a8a68da..aa8c041 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -301,10 +301,29 @@ def main():
             CheckBuildOptionPcd()
 
         """Modify images from build output if the feature of loading driver at fixed address is on."""
         if GenFdsGlobalVariable.FixedLoadAddress:
             GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform)
+
+        # Record the FV Region info that may specific in the FD
+        if FdfParserObj.Profile.FvDict and FdfParserObj.Profile.FdDict:
+            for Fv in FdfParserObj.Profile.FvDict:
+                FvObj = FdfParserObj.Profile.FvDict[Fv]
+                for Fd in FdfParserObj.Profile.FdDict:
+                    FdObj = FdfParserObj.Profile.FdDict[Fd]
+                    for RegionObj in FdObj.RegionList:
+                        if RegionObj.RegionType != 'FV':
+                            continue
+                        for RegionData in RegionObj.RegionDataList:
+                            if FvObj.UiFvName.upper() == RegionData.upper():
+                                if FvObj.FvRegionInFD:
+                                    if FvObj.FvRegionInFD != RegionObj.Size:
+                                        EdkLogger.error("GenFds", FORMAT_INVALID, "The FV %s's region is specified in multiple FD with different value." %FvObj.UiFvName)
+                                else:
+                                    FvObj.FvRegionInFD = RegionObj.Size
+                                    RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)
+
         """Call GenFds"""
         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
 
         """Generate GUID cross reference file"""
         GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList)
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: GenFds get the Size info for FV image in the FD region
  2017-03-15  1:22 [Patch] BaseTools: GenFds get the Size info for FV image in the FD region Yonghong Zhu
@ 2017-03-15  5:46 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-03-15  5:46 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Wednesday, March 15, 2017 9:23 AM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: GenFds get the Size info for FV image in the FD
>region
>
>When the FV size is specify in the FD region, Tool generate the FV file
>may not use the correct size.
>
>Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=387
>Cc: Liming Gao <liming.gao@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/GenFds/Fv.py     |  3 ++-
> BaseTools/Source/Python/GenFds/GenFds.py | 19 +++++++++++++++++++
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/GenFds/Fv.py
>b/BaseTools/Source/Python/GenFds/Fv.py
>index ab3f8b2..f6ccb59 100644
>--- a/BaseTools/Source/Python/GenFds/Fv.py
>+++ b/BaseTools/Source/Python/GenFds/Fv.py
>@@ -1,9 +1,9 @@
> ## @file
> # process FV generation
> #
>-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
>+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
> #
> #  This program and the accompanying materials
> #  are licensed and made available under the terms and conditions of the BSD
>License
> #  which accompanies this distribution.  The full text of the license may be
>found at
> #  http://opensource.org/licenses/bsd-license.php
>@@ -48,10 +48,11 @@ class FV (FvClassObject):
>         self.InfFileName = None
>         self.FvAddressFileName = None
>         self.CapsuleName = None
>         self.FvBaseAddress = None
>         self.FvForceRebase = None
>+        self.FvRegionInFD = None
>
>     ## AddToBuffer()
>     #
>     #   Generate Fv and add it to the Buffer
>     #
>diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
>b/BaseTools/Source/Python/GenFds/GenFds.py
>index a8a68da..aa8c041 100644
>--- a/BaseTools/Source/Python/GenFds/GenFds.py
>+++ b/BaseTools/Source/Python/GenFds/GenFds.py
>@@ -301,10 +301,29 @@ def main():
>             CheckBuildOptionPcd()
>
>         """Modify images from build output if the feature of loading driver at
>fixed address is on."""
>         if GenFdsGlobalVariable.FixedLoadAddress:
>             GenFds.PreprocessImage(BuildWorkSpace,
>GenFdsGlobalVariable.ActivePlatform)
>+
>+        # Record the FV Region info that may specific in the FD
>+        if FdfParserObj.Profile.FvDict and FdfParserObj.Profile.FdDict:
>+            for Fv in FdfParserObj.Profile.FvDict:
>+                FvObj = FdfParserObj.Profile.FvDict[Fv]
>+                for Fd in FdfParserObj.Profile.FdDict:
>+                    FdObj = FdfParserObj.Profile.FdDict[Fd]
>+                    for RegionObj in FdObj.RegionList:
>+                        if RegionObj.RegionType != 'FV':
>+                            continue
>+                        for RegionData in RegionObj.RegionDataList:
>+                            if FvObj.UiFvName.upper() == RegionData.upper():
>+                                if FvObj.FvRegionInFD:
>+                                    if FvObj.FvRegionInFD != RegionObj.Size:
>+                                        EdkLogger.error("GenFds", FORMAT_INVALID, "The
>FV %s's region is specified in multiple FD with different
>value." %FvObj.UiFvName)
>+                                else:
>+                                    FvObj.FvRegionInFD = RegionObj.Size
>+                                    RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)
>+
>         """Call GenFds"""
>         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
>
>         """Generate GUID cross reference file"""
>         GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList)
>--
>2.6.1.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-15  5:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-15  1:22 [Patch] BaseTools: GenFds get the Size info for FV image in the FD region Yonghong Zhu
2017-03-15  5:46 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox