コード例 #1
0
    def ProcessPcdType(self):
        for Arch in self.ArchList:
            Platform = self.BuildDatabase[self.MetaFile, Arch,
                                          self.BuildTarget, self.ToolChain]
            Platform.Pcds
            # generate the SourcePcdDict and BinaryPcdDict
            Libs = []
            for BuildData in list(self.BuildDatabase._CACHE_.values()):
                if BuildData.Arch != Arch:
                    continue
                if BuildData.MetaFile.Ext == '.inf' and str(
                        BuildData) in Platform.Modules:
                    Libs.extend(
                        GetModuleLibInstances(BuildData, Platform,
                                              self.BuildDatabase, Arch,
                                              self.BuildTarget, self.ToolChain,
                                              self.Platform.MetaFile,
                                              EdkLogger))
            for BuildData in list(self.BuildDatabase._CACHE_.values()):
                if BuildData.Arch != Arch:
                    continue
                if BuildData.MetaFile.Ext == '.inf':
                    for key in BuildData.Pcds:
                        if BuildData.Pcds[key].Pending:
                            if key in Platform.Pcds:
                                PcdInPlatform = Platform.Pcds[key]
                                if PcdInPlatform.Type:
                                    BuildData.Pcds[
                                        key].Type = PcdInPlatform.Type
                                    BuildData.Pcds[key].Pending = False

                            if BuildData.MetaFile in Platform.Modules:
                                PlatformModule = Platform.Modules[str(
                                    BuildData.MetaFile)]
                                if key in PlatformModule.Pcds:
                                    PcdInPlatform = PlatformModule.Pcds[key]
                                    if PcdInPlatform.Type:
                                        BuildData.Pcds[
                                            key].Type = PcdInPlatform.Type
                                        BuildData.Pcds[key].Pending = False
                            else:
                                #Pcd used in Library, Pcd Type from reference module if Pcd Type is Pending
                                if BuildData.Pcds[key].Pending:
                                    if bool(BuildData.LibraryClass):
                                        if BuildData in set(Libs):
                                            ReferenceModules = BuildData.ReferenceModules
                                            for ReferenceModule in ReferenceModules:
                                                if ReferenceModule.MetaFile in Platform.Modules:
                                                    RefPlatformModule = Platform.Modules[
                                                        str(ReferenceModule.
                                                            MetaFile)]
                                                    if key in RefPlatformModule.Pcds:
                                                        PcdInReferenceModule = RefPlatformModule.Pcds[
                                                            key]
                                                        if PcdInReferenceModule.Type:
                                                            BuildData.Pcds[
                                                                key].Type = PcdInReferenceModule.Type
                                                            BuildData.Pcds[
                                                                key].Pending = False
                                                            break
