BaseTools: Remove unused logic for EDKI
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350 Remove EDK module type support from BaseTools python code. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -2174,42 +2174,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
Pcd.MaxDatumSize = str(len(Value) - 1)
|
Pcd.MaxDatumSize = str(len(Value) - 1)
|
||||||
return Pcds.values()
|
return Pcds.values()
|
||||||
|
|
||||||
## Resolve library names to library modules
|
|
||||||
#
|
|
||||||
# (for Edk.x modules)
|
|
||||||
#
|
|
||||||
# @param Module The module from which the library names will be resolved
|
|
||||||
#
|
|
||||||
# @retval library_list The list of library modules
|
|
||||||
#
|
|
||||||
def ResolveLibraryReference(self, Module):
|
|
||||||
EdkLogger.verbose("")
|
|
||||||
EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), self.Arch))
|
|
||||||
LibraryConsumerList = [Module]
|
|
||||||
|
|
||||||
# "CompilerStub" is a must for Edk modules
|
|
||||||
if Module.Libraries:
|
|
||||||
Module.Libraries.append("CompilerStub")
|
|
||||||
LibraryList = []
|
|
||||||
while len(LibraryConsumerList) > 0:
|
|
||||||
M = LibraryConsumerList.pop()
|
|
||||||
for LibraryName in M.Libraries:
|
|
||||||
Library = self.Platform.LibraryClasses[LibraryName, ':dummy:']
|
|
||||||
if Library is None:
|
|
||||||
for Key in self.Platform.LibraryClasses.data:
|
|
||||||
if LibraryName.upper() == Key.upper():
|
|
||||||
Library = self.Platform.LibraryClasses[Key, ':dummy:']
|
|
||||||
break
|
|
||||||
if Library is None:
|
|
||||||
EdkLogger.warn("build", "Library [%s] is not found" % LibraryName, File=str(M),
|
|
||||||
ExtraData="\t%s [%s]" % (str(Module), self.Arch))
|
|
||||||
continue
|
|
||||||
|
|
||||||
if Library not in LibraryList:
|
|
||||||
LibraryList.append(Library)
|
|
||||||
LibraryConsumerList.append(Library)
|
|
||||||
EdkLogger.verbose("\t" + LibraryName + " : " + str(Library) + ' ' + str(type(Library)))
|
|
||||||
return LibraryList
|
|
||||||
|
|
||||||
## Calculate the priority value of the build option
|
## Calculate the priority value of the build option
|
||||||
#
|
#
|
||||||
@ -2377,12 +2342,8 @@ class PlatformAutoGen(AutoGen):
|
|||||||
#
|
#
|
||||||
def ApplyBuildOption(self, Module):
|
def ApplyBuildOption(self, Module):
|
||||||
# Get the different options for the different style module
|
# Get the different options for the different style module
|
||||||
if Module.AutoGenVersion < 0x00010005:
|
PlatformOptions = self.EdkIIBuildOption
|
||||||
PlatformOptions = self.EdkBuildOption
|
ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)
|
||||||
ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDK_NAME, Module.ModuleType)
|
|
||||||
else:
|
|
||||||
PlatformOptions = self.EdkIIBuildOption
|
|
||||||
ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)
|
|
||||||
ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
|
ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
|
||||||
ModuleOptions = self._ExpandBuildOption(Module.BuildOptions)
|
ModuleOptions = self._ExpandBuildOption(Module.BuildOptions)
|
||||||
if Module in self.Platform.Modules:
|
if Module in self.Platform.Modules:
|
||||||
@ -2422,11 +2383,6 @@ class PlatformAutoGen(AutoGen):
|
|||||||
else:
|
else:
|
||||||
BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
|
BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
|
||||||
|
|
||||||
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:
|
|
||||||
#
|
|
||||||
# Override UNI flag only for EDK module.
|
|
||||||
#
|
|
||||||
BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag
|
|
||||||
return BuildOptions, BuildRuleOrder
|
return BuildOptions, BuildRuleOrder
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -2962,14 +2918,13 @@ class ModuleAutoGen(AutoGen):
|
|||||||
# EDK II modules must not reference header files outside of the packages they depend on or
|
# EDK II modules must not reference header files outside of the packages they depend on or
|
||||||
# within the module's directory tree. Report error if violation.
|
# within the module's directory tree. Report error if violation.
|
||||||
#
|
#
|
||||||
if self.AutoGenVersion >= 0x00010005:
|
for Path in IncPathList:
|
||||||
for Path in IncPathList:
|
if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
|
||||||
if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
|
ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
|
||||||
ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
|
EdkLogger.error("build",
|
||||||
EdkLogger.error("build",
|
PARAMETER_INVALID,
|
||||||
PARAMETER_INVALID,
|
ExtraData=ErrMsg,
|
||||||
ExtraData=ErrMsg,
|
File=str(self.MetaFile))
|
||||||
File=str(self.MetaFile))
|
|
||||||
RetVal += IncPathList
|
RetVal += IncPathList
|
||||||
return RetVal
|
return RetVal
|
||||||
|
|
||||||
@ -2999,7 +2954,7 @@ class ModuleAutoGen(AutoGen):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# add the file path into search path list for file including
|
# add the file path into search path list for file including
|
||||||
if F.Dir not in self.IncludePathList and self.AutoGenVersion >= 0x00010005:
|
if F.Dir not in self.IncludePathList:
|
||||||
self.IncludePathList.insert(0, F.Dir)
|
self.IncludePathList.insert(0, F.Dir)
|
||||||
RetVal.append(F)
|
RetVal.append(F)
|
||||||
|
|
||||||
@ -3261,8 +3216,6 @@ class ModuleAutoGen(AutoGen):
|
|||||||
# only merge library classes and PCD for non-library module
|
# only merge library classes and PCD for non-library module
|
||||||
if self.IsLibrary:
|
if self.IsLibrary:
|
||||||
return []
|
return []
|
||||||
if self.AutoGenVersion < 0x00010005:
|
|
||||||
return self.PlatformInfo.ResolveLibraryReference(self.Module)
|
|
||||||
return self.PlatformInfo.ApplyLibraryInstance(self.Module)
|
return self.PlatformInfo.ApplyLibraryInstance(self.Module)
|
||||||
|
|
||||||
## Get the list of PCDs from current module
|
## Get the list of PCDs from current module
|
||||||
@ -3351,19 +3304,8 @@ class ModuleAutoGen(AutoGen):
|
|||||||
@cached_property
|
@cached_property
|
||||||
def IncludePathList(self):
|
def IncludePathList(self):
|
||||||
RetVal = []
|
RetVal = []
|
||||||
if self.AutoGenVersion < 0x00010005:
|
RetVal.append(self.MetaFile.Dir)
|
||||||
for Inc in self.Module.Includes:
|
RetVal.append(self.DebugDir)
|
||||||
if Inc not in RetVal:
|
|
||||||
RetVal.append(Inc)
|
|
||||||
# for Edk modules
|
|
||||||
Inc = path.join(Inc, self.Arch.capitalize())
|
|
||||||
if os.path.exists(Inc) and Inc not in RetVal:
|
|
||||||
RetVal.append(Inc)
|
|
||||||
# Edk module needs to put DEBUG_DIR at the end of search path and not to use SOURCE_DIR all the time
|
|
||||||
RetVal.append(self.DebugDir)
|
|
||||||
else:
|
|
||||||
RetVal.append(self.MetaFile.Dir)
|
|
||||||
RetVal.append(self.DebugDir)
|
|
||||||
|
|
||||||
for Package in self.Module.Packages:
|
for Package in self.Module.Packages:
|
||||||
PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
|
PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
|
||||||
@ -3526,10 +3468,6 @@ class ModuleAutoGen(AutoGen):
|
|||||||
if self.IsAsBuiltInfCreated:
|
if self.IsAsBuiltInfCreated:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Skip the following code for EDK I inf
|
|
||||||
if self.AutoGenVersion < 0x00010005:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Skip the following code for libraries
|
# Skip the following code for libraries
|
||||||
if self.IsLibrary:
|
if self.IsLibrary:
|
||||||
return
|
return
|
||||||
@ -3986,17 +3924,10 @@ class ModuleAutoGen(AutoGen):
|
|||||||
|
|
||||||
for File in self.AutoGenFileList:
|
for File in self.AutoGenFileList:
|
||||||
if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
|
if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
|
||||||
#Ignore Edk AutoGen.c
|
|
||||||
if self.AutoGenVersion < 0x00010005 and File.Name == 'AutoGen.c':
|
|
||||||
continue
|
|
||||||
|
|
||||||
AutoGenList.append(str(File))
|
AutoGenList.append(str(File))
|
||||||
else:
|
else:
|
||||||
IgoredAutoGenList.append(str(File))
|
IgoredAutoGenList.append(str(File))
|
||||||
|
|
||||||
# Skip the following code for EDK I inf
|
|
||||||
if self.AutoGenVersion < 0x00010005:
|
|
||||||
return
|
|
||||||
|
|
||||||
for ModuleType in self.DepexList:
|
for ModuleType in self.DepexList:
|
||||||
# Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
|
# Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
|
||||||
|
@ -1681,22 +1681,6 @@ def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuff
|
|||||||
# Get all files under [Sources] section in inf file for EDK-II module
|
# Get all files under [Sources] section in inf file for EDK-II module
|
||||||
EDK2Module = True
|
EDK2Module = True
|
||||||
SrcList = [F for F in Info.SourceFileList]
|
SrcList = [F for F in Info.SourceFileList]
|
||||||
if Info.AutoGenVersion < 0x00010005:
|
|
||||||
EDK2Module = False
|
|
||||||
# Get all files under the module directory for EDK-I module
|
|
||||||
Cwd = os.getcwd()
|
|
||||||
os.chdir(Info.MetaFile.Dir)
|
|
||||||
for Root, Dirs, Files in os.walk("."):
|
|
||||||
if 'CVS' in Dirs:
|
|
||||||
Dirs.remove('CVS')
|
|
||||||
if '.svn' in Dirs:
|
|
||||||
Dirs.remove('.svn')
|
|
||||||
for File in Files:
|
|
||||||
File = PathClass(os.path.join(Root, File), Info.MetaFile.Dir)
|
|
||||||
if File in SrcList:
|
|
||||||
continue
|
|
||||||
SrcList.append(File)
|
|
||||||
os.chdir(Cwd)
|
|
||||||
|
|
||||||
if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1:
|
if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1:
|
||||||
CompatibleMode = True
|
CompatibleMode = True
|
||||||
@ -1984,42 +1968,41 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
|||||||
# header file Prologue
|
# header file Prologue
|
||||||
AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-', '_')}))
|
AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-', '_')}))
|
||||||
AutoGenH.Append(gAutoGenHCppPrologueString)
|
AutoGenH.Append(gAutoGenHCppPrologueString)
|
||||||
if Info.AutoGenVersion >= 0x00010005:
|
|
||||||
# header files includes
|
|
||||||
if Info.ModuleType in gModuleTypeHeaderFile:
|
|
||||||
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
|
|
||||||
#
|
|
||||||
# if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
|
|
||||||
# As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.
|
|
||||||
#
|
|
||||||
if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
|
|
||||||
AutoGenH.Append("#include <Library/PcdLib.h>\n")
|
|
||||||
|
|
||||||
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
|
# header files includes
|
||||||
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
|
if Info.ModuleType in gModuleTypeHeaderFile:
|
||||||
|
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
|
||||||
|
#
|
||||||
|
# if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
|
||||||
|
# As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.
|
||||||
|
#
|
||||||
|
if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
|
||||||
|
AutoGenH.Append("#include <Library/PcdLib.h>\n")
|
||||||
|
|
||||||
if Info.IsLibrary:
|
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
|
||||||
return
|
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
|
||||||
|
|
||||||
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
|
if Info.IsLibrary:
|
||||||
|
return
|
||||||
|
|
||||||
|
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
|
||||||
|
|
||||||
if Info.IsLibrary:
|
if Info.IsLibrary:
|
||||||
return
|
return
|
||||||
# C file header
|
# C file header
|
||||||
AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'}))
|
AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'}))
|
||||||
if Info.AutoGenVersion >= 0x00010005:
|
# C file header files includes
|
||||||
# C file header files includes
|
if Info.ModuleType in gModuleTypeHeaderFile:
|
||||||
if Info.ModuleType in gModuleTypeHeaderFile:
|
for Inc in gModuleTypeHeaderFile[Info.ModuleType]:
|
||||||
for Inc in gModuleTypeHeaderFile[Info.ModuleType]:
|
AutoGenC.Append("#include <%s>\n" % Inc)
|
||||||
AutoGenC.Append("#include <%s>\n" % Inc)
|
else:
|
||||||
else:
|
AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)
|
||||||
AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Publish the CallerId Guid
|
# Publish the CallerId Guid
|
||||||
#
|
#
|
||||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
|
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
|
||||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
|
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
|
||||||
|
|
||||||
## Create common code for header file
|
## Create common code for header file
|
||||||
#
|
#
|
||||||
@ -2045,15 +2028,14 @@ def CreateFooterCode(Info, AutoGenC, AutoGenH):
|
|||||||
def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, StringIdf, IdfGenCFlag, IdfGenBinBuffer):
|
def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, StringIdf, IdfGenCFlag, IdfGenBinBuffer):
|
||||||
CreateHeaderCode(Info, AutoGenC, AutoGenH)
|
CreateHeaderCode(Info, AutoGenC, AutoGenH)
|
||||||
|
|
||||||
if Info.AutoGenVersion >= 0x00010005:
|
CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)
|
||||||
CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)
|
CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)
|
||||||
CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)
|
CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)
|
||||||
CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)
|
CreatePcdCode(Info, AutoGenC, AutoGenH)
|
||||||
CreatePcdCode(Info, AutoGenC, AutoGenH)
|
CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)
|
||||||
CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)
|
CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)
|
||||||
CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)
|
CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)
|
||||||
CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)
|
CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)
|
||||||
CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)
|
|
||||||
|
|
||||||
if Info.UnicodeFileList:
|
if Info.UnicodeFileList:
|
||||||
FileName = "%sStrDefs.h" % Info.Name
|
FileName = "%sStrDefs.h" % Info.Name
|
||||||
@ -2112,10 +2094,6 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer,
|
|||||||
|
|
||||||
CreateFooterCode(Info, AutoGenC, AutoGenH)
|
CreateFooterCode(Info, AutoGenC, AutoGenH)
|
||||||
|
|
||||||
# no generation of AutoGen.c for Edk modules without unicode file
|
|
||||||
if Info.AutoGenVersion < 0x00010005 and len(Info.UnicodeFileList) == 0:
|
|
||||||
AutoGenC.String = ''
|
|
||||||
|
|
||||||
## Create the code file
|
## Create the code file
|
||||||
#
|
#
|
||||||
# @param FilePath The path of code file
|
# @param FilePath The path of code file
|
||||||
|
@ -476,18 +476,11 @@ cleanlib:
|
|||||||
else:
|
else:
|
||||||
ModuleEntryPoint = "_ModuleEntryPoint"
|
ModuleEntryPoint = "_ModuleEntryPoint"
|
||||||
|
|
||||||
# Intel EBC compiler enforces EfiMain
|
ArchEntryPoint = ModuleEntryPoint
|
||||||
if MyAgo.AutoGenVersion < 0x00010005 and MyAgo.Arch == "EBC":
|
|
||||||
ArchEntryPoint = "EfiMain"
|
|
||||||
else:
|
|
||||||
ArchEntryPoint = ModuleEntryPoint
|
|
||||||
|
|
||||||
if MyAgo.Arch == "EBC":
|
if MyAgo.Arch == "EBC":
|
||||||
# EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules
|
# EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules
|
||||||
ImageEntryPoint = "EfiStart"
|
ImageEntryPoint = "EfiStart"
|
||||||
elif MyAgo.AutoGenVersion < 0x00010005:
|
|
||||||
# Edk modules use entry point specified in INF file
|
|
||||||
ImageEntryPoint = ModuleEntryPoint
|
|
||||||
else:
|
else:
|
||||||
# EdkII modules always use "_ModuleEntryPoint" as entry point
|
# EdkII modules always use "_ModuleEntryPoint" as entry point
|
||||||
ImageEntryPoint = "_ModuleEntryPoint"
|
ImageEntryPoint = "_ModuleEntryPoint"
|
||||||
@ -625,11 +618,6 @@ cleanlib:
|
|||||||
False
|
False
|
||||||
)
|
)
|
||||||
|
|
||||||
# Edk modules need <BaseName>StrDefs.h for string ID
|
|
||||||
#if MyAgo.AutoGenVersion < 0x00010005 and len(MyAgo.UnicodeFileList) > 0:
|
|
||||||
# BcTargetList = ['strdefs']
|
|
||||||
#else:
|
|
||||||
# BcTargetList = []
|
|
||||||
BcTargetList = []
|
BcTargetList = []
|
||||||
|
|
||||||
MakefileName = self._FILE_NAME_[self._FileType]
|
MakefileName = self._FILE_NAME_[self._FileType]
|
||||||
@ -1537,13 +1525,9 @@ class TopLevelMakefile(BuildFile):
|
|||||||
if MyAgo.FdfFile is not None and MyAgo.FdfFile != "":
|
if MyAgo.FdfFile is not None and MyAgo.FdfFile != "":
|
||||||
FdfFileList = [MyAgo.FdfFile]
|
FdfFileList = [MyAgo.FdfFile]
|
||||||
# macros passed to GenFds
|
# macros passed to GenFds
|
||||||
MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))
|
|
||||||
MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\')))
|
|
||||||
MacroDict = {}
|
MacroDict = {}
|
||||||
MacroDict.update(GlobalData.gGlobalDefines)
|
MacroDict.update(GlobalData.gGlobalDefines)
|
||||||
MacroDict.update(GlobalData.gCommandLineDefines)
|
MacroDict.update(GlobalData.gCommandLineDefines)
|
||||||
MacroDict.pop("EFI_SOURCE", "dummy")
|
|
||||||
MacroDict.pop("EDK_SOURCE", "dummy")
|
|
||||||
for MacroName in MacroDict:
|
for MacroName in MacroDict:
|
||||||
if MacroDict[MacroName] != "":
|
if MacroDict[MacroName] != "":
|
||||||
MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\')))
|
MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\')))
|
||||||
|
@ -47,8 +47,6 @@ TAB_PCD_CLEAN_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64}
|
|||||||
TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}
|
TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}
|
||||||
TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN', TAB_VOID}
|
TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN', TAB_VOID}
|
||||||
|
|
||||||
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
|
|
||||||
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
|
|
||||||
TAB_WORKSPACE = '$(WORKSPACE)'
|
TAB_WORKSPACE = '$(WORKSPACE)'
|
||||||
TAB_FV_DIRECTORY = 'FV'
|
TAB_FV_DIRECTORY = 'FV'
|
||||||
|
|
||||||
|
@ -13,13 +13,7 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
gIsWindows = None
|
gIsWindows = None
|
||||||
|
|
||||||
gEdkCompatibilityPkg = "EdkCompatibilityPkg"
|
|
||||||
gWorkspace = "."
|
gWorkspace = "."
|
||||||
gEdkSource = "EdkCompatibilityPkg"
|
|
||||||
gEfiSource = "."
|
|
||||||
gEcpSource = "EdkCompatibilityPkg"
|
|
||||||
|
|
||||||
gOptions = None
|
gOptions = None
|
||||||
gCaseInsensitive = False
|
gCaseInsensitive = False
|
||||||
gAllFiles = None
|
gAllFiles = None
|
||||||
|
@ -18,7 +18,7 @@ from types import *
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from CommonDataClass.DataClass import *
|
from CommonDataClass.DataClass import *
|
||||||
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject
|
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject
|
||||||
from Common.GlobalData import gGlobalDefines, gEcpSource
|
from Common.GlobalData import gGlobalDefines
|
||||||
from re import compile
|
from re import compile
|
||||||
|
|
||||||
## Platform build information from DEC file
|
## Platform build information from DEC file
|
||||||
@ -300,7 +300,6 @@ class DecBuildData(PackageBuildClassObject):
|
|||||||
PublicInclues = []
|
PublicInclues = []
|
||||||
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]
|
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]
|
||||||
Macros = self._Macros
|
Macros = self._Macros
|
||||||
Macros["EDK_SOURCE"] = gEcpSource
|
|
||||||
for Record in RecordList:
|
for Record in RecordList:
|
||||||
File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)
|
File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)
|
||||||
LineNo = Record[-1]
|
LineNo = Record[-1]
|
||||||
|
@ -715,7 +715,6 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
self._Modules = OrderedDict()
|
self._Modules = OrderedDict()
|
||||||
RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
|
RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
|
||||||
Macros = self._Macros
|
Macros = self._Macros
|
||||||
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
|
|
||||||
for Record in RecordList:
|
for Record in RecordList:
|
||||||
DuplicatedFile = False
|
DuplicatedFile = False
|
||||||
|
|
||||||
@ -858,8 +857,6 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
continue
|
continue
|
||||||
self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance
|
self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance
|
||||||
|
|
||||||
# for Edk style library instances, which are listed in different section
|
|
||||||
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
|
|
||||||
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]
|
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]
|
||||||
for Record in RecordList:
|
for Record in RecordList:
|
||||||
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
|
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
|
||||||
|
@ -145,10 +145,6 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
@cached_property
|
@cached_property
|
||||||
def _Macros(self):
|
def _Macros(self):
|
||||||
RetVal = {}
|
RetVal = {}
|
||||||
# EDK_GLOBAL defined macros can be applied to EDK module
|
|
||||||
if self.AutoGenVersion < 0x00010005:
|
|
||||||
RetVal.update(GlobalData.gEdkGlobal)
|
|
||||||
RetVal.update(GlobalData.gGlobalDefines)
|
|
||||||
return RetVal
|
return RetVal
|
||||||
|
|
||||||
## Get architecture
|
## Get architecture
|
||||||
@ -246,106 +242,50 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
#
|
#
|
||||||
# Retrieve information in sections specific to Edk.x modules
|
# Retrieve information in sections specific to Edk.x modules
|
||||||
#
|
#
|
||||||
if self.AutoGenVersion >= 0x00010005:
|
if not self._ModuleType:
|
||||||
if not self._ModuleType:
|
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
||||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
"MODULE_TYPE is not given", File=self.MetaFile)
|
||||||
"MODULE_TYPE is not given", File=self.MetaFile)
|
if self._ModuleType not in SUP_MODULE_LIST:
|
||||||
if self._ModuleType not in SUP_MODULE_LIST:
|
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
|
||||||
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
|
for Record in RecordList:
|
||||||
for Record in RecordList:
|
Name = Record[1]
|
||||||
Name = Record[1]
|
if Name == "MODULE_TYPE":
|
||||||
if Name == "MODULE_TYPE":
|
LineNo = Record[6]
|
||||||
LineNo = Record[6]
|
break
|
||||||
break
|
EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
|
"MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),
|
||||||
"MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),
|
File=self.MetaFile, Line=LineNo)
|
||||||
File=self.MetaFile, Line=LineNo)
|
if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
|
||||||
if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
|
if self._ModuleType == SUP_MODULE_SMM_CORE:
|
||||||
if self._ModuleType == SUP_MODULE_SMM_CORE:
|
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
|
if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
|
||||||
if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
|
if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
|
||||||
if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
|
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
|
if self._ModuleType == SUP_MODULE_MM_STANDALONE:
|
||||||
if self._ModuleType == SUP_MODULE_MM_STANDALONE:
|
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
|
if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
|
||||||
if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
|
and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:
|
||||||
and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:
|
self._BuildType = 'UEFI_OPTIONROM'
|
||||||
self._BuildType = 'UEFI_OPTIONROM'
|
if 'PCI_COMPRESS' in self._Defs:
|
||||||
if 'PCI_COMPRESS' in self._Defs:
|
if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
|
||||||
if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
|
EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)
|
||||||
EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)
|
|
||||||
|
|
||||||
elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
|
elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
|
||||||
and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
|
and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
|
||||||
self._BuildType = 'UEFI_HII'
|
self._BuildType = 'UEFI_HII'
|
||||||
else:
|
|
||||||
self._BuildType = self._ModuleType.upper()
|
|
||||||
|
|
||||||
if self._DxsFile:
|
|
||||||
File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)
|
|
||||||
# check the file validation
|
|
||||||
ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
|
|
||||||
if ErrorCode != 0:
|
|
||||||
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
|
|
||||||
File=self.MetaFile, Line=LineNo)
|
|
||||||
if not self._DependencyFileList:
|
|
||||||
self._DependencyFileList = []
|
|
||||||
self._DependencyFileList.append(File)
|
|
||||||
else:
|
else:
|
||||||
if not self._ComponentType:
|
self._BuildType = self._ModuleType.upper()
|
||||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
|
||||||
"COMPONENT_TYPE is not given", File=self.MetaFile)
|
|
||||||
self._BuildType = self._ComponentType.upper()
|
|
||||||
if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:
|
|
||||||
self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]
|
|
||||||
if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY:
|
|
||||||
self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
|
|
||||||
# make use some [nmake] section macros
|
|
||||||
Macros = self._Macros
|
|
||||||
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
|
|
||||||
Macros['PROCESSOR'] = self._Arch
|
|
||||||
RecordList = self._RawData[MODEL_META_DATA_NMAKE, self._Arch, self._Platform]
|
|
||||||
for Name, Value, Dummy, Arch, Platform, ID, LineNo in RecordList:
|
|
||||||
Value = ReplaceMacro(Value, Macros, True)
|
|
||||||
if Name == "IMAGE_ENTRY_POINT":
|
|
||||||
if self._ModuleEntryPointList is None:
|
|
||||||
self._ModuleEntryPointList = []
|
|
||||||
self._ModuleEntryPointList.append(Value)
|
|
||||||
elif Name == "DPX_SOURCE":
|
|
||||||
File = PathClass(NormPath(Value), self._ModuleDir, Arch=self._Arch)
|
|
||||||
# check the file validation
|
|
||||||
ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
|
|
||||||
if ErrorCode != 0:
|
|
||||||
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
|
|
||||||
File=self.MetaFile, Line=LineNo)
|
|
||||||
if not self._DependencyFileList:
|
|
||||||
self._DependencyFileList = []
|
|
||||||
self._DependencyFileList.append(File)
|
|
||||||
else:
|
|
||||||
ToolList = self._NMAKE_FLAG_PATTERN_.findall(Name)
|
|
||||||
if len(ToolList) == 1:
|
|
||||||
if self._BuildOptions is None:
|
|
||||||
self._BuildOptions = OrderedDict()
|
|
||||||
|
|
||||||
if ToolList[0] in self._TOOL_CODE_:
|
if self._DxsFile:
|
||||||
Tool = self._TOOL_CODE_[ToolList[0]]
|
File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)
|
||||||
else:
|
# check the file validation
|
||||||
Tool = ToolList[0]
|
ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
|
||||||
ToolChain = "*_*_*_%s_FLAGS" % Tool
|
if ErrorCode != 0:
|
||||||
# Edk.x only support MSFT tool chain
|
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
|
||||||
# ignore not replaced macros in value
|
File=self.MetaFile, Line=LineNo)
|
||||||
ValueList = GetSplitList(' ' + Value, '/D')
|
if not self._DependencyFileList:
|
||||||
Dummy = ValueList[0]
|
self._DependencyFileList = []
|
||||||
for Index in range(1, len(ValueList)):
|
self._DependencyFileList.append(File)
|
||||||
if ValueList[Index][-1] == '=' or ValueList[Index] == '':
|
|
||||||
continue
|
|
||||||
Dummy = Dummy + ' /D ' + ValueList[Index]
|
|
||||||
Value = Dummy.strip()
|
|
||||||
if (TAB_COMPILER_MSFT, ToolChain) not in self._BuildOptions:
|
|
||||||
self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = Value
|
|
||||||
else:
|
|
||||||
OptionString = self._BuildOptions[TAB_COMPILER_MSFT, ToolChain]
|
|
||||||
self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = OptionString + " " + Value
|
|
||||||
|
|
||||||
## Retrieve file version
|
## Retrieve file version
|
||||||
@cached_property
|
@cached_property
|
||||||
@ -524,7 +464,6 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
RetVal = []
|
RetVal = []
|
||||||
RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]
|
RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]
|
||||||
Macros = self._Macros
|
Macros = self._Macros
|
||||||
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
|
|
||||||
Macros['PROCESSOR'] = self._Arch
|
Macros['PROCESSOR'] = self._Arch
|
||||||
for Record in RecordList:
|
for Record in RecordList:
|
||||||
FileType = Record[0]
|
FileType = Record[0]
|
||||||
@ -572,31 +511,13 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
ToolChainFamily = Record[1]
|
ToolChainFamily = Record[1]
|
||||||
TagName = Record[2]
|
TagName = Record[2]
|
||||||
ToolCode = Record[3]
|
ToolCode = Record[3]
|
||||||
if self.AutoGenVersion < 0x00010005:
|
|
||||||
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
|
File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',
|
||||||
Macros['PROCESSOR'] = self._Arch
|
'', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
|
||||||
SourceFile = NormPath(Record[0], Macros)
|
# check the file validation
|
||||||
if SourceFile[0] == os.path.sep:
|
ErrorCode, ErrorInfo = File.Validate()
|
||||||
SourceFile = mws.join(GlobalData.gWorkspace, SourceFile[1:])
|
if ErrorCode != 0:
|
||||||
# old module source files (Edk)
|
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
|
||||||
File = PathClass(SourceFile, self._ModuleDir, self._SourceOverridePath,
|
|
||||||
'', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
|
|
||||||
# check the file validation
|
|
||||||
ErrorCode, ErrorInfo = File.Validate(CaseSensitive=False)
|
|
||||||
if ErrorCode != 0:
|
|
||||||
if File.Ext.lower() == '.h':
|
|
||||||
EdkLogger.warn('build', 'Include file not found', ExtraData=ErrorInfo,
|
|
||||||
File=self.MetaFile, Line=LineNo)
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
EdkLogger.error('build', ErrorCode, ExtraData=File, File=self.MetaFile, Line=LineNo)
|
|
||||||
else:
|
|
||||||
File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',
|
|
||||||
'', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
|
|
||||||
# check the file validation
|
|
||||||
ErrorCode, ErrorInfo = File.Validate()
|
|
||||||
if ErrorCode != 0:
|
|
||||||
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
|
|
||||||
|
|
||||||
RetVal.append(File)
|
RetVal.append(File)
|
||||||
# add any previously found dependency files to the source list
|
# add any previously found dependency files to the source list
|
||||||
@ -716,7 +637,6 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
|
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
|
||||||
for Record in RecordList:
|
for Record in RecordList:
|
||||||
if Record[0].find('EDK_SOURCE') > -1:
|
if Record[0].find('EDK_SOURCE') > -1:
|
||||||
Macros['EDK_SOURCE'] = GlobalData.gEcpSource
|
|
||||||
File = NormPath(Record[0], self._Macros)
|
File = NormPath(Record[0], self._Macros)
|
||||||
if File[0] == '.':
|
if File[0] == '.':
|
||||||
File = os.path.join(self._ModuleDir, File)
|
File = os.path.join(self._ModuleDir, File)
|
||||||
@ -727,7 +647,6 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
RetVal.append(File)
|
RetVal.append(File)
|
||||||
|
|
||||||
# TRICK: let compiler to choose correct header file
|
# TRICK: let compiler to choose correct header file
|
||||||
Macros['EDK_SOURCE'] = GlobalData.gEdkSource
|
|
||||||
File = NormPath(Record[0], self._Macros)
|
File = NormPath(Record[0], self._Macros)
|
||||||
if File[0] == '.':
|
if File[0] == '.':
|
||||||
File = os.path.join(self._ModuleDir, File)
|
File = os.path.join(self._ModuleDir, File)
|
||||||
@ -745,17 +664,6 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
File = RealPath(os.path.normpath(File))
|
File = RealPath(os.path.normpath(File))
|
||||||
if File:
|
if File:
|
||||||
RetVal.append(File)
|
RetVal.append(File)
|
||||||
if not File and Record[0].find('EFI_SOURCE') > -1:
|
|
||||||
# tricky to regard WorkSpace as EFI_SOURCE
|
|
||||||
Macros['EFI_SOURCE'] = GlobalData.gWorkspace
|
|
||||||
File = NormPath(Record[0], Macros)
|
|
||||||
if File[0] == '.':
|
|
||||||
File = os.path.join(self._ModuleDir, File)
|
|
||||||
else:
|
|
||||||
File = os.path.join(GlobalData.gWorkspace, File)
|
|
||||||
File = RealPath(os.path.normpath(File))
|
|
||||||
if File:
|
|
||||||
RetVal.append(File)
|
|
||||||
return RetVal
|
return RetVal
|
||||||
|
|
||||||
## Retrieve packages this module depends on
|
## Retrieve packages this module depends on
|
||||||
@ -764,7 +672,6 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
RetVal = []
|
RetVal = []
|
||||||
RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]
|
RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]
|
||||||
Macros = self._Macros
|
Macros = self._Macros
|
||||||
Macros['EDK_SOURCE'] = GlobalData.gEcpSource
|
|
||||||
for Record in RecordList:
|
for Record in RecordList:
|
||||||
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
|
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
|
||||||
# check the file validation
|
# check the file validation
|
||||||
|
@ -686,18 +686,6 @@ class InfParser(MetaFileParser):
|
|||||||
Value = self._ValueList[Index]
|
Value = self._ValueList[Index]
|
||||||
if not Value:
|
if not Value:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1:
|
|
||||||
Value = '$(EDK_SOURCE)' + Value[17:]
|
|
||||||
if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1:
|
|
||||||
pass
|
|
||||||
elif Value.startswith('.'):
|
|
||||||
pass
|
|
||||||
elif Value.startswith('$('):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
Value = '$(EFI_SOURCE)/' + Value
|
|
||||||
|
|
||||||
self._ValueList[Index] = ReplaceMacro(Value, Macros)
|
self._ValueList[Index] = ReplaceMacro(Value, Macros)
|
||||||
|
|
||||||
## Parse [Sources] section
|
## Parse [Sources] section
|
||||||
@ -1600,16 +1588,6 @@ class DscParser(MetaFileParser):
|
|||||||
# Allow using system environment variables in path after !include
|
# Allow using system environment variables in path after !include
|
||||||
#
|
#
|
||||||
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
|
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
|
||||||
if "ECP_SOURCE" in GlobalData.gGlobalDefines:
|
|
||||||
__IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']
|
|
||||||
#
|
|
||||||
# During GenFds phase call DSC parser, will go into this branch.
|
|
||||||
#
|
|
||||||
elif "ECP_SOURCE" in GlobalData.gCommandLineDefines:
|
|
||||||
__IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']
|
|
||||||
|
|
||||||
__IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']
|
|
||||||
__IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE']
|
|
||||||
#
|
#
|
||||||
# Allow using MACROs comes from [Defines] section to keep compatible.
|
# Allow using MACROs comes from [Defines] section to keep compatible.
|
||||||
#
|
#
|
||||||
|
@ -90,10 +90,7 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain, additionalP
|
|||||||
# @retval: List of dependent libraries which are InfBuildData instances
|
# @retval: List of dependent libraries which are InfBuildData instances
|
||||||
#
|
#
|
||||||
def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):
|
def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):
|
||||||
if Module.AutoGenVersion >= 0x00010005:
|
return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)
|
||||||
return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)
|
|
||||||
else:
|
|
||||||
return _ResolveLibraryReference(Module, Platform)
|
|
||||||
|
|
||||||
def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain, FileName = '', EdkLogger = None):
|
def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain, FileName = '', EdkLogger = None):
|
||||||
ModuleType = Module.ModuleType
|
ModuleType = Module.ModuleType
|
||||||
@ -255,27 +252,3 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||||||
#
|
#
|
||||||
SortedLibraryList.reverse()
|
SortedLibraryList.reverse()
|
||||||
return SortedLibraryList
|
return SortedLibraryList
|
||||||
|
|
||||||
def _ResolveLibraryReference(Module, Platform):
|
|
||||||
LibraryConsumerList = [Module]
|
|
||||||
|
|
||||||
# "CompilerStub" is a must for Edk modules
|
|
||||||
if Module.Libraries:
|
|
||||||
Module.Libraries.append("CompilerStub")
|
|
||||||
LibraryList = []
|
|
||||||
while len(LibraryConsumerList) > 0:
|
|
||||||
M = LibraryConsumerList.pop()
|
|
||||||
for LibraryName in M.Libraries:
|
|
||||||
Library = Platform.LibraryClasses[LibraryName, ':dummy:']
|
|
||||||
if Library is None:
|
|
||||||
for Key in Platform.LibraryClasses.data:
|
|
||||||
if LibraryName.upper() == Key.upper():
|
|
||||||
Library = Platform.LibraryClasses[Key, ':dummy:']
|
|
||||||
break
|
|
||||||
if Library is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if Library not in LibraryList:
|
|
||||||
LibraryList.append(Library)
|
|
||||||
LibraryConsumerList.append(Library)
|
|
||||||
return LibraryList
|
|
||||||
|
@ -332,10 +332,6 @@ class LibraryReport(object):
|
|||||||
#
|
#
|
||||||
def __init__(self, M):
|
def __init__(self, M):
|
||||||
self.LibraryList = []
|
self.LibraryList = []
|
||||||
if int(str(M.AutoGenVersion), 0) >= 0x00010005:
|
|
||||||
self._EdkIIModule = True
|
|
||||||
else:
|
|
||||||
self._EdkIIModule = False
|
|
||||||
|
|
||||||
for Lib in M.DependentLibraryList:
|
for Lib in M.DependentLibraryList:
|
||||||
LibInfPath = str(Lib)
|
LibInfPath = str(Lib)
|
||||||
@ -368,28 +364,23 @@ class LibraryReport(object):
|
|||||||
LibInfPath = LibraryItem[0]
|
LibInfPath = LibraryItem[0]
|
||||||
FileWrite(File, LibInfPath)
|
FileWrite(File, LibInfPath)
|
||||||
|
|
||||||
#
|
LibClass = LibraryItem[1]
|
||||||
# Report library class, library constructor and destructor for
|
EdkIILibInfo = ""
|
||||||
# EDKII style module.
|
LibConstructor = " ".join(LibraryItem[2])
|
||||||
#
|
if LibConstructor:
|
||||||
if self._EdkIIModule:
|
EdkIILibInfo += " C = " + LibConstructor
|
||||||
LibClass = LibraryItem[1]
|
LibDestructor = " ".join(LibraryItem[3])
|
||||||
EdkIILibInfo = ""
|
if LibDestructor:
|
||||||
LibConstructor = " ".join(LibraryItem[2])
|
EdkIILibInfo += " D = " + LibDestructor
|
||||||
if LibConstructor:
|
LibDepex = " ".join(LibraryItem[4])
|
||||||
EdkIILibInfo += " C = " + LibConstructor
|
if LibDepex:
|
||||||
LibDestructor = " ".join(LibraryItem[3])
|
EdkIILibInfo += " Depex = " + LibDepex
|
||||||
if LibDestructor:
|
if LibraryItem[5]:
|
||||||
EdkIILibInfo += " D = " + LibDestructor
|
EdkIILibInfo += " Time = " + LibraryItem[5]
|
||||||
LibDepex = " ".join(LibraryItem[4])
|
if EdkIILibInfo:
|
||||||
if LibDepex:
|
FileWrite(File, "{%s: %s}" % (LibClass, EdkIILibInfo))
|
||||||
EdkIILibInfo += " Depex = " + LibDepex
|
else:
|
||||||
if LibraryItem[5]:
|
FileWrite(File, "{%s}" % LibClass)
|
||||||
EdkIILibInfo += " Time = " + LibraryItem[5]
|
|
||||||
if EdkIILibInfo:
|
|
||||||
FileWrite(File, "{%s: %s}" % (LibClass, EdkIILibInfo))
|
|
||||||
else:
|
|
||||||
FileWrite(File, "{%s}" % LibClass)
|
|
||||||
|
|
||||||
FileWrite(File, gSubSectionEnd)
|
FileWrite(File, gSubSectionEnd)
|
||||||
|
|
||||||
@ -1546,15 +1537,8 @@ class PredictionReport(object):
|
|||||||
|
|
||||||
if Module.Guid and not Module.IsLibrary:
|
if Module.Guid and not Module.IsLibrary:
|
||||||
EntryPoint = " ".join(Module.Module.ModuleEntryPointList)
|
EntryPoint = " ".join(Module.Module.ModuleEntryPointList)
|
||||||
if int(str(Module.AutoGenVersion), 0) >= 0x00010005:
|
|
||||||
RealEntryPoint = "_ModuleEntryPoint"
|
RealEntryPoint = "_ModuleEntryPoint"
|
||||||
else:
|
|
||||||
RealEntryPoint = EntryPoint
|
|
||||||
if EntryPoint == "_ModuleEntryPoint":
|
|
||||||
CCFlags = Module.BuildOption.get("CC", {}).get("FLAGS", "")
|
|
||||||
Match = gGlueLibEntryPoint.search(CCFlags)
|
|
||||||
if Match:
|
|
||||||
EntryPoint = Match.group(1)
|
|
||||||
|
|
||||||
self._FfsEntryPoint[Module.Guid.upper()] = (EntryPoint, RealEntryPoint)
|
self._FfsEntryPoint[Module.Guid.upper()] = (EntryPoint, RealEntryPoint)
|
||||||
|
|
||||||
|
@ -122,65 +122,9 @@ def CheckEnvVariable():
|
|||||||
elif ' ' in Path:
|
elif ' ' in Path:
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path)
|
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path)
|
||||||
|
|
||||||
#
|
|
||||||
# Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP
|
|
||||||
#
|
|
||||||
if "ECP_SOURCE" not in os.environ:
|
|
||||||
os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
|
|
||||||
if "EFI_SOURCE" not in os.environ:
|
|
||||||
os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]
|
|
||||||
if "EDK_SOURCE" not in os.environ:
|
|
||||||
os.environ["EDK_SOURCE"] = os.environ["ECP_SOURCE"]
|
|
||||||
|
|
||||||
#
|
|
||||||
# Unify case of characters on case-insensitive systems
|
|
||||||
#
|
|
||||||
EfiSourceDir = os.path.normcase(os.path.normpath(os.environ["EFI_SOURCE"]))
|
|
||||||
EdkSourceDir = os.path.normcase(os.path.normpath(os.environ["EDK_SOURCE"]))
|
|
||||||
EcpSourceDir = os.path.normcase(os.path.normpath(os.environ["ECP_SOURCE"]))
|
|
||||||
|
|
||||||
os.environ["EFI_SOURCE"] = EfiSourceDir
|
|
||||||
os.environ["EDK_SOURCE"] = EdkSourceDir
|
|
||||||
os.environ["ECP_SOURCE"] = EcpSourceDir
|
|
||||||
os.environ["EDK_TOOLS_PATH"] = os.path.normcase(os.environ["EDK_TOOLS_PATH"])
|
os.environ["EDK_TOOLS_PATH"] = os.path.normcase(os.environ["EDK_TOOLS_PATH"])
|
||||||
|
|
||||||
if not os.path.exists(EcpSourceDir):
|
|
||||||
EdkLogger.verbose("ECP_SOURCE = %s doesn't exist. Edk modules could not be built." % EcpSourceDir)
|
|
||||||
elif ' ' in EcpSourceDir:
|
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in ECP_SOURCE path",
|
|
||||||
ExtraData=EcpSourceDir)
|
|
||||||
if not os.path.exists(EdkSourceDir):
|
|
||||||
if EdkSourceDir == EcpSourceDir:
|
|
||||||
EdkLogger.verbose("EDK_SOURCE = %s doesn't exist. Edk modules could not be built." % EdkSourceDir)
|
|
||||||
else:
|
|
||||||
EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE does not exist",
|
|
||||||
ExtraData=EdkSourceDir)
|
|
||||||
elif ' ' in EdkSourceDir:
|
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in EDK_SOURCE path",
|
|
||||||
ExtraData=EdkSourceDir)
|
|
||||||
if not os.path.exists(EfiSourceDir):
|
|
||||||
if EfiSourceDir == EcpSourceDir:
|
|
||||||
EdkLogger.verbose("EFI_SOURCE = %s doesn't exist. Edk modules could not be built." % EfiSourceDir)
|
|
||||||
else:
|
|
||||||
EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE does not exist",
|
|
||||||
ExtraData=EfiSourceDir)
|
|
||||||
elif ' ' in EfiSourceDir:
|
|
||||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in EFI_SOURCE path",
|
|
||||||
ExtraData=EfiSourceDir)
|
|
||||||
|
|
||||||
# check those variables on single workspace case
|
|
||||||
if not PackagesPath:
|
|
||||||
# change absolute path to relative path to WORKSPACE
|
|
||||||
if EfiSourceDir.upper().find(WorkspaceDir.upper()) != 0:
|
|
||||||
EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE is not under WORKSPACE",
|
|
||||||
ExtraData="WORKSPACE = %s\n EFI_SOURCE = %s" % (WorkspaceDir, EfiSourceDir))
|
|
||||||
if EdkSourceDir.upper().find(WorkspaceDir.upper()) != 0:
|
|
||||||
EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE is not under WORKSPACE",
|
|
||||||
ExtraData="WORKSPACE = %s\n EDK_SOURCE = %s" % (WorkspaceDir, EdkSourceDir))
|
|
||||||
if EcpSourceDir.upper().find(WorkspaceDir.upper()) != 0:
|
|
||||||
EdkLogger.error("build", PARAMETER_INVALID, "ECP_SOURCE is not under WORKSPACE",
|
|
||||||
ExtraData="WORKSPACE = %s\n ECP_SOURCE = %s" % (WorkspaceDir, EcpSourceDir))
|
|
||||||
|
|
||||||
# check EDK_TOOLS_PATH
|
# check EDK_TOOLS_PATH
|
||||||
if "EDK_TOOLS_PATH" not in os.environ:
|
if "EDK_TOOLS_PATH" not in os.environ:
|
||||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
|
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
|
||||||
@ -192,14 +136,8 @@ def CheckEnvVariable():
|
|||||||
ExtraData="PATH")
|
ExtraData="PATH")
|
||||||
|
|
||||||
GlobalData.gWorkspace = WorkspaceDir
|
GlobalData.gWorkspace = WorkspaceDir
|
||||||
GlobalData.gEfiSource = EfiSourceDir
|
|
||||||
GlobalData.gEdkSource = EdkSourceDir
|
|
||||||
GlobalData.gEcpSource = EcpSourceDir
|
|
||||||
|
|
||||||
GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir
|
GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir
|
||||||
GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir
|
|
||||||
GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir
|
|
||||||
GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir
|
|
||||||
GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]
|
GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]
|
||||||
|
|
||||||
## Get normalized file path
|
## Get normalized file path
|
||||||
@ -848,9 +786,6 @@ class Build():
|
|||||||
if "PACKAGES_PATH" in os.environ:
|
if "PACKAGES_PATH" in os.environ:
|
||||||
# WORKSPACE env has been converted before. Print the same path style with WORKSPACE env.
|
# WORKSPACE env has been converted before. Print the same path style with WORKSPACE env.
|
||||||
EdkLogger.quiet("%-16s = %s" % ("PACKAGES_PATH", os.path.normcase(os.path.normpath(os.environ["PACKAGES_PATH"]))))
|
EdkLogger.quiet("%-16s = %s" % ("PACKAGES_PATH", os.path.normcase(os.path.normpath(os.environ["PACKAGES_PATH"]))))
|
||||||
EdkLogger.quiet("%-16s = %s" % ("ECP_SOURCE", os.environ["ECP_SOURCE"]))
|
|
||||||
EdkLogger.quiet("%-16s = %s" % ("EDK_SOURCE", os.environ["EDK_SOURCE"]))
|
|
||||||
EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))
|
|
||||||
EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))
|
EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))
|
||||||
if "EDK_TOOLS_BIN" in os.environ:
|
if "EDK_TOOLS_BIN" in os.environ:
|
||||||
# Print the same path style with WORKSPACE env.
|
# Print the same path style with WORKSPACE env.
|
||||||
|
@ -42,11 +42,8 @@ if %WORKSPACE% == %CD% (
|
|||||||
|
|
||||||
:SetWorkSpace
|
:SetWorkSpace
|
||||||
@REM set new workspace
|
@REM set new workspace
|
||||||
@REM clear EFI_SOURCE and EDK_SOURCE for the new workspace
|
|
||||||
if not defined WORKSPACE (
|
if not defined WORKSPACE (
|
||||||
set WORKSPACE=%CD%
|
set WORKSPACE=%CD%
|
||||||
set EFI_SOURCE=
|
|
||||||
set EDK_SOURCE=
|
|
||||||
)
|
)
|
||||||
|
|
||||||
:ParseArgs
|
:ParseArgs
|
||||||
|
Reference in New Issue
Block a user