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>
This commit is contained in:
committed by
Yonghong Zhu
parent
50874612be
commit
8bb63e377b
@ -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
|
||||
|
Reference in New Issue
Block a user