[edk2] [PATCH] BaseTool: correct the generate compress section process

Feng, YunhuaX posted 1 patch 6 years, 2 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/GenFds/CompressSection.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[edk2] [PATCH] BaseTool: correct the generate compress section process
Posted by Feng, YunhuaX 6 years, 2 months ago

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

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py
index 98532ed8e6..af0392c153 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -58,10 +58,11 @@ class CompressSection (CompressSectionClassObject) :
         if FfsInf != None:
             self.CompType = FfsInf.__ExtendMacro__(self.CompType)
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
 
         SectFiles = tuple()
+        SectAlign = []
         Index = 0
         MaxAlign = None
         for Sect in self.SectionList:
             Index = Index + 1
             SecIndex = '%s.%d' %(SecNum, Index) @@ -74,10 +75,11 @@ class CompressSection (CompressSectionClassObject) :
             if ReturnSectList != []:
                 if AlignValue == None:
                     AlignValue = "1"
                 for FileData in ReturnSectList:
                     SectFiles += (FileData,)
+                    SectAlign.append(AlignValue)
 
         if MaxAlign != None:
             if self.Alignment == None:
                 self.Alignment = MaxAlign
             else:
@@ -89,12 +91,14 @@ class CompressSection (CompressSectionClassObject) :
                      ModuleName + \
                      'SEC'      + \
                      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)
         return OutputFileList, self.Alignment
 
--
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel