]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fixed bug for single FV generating.
authorYingke Liu <yingke.d.liu@intel.com>
Fri, 28 Aug 2015 02:04:37 +0000 (02:04 +0000)
committeryingke <yingke@Edk2>
Fri, 28 Aug 2015 02:04:37 +0000 (02:04 +0000)
If -i is specified and this FV has no BlockSize defined,
tool did not inherit FD's BlockSize.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18339 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/GenFds/Fv.py

index d7705823265912eedf2a03dfa314accdb7c2e7e8..163ccd37f1582a03a3056bae04e587801dfa51a7 100644 (file)
@@ -207,6 +207,30 @@ class FV (FvClassObject):
         GenFdsGlobalVariable.LargeFileInFvFlags.pop()\r
         return FvOutputFile\r
 \r
+    ## _GetBlockSize()\r
+    #\r
+    #   Calculate FV's block size\r
+    #   Inherit block size from FD if no block size specified in FV\r
+    #\r
+    def _GetBlockSize(self):\r
+        if self.BlockSizeList:\r
+            return True\r
+\r
+        for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
+            FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
+            for RegionObj in FdObj.RegionList:\r
+                if RegionObj.RegionType != 'FV':\r
+                    continue\r
+                for RegionData in RegionObj.RegionDataList:\r
+                    #\r
+                    # Found the FD and region that contain this FV\r
+                    #\r
+                    if self.UiFvName.upper() == RegionData.upper():\r
+                        RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, self)\r
+                        if self.BlockSizeList:\r
+                            return True\r
+        return False\r
+\r
     ## __InitializeInf__()\r
     #\r
     #   Initilize the inf file to create FV\r
@@ -245,8 +269,9 @@ class FV (FvClassObject):
                                       T_CHAR_LF)\r
         else:\r
             if self.BlockSizeList == []:\r
-                #set default block size is 1\r
-                self.FvInfFile.writelines("EFI_BLOCK_SIZE  = 0x1" + T_CHAR_LF)\r
+                if not self._GetBlockSize():\r
+                    #set default block size is 1\r
+                    self.FvInfFile.writelines("EFI_BLOCK_SIZE  = 0x1" + T_CHAR_LF)\r
             \r
             for BlockSize in self.BlockSizeList :\r
                 if BlockSize[0] != None:\r