]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools: replace string constants used for module types
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / EfiSection.py
index 5bb1ae6f664c8649fbbb75e8befac7a70899d3ce..1be23b4bf7fd85e52f48354875dd00801275b8bf 100644 (file)
@@ -27,6 +27,7 @@ from Common.BuildToolError import *
 from Common.Misc import PeImageClass\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 from Common.LongFilePathSupport import CopyLongFilePath\r
+from Common.DataType import *\r
 \r
 ## generate rule section\r
 #\r
@@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
             StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')\r
             NoStrip = True\r
-            if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):\r
+            if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'):\r
                 if FfsInf.KeepReloc is not None:\r
                     NoStrip = FfsInf.KeepReloc\r
                 elif FfsInf.KeepRelocFromRule is not None:\r
@@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject):
                     BuildNumTuple = tuple()\r
 \r
                 Num = SecNum\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',\r
                                                     #Ui=StringData,\r
                                                     Ver=BuildNum,\r
@@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject):
                 for File in FileList:\r
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
-                    OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))\r
                     f = open(File, 'r')\r
                     VerString = f.read()\r
                     f.close()\r
@@ -162,7 +163,7 @@ class EfiSection (EfiSectionClassObject):
                     else:\r
                         EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName)\r
                 Num = SecNum\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',\r
                                                     #Ui=VerString,\r
                                                     Ver=BuildNum,\r
@@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject):
                 Num = SecNum\r
                 if IsMakefile and StringData == ModuleNameStr:\r
                     StringData = "$(MODULE_NAME)"\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
@@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject):
                 for File in FileList:\r
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
-                    OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))\r
                     f = open(File, 'r')\r
                     UiString = f.read()\r
                     f.close()\r
@@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject):
                 Num = SecNum\r
                 if IsMakefile and StringData == ModuleNameStr:\r
                     StringData = "$(MODULE_NAME)"\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
@@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject):
                     """ Copy Map file to FFS output path """\r
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
-                    OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))\r
                     File = GenFdsGlobalVariable.MacroExtend(File, Dict)\r
                     \r
                     #Get PE Section alignment when align is set to AUTO\r