]> 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 7f24b51fc34af60c00b2bf10666f977bb8b3a0d8..0f41953ad42f6c2ba1a8fd825ed2f2c5b5c569c5 100644 (file)
@@ -1,9 +1,9 @@
 ## @file\r
 # process data section generation\r
 #\r
-#  Copyright (c) 2007, Intel Corporation\r
+#  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
 #\r
-#  All rights reserved. This program and the accompanying materials\r
+#  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
@@ -21,6 +21,7 @@ import subprocess
 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
@@ -74,6 +75,14 @@ class DataSection (DataSectionClassObject):
                     (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