]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix COMPRESS alignment incorrect issue
authorFeng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1>
Tue, 6 Feb 2018 07:25:53 +0000 (15:25 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 7 Feb 2018 06:48:04 +0000 (14:48 +0800)
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>
BaseTools/Source/Python/GenFds/CompressSection.py

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