summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/EfiSection.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-04-27 00:57:53 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-05-02 14:56:31 +0800
commit8bb63e377bf10f5769e1502f8d22579fdd40c701 (patch)
treeca0ac4f1fd763587c189055c4d9173be6fc64705 /BaseTools/Source/Python/GenFds/EfiSection.py
parent50874612be60df3752327fb488799074826b759e (diff)
downloadedk2-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/EfiSection.py')
-rw-r--r--BaseTools/Source/Python/GenFds/EfiSection.py17
1 files changed, 9 insertions, 8 deletions
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