]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/DataSection.py
BaseTools: FdfParser - update to remove duplicate constant value
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / DataSection.py
index 2d2975f75c0f5ae0ba8509a9cf6e836fcc9a6fdf..29caa00c0d8dc4ff6031afa600c3d7e80b0e81ed 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process data section generation\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -23,6 +23,7 @@ import Common.LongFilePathOs as os
 from CommonDataClass.FdfClass import DataSectionClassObject\r
 from Common.Misc import PeImageClass\r
 from Common.LongFilePathSupport import CopyLongFilePath\r
+from Common.DataType import *\r
 \r
 ## generate data section\r
 #\r
@@ -52,7 +53,7 @@ class DataSection (DataSectionClassObject):
         #\r
         # Prepare the parameter of GenSection\r
         #\r
-        if FfsFile != None:\r
+        if FfsFile is not None:\r
             self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)\r
             self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict, FfsFile.CurrentArch)\r
         else:\r
@@ -81,7 +82,7 @@ class DataSection (DataSectionClassObject):
                         CopyLongFilePath(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
+        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
@@ -91,8 +92,8 @@ class DataSection (DataSectionClassObject):
                 self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
 \r
         NoStrip = True\r
-        if self.SecType in ('TE', 'PE32'):\r
-            if self.KeepReloc != None:\r
+        if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):\r
+            if self.KeepReloc is not None:\r
                 NoStrip = self.KeepReloc\r
 \r
         if not NoStrip:\r
@@ -109,7 +110,7 @@ class DataSection (DataSectionClassObject):
                 )\r
             self.SectFileName = StrippedFile\r
 \r
-        if self.SecType == 'TE':\r
+        if self.SecType == BINARY_FILE_TYPE_TE:\r
             TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')\r
             GenFdsGlobalVariable.GenerateFirmwareImage(\r
                     TeFile,\r
@@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject):
                 )\r
             self.SectFileName = TeFile\r
 \r
-        OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))\r
+        OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType))\r
         OutputFile = os.path.normpath(OutputFile)\r
         GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)\r
         FileList = [OutputFile]\r