Ejemplo n.º 1
0
def LoadPlatformLibraryClass(XmlPlatformLibraryClass):
    PlatformLibraryInstance = PlatformLibraryClass()

    XmlTag = "ModuleGuid"
    LibraryInstanceModuleGuid = XmlAttribute(XmlPlatformLibraryClass, XmlTag)

    XmlTag = "PackageGuid"
    LibraryInstancePackageGuid = XmlAttribute(XmlPlatformLibraryClass, XmlTag)

    LibraryInstancePath = gEdkIIWorkspaceGuidsInfo.ResolveModuleFilePath(
        LibraryInstanceModuleGuid)

    if LibraryInstancePath != "":  # if LibraryInstancePath == "" that's because the module guid cannot be resolved
        PlatformLibraryInstance.FilePath = LibraryInstancePath
        # replace *.inf to *.msa
        LibraryInstanceMSAName = LibraryInstancePath.replace('.inf', '.msa')
        WorkSpace = os.getenv('WORKSPACE')
        LibraryInstanceMSAPath = os.path.join(WorkSpace,
                                              LibraryInstanceMSAName)

        PlatformLibraryInstance.FilePath = LibraryInstancePath

        XmlMsa = XmlParseFile(LibraryInstanceMSAPath)

        XmlTag = "ModuleSurfaceArea/MsaHeader/ModuleName"
        PlatformLibraryInstance.Name = XmlElement(XmlMsa, XmlTag)

        XmlTag = "ModuleSurfaceArea/MsaHeader/ModuleType"
        PlatformLibraryInstance.ModuleType = XmlElement(XmlMsa, XmlTag)

        if PlatformLibraryInstance.ModuleType != "BASE":
            XmlTag = "ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass"
            List = map(LoadLibraryClassSupModuleList, XmlList(XmlMsa, XmlTag))
            if List != []:
                PlatformLibraryInstance.SupModuleList = List[0]
        XmlTag = "ModuleSurfaceArea/ModuleDefinitions/SupportedArchitectures"
        PlatformLibraryInstance.SupArchList = XmlElement(XmlMsa,
                                                         XmlTag).split()

        PlatformLibraryInstance.ModuleGuid = LibraryInstanceModuleGuid

        XmlTag = "ModuleSurfaceArea/MsaHeader/Version"
        PlatformLibraryInstance.ModuleVersion = XmlElement(XmlMsa, XmlTag)

        PlatformLibraryInstance.PackageGuid = LibraryInstancePackageGuid
        PlatformLibraryInstance.PackageVersion = ''

        return PlatformLibraryInstance
Ejemplo n.º 2
0
def LoadPlatformModuleLibraryInstance(XmlLibraryInstance):
    LibraryInstance = []

    XmlTag = "ModuleGuid"
    ModuleGuid = XmlAttribute(XmlLibraryInstance, XmlTag)

    ModulePath = gEdkIIWorkspaceGuidsInfo.ResolveModuleFilePath(ModuleGuid)
    ModuleMSAFile = ModulePath.replace('.inf', '.msa')
    WorkSpace = os.getenv('WORKSPACE')
    ModuleMSAFileName = os.path.join(WorkSpace, ModuleMSAFile)
    XmlMsa = XmlParseFile(ModuleMSAFileName)

    XmlTag = "ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass/Keyword"
    Name = XmlElement(XmlMsa, XmlTag)
    LibraryInstance.append(Name)
    LibraryInstance.append(ModulePath)

    #XmlTag = "PackageGuid"
    #PackageGuid = XmlAttribute(XmlLibraryInstance, XmlTag)
    #LibraryInstance.append(PackageGuid)
    return LibraryInstance
Ejemplo n.º 3
0
def LoadModuleSA(XmlModuleSA):
    PlatformModule = PlatformModuleClass()

    # three parts: Libraries instances, PcdBuildDefinition, ModuleSaBuildOptions
    XmlTag = "ModuleSA/Libraries/Instance"

    PlatformModule.LibraryClasses = map(LoadPlatformModuleLibraryInstance,
                                        XmlList(XmlModuleSA, XmlTag))

    XmlTag = "ModuleSA/PcdBuildDefinition/PcdData"
    PlatformModule.PcdBuildDefinitions = map(LoadPlatformPcdData,
                                             XmlList(XmlModuleSA, XmlTag))

    XmlTag = "ModuleSA/ModuleSaBuildOptions"
    PlatformModule.ModuleSaBuildOption = LoadPlatformModuleSaBuildOption(
        XmlModuleSA)

    XmlTag = "ModuleSA/BuildOptions"
    PlatformModule.BuildOptions = map(LoadModuleBuildOption,
                                      XmlList(XmlModuleSA,
                                              XmlTag))  #bugbug fix me

    XmlTag = "ModuleSA/Externs"
    PlatformModule.Externs = map(LoadModuleExtern,
                                 XmlList(XmlModuleSA, XmlTag))  #bugbug fix me

    XmlTag = "SupArchList"
    PlatformModule.SupArchList = XmlAttribute(XmlModuleSA, XmlTag).split()

    # the package guid which the module depends on, do not care for now
    XmlTag = "PackageGuid"
    PlatformModule.PackageGuid = XmlAttribute(XmlModuleSA, XmlTag)

    # the module guid, use this guid to get the module *.msa file and convert it to *.inf file with path
    XmlTag = "ModuleGuid"
    PlatformModule.ModuleGuid = XmlAttribute(XmlModuleSA, XmlTag)
    # use this guid to find the *.msa file path or FilePath $(WORKSPACE)/EdkModulePkg/Core/Dxe/DxeMain.msa
    # then convert $(WORKSPACE)/EdkModulePkg/Core/Dxe/DxeMain.msa to $(WORKSPACE)/EdkModulePkg/Core/Dxe/DxeMain.inf, it's FilePath
    PlatformModulePath = gEdkIIWorkspaceGuidsInfo.ResolveModuleFilePath(
        PlatformModule.ModuleGuid)

    PlatformModule.FilePath = PlatformModulePath  # *.inf file path
    # *.inf back to *.msa
    ModuleMSAFileName = PlatformModulePath.replace('.inf', '.msa')
    WorkSpace = os.getenv('WORKSPACE')
    ModuleMSAFileName = os.path.join(WorkSpace, ModuleMSAFileName)
    # Open this module
    #ModuleMSA = open(ModuleMSAFileName, "r")
    XmlMsa = XmlParseFile(ModuleMSAFileName)

    XmlTag = "ModuleSurfaceArea/MsaHeader/ModuleName"
    PlatformModule.Name = XmlElement(XmlMsa, XmlTag)  # ModuleName

    XmlTag = "ModuleSurfaceArea/MsaHeader/ModuleType"
    PlatformModule.ModuleType = XmlElement(XmlMsa, XmlTag)

    # IA32, X64, IPF and EBC which the module support arch
    #XmlTag = "ModuleSurfaceArea/ModuleDefinitions/SupportedArchitectures"
    #PlatformModule.SupArchList = XmlElement(XmlMsa, XmlTag).split()

    #XmlTag = "ModuleSurfaceArea/MsaHeader/"
    PlatformModule.Type = ''  #LIBRARY | LIBRARY_CLASS | MODULE, used by dsc. New in DSC spec

    PlatformModule.ExecFilePath = ''  # New in DSC spec

    XmlTag = "ModuleSurfaceArea/MsaHeader/Specification"
    PlatformModule.Specifications = XmlElement(XmlMsa, XmlTag).split()

    return PlatformModule