From ce2818e418020a9cf84f6712cbda4075b0652809 Mon Sep 17 00:00:00 2001 From: "Feng, YunhuaX" Date: Fri, 9 Feb 2018 16:06:07 +0800 Subject: [PATCH] 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 Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Liming Gao --- BaseTools/Source/Python/GenFds/CompressSection.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py index 98532ed8e6..56e71a3545 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -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) -- 2.39.2