]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTool: correct the generate compress section process
authorFeng, YunhuaX <yunhuax.feng@intel.com>
Fri, 9 Feb 2018 08:06:07 +0000 (16:06 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 9 Feb 2018 09:07:55 +0000 (17:07 +0800)
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>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/GenFds/CompressSection.py

index 98532ed8e698d769106d8a57de24fa9f57585f8f..56e71a35453b92edf1b77d62dc0e1e28d7a15904 100644 (file)
@@ -60,6 +60,7 @@ class CompressSection (CompressSectionClassObject) :
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
 \r
         SectFiles = tuple()\r
+        SectAlign = []\r
         Index = 0\r
         MaxAlign = None\r
         for Sect in self.SectionList:\r
@@ -76,13 +77,7 @@ class CompressSection (CompressSectionClassObject) :
                     AlignValue = "1"\r
                 for FileData in ReturnSectList:\r
                     SectFiles += (FileData,)\r
-\r
-        if MaxAlign != None:\r
-            if self.Alignment == None:\r
-                self.Alignment = MaxAlign\r
-            else:\r
-                if GenFdsGlobalVariable.GetAlignment (MaxAlign) > GenFdsGlobalVariable.GetAlignment (self.Alignment):\r
-                    self.Alignment = MaxAlign\r
+                    SectAlign.append(AlignValue)\r
 \r
         OutputFile = OutputPath + \\r
                      os.sep     + \\r
@@ -91,8 +86,10 @@ class CompressSection (CompressSectionClassObject) :
                      SecNum     + \\r
                      Ffs.SectionSuffix['COMPRESS']\r
         OutputFile = os.path.normpath(OutputFile)\r
+        DummyFile = OutputFile + '.dummy'\r
+        GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAlign=SectAlign, IsMakefile=IsMakefile)\r
 \r
-        GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],\r
+        GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], Section.Section.SectionType['COMPRESS'],\r
                                              CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)\r
         OutputFileList = []\r
         OutputFileList.append(OutputFile)\r