public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTool: correct the generate compress section process
@ 2018-02-09  8:06 Feng, YunhuaX
  2018-02-09  9:00 ` Gao, Liming
  0 siblings, 1 reply; 3+ messages in thread
From: Feng, YunhuaX @ 2018-02-09  8:06 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zhu, Yonghong, Gao, Liming

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

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 | 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
@@ -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,27 +75,23 @@ class CompressSection (CompressSectionClassObject) :
             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
+                    SectAlign.append(AlignValue)
 
         OutputFile = OutputPath + \
                      os.sep     + \
                      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



^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] BaseTool: correct the generate compress section process
@ 2018-02-09  5:12 Feng, YunhuaX
  0 siblings, 0 replies; 3+ messages in thread
From: Feng, YunhuaX @ 2018-02-09  5:12 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zhu, Yonghong, Gao, Liming


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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-09  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09  8:06 [PATCH] BaseTool: correct the generate compress section process Feng, YunhuaX
2018-02-09  9:00 ` Gao, Liming
  -- strict thread matches above, loose matches on Subject: below --
2018-02-09  5:12 Feng, YunhuaX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox