Sync BaseTools Branch (version r2321) to EDKII main trunk.
Signed-off-by: lgao4 Reviewed-by: gikidy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12372 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -357,8 +357,8 @@ class WorkspaceAutoGen(AutoGen):
|
||||
# @return None
|
||||
#
|
||||
def _CheckAllPcdsTokenValueConflict(self):
|
||||
if len(self.BuildDatabase.WorkspaceDb.PackageList) >= 1:
|
||||
for Package in self.BuildDatabase.WorkspaceDb.PackageList:
|
||||
for Pa in self.AutoGenObjectList:
|
||||
for Package in Pa.PackageList:
|
||||
PcdList = Package.Pcds.values()
|
||||
PcdList.sort(lambda x, y: cmp(x.TokenValue, y.TokenValue))
|
||||
Count = 0
|
||||
@@ -1152,7 +1152,7 @@ class PlatformAutoGen(AutoGen):
|
||||
if LibraryClass.startswith("NULL"):
|
||||
Module.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
|
||||
|
||||
# R9 module
|
||||
# EdkII module
|
||||
LibraryConsumerList = [Module]
|
||||
Constructor = []
|
||||
ConsumedByList = sdict()
|
||||
@@ -1401,7 +1401,7 @@ class PlatformAutoGen(AutoGen):
|
||||
|
||||
## Resolve library names to library modules
|
||||
#
|
||||
# (for R8.x modules)
|
||||
# (for Edk.x modules)
|
||||
#
|
||||
# @param Module The module from which the library names will be resolved
|
||||
#
|
||||
@@ -1412,7 +1412,7 @@ class PlatformAutoGen(AutoGen):
|
||||
EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), self.Arch))
|
||||
LibraryConsumerList = [Module]
|
||||
|
||||
# "CompilerStub" is a must for R8 modules
|
||||
# "CompilerStub" is a must for Edk modules
|
||||
if Module.Libraries:
|
||||
Module.Libraries.append("CompilerStub")
|
||||
LibraryList = []
|
||||
@@ -1794,6 +1794,10 @@ class ModuleAutoGen(AutoGen):
|
||||
def _GetBaseName(self):
|
||||
return self.Module.BaseName
|
||||
|
||||
## Return the module DxsFile if exist
|
||||
def _GetDxsFile(self):
|
||||
return self.Module.DxsFile
|
||||
|
||||
## Return the module SourceOverridePath
|
||||
def _GetSourceOverridePath(self):
|
||||
return self.Module.SourceOverridePath
|
||||
@@ -1810,7 +1814,7 @@ class ModuleAutoGen(AutoGen):
|
||||
def _GetModuleType(self):
|
||||
return self.Module.ModuleType
|
||||
|
||||
## Return the component type (for R8.x style of module)
|
||||
## Return the component type (for Edk.x style of module)
|
||||
def _GetComponentType(self):
|
||||
return self.Module.ComponentType
|
||||
|
||||
@@ -1913,7 +1917,7 @@ class ModuleAutoGen(AutoGen):
|
||||
def _GetDepexTokenList(self):
|
||||
if self._DepexList == None:
|
||||
self._DepexList = {}
|
||||
if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
|
||||
if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
|
||||
return self._DepexList
|
||||
|
||||
self._DepexList[self.ModuleType] = []
|
||||
@@ -1949,7 +1953,7 @@ class ModuleAutoGen(AutoGen):
|
||||
def _GetDepexExpressionTokenList(self):
|
||||
if self._DepexExpressionList == None:
|
||||
self._DepexExpressionList = {}
|
||||
if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
|
||||
if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
|
||||
return self._DepexExpressionList
|
||||
|
||||
self._DepexExpressionList[self.ModuleType] = ''
|
||||
@@ -2153,7 +2157,7 @@ class ModuleAutoGen(AutoGen):
|
||||
self._BuildTargets = {}
|
||||
self._FileTypes = {}
|
||||
|
||||
#TRICK: call _GetSourceFileList to apply build rule for binary files
|
||||
#TRICK: call _GetSourceFileList to apply build rule for source files
|
||||
if self.SourceFileList:
|
||||
pass
|
||||
|
||||
@@ -2306,11 +2310,11 @@ class ModuleAutoGen(AutoGen):
|
||||
for Inc in self.Module.Includes:
|
||||
if Inc not in self._IncludePathList:
|
||||
self._IncludePathList.append(Inc)
|
||||
# for r8 modules
|
||||
# for Edk modules
|
||||
Inc = path.join(Inc, self.Arch.capitalize())
|
||||
if os.path.exists(Inc) and Inc not in self._IncludePathList:
|
||||
self._IncludePathList.append(Inc)
|
||||
# r8 module needs to put DEBUG_DIR at the end of search path and not to use SOURCE_DIR all the time
|
||||
# Edk module needs to put DEBUG_DIR at the end of search path and not to use SOURCE_DIR all the time
|
||||
self._IncludePathList.append(self.DebugDir)
|
||||
else:
|
||||
self._IncludePathList.append(self.MetaFile.Dir)
|
||||
@@ -2470,7 +2474,7 @@ class ModuleAutoGen(AutoGen):
|
||||
|
||||
for File in self.AutoGenFileList:
|
||||
if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
|
||||
#Ignore R8 AutoGen.c
|
||||
#Ignore Edk AutoGen.c
|
||||
if self.AutoGenVersion < 0x00010005 and File.Name == 'AutoGen.c':
|
||||
continue
|
||||
|
||||
@@ -2572,6 +2576,7 @@ class ModuleAutoGen(AutoGen):
|
||||
ProtocolList = property(_GetProtocolList)
|
||||
PpiList = property(_GetPpiList)
|
||||
DepexList = property(_GetDepexTokenList)
|
||||
DxsFile = property(_GetDxsFile)
|
||||
DepexExpressionList = property(_GetDepexExpressionTokenList)
|
||||
BuildOption = property(_GetModuleBuildOption)
|
||||
BuildCommand = property(_GetBuildCommand)
|
||||
|
@@ -67,21 +67,21 @@ typedef UINT8 SKU_ID;
|
||||
|
||||
#define PCD_TYPE_SHIFT 28
|
||||
|
||||
#define PCD_TYPE_DATA (0x0 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_HII (0x8 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_VPD (0x4 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_SKU_ENABLED (0x2 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_STRING (0x1 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_DATA (0x0U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_HII (0x8U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_VPD (0x4U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_SKU_ENABLED (0x2U << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_STRING (0x1U << PCD_TYPE_SHIFT)
|
||||
|
||||
#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)
|
||||
|
||||
#define PCD_DATUM_TYPE_SHIFT 24
|
||||
|
||||
#define PCD_DATUM_TYPE_POINTER (0x0 << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT8 (0x1 << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT16 (0x2 << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT32 (0x4 << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT64 (0x8 << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_POINTER (0x0U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT8 (0x1U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT16 (0x2U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT32 (0x4U << PCD_DATUM_TYPE_SHIFT)
|
||||
#define PCD_DATUM_TYPE_UINT64 (0x8U << PCD_DATUM_TYPE_SHIFT)
|
||||
|
||||
#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \\
|
||||
PCD_DATUM_TYPE_UINT8 | \\
|
||||
@@ -1951,7 +1951,11 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
||||
if Info.ModuleType in gModuleTypeHeaderFile \
|
||||
and gModuleTypeHeaderFile[Info.ModuleType][0] != gBasicHeaderFile:
|
||||
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
|
||||
if 'PcdLib' in Info.Module.LibraryClasses:
|
||||
#
|
||||
# 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;\n\n')
|
||||
@@ -2018,7 +2022,7 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer):
|
||||
|
||||
CreateFooterCode(Info, AutoGenC, AutoGenH)
|
||||
|
||||
# no generation of AutoGen.c for R8 modules without unicode file
|
||||
# no generation of AutoGen.c for Edk modules without unicode file
|
||||
if Info.AutoGenVersion < 0x00010005 and len(Info.UnicodeFileList) == 0:
|
||||
AutoGenC.String = ''
|
||||
|
||||
|
@@ -23,7 +23,7 @@ from Common.BuildToolError import *
|
||||
from Common.Misc import SaveFileOnChange
|
||||
from Common.Misc import GuidStructureStringToGuidString
|
||||
from Common import EdkLogger as EdkLogger
|
||||
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END"
|
||||
gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S)
|
||||
@@ -354,7 +354,7 @@ class DependencyExpression:
|
||||
Buffer.close()
|
||||
return FileChangeFlag
|
||||
|
||||
versionNumber = "0.04"
|
||||
versionNumber = ("0.04" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + versionNumber
|
||||
__copyright__ = "Copyright (c) 2007-2010, Intel Corporation All rights reserved."
|
||||
__usage__ = "%prog [options] [dependency_expression_file]"
|
||||
|
@@ -31,7 +31,7 @@ gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n
|
||||
## Regular expression for matching macro used in header file inclusion
|
||||
gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
|
||||
|
||||
## pattern for include style in R8.x code
|
||||
## pattern for include style in Edk.x code
|
||||
gProtocolDefinition = "Protocol/%(HeaderKey)s/%(HeaderKey)s.h"
|
||||
gGuidDefinition = "Guid/%(HeaderKey)s/%(HeaderKey)s.h"
|
||||
gArchProtocolDefinition = "ArchProtocol/%(HeaderKey)s/%(HeaderKey)s.h"
|
||||
@@ -462,13 +462,13 @@ cleanlib:
|
||||
ArchEntryPoint = ModuleEntryPoint
|
||||
|
||||
if self._AutoGenObject.Arch == "EBC":
|
||||
# EBC compiler always use "EfiStart" as entry point. Only applies to R9 modules
|
||||
# EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules
|
||||
ImageEntryPoint = "EfiStart"
|
||||
elif self._AutoGenObject.AutoGenVersion < 0x00010005:
|
||||
# R8 modules use entry point specified in INF file
|
||||
# Edk modules use entry point specified in INF file
|
||||
ImageEntryPoint = ModuleEntryPoint
|
||||
else:
|
||||
# R9 modules always use "_ModuleEntryPoint" as entry point
|
||||
# EdkII modules always use "_ModuleEntryPoint" as entry point
|
||||
ImageEntryPoint = "_ModuleEntryPoint"
|
||||
|
||||
# tools definitions
|
||||
@@ -535,7 +535,7 @@ cleanlib:
|
||||
False
|
||||
)
|
||||
|
||||
# R8 modules need <BaseName>StrDefs.h for string ID
|
||||
# Edk modules need <BaseName>StrDefs.h for string ID
|
||||
#if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0:
|
||||
# BcTargetList = ['strdefs']
|
||||
#else:
|
||||
|
@@ -27,12 +27,13 @@ import encodings.ascii
|
||||
from optparse import OptionParser
|
||||
from Common import EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
import StringTable as st
|
||||
import GenVpd
|
||||
|
||||
PROJECT_NAME = st.LBL_BPDG_LONG_UNI
|
||||
VERSION = st.LBL_BPDG_VERSION
|
||||
VERSION = (st.LBL_BPDG_VERSION + " " + gBUILD_VERSION)
|
||||
|
||||
## Tool entrance method
|
||||
#
|
||||
|
3
BaseTools/Source/Python/Common/BuildVersion.py
Normal file
3
BaseTools/Source/Python/Common/BuildVersion.py
Normal file
@@ -0,0 +1,3 @@
|
||||
#This file is for build version number auto generation
|
||||
#
|
||||
gBUILD_VERSION = "Build 2318"
|
@@ -14,9 +14,9 @@
|
||||
# Common Definitions
|
||||
#
|
||||
TAB_SPLIT = '.'
|
||||
TAB_COMMENT_R8_START = '/*'
|
||||
TAB_COMMENT_R8_END = '*/'
|
||||
TAB_COMMENT_R8_SPLIT = '//'
|
||||
TAB_COMMENT_EDK_START = '/*'
|
||||
TAB_COMMENT_EDK_END = '*/'
|
||||
TAB_COMMENT_EDK_SPLIT = '//'
|
||||
TAB_COMMENT_SPLIT = '#'
|
||||
TAB_EQUAL_SPLIT = '='
|
||||
TAB_VALUE_SPLIT = '|'
|
||||
@@ -302,16 +302,17 @@ TAB_INF_DEFINES_BINARY_MODULE = 'BINARY_MODULE'
|
||||
TAB_INF_DEFINES_LIBRARY_CLASS = 'LIBRARY_CLASS'
|
||||
TAB_INF_DEFINES_COMPONENT_TYPE = 'COMPONENT_TYPE'
|
||||
TAB_INF_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
|
||||
TAB_INF_DEFINES_DPX_SOURCE = 'DPX_SOURCE'
|
||||
TAB_INF_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
|
||||
TAB_INF_DEFINES_BUILD_TYPE = 'BUILD_TYPE'
|
||||
TAB_INF_DEFINES_FFS_EXT = 'FFS_EXT'
|
||||
TAB_INF_DEFINES_FV_EXT = 'FV_EXT'
|
||||
TAB_INF_DEFINES_SOURCE_FV = 'SOURCE_FV'
|
||||
TAB_INF_DEFINES_VERSION_NUMBER = 'VERSION_NUMBER'
|
||||
TAB_INF_DEFINES_VERSION = 'VERSION' # for R8 inf, the same as VERSION_NUMBER
|
||||
TAB_INF_DEFINES_VERSION = 'VERSION' # for Edk inf, the same as VERSION_NUMBER
|
||||
TAB_INF_DEFINES_VERSION_STRING = 'VERSION_STRING'
|
||||
TAB_INF_DEFINES_PCD_IS_DRIVER = 'PCD_IS_DRIVER'
|
||||
TAB_INF_DEFINES_TIANO_R8_FLASHMAP_H = 'TIANO_R8_FLASHMAP_H'
|
||||
TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H = 'TIANO_EDK_FLASHMAP_H'
|
||||
TAB_INF_DEFINES_ENTRY_POINT = 'ENTRY_POINT'
|
||||
TAB_INF_DEFINES_UNLOAD_IMAGE = 'UNLOAD_IMAGE'
|
||||
TAB_INF_DEFINES_CONSTRUCTOR = 'CONSTRUCTOR'
|
||||
|
@@ -162,11 +162,11 @@ class Dec(DecObject):
|
||||
#
|
||||
# Remove comment block
|
||||
#
|
||||
if Line.find(TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
|
||||
IsFindBlockComment = True
|
||||
if Line.find(TAB_COMMENT_R8_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(TAB_COMMENT_EDK_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
|
@@ -135,8 +135,8 @@ class Dec(DecObject):
|
||||
for Line in open(Filename, 'r'):
|
||||
LineNo = LineNo + 1
|
||||
# Remove comment block
|
||||
if Line.find(TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
|
||||
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
|
||||
Comment = Comment + Line.strip() + '\n'
|
||||
ReservedLine = ''
|
||||
@@ -145,9 +145,9 @@ class Dec(DecObject):
|
||||
IsFindBlockComment = True
|
||||
if not ReservedLine:
|
||||
continue
|
||||
if Line.find(TAB_COMMENT_R8_END) > -1:
|
||||
Comment = Comment + Line[:Line.find(TAB_COMMENT_R8_END) + len(TAB_COMMENT_R8_END)] + '\n'
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(TAB_COMMENT_EDK_END) > -1:
|
||||
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
@@ -312,7 +312,7 @@ class Dec(DecObject):
|
||||
self.GenPackageHeader(ContainerFile)
|
||||
|
||||
# Generate Includes
|
||||
# Only for R8
|
||||
# Only for Edk
|
||||
self.GenIncludes(ContainerFile)
|
||||
|
||||
# Generate Guids
|
||||
|
@@ -1045,11 +1045,11 @@ class Dsc(DscObject):
|
||||
#
|
||||
# Remove comment block
|
||||
#
|
||||
if Line.find(TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
|
||||
IsFindBlockComment = True
|
||||
if Line.find(TAB_COMMENT_R8_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(TAB_COMMENT_EDK_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
|
@@ -929,13 +929,13 @@ class WorkspaceBuild(object):
|
||||
ModuleDatabase = self.Build[Arch].ModuleDatabase
|
||||
ModuleType = Module.ModuleType
|
||||
|
||||
# check R8 module
|
||||
# check Edk module
|
||||
if Module.AutoGenVersion < 0x00010005:
|
||||
EdkLogger.verbose("")
|
||||
EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch))
|
||||
LibraryConsumerList = [Module]
|
||||
|
||||
# "CompilerStub" is a must for R8 modules
|
||||
# "CompilerStub" is a must for Edk modules
|
||||
Module.Libraries.append("CompilerStub")
|
||||
while len(LibraryConsumerList) > 0:
|
||||
M = LibraryConsumerList.pop()
|
||||
@@ -952,7 +952,7 @@ class WorkspaceBuild(object):
|
||||
EdkLogger.verbose("\t" + LibraryName + " : " + LibraryFile)
|
||||
return
|
||||
|
||||
# R9 module
|
||||
# EdkII module
|
||||
LibraryConsumerList = [Module]
|
||||
Constructor = []
|
||||
ConsumedByList = sdict()
|
||||
|
@@ -3647,7 +3647,14 @@ class FdfParser(object):
|
||||
return CycleRefExists
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = FdfParser("..\LakeportX64Pkg.fdf")
|
||||
import sys
|
||||
try:
|
||||
test_file = sys.argv[1]
|
||||
except IndexError, v:
|
||||
print "Usage: %s filename" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
parser = FdfParser(test_file)
|
||||
try:
|
||||
parser.ParseFile()
|
||||
parser.CycleReferenceCheck()
|
||||
|
@@ -34,4 +34,3 @@ gBuildingModule = ''
|
||||
|
||||
## Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
||||
gMacroPattern = re.compile("\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
||||
|
||||
|
@@ -104,7 +104,7 @@ class InfHeader(ModuleHeaderClass):
|
||||
TAB_INF_DEFINES_VERSION_STRING : "VersionString",
|
||||
TAB_INF_DEFINES_VERSION : "Version",
|
||||
TAB_INF_DEFINES_PCD_IS_DRIVER : "PcdIsDriver",
|
||||
TAB_INF_DEFINES_TIANO_R8_FLASHMAP_H : "TianoR8FlashMap_h",
|
||||
TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H : "TianoEdkFlashMap_h",
|
||||
TAB_INF_DEFINES_SHADOW : "Shadow",
|
||||
# TAB_INF_DEFINES_LIBRARY_CLASS : "LibraryClass",
|
||||
# TAB_INF_DEFINES_ENTRY_POINT : "ExternImages",
|
||||
@@ -352,11 +352,11 @@ class Inf(InfObject):
|
||||
#
|
||||
# Remove comment block
|
||||
#
|
||||
if Line.find(TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
|
||||
IsFindBlockComment = True
|
||||
if Line.find(TAB_COMMENT_R8_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(TAB_COMMENT_EDK_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
@@ -465,7 +465,7 @@ class Inf(InfObject):
|
||||
print 'FvExt =', M.Header[Arch].FvExt
|
||||
print 'SourceFv =', M.Header[Arch].SourceFv
|
||||
print 'PcdIsDriver =', M.Header[Arch].PcdIsDriver
|
||||
print 'TianoR8FlashMap_h =', M.Header[Arch].TianoR8FlashMap_h
|
||||
print 'TianoEdkFlashMap_h =', M.Header[Arch].TianoEdkFlashMap_h
|
||||
print 'Shadow =', M.Header[Arch].Shadow
|
||||
print 'LibraryClass =', M.Header[Arch].LibraryClass
|
||||
for Item in M.Header[Arch].LibraryClass:
|
||||
@@ -613,7 +613,7 @@ class Inf(InfObject):
|
||||
# Get version of INF
|
||||
#
|
||||
if ModuleHeader.InfVersion != "":
|
||||
# R9 inf
|
||||
# EdkII inf
|
||||
VersionNumber = ModuleHeader.VersionNumber
|
||||
VersionString = ModuleHeader.VersionString
|
||||
if len(VersionNumber) > 0 and len(VersionString) == 0:
|
||||
@@ -624,12 +624,12 @@ class Inf(InfObject):
|
||||
EdkLogger.warn(2001, 'INF file %s defines both VERSION_NUMBER and VERSION_STRING, using VERSION_STRING' % self.Identification.FileFullPath)
|
||||
ModuleHeader.Version = VersionString
|
||||
else:
|
||||
# R8 inf
|
||||
# Edk inf
|
||||
ModuleHeader.InfVersion = "0x00010000"
|
||||
if ModuleHeader.ComponentType in gComponentType2ModuleType:
|
||||
ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType]
|
||||
elif ModuleHeader.ComponentType != '':
|
||||
EdkLogger.error("Parser", PARSER_ERROR, "Unsupported R8 component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError)
|
||||
EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError)
|
||||
|
||||
self.Module.Header[Arch] = ModuleHeader
|
||||
|
||||
@@ -841,7 +841,7 @@ class Inf(InfObject):
|
||||
Nmake.SupArchList = Nmakes[Key]
|
||||
self.Module.Nmake.append(Nmake)
|
||||
|
||||
# convert R8 format to R9 format
|
||||
# convert Edk format to EdkII format
|
||||
if Nmake.Name == "IMAGE_ENTRY_POINT":
|
||||
Image = ModuleExternImageClass()
|
||||
Image.ModuleEntryPoint = Nmake.Value
|
||||
|
@@ -89,7 +89,7 @@ class InfHeader(ModuleHeaderClass):
|
||||
TAB_INF_DEFINES_VERSION_STRING : "VersionString",
|
||||
TAB_INF_DEFINES_VERSION : "Version",
|
||||
TAB_INF_DEFINES_PCD_IS_DRIVER : "PcdIsDriver",
|
||||
TAB_INF_DEFINES_TIANO_R8_FLASHMAP_H : "TianoR8FlashMap_h",
|
||||
TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H : "TianoEdkFlashMap_h",
|
||||
TAB_INF_DEFINES_SHADOW : "Shadow",
|
||||
}
|
||||
|
||||
@@ -411,8 +411,8 @@ class Inf(InfObject):
|
||||
for Line in open(Filename, 'r'):
|
||||
LineNo = LineNo + 1
|
||||
# Remove comment block
|
||||
if Line.find(TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
|
||||
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
|
||||
Comment = Comment + Line.strip() + '\n'
|
||||
ReservedLine = ''
|
||||
@@ -421,9 +421,9 @@ class Inf(InfObject):
|
||||
IsFindBlockComment = True
|
||||
if not ReservedLine:
|
||||
continue
|
||||
if Line.find(TAB_COMMENT_R8_END) > -1:
|
||||
Comment = Comment + Line[:Line.find(TAB_COMMENT_R8_END) + len(TAB_COMMENT_R8_END)] + '\n'
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(TAB_COMMENT_EDK_END) > -1:
|
||||
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
|
@@ -468,7 +468,7 @@ def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='
|
||||
if FileExt.lower() != Ext.lower():
|
||||
return False, File
|
||||
|
||||
# Replace the R8 macros
|
||||
# Replace the Edk macros
|
||||
if OverrideDir != '' and OverrideDir != None:
|
||||
if OverrideDir.find('$(EFI_SOURCE)') > -1:
|
||||
OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource)
|
||||
@@ -480,7 +480,7 @@ def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='
|
||||
Dir = os.getcwd()
|
||||
Dir = Dir[len(Workspace)+1:]
|
||||
|
||||
# First check if File has R8 definition itself
|
||||
# First check if File has Edk definition itself
|
||||
if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1:
|
||||
NewFile = File.replace('$(EFI_SOURCE)', EfiSource)
|
||||
NewFile = NewFile.replace('$(EDK_SOURCE)', EdkSource)
|
||||
@@ -506,7 +506,7 @@ def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='
|
||||
#
|
||||
#
|
||||
def ValidFile3(AllFiles, File, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''):
|
||||
# Replace the R8 macros
|
||||
# Replace the Edk macros
|
||||
if OverrideDir != '' and OverrideDir != None:
|
||||
if OverrideDir.find('$(EFI_SOURCE)') > -1:
|
||||
OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource)
|
||||
@@ -524,7 +524,7 @@ def ValidFile3(AllFiles, File, Workspace='', EfiSource='', EdkSource='', Dir='.'
|
||||
NewRelaPath = RelaPath
|
||||
|
||||
while(True):
|
||||
# First check if File has R8 definition itself
|
||||
# First check if File has Edk definition itself
|
||||
if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1:
|
||||
File = File.replace('$(EFI_SOURCE)', EfiSource)
|
||||
File = File.replace('$(EDK_SOURCE)', EdkSource)
|
||||
|
@@ -20,7 +20,7 @@ import os.path
|
||||
import string
|
||||
import EdkLogger as EdkLogger
|
||||
|
||||
from GlobalData import *
|
||||
import GlobalData
|
||||
from BuildToolError import *
|
||||
|
||||
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE)
|
||||
@@ -213,7 +213,7 @@ def ReplaceMacros(StringList, MacroDefinitions={}, SelfReplacement = False):
|
||||
def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement = False):
|
||||
LastString = String
|
||||
while MacroDefinitions:
|
||||
MacroUsed = gMacroPattern.findall(String)
|
||||
MacroUsed = GlobalData.gMacroPattern.findall(String)
|
||||
# no macro found in String, stop replacing
|
||||
if len(MacroUsed) == 0:
|
||||
break
|
||||
@@ -277,21 +277,40 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
|
||||
#
|
||||
Line = Line.strip();
|
||||
#
|
||||
# Replace R8's comment character
|
||||
# Replace Edk's comment character
|
||||
#
|
||||
if AllowCppStyleComment:
|
||||
Line = Line.replace(DataType.TAB_COMMENT_R8_SPLIT, CommentCharacter)
|
||||
Line = Line.replace(DataType.TAB_COMMENT_EDK_SPLIT, CommentCharacter)
|
||||
#
|
||||
# remove comments, but we should escape comment character in string
|
||||
#
|
||||
InString = False
|
||||
CommentInString = False
|
||||
for Index in range(0, len(Line)):
|
||||
if Line[Index] == '"':
|
||||
InString = not InString
|
||||
elif Line[Index] == CommentCharacter and not InString:
|
||||
elif Line[Index] == CommentCharacter and InString :
|
||||
CommentInString = True
|
||||
elif Line[Index] == CommentCharacter and not InString :
|
||||
Line = Line[0: Index]
|
||||
break
|
||||
|
||||
|
||||
if CommentInString:
|
||||
Line = Line.replace('"', '')
|
||||
ChIndex = Line.find('#')
|
||||
while ChIndex >= 0:
|
||||
if GlobalData.gIsWindows:
|
||||
if ChIndex == 0 or Line[ChIndex-1] != '^':
|
||||
Line = Line[0:ChIndex] + '^' + Line[ChIndex:]
|
||||
ChIndex = Line.find('#', ChIndex + 2)
|
||||
else:
|
||||
ChIndex = Line.find('#', ChIndex + 1)
|
||||
else:
|
||||
if ChIndex == 0 or Line[ChIndex-1] != '\\':
|
||||
Line = Line[0:ChIndex] + '\\' + Line[ChIndex:]
|
||||
ChIndex = Line.find('#', ChIndex + 2)
|
||||
else:
|
||||
ChIndex = Line.find('#', ChIndex + 1)
|
||||
#
|
||||
# remove whitespace again
|
||||
#
|
||||
@@ -315,10 +334,10 @@ def CleanString2(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSt
|
||||
#
|
||||
Line = Line.strip();
|
||||
#
|
||||
# Replace R8's comment character
|
||||
# Replace Edk's comment character
|
||||
#
|
||||
if AllowCppStyleComment:
|
||||
Line = Line.replace(DataType.TAB_COMMENT_R8_SPLIT, CommentCharacter)
|
||||
Line = Line.replace(DataType.TAB_COMMENT_EDK_SPLIT, CommentCharacter)
|
||||
#
|
||||
# separate comments and statements
|
||||
#
|
||||
@@ -689,11 +708,11 @@ def RemoveBlockComment(Lines):
|
||||
#
|
||||
# Remove comment block
|
||||
#
|
||||
if Line.find(DataType.TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, DataType.TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, DataType.TAB_COMMENT_EDK_START, 1)[0]
|
||||
IsFindBlockComment = True
|
||||
if Line.find(DataType.TAB_COMMENT_R8_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, DataType.TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(DataType.TAB_COMMENT_EDK_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, DataType.TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
|
@@ -32,7 +32,7 @@ from CommonClass import *
|
||||
# [ ClonedRecordClass, ... ]
|
||||
# @var PcdIsDriver: To store value for PcdIsDriver, selection scope is in below list
|
||||
# PEI_PCD_DRIVER | DXE_PCD_DRIVER
|
||||
# @var TianoR8FlashMap_h: To store value for TianoR8FlashMap_h
|
||||
# @var TianoEdkFlashMap_h: To store value for TianoEdkFlashMap_h
|
||||
# @var InfVersion: To store value for InfVersion
|
||||
# @var UefiSpecificationVersion: To store value for UefiSpecificationVersion
|
||||
# @var EdkReleaseVersion: To store value for EdkReleaseVersion
|
||||
@@ -63,7 +63,7 @@ class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
|
||||
self.OutputFileBasename = ''
|
||||
self.ClonedFrom = []
|
||||
self.PcdIsDriver = ''
|
||||
self.TianoR8FlashMap_h = False
|
||||
self.TianoEdkFlashMap_h = False
|
||||
self.InfVersion = ''
|
||||
self.PiSpecificationVersion = ''
|
||||
self.UefiSpecificationVersion = ''
|
||||
|
@@ -27,6 +27,7 @@ from Common.DecClassObject import Dec
|
||||
from Common.DscClassObject import Dsc
|
||||
from Common.FdfClassObject import Fdf
|
||||
from Common.String import NormPath
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
from Common import BuildToolError
|
||||
import c
|
||||
import re, string
|
||||
@@ -41,7 +42,7 @@ from Exception import *
|
||||
class Ecc(object):
|
||||
def __init__(self):
|
||||
# Version and Copyright
|
||||
self.VersionNumber = "0.01"
|
||||
self.VersionNumber = ("0.01" + " " + gBUILD_VERSION)
|
||||
self.Version = "%prog Version " + self.VersionNumber
|
||||
self.Copyright = "Copyright (c) 2009 - 2010, Intel Corporation All rights reserved."
|
||||
|
||||
|
@@ -2539,7 +2539,12 @@ if __name__ == '__main__':
|
||||
# EdkLogger.Initialize()
|
||||
# EdkLogger.SetLevel(EdkLogger.QUIET)
|
||||
# CollectSourceCodeDataIntoDB(sys.argv[1])
|
||||
MsgList = CheckFuncHeaderDoxygenComments('C:\\Combo\\R9\\LakeportX64Dev\\FlashDevicePkg\\Library\\SpiFlashChipM25P64\\SpiFlashChipM25P64.c')
|
||||
try:
|
||||
test_file = sys.argv[1]
|
||||
except IndexError, v:
|
||||
print "Usage: %s filename" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
MsgList = CheckFuncHeaderDoxygenComments(test_file)
|
||||
for Msg in MsgList:
|
||||
print Msg
|
||||
print 'Done!'
|
||||
|
@@ -28,6 +28,7 @@ from FvImage import *
|
||||
from array import array
|
||||
from Report import Report
|
||||
from Common.Misc import ParseConsoleLog
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
from Parser import ConvertGuid
|
||||
|
||||
## Class Eot
|
||||
@@ -45,7 +46,7 @@ class Eot(object):
|
||||
IncludeDirList=None, DecFileList=None, GuidList=None, LogFile=None,
|
||||
FvFileList="", MapFileList="", Report='Report.html', Dispatch=None):
|
||||
# Version and Copyright
|
||||
self.VersionNumber = "0.02"
|
||||
self.VersionNumber = ("0.02" + " " + gBUILD_VERSION)
|
||||
self.Version = "%prog Version " + self.VersionNumber
|
||||
self.Copyright = "Copyright (c) 2008 - 2010, Intel Corporation All rights reserved."
|
||||
self.Report = Report
|
||||
|
@@ -49,11 +49,11 @@ def PreProcess(Filename, MergeMultipleLines = True, LineNo = -1):
|
||||
for Line in open(Filename, 'r'):
|
||||
Line = Line.strip()
|
||||
# Remove comment block
|
||||
if Line.find(TAB_COMMENT_R8_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0]
|
||||
if Line.find(TAB_COMMENT_EDK_START) > -1:
|
||||
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
|
||||
IsFindBlockComment = True
|
||||
if Line.find(TAB_COMMENT_R8_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1]
|
||||
if Line.find(TAB_COMMENT_EDK_END) > -1:
|
||||
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
|
||||
ReservedLine = ''
|
||||
IsFindBlockComment = False
|
||||
if IsFindBlockComment:
|
||||
|
@@ -31,16 +31,6 @@ IncludePathListDict = {}
|
||||
ComplexTypeDict = {}
|
||||
SUDict = {}
|
||||
|
||||
## GetIgnoredDirListPattern() method
|
||||
#
|
||||
# Get the pattern of ignored direction list
|
||||
#
|
||||
# @return p: the pattern of ignored direction list
|
||||
#
|
||||
def GetIgnoredDirListPattern():
|
||||
p = re.compile(r'.*[\\/](?:BUILD|INTELRESTRICTEDTOOLS|INTELRESTRICTEDPKG|PCCTS)[\\/].*')
|
||||
return p
|
||||
|
||||
## GetFuncDeclPattern() method
|
||||
#
|
||||
# Get the pattern of function declaration
|
||||
|
@@ -43,7 +43,7 @@ class CapsuleFfs (CapsuleData):
|
||||
#
|
||||
# @param self The object pointer
|
||||
#
|
||||
def __init_(self) :
|
||||
def __init__(self) :
|
||||
self.Ffs = None
|
||||
self.FvName = None
|
||||
|
||||
@@ -87,3 +87,51 @@ class CapsuleFv (CapsuleData):
|
||||
else:
|
||||
FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName)
|
||||
return FvFile
|
||||
|
||||
## FD class for capsule data
|
||||
#
|
||||
#
|
||||
class CapsuleFd (CapsuleData):
|
||||
## The constructor
|
||||
#
|
||||
# @param self The object pointer
|
||||
#
|
||||
def __init__(self) :
|
||||
self.Ffs = None
|
||||
self.FdName = None
|
||||
self.CapsuleName = None
|
||||
|
||||
## generate FD capsule data
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @retval string Generated file name
|
||||
#
|
||||
def GenCapsuleSubItem(self):
|
||||
if self.FdName.find('.fd') == -1:
|
||||
if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())
|
||||
FdFile = FdObj.GenFd()
|
||||
return FdFile
|
||||
else:
|
||||
FdFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FdName)
|
||||
return FdFile
|
||||
|
||||
## AnyFile class for capsule data
|
||||
#
|
||||
#
|
||||
class CapsuleAnyFile (CapsuleData):
|
||||
## The constructor
|
||||
#
|
||||
# @param self The object pointer
|
||||
#
|
||||
def __init__(self) :
|
||||
self.Ffs = None
|
||||
self.FileName = None
|
||||
|
||||
## generate AnyFile capsule data
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @retval string Generated file name
|
||||
#
|
||||
def GenCapsuleSubItem(self):
|
||||
return self.FileName
|
@@ -2298,10 +2298,15 @@ class FdfParser:
|
||||
if not self.__IsKeyword( "FILE"):
|
||||
return False
|
||||
|
||||
FfsFileObj = FfsFileStatement.FileStatement()
|
||||
|
||||
if not self.__GetNextWord():
|
||||
raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if ForCapsule and self.__Token == 'DATA':
|
||||
self.__UndoToken()
|
||||
self.__UndoToken()
|
||||
return False
|
||||
|
||||
FfsFileObj = FfsFileStatement.FileStatement()
|
||||
FfsFileObj.FvFileType = self.__Token
|
||||
|
||||
if not self.__IsToken( "="):
|
||||
@@ -2917,7 +2922,9 @@ class FdfParser:
|
||||
IsInf = self.__GetInfStatement(Obj, True)
|
||||
IsFile = self.__GetFileStatement(Obj, True)
|
||||
IsFv = self.__GetFvStatement(Obj)
|
||||
if not IsInf and not IsFile and not IsFv:
|
||||
IsFd = self.__GetFdStatement(Obj)
|
||||
IsAnyFile = self.__GetAnyFileStatement(Obj)
|
||||
if not (IsInf or IsFile or IsFv or IsFd or IsAnyFile):
|
||||
break
|
||||
|
||||
## __GetFvStatement() method
|
||||
@@ -2945,6 +2952,65 @@ class FdfParser:
|
||||
CapsuleObj.CapsuleDataList.append(CapsuleFv)
|
||||
return True
|
||||
|
||||
## __GetFdStatement() method
|
||||
#
|
||||
# Get FD for capsule
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @param CapsuleObj for whom FD is got
|
||||
# @retval True Successfully find a FD statement
|
||||
# @retval False Not able to find a FD statement
|
||||
#
|
||||
def __GetFdStatement(self, CapsuleObj):
|
||||
|
||||
if not self.__IsKeyword("FD"):
|
||||
return False
|
||||
|
||||
if not self.__IsToken("="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected FD name", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
CapsuleFd = CapsuleData.CapsuleFd()
|
||||
CapsuleFd.FdName = self.__Token
|
||||
CapsuleObj.CapsuleDataList.append(CapsuleFd)
|
||||
return True
|
||||
|
||||
## __GetAnyFileStatement() method
|
||||
#
|
||||
# Get AnyFile for capsule
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @param CapsuleObj for whom AnyFile is got
|
||||
# @retval True Successfully find a Anyfile statement
|
||||
# @retval False Not able to find a AnyFile statement
|
||||
#
|
||||
def __GetAnyFileStatement(self, CapsuleObj):
|
||||
|
||||
if not self.__IsKeyword("FILE"):
|
||||
return False
|
||||
|
||||
if not self.__IsKeyword("DATA"):
|
||||
self.__UndoToken()
|
||||
return False
|
||||
|
||||
if not self.__IsToken("="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected File name", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
AnyFileName = self.__Token
|
||||
AnyFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(AnyFileName)
|
||||
if not os.path.exists(AnyFileName):
|
||||
raise Warning("File %s not exists"%AnyFileName, self.FileName, self.CurrentLineNumber)
|
||||
|
||||
CapsuleAnyFile = CapsuleData.CapsuleAnyFile()
|
||||
CapsuleAnyFile.FileName = AnyFileName
|
||||
CapsuleObj.CapsuleDataList.append(CapsuleAnyFile)
|
||||
return True
|
||||
|
||||
## __GetRule() method
|
||||
#
|
||||
# Get Rule section contents and store its data into rule list of self.Profile
|
||||
@@ -3930,16 +3996,18 @@ class FdfParser:
|
||||
def __GetReferencedFdCapTuple(self, CapObj, RefFdList = [], RefFvList = []):
|
||||
|
||||
for CapsuleDataObj in CapObj.CapsuleDataList :
|
||||
if CapsuleDataObj.FvName != None and CapsuleDataObj.FvName.upper() not in RefFvList:
|
||||
if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.FvName != None and CapsuleDataObj.FvName.upper() not in RefFvList:
|
||||
RefFvList.append (CapsuleDataObj.FvName.upper())
|
||||
elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.FdName != None and CapsuleDataObj.FdName.upper() not in RefFdList:
|
||||
RefFdList.append (CapsuleDataObj.FdName.upper())
|
||||
elif CapsuleDataObj.Ffs != None:
|
||||
if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.FileStatement):
|
||||
if CapsuleDataObj.Ffs.FvName != None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:
|
||||
RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())
|
||||
elif CapsuleDataObj.Ffs.FdName != None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:
|
||||
RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())
|
||||
else:
|
||||
self.__GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)
|
||||
if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.FileStatement):
|
||||
if CapsuleDataObj.Ffs.FvName != None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:
|
||||
RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())
|
||||
elif CapsuleDataObj.Ffs.FdName != None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:
|
||||
RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())
|
||||
else:
|
||||
self.__GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)
|
||||
|
||||
## __GetFvInFd() method
|
||||
#
|
||||
@@ -4139,12 +4207,19 @@ class FdfParser:
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = FdfParser("..\LakeportX64Pkg.fdf")
|
||||
import sys
|
||||
try:
|
||||
test_file = sys.argv[1]
|
||||
except IndexError, v:
|
||||
print "Usage: %s filename" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
parser = FdfParser(test_file)
|
||||
try:
|
||||
parser.ParseFile()
|
||||
parser.CycleReferenceCheck()
|
||||
except Warning, X:
|
||||
print str(X)
|
||||
print str(X)
|
||||
else:
|
||||
print "Success!"
|
||||
|
||||
|
@@ -36,6 +36,7 @@ from Common.BuildToolError import *
|
||||
from GuidSection import GuidSection
|
||||
from FvImageSection import FvImageSection
|
||||
from Common.Misc import PeImageClass
|
||||
from AutoGen.GenDepex import DependencyExpression
|
||||
|
||||
## generate FFS from INF
|
||||
#
|
||||
@@ -54,17 +55,75 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
self.OptRomDefs = {}
|
||||
self.PiSpecVersion = '0x00000000'
|
||||
self.InfModule = None
|
||||
self.FinalBuildTargetList = []
|
||||
self.FinalTargetSuffixMap = {}
|
||||
|
||||
## GetFinalBuildTargetList() method
|
||||
## GetFinalTargetSuffixMap() method
|
||||
#
|
||||
# Get final build target list
|
||||
def GetFinalBuildTargetList(self):
|
||||
def GetFinalTargetSuffixMap(self):
|
||||
if not self.InfModule or not self.CurrentArch:
|
||||
return []
|
||||
if not self.FinalBuildTargetList:
|
||||
self.FinalBuildTargetList = GenFdsGlobalVariable.GetModuleCodaTargetList(self.InfModule, self.CurrentArch)
|
||||
return self.FinalBuildTargetList
|
||||
if not self.FinalTargetSuffixMap:
|
||||
FinalBuildTargetList = GenFdsGlobalVariable.GetModuleCodaTargetList(self.InfModule, self.CurrentArch)
|
||||
for File in FinalBuildTargetList:
|
||||
self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)
|
||||
|
||||
# Check if current INF module has DEPEX
|
||||
if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != "USER_DEFINED" \
|
||||
and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
|
||||
ModuleType = self.InfModule.ModuleType
|
||||
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
|
||||
if ModuleType != DataType.SUP_MODULE_USER_DEFINED:
|
||||
for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
|
||||
if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
|
||||
self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
|
||||
|
||||
StrModule = str(self.InfModule)
|
||||
PlatformModule = None
|
||||
if StrModule in PlatformDataBase.Modules:
|
||||
PlatformModule = PlatformDataBase.Modules[StrModule]
|
||||
for LibraryClass in PlatformModule.LibraryClasses:
|
||||
if LibraryClass.startswith("NULL"):
|
||||
self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
|
||||
|
||||
DependencyList = [self.InfModule]
|
||||
LibraryInstance = {}
|
||||
DepexList = []
|
||||
while len(DependencyList) > 0:
|
||||
Module = DependencyList.pop(0)
|
||||
if not Module:
|
||||
continue
|
||||
for Dep in Module.Depex[self.CurrentArch, ModuleType]:
|
||||
if DepexList != []:
|
||||
DepexList.append('AND')
|
||||
DepexList.append('(')
|
||||
DepexList.extend(Dep)
|
||||
if DepexList[-1] == 'END': # no need of a END at this time
|
||||
DepexList.pop()
|
||||
DepexList.append(')')
|
||||
if 'BEFORE' in DepexList or 'AFTER' in DepexList:
|
||||
break
|
||||
for LibName in Module.LibraryClasses:
|
||||
if LibName in LibraryInstance:
|
||||
continue
|
||||
if PlatformModule and LibName in PlatformModule.LibraryClasses:
|
||||
LibraryPath = PlatformModule.LibraryClasses[LibName]
|
||||
else:
|
||||
LibraryPath = PlatformDataBase.LibraryClasses[LibName, ModuleType]
|
||||
if not LibraryPath:
|
||||
LibraryPath = Module.LibraryClasses[LibName]
|
||||
if not LibraryPath:
|
||||
continue
|
||||
LibraryModule = GenFdsGlobalVariable.WorkSpace.BuildObject[LibraryPath, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
LibraryInstance[LibName] = LibraryModule
|
||||
DependencyList.append(LibraryModule)
|
||||
if DepexList:
|
||||
Dpx = DependencyExpression(DepexList, ModuleType, True)
|
||||
if len(Dpx.PostfixNotation) != 0:
|
||||
# It means this module has DEPEX
|
||||
self.FinalTargetSuffixMap['.depex'] = [os.path.join(self.EfiOutputPath, self.BaseName) + '.depex']
|
||||
return self.FinalTargetSuffixMap
|
||||
|
||||
## __InfParse() method
|
||||
#
|
||||
|
@@ -36,9 +36,10 @@ from Common import EdkLogger
|
||||
from Common.String import *
|
||||
from Common.Misc import DirCache,PathClass
|
||||
from Common.Misc import SaveFileOnChange
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
## Version and Copyright
|
||||
versionNumber = "1.0"
|
||||
versionNumber = "1.0" + ' ' + gBUILD_VERSION
|
||||
__version__ = "%prog Version " + versionNumber
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
|
||||
@@ -311,7 +312,7 @@ def myOptionParser():
|
||||
Parser.add_option("-r", "--rom_image", dest="uiFdName", help="Build the image using the [FD] section named by FdUiName.")
|
||||
Parser.add_option("-i", "--FvImage", dest="uiFvName", help="Build the FV image using the [FV] section named by UiFvName")
|
||||
Parser.add_option("-C", "--CapsuleImage", dest="uiCapName", help="Build the Capsule image using the [Capsule] section named by UiCapName")
|
||||
Parser.add_option("-b", "--buildtarget", type="choice", choices=['DEBUG','RELEASE'], dest="BuildTarget", help="Build TARGET is one of list: DEBUG, RELEASE.",
|
||||
Parser.add_option("-b", "--buildtarget", type="choice", choices=['DEBUG','RELEASE', 'NOOPT'], dest="BuildTarget", help="Build TARGET is one of list: DEBUG, RELEASE, NOOPT.",
|
||||
action="callback", callback=SingleCheckCallback)
|
||||
Parser.add_option("-t", "--tagname", type="string", dest="ToolChain", help="Using the tools: TOOL_CHAIN_TAG name to build the platform.",
|
||||
action="callback", callback=SingleCheckCallback)
|
||||
|
@@ -140,9 +140,9 @@ class Section (SectionClassObject):
|
||||
GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
|
||||
|
||||
if Suffix != None:
|
||||
for File in FfsInf.GetFinalBuildTargetList():
|
||||
if os.path.splitext(File)[1] in (Suffix):
|
||||
FileList.append(File)
|
||||
SuffixMap = FfsInf.GetFinalTargetSuffixMap()
|
||||
if Suffix in SuffixMap:
|
||||
FileList.extend(SuffixMap[Suffix])
|
||||
|
||||
#Process the file lists is alphabetical for a same section type
|
||||
if len (FileList) > 1:
|
||||
|
@@ -25,9 +25,10 @@ import array
|
||||
from Common.BuildToolError import *
|
||||
import Common.EdkLogger as EdkLogger
|
||||
from Common.Misc import PeImageClass
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
# Version and Copyright
|
||||
__version_number__ = "0.10"
|
||||
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + __version_number__
|
||||
__copyright__ = "Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved."
|
||||
|
||||
|
@@ -49,6 +49,7 @@ COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildToolError.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Common\XmlParser.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Common\XmlRoutines.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Common\__init__.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Common\BuildVersion.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Workspace\BuildClassObject.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Workspace\MetaDataTable.py \
|
||||
$(BASE_TOOLS_PATH)\Source\Python\Workspace\MetaFileParser.py \
|
||||
@@ -79,7 +80,7 @@ $(BIN_DIR)\GenFds.exe: $(BASE_TOOLS_PATH)\Source\Python\GenFds\GenFds.py $(COMMO
|
||||
$(BIN_DIR)\Trim.exe: $(BASE_TOOLS_PATH)\Source\Python\Trim\Trim.py $(COMMON_PYTHON)
|
||||
@pushd . & @cd Trim & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Trim.py & @popd
|
||||
|
||||
$(BIN_DIR)\MigrationMsa2Inf.exe: $(BASE_TOOLS_PATH)\Source\Python\MigrationMsa2Inf\MigrationMsa2Inf.py
|
||||
$(BIN_DIR)\MigrationMsa2Inf.exe: $(BASE_TOOLS_PATH)\Source\Python\MigrationMsa2Inf\MigrationMsa2Inf.py $(COMMON_PYTHON)
|
||||
@pushd . & @cd MigrationMsa2Inf & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) MigrationMsa2Inf.py & @popd
|
||||
|
||||
$(BIN_DIR)\Fpd2Dsc.exe: $(BASE_TOOLS_PATH)\Source\Python\Fpd2Dsc\Fpd2Dsc.py $(COMMON_PYTHON)
|
||||
@@ -103,7 +104,7 @@ $(BIN_DIR)\PatchPcdValue.exe: $(BASE_TOOLS_PATH)\Source\Python\PatchPcdValue\Pat
|
||||
$(BIN_DIR)\BPDG.exe: $(BASE_TOOLS_PATH)\Source\Python\BPDG\BPDG.py $(COMMON_PYTHON)
|
||||
@pushd . & @cd BPDG & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) BPDG.py & @popd
|
||||
|
||||
$(BIN_DIR)\UPT.exe: $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py
|
||||
$(BIN_DIR)\UPT.exe: $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py $(COMMON_PYTHON)
|
||||
@pushd . & @cd UPT & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) UPT.py & @popd
|
||||
|
||||
clean:
|
||||
|
@@ -18,8 +18,9 @@ from optparse import OptionParser
|
||||
from AutoGenExterns import *
|
||||
from Common.XmlRoutines import * # XmlParseFile, XmlElement, XmlAttribute, XmlList, XmlElementData, XmlNode
|
||||
from Common.EdkIIWorkspace import *
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
versionNumber = "0.9"
|
||||
versionNumber = ("0.9" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + versionNumber
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
|
||||
|
@@ -22,10 +22,12 @@ from optparse import OptionParser
|
||||
from optparse import make_option
|
||||
from Common.BuildToolError import *
|
||||
import Common.EdkLogger as EdkLogger
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
import array
|
||||
|
||||
# Version and Copyright
|
||||
__version_number__ = "0.10"
|
||||
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + __version_number__
|
||||
__copyright__ = "Copyright (c) 2010, Intel Corporation. All rights reserved."
|
||||
|
||||
|
@@ -18,6 +18,7 @@ from optparse import OptionParser
|
||||
import Common.EdkLogger as EdkLogger
|
||||
import Common.BuildToolError as BuildToolError
|
||||
from Common.DataType import *
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
# To Do 1.set clean, 2. add item, if the line is disabled.
|
||||
|
||||
@@ -170,7 +171,7 @@ def GetConfigureKeyValue(self, Key):
|
||||
"Build rule file %s does not exist!" % self.Opt.BUILD_RULE_FILE, RaiseError=False)
|
||||
return Line
|
||||
|
||||
VersionNumber = "0.01"
|
||||
VersionNumber = ("0.01" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + VersionNumber
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
__usage__ = "%prog [options] {args} \
|
||||
|
@@ -22,11 +22,11 @@ from optparse import OptionParser
|
||||
from optparse import make_option
|
||||
from Common.BuildToolError import *
|
||||
from Common.Misc import *
|
||||
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
import Common.EdkLogger as EdkLogger
|
||||
|
||||
# Version and Copyright
|
||||
__version_number__ = "0.10"
|
||||
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + __version_number__
|
||||
__copyright__ = "Copyright (c) 2007-2010, Intel Corporation. All rights reserved."
|
||||
|
||||
@@ -390,7 +390,7 @@ def TrimAslFile(Source, Target, IncludePathFile):
|
||||
# @param Source File or directory to be trimmed
|
||||
# @param Target File or directory to store the trimmed content
|
||||
#
|
||||
def TrimR8Sources(Source, Target):
|
||||
def TrimEdkSources(Source, Target):
|
||||
if os.path.isdir(Source):
|
||||
for CurrentDir, Dirs, Files in os.walk(Source):
|
||||
if '.svn' in Dirs:
|
||||
@@ -402,17 +402,17 @@ def TrimR8Sources(Source, Target):
|
||||
Dummy, Ext = os.path.splitext(FileName)
|
||||
if Ext.upper() not in ['.C', '.H']: continue
|
||||
if Target == None or Target == '':
|
||||
TrimR8SourceCode(
|
||||
TrimEdkSourceCode(
|
||||
os.path.join(CurrentDir, FileName),
|
||||
os.path.join(CurrentDir, FileName)
|
||||
)
|
||||
else:
|
||||
TrimR8SourceCode(
|
||||
TrimEdkSourceCode(
|
||||
os.path.join(CurrentDir, FileName),
|
||||
os.path.join(Target, CurrentDir[len(Source)+1:], FileName)
|
||||
)
|
||||
else:
|
||||
TrimR8SourceCode(Source, Target)
|
||||
TrimEdkSourceCode(Source, Target)
|
||||
|
||||
## Trim one EDK source code file
|
||||
#
|
||||
@@ -445,7 +445,7 @@ def TrimR8Sources(Source, Target):
|
||||
# @param Source File to be trimmed
|
||||
# @param Target File to store the trimmed content
|
||||
#
|
||||
def TrimR8SourceCode(Source, Target):
|
||||
def TrimEdkSourceCode(Source, Target):
|
||||
EdkLogger.verbose("\t%s -> %s" % (Source, Target))
|
||||
CreateDirectory(os.path.dirname(Target))
|
||||
|
||||
@@ -491,8 +491,8 @@ def Options():
|
||||
help="The input file is preprocessed VFR file"),
|
||||
make_option("-a", "--asl-file", dest="FileType", const="Asl", action="store_const",
|
||||
help="The input file is ASL file"),
|
||||
make_option("-8", "--r8-source-code", dest="FileType", const="R8SourceCode", action="store_const",
|
||||
help="The input file is source code for R8 to be trimmed for ECP"),
|
||||
make_option("-8", "--Edk-source-code", dest="FileType", const="EdkSourceCode", action="store_const",
|
||||
help="The input file is source code for Edk to be trimmed for ECP"),
|
||||
|
||||
make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true",
|
||||
help="Convert standard hex format (0xabcd) to MASM format (abcdh)"),
|
||||
@@ -560,8 +560,8 @@ def Main():
|
||||
if CommandOptions.OutputFile == None:
|
||||
CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
|
||||
TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile)
|
||||
elif CommandOptions.FileType == "R8SourceCode":
|
||||
TrimR8Sources(InputFile, CommandOptions.OutputFile)
|
||||
elif CommandOptions.FileType == "EdkSourceCode":
|
||||
TrimEdkSources(InputFile, CommandOptions.OutputFile)
|
||||
else :
|
||||
if CommandOptions.OutputFile == None:
|
||||
CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
|
||||
|
@@ -43,6 +43,7 @@ import RmPkg
|
||||
from Library.Misc import CheckEnvVariable
|
||||
from Library import GlobalData
|
||||
from Core.IpiDb import IpiDatabase
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
##
|
||||
# Version and Copyright
|
||||
@@ -90,7 +91,7 @@ def SetLogLevel(Opt):
|
||||
def Main():
|
||||
Logger.Initialize()
|
||||
|
||||
Parser = OptionParser(version=MSG_VERSION, description=MSG_DESCRIPTION,
|
||||
Parser = OptionParser(version=(MSG_VERSION + ' ' + gBUILD_VERSION), description=MSG_DESCRIPTION,
|
||||
prog="UPT.exe", usage=MSG_USAGE)
|
||||
|
||||
Parser.add_option("-d", "--debug", action="store", type="int", dest="debug_level", help=ST.HLP_PRINT_DEBUG_INFO)
|
||||
|
@@ -338,10 +338,10 @@ class InfParser(MetaFileParser):
|
||||
NextLine = CleanString(self._Content[Index + 1])
|
||||
if Line == '':
|
||||
continue
|
||||
if Line.find(DataType.TAB_COMMENT_R8_START) > -1:
|
||||
if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
|
||||
IsFindBlockComment = True
|
||||
continue
|
||||
if Line.find(DataType.TAB_COMMENT_R8_END) > -1:
|
||||
if Line.find(DataType.TAB_COMMENT_EDK_END) > -1:
|
||||
IsFindBlockComment = False
|
||||
continue
|
||||
if IsFindBlockComment:
|
||||
@@ -479,7 +479,7 @@ class InfParser(MetaFileParser):
|
||||
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
|
||||
self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
|
||||
|
||||
## [nmake] section parser (R8.x style only)
|
||||
## [nmake] section parser (EDK.x style only)
|
||||
def _NmakeParser(self):
|
||||
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
|
||||
self._ValueList[0:len(TokenList)] = TokenList
|
||||
@@ -519,11 +519,11 @@ class InfParser(MetaFileParser):
|
||||
MODEL_UNKNOWN : MetaFileParser._Skip,
|
||||
MODEL_META_DATA_HEADER : _DefineParser,
|
||||
MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser,
|
||||
MODEL_EFI_INCLUDE : _IncludeParser, # for R8.x modules
|
||||
MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for R8.x modules
|
||||
MODEL_EFI_INCLUDE : _IncludeParser, # for EDK.x modules
|
||||
MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for EDK.x modules
|
||||
MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser,
|
||||
MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser,
|
||||
MODEL_META_DATA_NMAKE : _NmakeParser, # for R8.x modules
|
||||
MODEL_META_DATA_NMAKE : _NmakeParser, # for EDK.x modules
|
||||
MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
|
||||
MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
|
||||
MODEL_PCD_FEATURE_FLAG : _PcdParser,
|
||||
@@ -894,10 +894,20 @@ class DscParser(MetaFileParser):
|
||||
return self._OP_[Op](Value)
|
||||
# three operands
|
||||
elif TokenNumber == 3:
|
||||
TokenValue = self._EvaluateToken(TokenList[0], Expression)
|
||||
TokenValue = TokenList[0]
|
||||
if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
|
||||
TokenValue = TokenValue[1:-1]
|
||||
if TokenValue.startswith("$(") and TokenValue.endswith(")"):
|
||||
TokenValue = self._EvaluateToken(TokenValue, Expression)
|
||||
if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
|
||||
TokenValue = TokenValue[1:-1]
|
||||
if TokenValue == None:
|
||||
return False
|
||||
Value = TokenList[2]
|
||||
if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
|
||||
Value = Value[1:-1]
|
||||
if Value.startswith("$(") and Value.endswith(")"):
|
||||
Value = self._EvaluateToken(Value, Expression)
|
||||
if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
|
||||
Value = Value[1:-1]
|
||||
Op = TokenList[1]
|
||||
|
@@ -300,7 +300,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
if self._Header == None:
|
||||
self._GetHeaderInfo()
|
||||
if self._BuildTargets == None:
|
||||
self._BuildTargets = ['DEBUG', 'RELEASE']
|
||||
self._BuildTargets = ['DEBUG', 'RELEASE', 'NOOPT']
|
||||
return self._BuildTargets
|
||||
|
||||
## Retrieve SKUID_IDENTIFIER
|
||||
@@ -564,7 +564,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
continue
|
||||
self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance
|
||||
|
||||
# for R8 style library instances, which are listed in different section
|
||||
# for EDK style library instances, which are listed in different section
|
||||
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]
|
||||
for Record in RecordList:
|
||||
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
|
||||
@@ -1198,6 +1198,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
TAB_INF_DEFINES_COMPONENT_TYPE : "_ComponentType",
|
||||
TAB_INF_DEFINES_MAKEFILE_NAME : "_MakefileName",
|
||||
#TAB_INF_DEFINES_CUSTOM_MAKEFILE : "_CustomMakefile",
|
||||
TAB_INF_DEFINES_DPX_SOURCE :"_DxsFile",
|
||||
TAB_INF_DEFINES_VERSION_NUMBER : "_Version",
|
||||
TAB_INF_DEFINES_VERSION_STRING : "_Version",
|
||||
TAB_INF_DEFINES_VERSION : "_Version",
|
||||
@@ -1278,6 +1279,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._Header_ = None
|
||||
self._AutoGenVersion = None
|
||||
self._BaseName = None
|
||||
self._DxsFile = None
|
||||
self._ModuleType = None
|
||||
self._ComponentType = None
|
||||
self._BuildType = None
|
||||
@@ -1419,7 +1421,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._Defs[Name] = Record[1]
|
||||
|
||||
#
|
||||
# Retrieve information in sections specific to R8.x modules
|
||||
# Retrieve information in sections specific to EDK.x modules
|
||||
#
|
||||
if self._AutoGenVersion >= 0x00010005: # _AutoGenVersion may be None, which is less than anything
|
||||
if not self._ModuleType:
|
||||
@@ -1446,6 +1448,17 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
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 self.Sources == None:
|
||||
self._Sources = []
|
||||
self._Sources.append(File)
|
||||
else:
|
||||
self._BuildType = self._ComponentType.upper()
|
||||
if not self._ComponentType:
|
||||
@@ -1492,7 +1505,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
else:
|
||||
Tool = ToolList[0]
|
||||
ToolChain = "*_*_*_%s_FLAGS" % Tool
|
||||
ToolChainFamily = 'MSFT' # R8.x only support MSFT tool chain
|
||||
ToolChainFamily = 'MSFT' # EDK.x only support MSFT tool chain
|
||||
#ignore not replaced macros in value
|
||||
ValueList = GetSplitValueList(' ' + Value, '/D')
|
||||
Dummy = ValueList[0]
|
||||
@@ -1527,6 +1540,15 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BASE_NAME name", File=self.MetaFile)
|
||||
return self._BaseName
|
||||
|
||||
## Retrieve DxsFile
|
||||
def _GetDxsFile(self):
|
||||
if self._DxsFile == None:
|
||||
if self._Header_ == None:
|
||||
self._GetHeaderInfo()
|
||||
if self._DxsFile == None:
|
||||
self._DxsFile = ''
|
||||
return self._DxsFile
|
||||
|
||||
## Retrieve MODULE_TYPE
|
||||
def _GetModuleType(self):
|
||||
if self._ModuleType == None:
|
||||
@@ -1709,7 +1731,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
ToolCode = Record[3]
|
||||
FeatureFlag = Record[4]
|
||||
if self._AutoGenVersion < 0x00010005:
|
||||
# old module source files (R8)
|
||||
# old module source files (EDK)
|
||||
File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, self._SourceOverridePath,
|
||||
'', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
|
||||
# check the file validation
|
||||
@@ -1746,13 +1768,13 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._LibraryClasses[Lib] = Instance
|
||||
return self._LibraryClasses
|
||||
|
||||
## Retrieve library names (for R8.x style of modules)
|
||||
## Retrieve library names (for EDK.x style of modules)
|
||||
def _GetLibraryNames(self):
|
||||
if self._Libraries == None:
|
||||
self._Libraries = []
|
||||
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch, self._Platform]
|
||||
for Record in RecordList:
|
||||
# in case of name with '.lib' extension, which is unusual in R8.x inf
|
||||
# in case of name with '.lib' extension, which is unusual in EDK.x inf
|
||||
Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)
|
||||
LibraryName = os.path.splitext(Record[0])[0]
|
||||
if LibraryName not in self._Libraries:
|
||||
@@ -1807,14 +1829,14 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
self._Guids[CName] = Value
|
||||
return self._Guids
|
||||
|
||||
## Retrieve include paths necessary for this module (for R8.x style of modules)
|
||||
## Retrieve include paths necessary for this module (for EDK.x style of modules)
|
||||
def _GetIncludes(self):
|
||||
if self._Includes == None:
|
||||
self._Includes = []
|
||||
if self._SourceOverridePath:
|
||||
self._Includes.append(self._SourceOverridePath)
|
||||
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
|
||||
# [includes] section must be used only in old (R8.x) inf file
|
||||
# [includes] section must be used only in old (EDK.x) inf file
|
||||
if self.AutoGenVersion >= 0x00010005 and len(RecordList) > 0:
|
||||
EdkLogger.error('build', FORMAT_NOT_SUPPORTED, "No [include] section allowed",
|
||||
File=self.MetaFile, Line=RecordList[0][-1]-1)
|
||||
@@ -2130,7 +2152,8 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
ConstructorList = property(_GetConstructor)
|
||||
DestructorList = property(_GetDestructor)
|
||||
Defines = property(_GetDefines)
|
||||
|
||||
DxsFile = property(_GetDxsFile)
|
||||
|
||||
Binaries = property(_GetBinaryFiles)
|
||||
Sources = property(_GetSourceFiles)
|
||||
LibraryClasses = property(_GetLibraryClassUses)
|
||||
|
@@ -1256,7 +1256,7 @@ class FdRegionReport(object):
|
||||
FvTotalSize = 0
|
||||
FvTakenSize = 0
|
||||
FvFreeSize = 0
|
||||
FvReportFileName = os.path.join(self._FvDir, FvName + ".fv.txt")
|
||||
FvReportFileName = os.path.join(self._FvDir, FvName + ".Fv.txt")
|
||||
try:
|
||||
#
|
||||
# Collect size info in the firmware volume.
|
||||
|
@@ -34,6 +34,7 @@ from Common import Misc as Utils
|
||||
from Common.TargetTxtClassObject import *
|
||||
from Common.ToolDefClassObject import *
|
||||
from Common.DataType import *
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
from AutoGen.AutoGen import *
|
||||
from Common.BuildToolError import *
|
||||
from Workspace.WorkspaceDatabase import *
|
||||
@@ -46,7 +47,7 @@ import Common.EdkLogger
|
||||
import Common.GlobalData as GlobalData
|
||||
|
||||
# Version and Copyright
|
||||
VersionNumber = "0.5"
|
||||
VersionNumber = "0.5" + ' ' + gBUILD_VERSION
|
||||
__version__ = "%prog Version " + VersionNumber
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
|
||||
@@ -100,7 +101,7 @@ def CheckEnvVariable():
|
||||
os.environ["WORKSPACE"] = WorkspaceDir
|
||||
|
||||
#
|
||||
# Check EFI_SOURCE (R8 build convention). EDK_SOURCE will always point to ECP
|
||||
# Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP
|
||||
#
|
||||
if "ECP_SOURCE" not in os.environ:
|
||||
os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
|
||||
@@ -122,13 +123,13 @@ def CheckEnvVariable():
|
||||
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. R8 modules could not be built." % 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. R8 modules could not be built." % EdkSourceDir)
|
||||
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)
|
||||
@@ -137,7 +138,7 @@ def CheckEnvVariable():
|
||||
ExtraData=EdkSourceDir)
|
||||
if not os.path.exists(EfiSourceDir):
|
||||
if EfiSourceDir == EcpSourceDir:
|
||||
EdkLogger.verbose("EFI_SOURCE = %s doesn't exist. R8 modules could not be built." % EfiSourceDir)
|
||||
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)
|
||||
@@ -746,13 +747,15 @@ class Build():
|
||||
self.LoadConfiguration()
|
||||
|
||||
#
|
||||
# @attention Treat $(TARGET) in meta data files as special macro when it has only one build target.
|
||||
# This is not a complete support for $(TARGET) macro as it can only support one build target in ONE
|
||||
# invocation of build command. However, it should cover the frequent usage model that $(TARGET) macro
|
||||
# is used in DSC files to specify different libraries & PCD setting for debug/release build.
|
||||
# @attention Treat $(TARGET)/$(TOOL_CHAIN_TAG) in meta data files as special macro when it has only one build target/toolchain.
|
||||
# This is not a complete support for $(TARGET)/$(TOOL_CHAIN_TAG) macro as it can only support one build target/toolchain in ONE
|
||||
# invocation of build command. However, it should cover the frequent usage model that $(TARGET)/$(TOOL_CHAIN_TAG) macro
|
||||
# is used in DSC/FDF files to specify different libraries & PCD setting for debug/release build.
|
||||
#
|
||||
if len(self.BuildTargetList) == 1:
|
||||
self.Db._GlobalMacros.setdefault("TARGET", self.BuildTargetList[0])
|
||||
if len(self.ToolChainList) == 1:
|
||||
self.Db._GlobalMacros.setdefault("TOOL_CHAIN_TAG", self.ToolChainList[0])
|
||||
|
||||
self.InitBuild()
|
||||
|
||||
@@ -1708,8 +1711,8 @@ def MyOptionParser():
|
||||
help="Build the platform specified by the DSC file name argument, overriding target.txt's ACTIVE_PLATFORM definition.")
|
||||
Parser.add_option("-m", "--module", action="callback", type="string", dest="ModuleFile", callback=SingleCheckCallback,
|
||||
help="Build the module specified by the INF file name argument.")
|
||||
Parser.add_option("-b", "--buildtarget", action="append", type="choice", choices=['DEBUG','RELEASE'], dest="BuildTarget",
|
||||
help="BuildTarget is one of list: DEBUG, RELEASE, which overrides target.txt's TARGET definition. To specify more TARGET, please repeat this option.")
|
||||
Parser.add_option("-b", "--buildtarget", action="append", type="choice", choices=['DEBUG','RELEASE','NOOPT'], dest="BuildTarget",
|
||||
help="BuildTarget is one of list: DEBUG, RELEASE, NOOPT, which overrides target.txt's TARGET definition. To specify more TARGET, please repeat this option.")
|
||||
Parser.add_option("-t", "--tagname", action="append", type="string", dest="ToolChain",
|
||||
help="Using the Tool Chain Tagname to build the platform, overriding target.txt's TOOL_CHAIN_TAG definition.")
|
||||
Parser.add_option("-x", "--sku-id", action="callback", type="string", dest="SkuId", callback=SingleCheckCallback,
|
||||
|
@@ -18,9 +18,10 @@ import os, re, sys, xml.dom.minidom #XmlRoutines, EdkIIWorkspace
|
||||
from LoadFpd import LoadFpd
|
||||
from StoreDsc import StoreDsc
|
||||
from optparse import OptionParser
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
|
||||
# Version and Copyright
|
||||
__version_number__ = "1.0"
|
||||
__version_number__ = ("1.0" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + __version_number__
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
|
||||
|
@@ -68,9 +68,9 @@ def LoadModuleHeader(XmlMsa, MsaFileName):
|
||||
XmlTag = "ModuleSurfaceArea/Externs/PcdDriverTypes"
|
||||
ModuleHeader.PcdIsDriver = XmlElement(XmlMsa, XmlTag)
|
||||
|
||||
XmlTag = "ModuleSurfaceArea/Externs/TianoR8FlashMap_h"
|
||||
XmlTag = "ModuleSurfaceArea/Externs/TianoEdkFlashMap_h"
|
||||
if XmlElement(XmlMsa, XmlTag).lower() == "true":
|
||||
ModuleHeader.TianoR8FlashMap_h = True
|
||||
ModuleHeader.TianoEdkFlashMap_h = True
|
||||
|
||||
XmlTag = "ModuleSurfaceArea/Externs/Specification"
|
||||
for Specification in XmlElementList(XmlMsa, XmlTag):
|
||||
|
Reference in New Issue
Block a user