diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-04-27 00:57:53 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-05-02 14:56:31 +0800 |
commit | 8bb63e377bf10f5769e1502f8d22579fdd40c701 (patch) | |
tree | ca0ac4f1fd763587c189055c4d9173be6fc64705 /BaseTools/Source/Python/GenFds | |
parent | 50874612be60df3752327fb488799074826b759e (diff) | |
download | edk2-8bb63e377bf10f5769e1502f8d22579fdd40c701.tar.gz edk2-8bb63e377bf10f5769e1502f8d22579fdd40c701.tar.bz2 edk2-8bb63e377bf10f5769e1502f8d22579fdd40c701.zip |
BaseTools: replace string constants used for module types
replace raw strings in the code (note: except UPT) with constants.
SUP_MODULE_BASE was 'BASE'
SUP_MODULE_SEC was 'SEC'
SUP_MODULE_PEI_CORE was 'PEI_CORE'
SUP_MODULE_PEIM was 'PEIM'
SUP_MODULE_DXE_CORE was 'DXE_CORE'
SUP_MODULE_DXE_DRIVER was 'DXE_DRIVER'
SUP_MODULE_DXE_RUNTIME_DRIVER was 'DXE_RUNTIME_DRIVER'
SUP_MODULE_DXE_SAL_DRIVER was 'DXE_SAL_DRIVER'
SUP_MODULE_DXE_SMM_DRIVER was 'DXE_SMM_DRIVER'
SUP_MODULE_UEFI_DRIVER was 'UEFI_DRIVER'
SUP_MODULE_UEFI_APPLICATION was 'UEFI_APPLICATION'
SUP_MODULE_USER_DEFINED was 'USER_DEFINED'
SUP_MODULE_SMM_CORE was 'SMM_CORE'
SUP_MODULE_MM_STANDALONE was 'MM_STANDALONE'
SUP_MODULE_MM_CORE_STANDALONE was 'MM_CORE_STANDALONE'
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r-- | BaseTools/Source/Python/GenFds/CompressSection.py | 3 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/DataSection.py | 5 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/DepexSection.py | 11 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/EfiSection.py | 17 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 16 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/Ffs.py | 41 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/FfsInfStatement.py | 30 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/FvImageSection.py | 5 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/GuidSection.py | 5 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/UiSection.py | 3 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/VerSection.py | 3 |
11 files changed, 74 insertions, 65 deletions
diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py index 08ab48669f..4ae14f27b3 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -21,6 +21,7 @@ import subprocess import Common.LongFilePathOs as os
from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import CompressSectionClassObject
+from Common.DataType import *
## generate compress section
#
@@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) : OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['COMPRESS']
OutputFile = os.path.normpath(OutputFile)
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py index 40e345eee7..99d7392aaa 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -1,7 +1,7 @@ ## @file
# process data section generation
#
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -23,6 +23,7 @@ import Common.LongFilePathOs as os from CommonDataClass.FdfClass import DataSectionClassObject
from Common.Misc import PeImageClass
from Common.LongFilePathSupport import CopyLongFilePath
+from Common.DataType import *
## generate data section
#
@@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject): )
self.SectFileName = TeFile
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType))
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
FileList = [OutputFile]
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py index 4ed1aa7792..d04160e890 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -25,6 +25,7 @@ from AutoGen.GenDepex import DependencyExpression from Common import EdkLogger
from Common.BuildToolError import *
from Common.Misc import PathClass
+from Common.DataType import *
## generate data section
#
@@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject): self.ExpressionProcessed = True
if self.DepexType == 'PEI_DEPEX_EXP':
- ModuleType = 'PEIM'
+ ModuleType = SUP_MODULE_PEIM
SecType = 'PEI_DEPEX'
elif self.DepexType == 'DXE_DEPEX_EXP':
- ModuleType = 'DXE_DRIVER'
+ ModuleType = SUP_MODULE_DXE_DRIVER
SecType = 'DXE_DEPEX'
elif self.DepexType == 'SMM_DEPEX_EXP':
- ModuleType = 'DXE_SMM_DRIVER'
+ ModuleType = SUP_MODULE_DXE_SMM_DRIVER
SecType = 'SMM_DEPEX'
else:
EdkLogger.error("GenFds", FORMAT_INVALID,
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
- InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')
+ InputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.depex')
InputFile = os.path.normpath(InputFile)
Depex = DependencyExpression(self.Expression, ModuleType)
Depex.Generate(InputFile)
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.dpx')
OutputFile = os.path.normpath(OutputFile)
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py index 5bb1ae6f66..1be23b4bf7 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -27,6 +27,7 @@ from Common.BuildToolError import * from Common.Misc import PeImageClass
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.LongFilePathSupport import CopyLongFilePath
+from Common.DataType import *
## generate rule section
#
@@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject): StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True
- if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):
+ if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'):
if FfsInf.KeepReloc is not None:
NoStrip = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None:
@@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject): BuildNumTuple = tuple()
Num = SecNum
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=StringData,
Ver=BuildNum,
@@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList:
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
f = open(File, 'r')
VerString = f.read()
f.close()
@@ -162,7 +163,7 @@ class EfiSection (EfiSectionClassObject): else:
EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName)
Num = SecNum
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=VerString,
Ver=BuildNum,
@@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject): Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList:
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
f = open(File, 'r')
UiString = f.read()
f.close()
@@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject): Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject): """ Copy Map file to FFS output path """
Index = Index + 1
Num = '%s.%d' %(SecNum , Index)
- OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
#Get PE Section alignment when align is set to AUTO
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 25755a9778..db8947e4b4 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2626,7 +2626,7 @@ class FdfParser: #
@staticmethod
def __FileCouldHaveRelocFlag (FileType):
- if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'):
+ if FileType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'PEI_DXE_COMBO'):
return True
else:
return False
@@ -3626,12 +3626,12 @@ class FdfParser: if not self.__GetNextWord():
raise Warning("expected Module type", self.FileName, self.CurrentLineNumber)
- if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CORE", \
- "DXE_DRIVER", "DXE_SAL_DRIVER", \
- "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \
- "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \
+ if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \
+ SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
+ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \
+ SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \
"SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
- "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):
+ "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
return self.__Token
@@ -3673,8 +3673,8 @@ class FdfParser: raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber)
Type = self.__Token.strip().upper()
- if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\
- "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):
+ if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\
+ "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py index a417812111..fc760ae8be 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -16,6 +16,7 @@ # Import Modules
#
from CommonDataClass.FdfClass import FDClassObject
+from Common.DataType import *
## generate FFS
#
@@ -24,27 +25,27 @@ class Ffs(FDClassObject): # mapping between MODULE type in FDF (from INF) and file type for GenFfs
ModuleTypeToFileType = {
- 'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE',
- 'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE',
- 'PEIM' : 'EFI_FV_FILETYPE_PEIM',
- 'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE',
- 'DXE_DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
- 'DXE_SAL_DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
- 'DXE_SMM_DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
- 'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER',
- 'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
- 'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION',
- 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE',
- 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE',
- 'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
+ SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE',
+ SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE',
+ SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM',
+ SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE',
+ SUP_MODULE_DXE_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
+ SUP_MODULE_DXE_SAL_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
+ SUP_MODULE_DXE_SMM_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
+ SUP_MODULE_DXE_RUNTIME_DRIVER: 'EFI_FV_FILETYPE_DRIVER',
+ SUP_MODULE_UEFI_DRIVER : 'EFI_FV_FILETYPE_DRIVER',
+ SUP_MODULE_UEFI_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION',
+ SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE',
+ SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE',
+ SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
}
# mapping between FILE type in FDF and file type for GenFfs
FdfFvFileTypeToFileType = {
- 'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE',
- 'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE',
- 'PEIM' : 'EFI_FV_FILETYPE_PEIM',
- 'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE',
+ SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE',
+ SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE',
+ SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM',
+ SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE',
'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM',
'DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION',
@@ -52,9 +53,9 @@ class Ffs(FDClassObject): 'RAW' : 'EFI_FV_FILETYPE_RAW',
'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
'SMM' : 'EFI_FV_FILETYPE_SMM',
- 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE',
- 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE',
- 'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
+ SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE',
+ SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE',
+ SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
}
# mapping between section type in FDF and file suffix
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index 3c5eef4022..f973cf2f0b 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -88,7 +88,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)
# Check if current INF module has DEPEX
- if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != "USER_DEFINED" \
+ if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
ModuleType = self.InfModule.ModuleType
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
@@ -224,10 +224,10 @@ class FfsInfStatement(FfsInfStatementClassObject): if len(self.SourceFileList) != 0 and not self.InDsc:
EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))
- if self.ModuleType == 'SMM_CORE' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_SMM_CORE and int(self.PiSpecVersion, 16) < 0x0001000A:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
- if self.ModuleType == 'MM_CORE_STANDALONE' and int(self.PiSpecVersion, 16) < 0x00010032:
+ if self.ModuleType == SUP_MODULE_MM_CORE_STANDALONE and int(self.PiSpecVersion, 16) < 0x00010032:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)
if Inf._Defs is not None and len(Inf._Defs) > 0:
@@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject): #
# Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
#
- if FileType != 'PE32' and self.ModuleType != "USER_DEFINED":
+ if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:
return EfiFile
#
@@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject): #
# Convert Fv File Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Rule.FvFileType == 'DRIVER':
Rule.FvFileType = 'SMM'
#
# Framework SMM Driver has no SMM FV file type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
- if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if Rule.FvFileType == 'SMM' or Rule.FvFileType == SUP_MODULE_SMM_CORE:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
#
# For the rule only has simpleFile
@@ -738,17 +738,17 @@ class FfsInfStatement(FfsInfStatementClassObject): #
# Convert Fv Section Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if SectionType == 'DXE_DEPEX':
SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
if SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
- if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
if self.KeepReloc is not None:
NoStrip = self.KeepReloc
elif Rule.KeepReloc is not None:
@@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject): SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
- Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum
+ Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
Index = Index + 1
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
@@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject): else:
SecNum = '%d' %Index
GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
- Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum
+ Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
@@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # @retval string File name of the generated section file
#
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
- if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
if Rule.KeepReloc is not None:
self.KeepRelocFromRule = Rule.KeepReloc
SectFiles = []
@@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject): #
# Convert Fv Section Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Sect.SectionType == 'DXE_DEPEX':
Sect.SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
if Sect.SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
#
diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py index 5026a3ffca..eb84b44bbe 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -24,6 +24,7 @@ import Common.LongFilePathOs as os from CommonDataClass.FdfClass import FvImageSectionClassObject
from Common import EdkLogger
from Common.BuildToolError import *
+from Common.DataType import *
## generate FV image section
#
@@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject): if FvAlignmentValue > MaxFvAlignment:
MaxFvAlignment = FvAlignmentValue
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
@@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject): #
# Prepare the parameter of GenSection
#
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py index 08665a3d4d..1105689e0d 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -28,6 +28,7 @@ from Common.BuildToolError import * from FvImageSection import FvImageSection
from Common.LongFilePathSupport import OpenLongFilePath as open
from GenFds import FindExtendTool
+from Common.DataType import *
## generate GUIDed section
#
@@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) : OutputFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
Ffs.SectionSuffix['GUIDED']
OutputFile = os.path.normpath(OutputFile)
@@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) : TempFile = OutputPath + \
os.sep + \
ModuleName + \
- 'SEC' + \
+ SUP_MODULE_SEC + \
SecNum + \
'.tmp'
TempFile = os.path.normpath(TempFile)
diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py index 6340520602..084f761e12 100644 --- a/BaseTools/Source/Python/GenFds/UiSection.py +++ b/BaseTools/Source/Python/GenFds/UiSection.py @@ -22,6 +22,7 @@ import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import UiSectionClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.DataType import SUP_MODULE_SEC
## generate UI section
#
@@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject): self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
- OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('UI'))
if self.StringData is not None :
NameString = self.StringData
diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py index 11e974b993..456a430079 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -22,6 +22,7 @@ import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import VerSectionClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.DataType import SUP_MODULE_SEC
## generate version section
#
@@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject): self.FileName = FfsInf.__ExtendMacro__(self.FileName)
OutputFile = os.path.join(OutputPath,
- ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('VERSION'))
+ ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION'))
OutputFile = os.path.normpath(OutputFile)
# Get String Data
|