]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/DataSection.py
Sync EDKII BaseTools to BaseTools project r1988
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / DataSection.py
index dff4691462f177e7683685e18a47806859808971..0f41953ad42f6c2ba1a8fd825ed2f2c5b5c569c5 100644 (file)
@@ -21,6 +21,7 @@ import subprocess
 from Ffs import Ffs\r
 import os\r
 from CommonDataClass.FdfClass import DataSectionClassObject\r
 from Ffs import Ffs\r
 import os\r
 from CommonDataClass.FdfClass import DataSectionClassObject\r
+from Common.Misc import PeImageClass\r
 import shutil\r
 \r
 ## generate data section\r
 import shutil\r
 \r
 ## generate data section\r
@@ -74,6 +75,14 @@ class DataSection (DataSectionClassObject):
                     (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):\r
                     shutil.copyfile(MapFile, CopyMapFile)\r
 \r
                     (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):\r
                     shutil.copyfile(MapFile, CopyMapFile)\r
 \r
+        #Get PE Section alignment when align is set to AUTO\r
+        if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):\r
+            ImageObj = PeImageClass (Filename)\r
+            if ImageObj.SectionAlignment < 0x400:\r
+                self.Alignment = str (ImageObj.SectionAlignment)\r
+            else:\r
+                self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
+\r
         NoStrip = True\r
         if self.SecType in ('TE', 'PE32'):\r
             if self.KeepReloc != None:\r
         NoStrip = True\r
         if self.SecType in ('TE', 'PE32'):\r
             if self.KeepReloc != None:\r