summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/Region.py
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2017-11-22 15:42:25 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2017-12-05 09:26:22 +0800
commit37de70b764200718cc39a21abc491c335e3da7b3 (patch)
tree153e7a4fca9fe8edad1a8e730ba9a3791b8e612e /BaseTools/Source/Python/GenFds/Region.py
parentb37b108d92aa08cc7eed5f52feea53b0e7563068 (diff)
downloadedk2-37de70b764200718cc39a21abc491c335e3da7b3.tar.gz
edk2-37de70b764200718cc39a21abc491c335e3da7b3.tar.bz2
edk2-37de70b764200718cc39a21abc491c335e3da7b3.zip
BaseTools: Update Makefile to support FFS file generation
Update Makefile to support FFS file generation with new build option --genfds-multi-thread. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Region.py')
-rw-r--r--BaseTools/Source/Python/GenFds/Region.py49
1 files changed, 30 insertions, 19 deletions
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index 945c5489fd..c946758cf5 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -1,7 +1,7 @@
## @file
# process FD Region generation
#
-# Copyright (c) 2007 - 2015, 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
@@ -74,11 +74,14 @@ class Region(RegionClassObject):
# @retval string Generated FV file path
#
- def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict=None, MacroDict={}):
+ def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict=None, MacroDict={}, Flag=False):
Size = self.Size
- GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
- GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
+ GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
GenFdsGlobalVariable.SharpCounter = 0
+ if Flag and (self.RegionType != 'FV'):
+ return
if self.RegionType == 'FV':
#
@@ -91,7 +94,8 @@ class Region(RegionClassObject):
FileName = None
if RegionData.endswith(".fv"):
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
- GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s' % RegionData)
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s' % RegionData)
if RegionData[1] != ':' :
RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
if not os.path.exists(RegionData):
@@ -99,7 +103,8 @@ class Region(RegionClassObject):
FileName = RegionData
elif RegionData.upper() + 'fv' in ImageBinDict.keys():
- GenFdsGlobalVariable.InfLogger(' Region Name = FV')
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger(' Region Name = FV')
FileName = ImageBinDict[RegionData.upper() + 'fv']
else:
#
@@ -110,7 +115,8 @@ class Region(RegionClassObject):
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
if FvObj != None :
- GenFdsGlobalVariable.InfLogger(' Region Name = FV')
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger(' Region Name = FV')
#
# Call GenFv tool
#
@@ -124,7 +130,10 @@ class Region(RegionClassObject):
FvBaseAddress = '0x%X' % self.FvAddress
BlockSize = None
BlockNum = None
- FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)
+ FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict, Flag=Flag)
+ if Flag:
+ continue
+
if FvBuffer.len > Size:
FvBuffer.close()
EdkLogger.error("GenFds", GENFDS_ERROR,
@@ -142,20 +151,22 @@ class Region(RegionClassObject):
#
# Add the exist Fv image into FD buffer
#
- if FileName != None:
- FileLength = os.stat(FileName)[ST_SIZE]
- if FileLength > Size:
- EdkLogger.error("GenFds", GENFDS_ERROR,
- "Size of FV File (%s) is larger than Region Size 0x%X specified." \
- % (RegionData, Size))
- BinFile = open(FileName, 'rb')
- Buffer.write(BinFile.read())
- BinFile.close()
- Size = Size - FileLength
+ if not Flag:
+ if FileName != None:
+ FileLength = os.stat(FileName)[ST_SIZE]
+ if FileLength > Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "Size of FV File (%s) is larger than Region Size 0x%X specified." \
+ % (RegionData, Size))
+ BinFile = open(FileName, 'rb')
+ Buffer.write(BinFile.read())
+ BinFile.close()
+ Size = Size - FileLength
#
# Pad the left buffer
#
- self.PadBuffer(Buffer, ErasePolarity, Size)
+ if not Flag:
+ self.PadBuffer(Buffer, ErasePolarity, Size)
if self.RegionType == 'CAPSULE':
#