]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Set section alignment as zero if its type is Auto
authorBob Feng <bob.c.feng@intel.com>
Tue, 22 Sep 2020 11:27:54 +0000 (19:27 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 25 Sep 2020 02:27:35 +0000 (02:27 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2881

Currently, the build tool try to read the section alignment
from efi file if the section alignment type is Auto.
If there is no efi generated, the section alignment will
be set to zero. This behavior causes the Makefile to be different
between the full build and the incremental build.

Since the Genffs can auto get the section alignment from
efi file during Genffs procedure, the build tool can just set section
alignment as zero. This change can make the autogen makefile
consistent for the full build and the incremental build.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
BaseTools/Source/Python/GenFds/DataSection.py
BaseTools/Source/Python/GenFds/EfiSection.py

index f20fd702254ae48454bc814a1b981034136a5bba..5af3ee7b7f7c2462a0097b1551bd44f6aac91ad0 100644 (file)
@@ -80,14 +80,7 @@ class DataSection (DataSectionClassObject):
 \r
         #Get PE Section alignment when align is set to AUTO\r
         if self.Alignment == 'Auto' and self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):\r
-            ImageObj = PeImageClass (Filename)\r
-            if ImageObj.SectionAlignment < 0x400:\r
-                self.Alignment = str (ImageObj.SectionAlignment)\r
-            elif ImageObj.SectionAlignment < 0x100000:\r
-                self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'\r
-            else:\r
-                self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'\r
-\r
+            self.Alignment = "0"\r
         NoStrip = True\r
         if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):\r
             if self.KeepReloc is not None:\r
index e7d463904120391672c4cbabdf3dbb9991993531..fd58391dac9919e46960140dcf65e1c3102067d6 100644 (file)
@@ -260,14 +260,7 @@ class EfiSection (EfiSectionClassObject):
 \r
                     #Get PE Section alignment when align is set to AUTO\r
                     if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):\r
-                        ImageObj = PeImageClass (File)\r
-                        if ImageObj.SectionAlignment < 0x400:\r
-                            Align = str (ImageObj.SectionAlignment)\r
-                        elif ImageObj.SectionAlignment < 0x100000:\r
-                            Align = str (ImageObj.SectionAlignment // 0x400) + 'K'\r
-                        else:\r
-                            Align = str (ImageObj.SectionAlignment // 0x100000) + 'M'\r
-\r
+                        Align = "0"\r
                     if File[(len(File)-4):] == '.efi' and FfsInf.InfModule.BaseName == os.path.basename(File)[:-4]:\r
                         MapFile = File.replace('.efi', '.map')\r
                         CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')\r