From 4f735fc8cdd9a7e385d285c771abddfcae8a5e58 Mon Sep 17 00:00:00 2001 From: "Feng, YunhuaX" Date: Tue, 6 Feb 2018 15:25:53 +0800 Subject: [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue Doesn't generate the correct alignment for the leaf section in the compression section. Below FFS rule doesn't work as the expectation. [Rule.Common.PEIM.PE32] FILE PEIM = $(NAMED_GUID) { PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex COMPRESS { PE32 PE32 Align=Auto $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING="$(MODULE_NAME)" Optional VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) } } Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/GenFds/CompressSection.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py index 64ad275d83..98532ed8e6 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -61,14 +61,28 @@ class CompressSection (CompressSectionClassObject) : SectFiles = tuple() Index = 0 + MaxAlign = None for Sect in self.SectionList: Index = Index + 1 SecIndex = '%s.%d' %(SecNum, Index) ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile) + if AlignValue != None: + if MaxAlign == None: + MaxAlign = AlignValue + if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign): + MaxAlign = AlignValue if ReturnSectList != []: + if AlignValue == None: + 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 OutputFile = OutputPath + \ os.sep + \ -- 2.39.2