Pcd.MaxDatumSize = str(len(Value) - 1)\r
return Pcds.values()\r
\r
- ## Resolve library names to library modules\r
- #\r
- # (for Edk.x modules)\r
- #\r
- # @param Module The module from which the library names will be resolved\r
- #\r
- # @retval library_list The list of library modules\r
- #\r
- def ResolveLibraryReference(self, Module):\r
- EdkLogger.verbose("")\r
- EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), self.Arch))\r
- LibraryConsumerList = [Module]\r
-\r
- # "CompilerStub" is a must for Edk modules\r
- if Module.Libraries:\r
- Module.Libraries.append("CompilerStub")\r
- LibraryList = []\r
- while len(LibraryConsumerList) > 0:\r
- M = LibraryConsumerList.pop()\r
- for LibraryName in M.Libraries:\r
- Library = self.Platform.LibraryClasses[LibraryName, ':dummy:']\r
- if Library is None:\r
- for Key in self.Platform.LibraryClasses.data:\r
- if LibraryName.upper() == Key.upper():\r
- Library = self.Platform.LibraryClasses[Key, ':dummy:']\r
- break\r
- if Library is None:\r
- EdkLogger.warn("build", "Library [%s] is not found" % LibraryName, File=str(M),\r
- ExtraData="\t%s [%s]" % (str(Module), self.Arch))\r
- continue\r
\r
- if Library not in LibraryList:\r
- LibraryList.append(Library)\r
- LibraryConsumerList.append(Library)\r
- EdkLogger.verbose("\t" + LibraryName + " : " + str(Library) + ' ' + str(type(Library)))\r
- return LibraryList\r
\r
## Calculate the priority value of the build option\r
#\r
#\r
def ApplyBuildOption(self, Module):\r
# Get the different options for the different style module\r
- if Module.AutoGenVersion < 0x00010005:\r
- PlatformOptions = self.EdkBuildOption\r
- ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDK_NAME, Module.ModuleType)\r
- else:\r
- PlatformOptions = self.EdkIIBuildOption\r
- ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)\r
+ PlatformOptions = self.EdkIIBuildOption\r
+ ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)\r
ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)\r
ModuleOptions = self._ExpandBuildOption(Module.BuildOptions)\r
if Module in self.Platform.Modules:\r
else:\r
BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)\r
\r
- if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:\r
- #\r
- # Override UNI flag only for EDK module.\r
- #\r
- BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag\r
return BuildOptions, BuildRuleOrder\r
\r
#\r
# EDK II modules must not reference header files outside of the packages they depend on or\r
# within the module's directory tree. Report error if violation.\r
#\r
- if self.AutoGenVersion >= 0x00010005:\r
- for Path in IncPathList:\r
- if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):\r
- ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)\r
- EdkLogger.error("build",\r
- PARAMETER_INVALID,\r
- ExtraData=ErrMsg,\r
- File=str(self.MetaFile))\r
+ for Path in IncPathList:\r
+ if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):\r
+ ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)\r
+ EdkLogger.error("build",\r
+ PARAMETER_INVALID,\r
+ ExtraData=ErrMsg,\r
+ File=str(self.MetaFile))\r
RetVal += IncPathList\r
return RetVal\r
\r
continue\r
\r
# add the file path into search path list for file including\r
- if F.Dir not in self.IncludePathList and self.AutoGenVersion >= 0x00010005:\r
+ if F.Dir not in self.IncludePathList:\r
self.IncludePathList.insert(0, F.Dir)\r
RetVal.append(F)\r
\r
# only merge library classes and PCD for non-library module\r
if self.IsLibrary:\r
return []\r
- if self.AutoGenVersion < 0x00010005:\r
- return self.PlatformInfo.ResolveLibraryReference(self.Module)\r
return self.PlatformInfo.ApplyLibraryInstance(self.Module)\r
\r
## Get the list of PCDs from current module\r
@cached_property\r
def IncludePathList(self):\r
RetVal = []\r
- if self.AutoGenVersion < 0x00010005:\r
- for Inc in self.Module.Includes:\r
- if Inc not in RetVal:\r
- RetVal.append(Inc)\r
- # for Edk modules\r
- Inc = path.join(Inc, self.Arch.capitalize())\r
- if os.path.exists(Inc) and Inc not in RetVal:\r
- RetVal.append(Inc)\r
- # Edk module needs to put DEBUG_DIR at the end of search path and not to use SOURCE_DIR all the time\r
- RetVal.append(self.DebugDir)\r
- else:\r
- RetVal.append(self.MetaFile.Dir)\r
- RetVal.append(self.DebugDir)\r
+ RetVal.append(self.MetaFile.Dir)\r
+ RetVal.append(self.DebugDir)\r
\r
for Package in self.Module.Packages:\r
PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)\r
if self.IsAsBuiltInfCreated:\r
return\r
\r
- # Skip the following code for EDK I inf\r
- if self.AutoGenVersion < 0x00010005:\r
- return\r
-\r
# Skip the following code for libraries\r
if self.IsLibrary:\r
return\r
\r
for File in self.AutoGenFileList:\r
if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):\r
- #Ignore Edk AutoGen.c\r
- if self.AutoGenVersion < 0x00010005 and File.Name == 'AutoGen.c':\r
- continue\r
-\r
AutoGenList.append(str(File))\r
else:\r
IgoredAutoGenList.append(str(File))\r
\r
- # Skip the following code for EDK I inf\r
- if self.AutoGenVersion < 0x00010005:\r
- return\r
\r
for ModuleType in self.DepexList:\r
# Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module\r
# Get all files under [Sources] section in inf file for EDK-II module\r
EDK2Module = True\r
SrcList = [F for F in Info.SourceFileList]\r
- if Info.AutoGenVersion < 0x00010005:\r
- EDK2Module = False\r
- # Get all files under the module directory for EDK-I module\r
- Cwd = os.getcwd()\r
- os.chdir(Info.MetaFile.Dir)\r
- for Root, Dirs, Files in os.walk("."):\r
- if 'CVS' in Dirs:\r
- Dirs.remove('CVS')\r
- if '.svn' in Dirs:\r
- Dirs.remove('.svn')\r
- for File in Files:\r
- File = PathClass(os.path.join(Root, File), Info.MetaFile.Dir)\r
- if File in SrcList:\r
- continue\r
- SrcList.append(File)\r
- os.chdir(Cwd)\r
\r
if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1:\r
CompatibleMode = True\r
# header file Prologue\r
AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-', '_')}))\r
AutoGenH.Append(gAutoGenHCppPrologueString)\r
- if Info.AutoGenVersion >= 0x00010005:\r
- # header files includes\r
- if Info.ModuleType in gModuleTypeHeaderFile:\r
- AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])\r
- #\r
- # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h\r
- # As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.\r
- #\r
- if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:\r
- AutoGenH.Append("#include <Library/PcdLib.h>\n")\r
\r
- AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')\r
- AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')\r
+ # header files includes\r
+ if Info.ModuleType in gModuleTypeHeaderFile:\r
+ AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])\r
+ #\r
+ # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h\r
+ # As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.\r
+ #\r
+ if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:\r
+ AutoGenH.Append("#include <Library/PcdLib.h>\n")\r
+\r
+ AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')\r
+ AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')\r
\r
- if Info.IsLibrary:\r
- return\r
+ if Info.IsLibrary:\r
+ return\r
\r
- AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))\r
+ AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))\r
\r
if Info.IsLibrary:\r
return\r
# C file header\r
AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'}))\r
- if Info.AutoGenVersion >= 0x00010005:\r
- # C file header files includes\r
- if Info.ModuleType in gModuleTypeHeaderFile:\r
- for Inc in gModuleTypeHeaderFile[Info.ModuleType]:\r
- AutoGenC.Append("#include <%s>\n" % Inc)\r
- else:\r
- AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)\r
+ # C file header files includes\r
+ if Info.ModuleType in gModuleTypeHeaderFile:\r
+ for Inc in gModuleTypeHeaderFile[Info.ModuleType]:\r
+ AutoGenC.Append("#include <%s>\n" % Inc)\r
+ else:\r
+ AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)\r
\r
- #\r
- # Publish the CallerId Guid\r
- #\r
- AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))\r
- AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)\r
+ #\r
+ # Publish the CallerId Guid\r
+ #\r
+ AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))\r
+ AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)\r
\r
## Create common code for header file\r
#\r
def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, StringIdf, IdfGenCFlag, IdfGenBinBuffer):\r
CreateHeaderCode(Info, AutoGenC, AutoGenH)\r
\r
- if Info.AutoGenVersion >= 0x00010005:\r
- CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)\r
- CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)\r
- CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)\r
- CreatePcdCode(Info, AutoGenC, AutoGenH)\r
- CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)\r
- CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)\r
- CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)\r
- CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)\r
+ CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)\r
+ CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)\r
+ CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)\r
+ CreatePcdCode(Info, AutoGenC, AutoGenH)\r
+ CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)\r
+ CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)\r
+ CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)\r
+ CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)\r
\r
if Info.UnicodeFileList:\r
FileName = "%sStrDefs.h" % Info.Name\r
\r
CreateFooterCode(Info, AutoGenC, AutoGenH)\r
\r
- # no generation of AutoGen.c for Edk modules without unicode file\r
- if Info.AutoGenVersion < 0x00010005 and len(Info.UnicodeFileList) == 0:\r
- AutoGenC.String = ''\r
-\r
## Create the code file\r
#\r
# @param FilePath The path of code file\r
else:\r
ModuleEntryPoint = "_ModuleEntryPoint"\r
\r
- # Intel EBC compiler enforces EfiMain\r
- if MyAgo.AutoGenVersion < 0x00010005 and MyAgo.Arch == "EBC":\r
- ArchEntryPoint = "EfiMain"\r
- else:\r
- ArchEntryPoint = ModuleEntryPoint\r
+ ArchEntryPoint = ModuleEntryPoint\r
\r
if MyAgo.Arch == "EBC":\r
# EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules\r
ImageEntryPoint = "EfiStart"\r
- elif MyAgo.AutoGenVersion < 0x00010005:\r
- # Edk modules use entry point specified in INF file\r
- ImageEntryPoint = ModuleEntryPoint\r
else:\r
# EdkII modules always use "_ModuleEntryPoint" as entry point\r
ImageEntryPoint = "_ModuleEntryPoint"\r
False\r
)\r
\r
- # Edk modules need <BaseName>StrDefs.h for string ID\r
- #if MyAgo.AutoGenVersion < 0x00010005 and len(MyAgo.UnicodeFileList) > 0:\r
- # BcTargetList = ['strdefs']\r
- #else:\r
- # BcTargetList = []\r
BcTargetList = []\r
\r
MakefileName = self._FILE_NAME_[self._FileType]\r
if MyAgo.FdfFile is not None and MyAgo.FdfFile != "":\r
FdfFileList = [MyAgo.FdfFile]\r
# macros passed to GenFds\r
- MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))\r
- MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\')))\r
MacroDict = {}\r
MacroDict.update(GlobalData.gGlobalDefines)\r
MacroDict.update(GlobalData.gCommandLineDefines)\r
- MacroDict.pop("EFI_SOURCE", "dummy")\r
- MacroDict.pop("EDK_SOURCE", "dummy")\r
for MacroName in MacroDict:\r
if MacroDict[MacroName] != "":\r
MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\')))\r
TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}\r
TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN', TAB_VOID}\r
\r
-TAB_EDK_SOURCE = '$(EDK_SOURCE)'\r
-TAB_EFI_SOURCE = '$(EFI_SOURCE)'\r
TAB_WORKSPACE = '$(WORKSPACE)'\r
TAB_FV_DIRECTORY = 'FV'\r
\r
import re\r
\r
gIsWindows = None\r
-\r
-gEdkCompatibilityPkg = "EdkCompatibilityPkg"\r
gWorkspace = "."\r
-gEdkSource = "EdkCompatibilityPkg"\r
-gEfiSource = "."\r
-gEcpSource = "EdkCompatibilityPkg"\r
-\r
gOptions = None\r
gCaseInsensitive = False\r
gAllFiles = None\r
from collections import OrderedDict\r
from CommonDataClass.DataClass import *\r
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject\r
-from Common.GlobalData import gGlobalDefines, gEcpSource\r
+from Common.GlobalData import gGlobalDefines\r
from re import compile\r
\r
## Platform build information from DEC file\r
PublicInclues = []\r
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]\r
Macros = self._Macros\r
- Macros["EDK_SOURCE"] = gEcpSource\r
for Record in RecordList:\r
File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)\r
LineNo = Record[-1]\r
self._Modules = OrderedDict()\r
RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]\r
Macros = self._Macros\r
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
for Record in RecordList:\r
DuplicatedFile = False\r
\r
continue\r
self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance\r
\r
- # for Edk style library instances, which are listed in different section\r
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]\r
for Record in RecordList:\r
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)\r
@cached_property\r
def _Macros(self):\r
RetVal = {}\r
- # EDK_GLOBAL defined macros can be applied to EDK module\r
- if self.AutoGenVersion < 0x00010005:\r
- RetVal.update(GlobalData.gEdkGlobal)\r
- RetVal.update(GlobalData.gGlobalDefines)\r
return RetVal\r
\r
## Get architecture\r
#\r
# Retrieve information in sections specific to Edk.x modules\r
#\r
- if self.AutoGenVersion >= 0x00010005:\r
- if not self._ModuleType:\r
- EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
- "MODULE_TYPE is not given", File=self.MetaFile)\r
- if self._ModuleType not in SUP_MODULE_LIST:\r
- RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]\r
- for Record in RecordList:\r
- Name = Record[1]\r
- if Name == "MODULE_TYPE":\r
- LineNo = Record[6]\r
- break\r
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
- "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),\r
- File=self.MetaFile, Line=LineNo)\r
- if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):\r
- if self._ModuleType == SUP_MODULE_SMM_CORE:\r
- 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)\r
- if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):\r
- if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:\r
- 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)\r
- if self._ModuleType == SUP_MODULE_MM_STANDALONE:\r
- 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)\r
- if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
- and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:\r
- self._BuildType = 'UEFI_OPTIONROM'\r
- if 'PCI_COMPRESS' in self._Defs:\r
- if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):\r
- EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)\r
-\r
- elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
- and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':\r
- self._BuildType = 'UEFI_HII'\r
- else:\r
- self._BuildType = self._ModuleType.upper()\r
-\r
- if self._DxsFile:\r
- File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)\r
- # check the file validation\r
- ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)\r
- if ErrorCode != 0:\r
- EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,\r
- File=self.MetaFile, Line=LineNo)\r
- if not self._DependencyFileList:\r
- self._DependencyFileList = []\r
- self._DependencyFileList.append(File)\r
+ if not self._ModuleType:\r
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
+ "MODULE_TYPE is not given", File=self.MetaFile)\r
+ if self._ModuleType not in SUP_MODULE_LIST:\r
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]\r
+ for Record in RecordList:\r
+ Name = Record[1]\r
+ if Name == "MODULE_TYPE":\r
+ LineNo = Record[6]\r
+ break\r
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
+ "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),\r
+ File=self.MetaFile, Line=LineNo)\r
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):\r
+ if self._ModuleType == SUP_MODULE_SMM_CORE:\r
+ 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)\r
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):\r
+ if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:\r
+ 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)\r
+ if self._ModuleType == SUP_MODULE_MM_STANDALONE:\r
+ 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)\r
+ if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
+ and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:\r
+ self._BuildType = 'UEFI_OPTIONROM'\r
+ if 'PCI_COMPRESS' in self._Defs:\r
+ if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):\r
+ EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)\r
+\r
+ elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
+ and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':\r
+ self._BuildType = 'UEFI_HII'\r
else:\r
- if not self._ComponentType:\r
- EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
- "COMPONENT_TYPE is not given", File=self.MetaFile)\r
- self._BuildType = self._ComponentType.upper()\r
- if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:\r
- self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]\r
- if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY:\r
- self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]\r
- # make use some [nmake] section macros\r
- Macros = self._Macros\r
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
- Macros['PROCESSOR'] = self._Arch\r
- RecordList = self._RawData[MODEL_META_DATA_NMAKE, self._Arch, self._Platform]\r
- for Name, Value, Dummy, Arch, Platform, ID, LineNo in RecordList:\r
- Value = ReplaceMacro(Value, Macros, True)\r
- if Name == "IMAGE_ENTRY_POINT":\r
- if self._ModuleEntryPointList is None:\r
- self._ModuleEntryPointList = []\r
- self._ModuleEntryPointList.append(Value)\r
- elif Name == "DPX_SOURCE":\r
- File = PathClass(NormPath(Value), self._ModuleDir, Arch=self._Arch)\r
- # check the file validation\r
- ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)\r
- if ErrorCode != 0:\r
- EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,\r
- File=self.MetaFile, Line=LineNo)\r
- if not self._DependencyFileList:\r
- self._DependencyFileList = []\r
- self._DependencyFileList.append(File)\r
- else:\r
- ToolList = self._NMAKE_FLAG_PATTERN_.findall(Name)\r
- if len(ToolList) == 1:\r
- if self._BuildOptions is None:\r
- self._BuildOptions = OrderedDict()\r
+ self._BuildType = self._ModuleType.upper()\r
\r
- if ToolList[0] in self._TOOL_CODE_:\r
- Tool = self._TOOL_CODE_[ToolList[0]]\r
- else:\r
- Tool = ToolList[0]\r
- ToolChain = "*_*_*_%s_FLAGS" % Tool\r
- # Edk.x only support MSFT tool chain\r
- # ignore not replaced macros in value\r
- ValueList = GetSplitList(' ' + Value, '/D')\r
- Dummy = ValueList[0]\r
- for Index in range(1, len(ValueList)):\r
- if ValueList[Index][-1] == '=' or ValueList[Index] == '':\r
- continue\r
- Dummy = Dummy + ' /D ' + ValueList[Index]\r
- Value = Dummy.strip()\r
- if (TAB_COMPILER_MSFT, ToolChain) not in self._BuildOptions:\r
- self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = Value\r
- else:\r
- OptionString = self._BuildOptions[TAB_COMPILER_MSFT, ToolChain]\r
- self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = OptionString + " " + Value\r
+ if self._DxsFile:\r
+ File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)\r
+ # check the file validation\r
+ ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)\r
+ if ErrorCode != 0:\r
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,\r
+ File=self.MetaFile, Line=LineNo)\r
+ if not self._DependencyFileList:\r
+ self._DependencyFileList = []\r
+ self._DependencyFileList.append(File)\r
\r
## Retrieve file version\r
@cached_property\r
RetVal = []\r
RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]\r
Macros = self._Macros\r
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
Macros['PROCESSOR'] = self._Arch\r
for Record in RecordList:\r
FileType = Record[0]\r
ToolChainFamily = Record[1]\r
TagName = Record[2]\r
ToolCode = Record[3]\r
- if self.AutoGenVersion < 0x00010005:\r
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
- Macros['PROCESSOR'] = self._Arch\r
- SourceFile = NormPath(Record[0], Macros)\r
- if SourceFile[0] == os.path.sep:\r
- SourceFile = mws.join(GlobalData.gWorkspace, SourceFile[1:])\r
- # old module source files (Edk)\r
- File = PathClass(SourceFile, self._ModuleDir, self._SourceOverridePath,\r
- '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)\r
- # check the file validation\r
- ErrorCode, ErrorInfo = File.Validate(CaseSensitive=False)\r
- if ErrorCode != 0:\r
- if File.Ext.lower() == '.h':\r
- EdkLogger.warn('build', 'Include file not found', ExtraData=ErrorInfo,\r
- File=self.MetaFile, Line=LineNo)\r
- continue\r
- else:\r
- EdkLogger.error('build', ErrorCode, ExtraData=File, File=self.MetaFile, Line=LineNo)\r
- else:\r
- File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',\r
- '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)\r
- # check the file validation\r
- ErrorCode, ErrorInfo = File.Validate()\r
- if ErrorCode != 0:\r
- EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)\r
+\r
+ File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',\r
+ '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)\r
+ # check the file validation\r
+ ErrorCode, ErrorInfo = File.Validate()\r
+ if ErrorCode != 0:\r
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)\r
\r
RetVal.append(File)\r
# add any previously found dependency files to the source list\r
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]\r
for Record in RecordList:\r
if Record[0].find('EDK_SOURCE') > -1:\r
- Macros['EDK_SOURCE'] = GlobalData.gEcpSource\r
File = NormPath(Record[0], self._Macros)\r
if File[0] == '.':\r
File = os.path.join(self._ModuleDir, File)\r
RetVal.append(File)\r
\r
# TRICK: let compiler to choose correct header file\r
- Macros['EDK_SOURCE'] = GlobalData.gEdkSource\r
File = NormPath(Record[0], self._Macros)\r
if File[0] == '.':\r
File = os.path.join(self._ModuleDir, File)\r
File = RealPath(os.path.normpath(File))\r
if File:\r
RetVal.append(File)\r
- if not File and Record[0].find('EFI_SOURCE') > -1:\r
- # tricky to regard WorkSpace as EFI_SOURCE\r
- Macros['EFI_SOURCE'] = GlobalData.gWorkspace\r
- File = NormPath(Record[0], Macros)\r
- if File[0] == '.':\r
- File = os.path.join(self._ModuleDir, File)\r
- else:\r
- File = os.path.join(GlobalData.gWorkspace, File)\r
- File = RealPath(os.path.normpath(File))\r
- if File:\r
- RetVal.append(File)\r
return RetVal\r
\r
## Retrieve packages this module depends on\r
RetVal = []\r
RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]\r
Macros = self._Macros\r
- Macros['EDK_SOURCE'] = GlobalData.gEcpSource\r
for Record in RecordList:\r
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)\r
# check the file validation\r
Value = self._ValueList[Index]\r
if not Value:\r
continue\r
-\r
- if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1:\r
- Value = '$(EDK_SOURCE)' + Value[17:]\r
- if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1:\r
- pass\r
- elif Value.startswith('.'):\r
- pass\r
- elif Value.startswith('$('):\r
- pass\r
- else:\r
- Value = '$(EFI_SOURCE)/' + Value\r
-\r
self._ValueList[Index] = ReplaceMacro(Value, Macros)\r
\r
## Parse [Sources] section\r
# Allow using system environment variables in path after !include\r
#\r
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']\r
- if "ECP_SOURCE" in GlobalData.gGlobalDefines:\r
- __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']\r
- #\r
- # During GenFds phase call DSC parser, will go into this branch.\r
- #\r
- elif "ECP_SOURCE" in GlobalData.gCommandLineDefines:\r
- __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']\r
-\r
- __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']\r
- __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE']\r
#\r
# Allow using MACROs comes from [Defines] section to keep compatible.\r
#\r
# @retval: List of dependent libraries which are InfBuildData instances\r
#\r
def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):\r
- if Module.AutoGenVersion >= 0x00010005:\r
- return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)\r
- else:\r
- return _ResolveLibraryReference(Module, Platform)\r
+ return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)\r
\r
def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain, FileName = '', EdkLogger = None):\r
ModuleType = Module.ModuleType\r
#\r
SortedLibraryList.reverse()\r
return SortedLibraryList\r
-\r
-def _ResolveLibraryReference(Module, Platform):\r
- LibraryConsumerList = [Module]\r
-\r
- # "CompilerStub" is a must for Edk modules\r
- if Module.Libraries:\r
- Module.Libraries.append("CompilerStub")\r
- LibraryList = []\r
- while len(LibraryConsumerList) > 0:\r
- M = LibraryConsumerList.pop()\r
- for LibraryName in M.Libraries:\r
- Library = Platform.LibraryClasses[LibraryName, ':dummy:']\r
- if Library is None:\r
- for Key in Platform.LibraryClasses.data:\r
- if LibraryName.upper() == Key.upper():\r
- Library = Platform.LibraryClasses[Key, ':dummy:']\r
- break\r
- if Library is None:\r
- continue\r
-\r
- if Library not in LibraryList:\r
- LibraryList.append(Library)\r
- LibraryConsumerList.append(Library)\r
- return LibraryList\r
#\r
def __init__(self, M):\r
self.LibraryList = []\r
- if int(str(M.AutoGenVersion), 0) >= 0x00010005:\r
- self._EdkIIModule = True\r
- else:\r
- self._EdkIIModule = False\r
\r
for Lib in M.DependentLibraryList:\r
LibInfPath = str(Lib)\r
LibInfPath = LibraryItem[0]\r
FileWrite(File, LibInfPath)\r
\r
- #\r
- # Report library class, library constructor and destructor for\r
- # EDKII style module.\r
- #\r
- if self._EdkIIModule:\r
- LibClass = LibraryItem[1]\r
- EdkIILibInfo = ""\r
- LibConstructor = " ".join(LibraryItem[2])\r
- if LibConstructor:\r
- EdkIILibInfo += " C = " + LibConstructor\r
- LibDestructor = " ".join(LibraryItem[3])\r
- if LibDestructor:\r
- EdkIILibInfo += " D = " + LibDestructor\r
- LibDepex = " ".join(LibraryItem[4])\r
- if LibDepex:\r
- EdkIILibInfo += " Depex = " + LibDepex\r
- if LibraryItem[5]:\r
- EdkIILibInfo += " Time = " + LibraryItem[5]\r
- if EdkIILibInfo:\r
- FileWrite(File, "{%s: %s}" % (LibClass, EdkIILibInfo))\r
- else:\r
- FileWrite(File, "{%s}" % LibClass)\r
+ LibClass = LibraryItem[1]\r
+ EdkIILibInfo = ""\r
+ LibConstructor = " ".join(LibraryItem[2])\r
+ if LibConstructor:\r
+ EdkIILibInfo += " C = " + LibConstructor\r
+ LibDestructor = " ".join(LibraryItem[3])\r
+ if LibDestructor:\r
+ EdkIILibInfo += " D = " + LibDestructor\r
+ LibDepex = " ".join(LibraryItem[4])\r
+ if LibDepex:\r
+ EdkIILibInfo += " Depex = " + LibDepex\r
+ if LibraryItem[5]:\r
+ EdkIILibInfo += " Time = " + LibraryItem[5]\r
+ if EdkIILibInfo:\r
+ FileWrite(File, "{%s: %s}" % (LibClass, EdkIILibInfo))\r
+ else:\r
+ FileWrite(File, "{%s}" % LibClass)\r
\r
FileWrite(File, gSubSectionEnd)\r
\r
\r
if Module.Guid and not Module.IsLibrary:\r
EntryPoint = " ".join(Module.Module.ModuleEntryPointList)\r
- if int(str(Module.AutoGenVersion), 0) >= 0x00010005:\r
- RealEntryPoint = "_ModuleEntryPoint"\r
- else:\r
- RealEntryPoint = EntryPoint\r
- if EntryPoint == "_ModuleEntryPoint":\r
- CCFlags = Module.BuildOption.get("CC", {}).get("FLAGS", "")\r
- Match = gGlueLibEntryPoint.search(CCFlags)\r
- if Match:\r
- EntryPoint = Match.group(1)\r
+\r
+ RealEntryPoint = "_ModuleEntryPoint"\r
\r
self._FfsEntryPoint[Module.Guid.upper()] = (EntryPoint, RealEntryPoint)\r
\r
elif ' ' in Path:\r
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path)\r
\r
- #\r
- # Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP\r
- #\r
- if "ECP_SOURCE" not in os.environ:\r
- os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)\r
- if "EFI_SOURCE" not in os.environ:\r
- os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]\r
- if "EDK_SOURCE" not in os.environ:\r
- os.environ["EDK_SOURCE"] = os.environ["ECP_SOURCE"]\r
-\r
- #\r
- # Unify case of characters on case-insensitive systems\r
- #\r
- EfiSourceDir = os.path.normcase(os.path.normpath(os.environ["EFI_SOURCE"]))\r
- EdkSourceDir = os.path.normcase(os.path.normpath(os.environ["EDK_SOURCE"]))\r
- EcpSourceDir = os.path.normcase(os.path.normpath(os.environ["ECP_SOURCE"]))\r
\r
- os.environ["EFI_SOURCE"] = EfiSourceDir\r
- os.environ["EDK_SOURCE"] = EdkSourceDir\r
- os.environ["ECP_SOURCE"] = EcpSourceDir\r
os.environ["EDK_TOOLS_PATH"] = os.path.normcase(os.environ["EDK_TOOLS_PATH"])\r
\r
- if not os.path.exists(EcpSourceDir):\r
- EdkLogger.verbose("ECP_SOURCE = %s doesn't exist. Edk modules could not be built." % EcpSourceDir)\r
- elif ' ' in EcpSourceDir:\r
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in ECP_SOURCE path",\r
- ExtraData=EcpSourceDir)\r
- if not os.path.exists(EdkSourceDir):\r
- if EdkSourceDir == EcpSourceDir:\r
- EdkLogger.verbose("EDK_SOURCE = %s doesn't exist. Edk modules could not be built." % EdkSourceDir)\r
- else:\r
- EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE does not exist",\r
- ExtraData=EdkSourceDir)\r
- elif ' ' in EdkSourceDir:\r
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in EDK_SOURCE path",\r
- ExtraData=EdkSourceDir)\r
- if not os.path.exists(EfiSourceDir):\r
- if EfiSourceDir == EcpSourceDir:\r
- EdkLogger.verbose("EFI_SOURCE = %s doesn't exist. Edk modules could not be built." % EfiSourceDir)\r
- else:\r
- EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE does not exist",\r
- ExtraData=EfiSourceDir)\r
- elif ' ' in EfiSourceDir:\r
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in EFI_SOURCE path",\r
- ExtraData=EfiSourceDir)\r
-\r
- # check those variables on single workspace case\r
- if not PackagesPath:\r
- # change absolute path to relative path to WORKSPACE\r
- if EfiSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
- EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE is not under WORKSPACE",\r
- ExtraData="WORKSPACE = %s\n EFI_SOURCE = %s" % (WorkspaceDir, EfiSourceDir))\r
- if EdkSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
- EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE is not under WORKSPACE",\r
- ExtraData="WORKSPACE = %s\n EDK_SOURCE = %s" % (WorkspaceDir, EdkSourceDir))\r
- if EcpSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
- EdkLogger.error("build", PARAMETER_INVALID, "ECP_SOURCE is not under WORKSPACE",\r
- ExtraData="WORKSPACE = %s\n ECP_SOURCE = %s" % (WorkspaceDir, EcpSourceDir))\r
-\r
# check EDK_TOOLS_PATH\r
if "EDK_TOOLS_PATH" not in os.environ:\r
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",\r
ExtraData="PATH")\r
\r
GlobalData.gWorkspace = WorkspaceDir\r
- GlobalData.gEfiSource = EfiSourceDir\r
- GlobalData.gEdkSource = EdkSourceDir\r
- GlobalData.gEcpSource = EcpSourceDir\r
\r
GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir\r
- GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir\r
- GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir\r
- GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir\r
GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]\r
\r
## Get normalized file path\r
if "PACKAGES_PATH" in os.environ:\r
# WORKSPACE env has been converted before. Print the same path style with WORKSPACE env.\r
EdkLogger.quiet("%-16s = %s" % ("PACKAGES_PATH", os.path.normcase(os.path.normpath(os.environ["PACKAGES_PATH"]))))\r
- EdkLogger.quiet("%-16s = %s" % ("ECP_SOURCE", os.environ["ECP_SOURCE"]))\r
- EdkLogger.quiet("%-16s = %s" % ("EDK_SOURCE", os.environ["EDK_SOURCE"]))\r
- EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))\r
EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))\r
if "EDK_TOOLS_BIN" in os.environ:\r
# Print the same path style with WORKSPACE env.\r
\r
:SetWorkSpace\r
@REM set new workspace\r
-@REM clear EFI_SOURCE and EDK_SOURCE for the new workspace\r
if not defined WORKSPACE (\r
set WORKSPACE=%CD%\r
- set EFI_SOURCE=\r
- set EDK_SOURCE=\r
)\r
\r
:ParseArgs\r