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>
This commit is contained in:
Yonghong Zhu
2017-11-22 15:42:25 +08:00
parent b37b108d92
commit 37de70b764
24 changed files with 793 additions and 411 deletions

View File

@ -48,7 +48,7 @@ class DataSection (DataSectionClassObject):
# @param Dict dictionary contains macro and its value
# @retval tuple (Generated file name list, section alignment)
#
def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):
def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}, IsMakefile = False):
#
# Prepare the parameter of GenSection
#
@ -69,10 +69,16 @@ class DataSection (DataSectionClassObject):
Filename = GenFdsGlobalVariable.MacroExtend(self.SectFileName)
if Filename[(len(Filename)-4):] == '.efi':
MapFile = Filename.replace('.efi', '.map')
if os.path.exists(MapFile):
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
CopyLongFilePath(MapFile, CopyMapFile)
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
if IsMakefile:
if GenFdsGlobalVariable.CopyList == []:
GenFdsGlobalVariable.CopyList = [(MapFile, CopyMapFile)]
else:
GenFdsGlobalVariable.CopyList.append((MapFile, CopyMapFile))
else:
if os.path.exists(MapFile):
if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
CopyLongFilePath(MapFile, CopyMapFile)
#Get PE Section alignment when align is set to AUTO
if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):
@ -96,24 +102,25 @@ class DataSection (DataSectionClassObject):
CopyLongFilePath(self.SectFileName, FileBeforeStrip)
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
GenFdsGlobalVariable.GenerateFirmwareImage(
StrippedFile,
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
Strip=True
)
StrippedFile,
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
Strip=True,
IsMakefile = IsMakefile
)
self.SectFileName = StrippedFile
if self.SecType == 'TE':
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
GenFdsGlobalVariable.GenerateFirmwareImage(
TeFile,
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
Type='te'
)
TeFile,
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
Type='te',
IsMakefile = IsMakefile
)
self.SectFileName = TeFile
OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
FileList = [OutputFile]
return FileList, self.Alignment