BaseTool: correct the generate compress section process

First generate a dummy file with section alignment,
then compress the dummy file to generate the compress file

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Feng, YunhuaX 2018-02-09 16:06:07 +08:00 committed by Liming Gao
parent 582e4e449d
commit ce2818e418
1 changed files with 5 additions and 8 deletions

View File

@ -60,6 +60,7 @@ class CompressSection (CompressSectionClassObject) :
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
SectFiles = tuple()
SectAlign = []
Index = 0
MaxAlign = None
for Sect in self.SectionList:
@ -76,13 +77,7 @@ class CompressSection (CompressSectionClassObject) :
AlignValue = "1"
for FileData in ReturnSectList:
SectFiles += (FileData,)
if MaxAlign != None:
if self.Alignment == None:
self.Alignment = MaxAlign
else:
if GenFdsGlobalVariable.GetAlignment (MaxAlign) > GenFdsGlobalVariable.GetAlignment (self.Alignment):
self.Alignment = MaxAlign
SectAlign.append(AlignValue)
OutputFile = OutputPath + \
os.sep + \
@ -91,8 +86,10 @@ class CompressSection (CompressSectionClassObject) :
SecNum + \
Ffs.SectionSuffix['COMPRESS']
OutputFile = os.path.normpath(OutputFile)
DummyFile = OutputFile + '.dummy'
GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAlign=SectAlign, IsMakefile=IsMakefile)
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],
GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], Section.Section.SectionType['COMPRESS'],
CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
OutputFileList = []
OutputFileList.append(OutputFile)