X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=BaseTools%2FSource%2FPython%2FAutoGen%2FAutoGen.py;h=5d6cce0dbb535a20050ee7c93d048fff7676f1b6;hb=2b8a6c44e0deb508f79804dd5ff7156bc7e25493;hp=008ad8ebc3ccdee3666dad91db942e9c4d8f5a44;hpb=e259779974ea7e109ee75b9b853f73bd0f66a4b3;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 008ad8ebc3..5d6cce0dbb 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -44,6 +44,7 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws import InfSectionParser import datetime import hashlib +from GenVar import VariableMgr,var_info ## Regular expression for splitting Dependency Expression string into tokens gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)") @@ -316,8 +317,8 @@ class WorkspaceAutoGen(AutoGen): EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile) - if Progress: - Progress.Start("\nProcessing meta-data") +# if Progress: +# Progress.Start("\nProcessing meta-data") if self.FdfFile: # @@ -686,9 +687,6 @@ class WorkspaceAutoGen(AutoGen): content += 'Flash Image Definition: ' content += str(self.FdfFile) content += os.linesep - if GlobalData.gBinCacheDest: - content += 'Cache of .efi location: ' - content += str(GlobalData.gBinCacheDest) SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False) # @@ -1227,6 +1225,7 @@ class PlatformAutoGen(AutoGen): self.AllPcdList = [] # get the original module/package/platform objects self.BuildDatabase = Workspace.BuildDatabase + self.DscBuildDataObj = Workspace.Platform # flag indicating if the makefile/C-code file has been created or not self.IsMakeFileCreated = False @@ -1307,12 +1306,15 @@ class PlatformAutoGen(AutoGen): # @param CreateModuleMakeFile Flag indicating if the makefile for # modules will be created as well # - def CreateMakeFile(self, CreateModuleMakeFile=False): + def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}): if CreateModuleMakeFile: for ModuleFile in self.Platform.Modules: Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile) - Ma.CreateMakeFile(True) + if (ModuleFile.File, self.Arch) in FfsCommand: + Ma.CreateMakeFile(True, FfsCommand[ModuleFile.File, self.Arch]) + else: + Ma.CreateMakeFile(True) #Ma.CreateAsBuiltInf() # no need to create makefile for the platform more than once @@ -1352,6 +1354,24 @@ class PlatformAutoGen(AutoGen): if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]: LibAuto.ConstPcd[key] = Pcd.DefaultValue + def CollectVariables(self, DynamicPcdSet): + VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(),self.DscBuildDataObj._GetSkuIds()) + Index = 0 + for Pcd in DynamicPcdSet: + pcdname = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) + for SkuName in Pcd.SkuInfoList: + Sku = Pcd.SkuInfoList[SkuName] + SkuId = Sku.SkuId + if SkuId == None or SkuId == '': + continue + if len(Sku.VariableName) > 0: + VariableGuidStructure = Sku.VariableGuidValue + VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure) + if Pcd.Phase == "DXE": + for StorageName in Sku.DefaultStoreDict: + VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableAttribute , Pcd.DefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType)) + Index += 1 + return VariableInfo ## Collect dynamic PCDs # # Gather dynamic PCDs list from each module and their settings from platform @@ -1557,12 +1577,19 @@ class PlatformAutoGen(AutoGen): if pcd not in self._PlatformPcds.keys(): self._PlatformPcds[pcd] = self.Platform.Pcds[pcd] + for item in self._PlatformPcds: + if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]: + self._PlatformPcds[item].DatumType = "VOID*" + if (self.Workspace.ArchList[-1] == self.Arch): for Pcd in self._DynamicPcdList: # just pick the a value to determine whether is unicode string type Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]] Sku.VpdOffset = Sku.VpdOffset.strip() + if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]: + Pcd.DatumType = "VOID*" + PcdValue = Sku.DefaultValue if Pcd.DatumType == 'VOID*' and PcdValue.startswith("L"): # if found PCD which datum value is unicode string the insert to left size of UnicodeIndex @@ -1575,6 +1602,20 @@ class PlatformAutoGen(AutoGen): if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]: VpdPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] = Pcd + #Collect DynamicHii PCD values and assign it to DynamicExVpd PCD gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer + PcdNvStoreDfBuffer = VpdPcdDict.get(("PcdNvStoreDefaultValueBuffer","gEfiMdeModulePkgTokenSpaceGuid")) + if PcdNvStoreDfBuffer: + var_info = self.CollectVariables(self._DynamicPcdList) + default_skuobj = PcdNvStoreDfBuffer.SkuInfoList.get("DEFAULT") + vardump = var_info.dump() + if vardump: + default_skuobj.DefaultValue = vardump + PcdNvStoreDfBuffer.DefaultValue = vardump + if default_skuobj: + PcdNvStoreDfBuffer.SkuInfoList.clear() + PcdNvStoreDfBuffer.SkuInfoList['DEFAULT'] = default_skuobj + PcdNvStoreDfBuffer.MaxDatumSize = str(len(default_skuobj.DefaultValue.split(","))) + PlatformPcds = self._PlatformPcds.keys() PlatformPcds.sort() # @@ -1751,6 +1792,13 @@ class PlatformAutoGen(AutoGen): self._DynamicPcdList.extend(UnicodePcdArray) self._DynamicPcdList.extend(HiiPcdArray) self._DynamicPcdList.extend(OtherPcdArray) + allskuset = [(SkuName,Sku.SkuId) for pcd in self._DynamicPcdList for (SkuName,Sku) in pcd.SkuInfoList.items()] + for pcd in self._DynamicPcdList: + if len(pcd.SkuInfoList) == 1: + for (SkuName,SkuId) in allskuset: + if type(SkuId) in (str,unicode) and eval(SkuId) == 0 or SkuId == 0: + continue + pcd.SkuInfoList[SkuName] = pcd.SkuInfoList['DEFAULT'] self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList ## Return the platform build data object @@ -2344,7 +2392,7 @@ class PlatformAutoGen(AutoGen): else: SkuName = 'DEFAULT' ToPcd.SkuInfoList = { - SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName], '', '', '', '', '', ToPcd.DefaultValue) + SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue) } ## Apply PCD setting defined platform to a module @@ -2760,6 +2808,7 @@ class ModuleAutoGen(AutoGen): self._BuildDir = None self._OutputDir = None + self._FfsOutputDir = None self._DebugDir = None self._MakeFileDir = None @@ -2876,6 +2925,7 @@ class ModuleAutoGen(AutoGen): self._Macro["PLATFORM_RELATIVE_DIR" ] = self.PlatformInfo.SourceDir self._Macro["PLATFORM_DIR" ] = mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir) self._Macro["PLATFORM_OUTPUT_DIR" ] = self.PlatformInfo.OutputDir + self._Macro["FFS_OUTPUT_DIR" ] = self.FfsOutputDir return self._Macro ## Return the module build data object @@ -2966,6 +3016,15 @@ class ModuleAutoGen(AutoGen): CreateDirectory(self._OutputDir) return self._OutputDir + ## Return the directory to store ffs file + def _GetFfsOutputDir(self): + if self._FfsOutputDir == None: + if GlobalData.gFdfParser != None: + self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name) + else: + self._FfsOutputDir = '' + return self._FfsOutputDir + ## Return the directory to store auto-gened source files of the mdoule def _GetDebugDir(self): if self._DebugDir == None: @@ -3827,7 +3886,13 @@ class ModuleAutoGen(AutoGen): ## Create AsBuilt INF file the module # - def CreateAsBuiltInf(self): + def CreateAsBuiltInf(self, IsOnlyCopy = False): + self.OutputFile = [] + if IsOnlyCopy: + if GlobalData.gBinCacheDest: + self.CopyModuleToCache() + return + if self.IsAsBuiltInfCreated: return @@ -3960,7 +4025,6 @@ class ModuleAutoGen(AutoGen): AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']] OutputDir = self.OutputDir.replace('\\', '/').strip('/') - self.OutputFile = [] for Item in self.CodaTargetList: File = Item.Target.Path.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/') if File not in self.OutputFile: @@ -4043,7 +4107,7 @@ class ModuleAutoGen(AutoGen): elif BoolValue == 'FALSE': Pcd.DefaultValue = '0' - if Pcd.DatumType != 'VOID*': + if Pcd.DatumType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']: HexFormat = '0x%02x' if Pcd.DatumType == 'UINT16': HexFormat = '0x%04x' @@ -4187,8 +4251,12 @@ class ModuleAutoGen(AutoGen): shutil.copy2(HashFile, FileDir) if os.path.exists(ModuleFile): shutil.copy2(ModuleFile, FileDir) + if not self.OutputFile: + Ma = self.Workspace.BuildDatabase[PathClass(ModuleFile), self.Arch, self.BuildTarget, self.ToolChain] + self.OutputFile = Ma.Binaries if self.OutputFile: for File in self.OutputFile: + File = str(File) if not os.path.isabs(File): File = os.path.join(self.OutputDir, File) if os.path.exists(File): @@ -4222,14 +4290,14 @@ class ModuleAutoGen(AutoGen): # @param CreateLibraryMakeFile Flag indicating if or not the makefiles of # dependent libraries will be created # - def CreateMakeFile(self, CreateLibraryMakeFile=True): + def CreateMakeFile(self, CreateLibraryMakeFile=True, GenFfsList = []): # Ignore generating makefile when it is a binary module if self.IsBinaryModule: return if self.IsMakeFileCreated: return - + self.GenFfsList = GenFfsList if not self.IsLibrary and CreateLibraryMakeFile: for LibraryAutoGen in self.LibraryAutoGenList: LibraryAutoGen.CreateMakeFile() @@ -4457,6 +4525,7 @@ class ModuleAutoGen(AutoGen): IsBinaryModule = property(_IsBinaryModule) BuildDir = property(_GetBuildDir) OutputDir = property(_GetOutputDir) + FfsOutputDir = property(_GetFfsOutputDir) DebugDir = property(_GetDebugDir) MakeFileDir = property(_GetMakeFileDir) CustomMakefile = property(_GetCustomMakefile)