コード例 #2
0
    def FillData(self, PlatformInfo):
        #Platform Pcds
        self.DataContainer = {
            "PLA_PCD": [
                PCD_DATA(pcd.TokenCName, pcd.TokenSpaceGuidCName, pcd.Type,
                         pcd.DatumType, pcd.SkuInfoList, pcd.DefaultValue,
                         pcd.MaxDatumSize, pcd.UserDefinedDefaultStoresFlag,
                         pcd.validateranges, pcd.validlists, pcd.expressions,
                         pcd.CustomAttribute, pcd.TokenValue)
                for pcd in PlatformInfo.Platform.Pcds.values()
            ]
        }

        #Platform Module Pcds
        ModulePcds = {}
        for m in PlatformInfo.Platform.Modules:
            m_pcds = PlatformInfo.Platform.Modules[m].Pcds
            if m_pcds:
                ModulePcds[(m.File, m.Root, m.Arch)] = [
                    PCD_DATA(pcd.TokenCName, pcd.TokenSpaceGuidCName, pcd.Type,
                             pcd.DatumType, pcd.SkuInfoList, pcd.DefaultValue,
                             pcd.MaxDatumSize,
                             pcd.UserDefinedDefaultStoresFlag,
                             pcd.validateranges, pcd.validlists,
                             pcd.expressions, pcd.CustomAttribute,
                             pcd.TokenValue)
                    for pcd in PlatformInfo.Platform.Modules[m].Pcds.values()
                ]

        self.DataContainer = {"MOL_PCDS": ModulePcds}

        #Module's Library Instance
        ModuleLibs = {}
        libModules = {}
        for m in PlatformInfo.Platform.Modules:
            module_obj = BuildDB.BuildObject[m, PlatformInfo.Arch,
                                             PlatformInfo.BuildTarget,
                                             PlatformInfo.ToolChain]
            Libs = GetModuleLibInstances(module_obj, PlatformInfo.Platform,
                                         BuildDB.BuildObject,
                                         PlatformInfo.Arch,
                                         PlatformInfo.BuildTarget,
                                         PlatformInfo.ToolChain,
                                         PlatformInfo.MetaFile, EdkLogger)
            for lib in Libs:
                try:
                    libModules[(lib.MetaFile.File, lib.MetaFile.Root, lib.Arch,
                                lib.MetaFile.Path)].append(
                                    (m.File, m.Root, module_obj.Arch, m.Path))
                except:
                    libModules[(lib.MetaFile.File, lib.MetaFile.Root, lib.Arch,
                                lib.MetaFile.Path)] = [
                                    (m.File, m.Root, module_obj.Arch, m.Path)
                                ]
            ModuleLibs[(m.File, m.Root, module_obj.Arch, m.Path)] = [
                (l.MetaFile.File, l.MetaFile.Root, l.Arch, l.MetaFile.Path)
                for l in Libs
            ]
        self.DataContainer = {"DEPS": ModuleLibs}
        self.DataContainer = {"REFS": libModules}

        #Platform BuildOptions

        platform_build_opt = PlatformInfo.EdkIIBuildOption

        ToolDefinition = PlatformInfo.ToolDefinition
        module_build_opt = {}
        for m in PlatformInfo.Platform.Modules:
            ModuleTypeOptions, PlatformModuleOptions = PlatformInfo.GetGlobalBuildOptions(
                BuildDB.BuildObject[m, PlatformInfo.Arch,
                                    PlatformInfo.BuildTarget,
                                    PlatformInfo.ToolChain])
            if ModuleTypeOptions or PlatformModuleOptions:
                module_build_opt.update({
                    (m.File, m.Root): {
                        "ModuleTypeOptions": ModuleTypeOptions,
                        "PlatformModuleOptions": PlatformModuleOptions
                    }
                })

        self.DataContainer = {
            "PLA_BO": platform_build_opt,
            "TOOLDEF": ToolDefinition,
            "MOL_BO": module_build_opt
        }

        #Platform Info
        PInfo = {
            "WorkspaceDir": PlatformInfo.Workspace.WorkspaceDir,
            "Target": PlatformInfo.BuildTarget,
            "ToolChain": PlatformInfo.Workspace.ToolChain,
            "BuildRuleFile": PlatformInfo.BuildRule,
            "Arch": PlatformInfo.Arch,
            "ArchList": PlatformInfo.Workspace.ArchList,
            "ActivePlatform": PlatformInfo.MetaFile
        }
        self.DataContainer = {'P_Info': PInfo}

        self.DataContainer = {'M_Name': PlatformInfo.UniqueBaseName}

        self.DataContainer = {"ToolChainFamily": PlatformInfo.ToolChainFamily}

        self.DataContainer = {"BuildRuleFamily": PlatformInfo.BuildRuleFamily}

        self.DataContainer = {"MixedPcd": GlobalData.MixedPcd}

        self.DataContainer = {"BuildOptPcd": GlobalData.BuildOptionPcd}

        self.DataContainer = {"BuildCommand": PlatformInfo.BuildCommand}

        self.DataContainer = {
            "AsBuildModuleList": PlatformInfo._AsBuildModuleList
        }

        self.DataContainer = {"G_defines": GlobalData.gGlobalDefines}

        self.DataContainer = {"CL_defines": GlobalData.gCommandLineDefines}

        self.DataContainer = {"Env_Var": {k: v for k, v in os.environ.items()}}

        self.DataContainer = {
            "PackageList":
            [(dec.MetaFile, dec.Arch) for dec in PlatformInfo.PackageList]
        }

        self.DataContainer = {"GuidDict": PlatformInfo.Platform._GuidDict}

        self.DataContainer = {"DatabasePath": GlobalData.gDatabasePath}

        self.DataContainer = {
            "FdfParser": True if GlobalData.gFdfParser else False
        }

        self.DataContainer = {"LogLevel": EdkLogger.GetLevel()}

        self.DataContainer = {"UseHashCache": GlobalData.gUseHashCache}

        self.DataContainer = {"BinCacheSource": GlobalData.gBinCacheSource}

        self.DataContainer = {"BinCacheDest": GlobalData.gBinCacheDest}

        self.DataContainer = {
            "EnableGenfdsMultiThread": GlobalData.gEnableGenfdsMultiThread
        }