BaseTools/Source/Python/GenFds/CompressSection.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
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>
---
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
@@ -59,18 +59,32 @@ class CompressSection (CompressSectionClassObject) :
self.CompType = FfsInf.__ExtendMacro__(self.CompType)
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
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 + \
ModuleName + \
'SEC' + \
--
2.12.2.windows.2
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Feng, YunhuaX Sent: Tuesday, February 06, 2018 3:26 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com> 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 <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> --- 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 @@ -59,18 +59,32 @@ class CompressSection (CompressSectionClassObject) : self.CompType = FfsInf.__ExtendMacro__(self.CompType) self.Alignment = FfsInf.__ExtendMacro__(self.Alignment) 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 + \ ModuleName + \ 'SEC' + \ -- 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.