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 <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: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Feng, YunhuaX 2018-02-06 15:25:53 +08:00 committed by Yonghong Zhu
parent 0a4c903c5a
commit 4f735fc8cd
1 changed files with 14 additions and 0 deletions

View File

@ -61,14 +61,28 @@ class CompressSection (CompressSectionClassObject) :
SectFiles = tuple() SectFiles = tuple()
Index = 0 Index = 0
MaxAlign = None
for Sect in self.SectionList: for Sect in self.SectionList:
Index = Index + 1 Index = Index + 1
SecIndex = '%s.%d' %(SecNum, Index) SecIndex = '%s.%d' %(SecNum, Index)
ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile) 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 ReturnSectList != []:
if AlignValue == None:
AlignValue = "1"
for FileData in ReturnSectList: for FileData in ReturnSectList:
SectFiles += (FileData,) 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 + \ OutputFile = OutputPath + \
os.sep + \ os.sep + \