Revision: 18339
          http://sourceforge.net/p/edk2/code/18339
Author:   yingke
Date:     2015-08-28 02:04:37 +0000 (Fri, 28 Aug 2015)
Log Message:
-----------
BaseTools: Fixed bug for single FV generating.

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 <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py

Modified: trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py     2015-08-28 01:31:38 UTC 
(rev 18338)
+++ trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py     2015-08-28 02:04:37 UTC 
(rev 18339)
@@ -207,6 +207,30 @@
         GenFdsGlobalVariable.LargeFileInFvFlags.pop()
         return FvOutputFile
 
+    ## _GetBlockSize()
+    #
+    #   Calculate FV's block size
+    #   Inherit block size from FD if no block size specified in FV
+    #
+    def _GetBlockSize(self):
+        if self.BlockSizeList:
+            return True
+
+        for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
+            FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
+            for RegionObj in FdObj.RegionList:
+                if RegionObj.RegionType != 'FV':
+                    continue
+                for RegionData in RegionObj.RegionDataList:
+                    #
+                    # Found the FD and region that contain this FV
+                    #
+                    if self.UiFvName.upper() == RegionData.upper():
+                        RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, self)
+                        if self.BlockSizeList:
+                            return True
+        return False
+
     ## __InitializeInf__()
     #
     #   Initilize the inf file to create FV
@@ -245,8 +269,9 @@
                                       T_CHAR_LF)
         else:
             if self.BlockSizeList == []:
-                #set default block size is 1
-                self.FvInfFile.writelines("EFI_BLOCK_SIZE  = 0x1" + T_CHAR_LF)
+                if not self._GetBlockSize():
+                    #set default block size is 1
+                    self.FvInfFile.writelines("EFI_BLOCK_SIZE  = 0x1" + 
T_CHAR_LF)
             
             for BlockSize in self.BlockSizeList :
                 if BlockSize[0] != None:


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to