]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: GenFds get the Size info for FV image in the FD region
authorYonghong Zhu <yonghong.zhu@intel.com>
Mon, 13 Mar 2017 07:11:38 +0000 (15:11 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 18 Mar 2017 08:38:54 +0000 (16:38 +0800)
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>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/GenFds/GenFds.py

index ab3f8b213b09b4260287be6e08884c972f90f6af..f6ccb59d7757b9d6150a29393b906db3a9f0cf31 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process FV generation\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -50,6 +50,7 @@ class FV (FvClassObject):
         self.CapsuleName = None\r
         self.FvBaseAddress = None\r
         self.FvForceRebase = None\r
+        self.FvRegionInFD = None\r
         \r
     ## AddToBuffer()\r
     #\r
index a8a68da7ce4566d3b313916ed2ba4c2d28d0ce6f..aa8c04123ac8f6e453668fd999f3ac53dbe38014 100644 (file)
@@ -303,6 +303,25 @@ def main():
         """Modify images from build output if the feature of loading driver at fixed address is on."""\r
         if GenFdsGlobalVariable.FixedLoadAddress:\r
             GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform)\r
+\r
+        # Record the FV Region info that may specific in the FD\r
+        if FdfParserObj.Profile.FvDict and FdfParserObj.Profile.FdDict:\r
+            for Fv in FdfParserObj.Profile.FvDict:\r
+                FvObj = FdfParserObj.Profile.FvDict[Fv]\r
+                for Fd in FdfParserObj.Profile.FdDict:\r
+                    FdObj = FdfParserObj.Profile.FdDict[Fd]\r
+                    for RegionObj in FdObj.RegionList:\r
+                        if RegionObj.RegionType != 'FV':\r
+                            continue\r
+                        for RegionData in RegionObj.RegionDataList:\r
+                            if FvObj.UiFvName.upper() == RegionData.upper():\r
+                                if FvObj.FvRegionInFD:\r
+                                    if FvObj.FvRegionInFD != RegionObj.Size:\r
+                                        EdkLogger.error("GenFds", FORMAT_INVALID, "The FV %s's region is specified in multiple FD with different value." %FvObj.UiFvName)\r
+                                else:\r
+                                    FvObj.FvRegionInFD = RegionObj.Size\r
+                                    RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)\r
+\r
         """Call GenFds"""\r
         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)\r
 \r