summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-03-12 10:54:01 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-03-12 10:54:01 +0000
commit636f2be673b2f43518167d8fddae56b714f19314 (patch)
treec82c7001b8eedcd561c73847fc17ff9875f72085 /BaseTools/Source/Python
parentb7250b714a24c650d3ed3abbf1a8c7d125edd85d (diff)
downloadedk2-platforms-636f2be673b2f43518167d8fddae56b714f19314.tar.xz
Sync EDKII BaseTools to BaseTools project r1928
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10234 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py4
-rw-r--r--BaseTools/Source/Python/Common/DscClassObject.py14
-rw-r--r--BaseTools/Source/Python/Common/FdfParserLite.py8
-rw-r--r--BaseTools/Source/Python/Common/Parsing.py16
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py63
-rw-r--r--BaseTools/Source/Python/build/BuildReport.py50
-rw-r--r--BaseTools/Source/Python/build/build.py75
7 files changed, 136 insertions, 94 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index c5d8991e07..b58d0c641f 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1,7 +1,7 @@
## @file
# Create makefile for MS nmake and GNU make
#
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -26,7 +26,7 @@ from BuildEngine import *
import Common.GlobalData as GlobalData
## Regular expression for finding header file inclusions
-gIncludePattern = re.compile(r"^[ \t]*#[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<][ \t]*)([\w.\\/]+)(?:[ \t]*[\">])", re.MULTILINE|re.UNICODE)
+gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<]?[ \t]*)([\w.\\/]+)(?:[ \t]*[\">]?)", re.MULTILINE|re.UNICODE)
## Regular expression for matching macro used in header file inclusion
gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
diff --git a/BaseTools/Source/Python/Common/DscClassObject.py b/BaseTools/Source/Python/Common/DscClassObject.py
index 50b6cc5bce..c25580ac37 100644
--- a/BaseTools/Source/Python/Common/DscClassObject.py
+++ b/BaseTools/Source/Python/Common/DscClassObject.py
@@ -1,7 +1,7 @@
## @file
# This file is used to define each component of DSC file
#
-# Copyright (c) 2007 ~ 2008, Intel Corporation
+# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -989,10 +989,14 @@ class Dsc(DscObject):
#
elif PreviousIf[2] in (MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, Model):
List = PreviousIf[0].split(' ')
- Value1 = List[0]
- Value2 = List[1]
- Value3 = List[2]
- Value3 = SplitString(Value3)
+ Value1, Value2, Value3 = '', '==', '0'
+ if len(List) == 3:
+ Value1 = List[0]
+ Value2 = List[1]
+ Value3 = List[2]
+ Value3 = SplitString(Value3)
+ if len(List) == 1:
+ Value1 = List[0]
Model = PreviousIf[2]
self.TblDsc.Insert(Model, Value1, Value2, Value3, ArchList, BelongsToItem, self.FileID, PreviousIf[1], StartColumn, EndLine, EndColumn, Enabled)
#
diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index eb7b0d7514..b181e65d16 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -1760,8 +1760,8 @@ class FdfParser(object):
if not self.__GetNextHexNumber():
raise Warning("expected Hex byte At Line ", self.FileName, self.CurrentLineNumber)
- if len(self.__Token) > 4:
- raise Warning("Hex byte(must be 2 digits) too long At Line ", self.FileName, self.CurrentLineNumber)
+ if len(self.__Token) > 18:
+ raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
DataString = self.__Token
DataString += ","
@@ -1792,8 +1792,8 @@ class FdfParser(object):
if not self.__GetNextHexNumber():
raise Warning("expected Hex byte At Line ", self.FileName, self.CurrentLineNumber)
- if len(self.__Token) > 4:
- raise Warning("Hex byte(must be 2 digits) too long At Line ", self.FileName, self.CurrentLineNumber)
+ if len(self.__Token) > 18:
+ raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
DataString = self.__Token
DataString += ","
diff --git a/BaseTools/Source/Python/Common/Parsing.py b/BaseTools/Source/Python/Common/Parsing.py
index 6ab91fbc33..3884b0521c 100644
--- a/BaseTools/Source/Python/Common/Parsing.py
+++ b/BaseTools/Source/Python/Common/Parsing.py
@@ -291,17 +291,17 @@ def QueryInfItem(Table, Model, BelongsToItem):
# @retval truple() A truple structure as (Family, ToolChain, Flag)
#
def GetBuildOption(String, File, LineNo = -1):
+ (Family, ToolChain, Flag) = ('', '', '')
if String.find(TAB_EQUAL_SPLIT) < 0:
RaiseParserError(String, 'BuildOptions', File, '[<Family>:]<ToolFlag>=Flag', LineNo)
- (Family, ToolChain, Flag) = ('', '', '')
- List = GetSplitValueList(String, TAB_EQUAL_SPLIT, MaxSplit = 1)
- if List[0].find(':') > -1:
- Family = List[0][ : List[0].find(':')].strip()
- ToolChain = List[0][List[0].find(':') + 1 : ].strip()
else:
- ToolChain = List[0].strip()
- Flag = List[1].strip()
-
+ List = GetSplitValueList(String, TAB_EQUAL_SPLIT, MaxSplit = 1)
+ if List[0].find(':') > -1:
+ Family = List[0][ : List[0].find(':')].strip()
+ ToolChain = List[0][List[0].find(':') + 1 : ].strip()
+ else:
+ ToolChain = List[0].strip()
+ Flag = List[1].strip()
return (Family, ToolChain, Flag)
## Get Library Class
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 92d6ab64ba..1e87eb410e 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1787,19 +1787,27 @@ class FdfParser:
if not self.__GetNextHexNumber():
raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber)
- if len(self.__Token) > 4:
- raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
-
- DataString = self.__Token
- DataString += ","
-
- while self.__IsToken(","):
- if not self.__GetNextHexNumber():
- raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
- if len(self.__Token) > 4:
- raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
- DataString += self.__Token
- DataString += ","
+ if len(self.__Token) > 18:
+ raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
+
+ # convert hex string value to byte hex string array
+ AllString = self.__Token
+ AllStrLen = len (AllString)
+ DataString = ""
+ while AllStrLen > 4:
+ DataString = DataString + "0x" + AllString[AllStrLen - 2: AllStrLen] + ","
+ AllStrLen = AllStrLen - 2
+ DataString = DataString + AllString[:AllStrLen] + ","
+
+ # byte value array
+ if len (self.__Token) <= 4:
+ while self.__IsToken(","):
+ if not self.__GetNextHexNumber():
+ raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
+ if len(self.__Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ DataString += self.__Token
+ DataString += ","
if not self.__IsToken( "}"):
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
@@ -1819,18 +1827,27 @@ class FdfParser:
if not self.__GetNextHexNumber():
raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber)
- if len(self.__Token) > 4:
- raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ if len(self.__Token) > 18:
+ raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
- DataString = self.__Token
- DataString += ","
+ # convert hex string value to byte hex string array
+ AllString = self.__Token
+ AllStrLen = len (AllString)
+ DataString = ""
+ while AllStrLen > 4:
+ DataString = DataString + "0x" + AllString[AllStrLen - 2: AllStrLen] + ","
+ AllStrLen = AllStrLen - 2
+ DataString = DataString + AllString[:AllStrLen] + ","
- while self.__IsToken(","):
- self.__GetNextHexNumber()
- if len(self.__Token) > 4:
- raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
- DataString += self.__Token
- DataString += ","
+ # byte value array
+ if len (self.__Token) <= 4:
+ while self.__IsToken(","):
+ if not self.__GetNextHexNumber():
+ raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
+ if len(self.__Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ DataString += self.__Token
+ DataString += ","
if not self.__IsToken( "}"):
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index eac21d1495..f805aae5ca 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -221,7 +221,7 @@ class LibraryReport(object):
EdkIILibInfo += " C = " + LibConstructor
LibDestructor = " ".join(LibraryItem[3])
if LibDestructor:
- EdkIILibInfo += " D = " + LibConstructor
+ EdkIILibInfo += " D = " + LibDestructor
LibDepex = " ".join(LibraryItem[4])
if LibDepex:
EdkIILibInfo += " Depex = " + LibDepex
@@ -255,7 +255,8 @@ class DepexReport(object):
ModuleType = M.ModuleType
if not ModuleType:
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
- if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE"]:
+
+ if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "UEFI_APPLICATION"]:
return
for Source in M.SourceFileList:
@@ -404,17 +405,18 @@ class ModuleReport(object):
self.Size = 0
self.BuildTimeStamp = None
self.DriverType = ""
- ModuleType = M.ModuleType
- if not ModuleType:
- ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
- #
- # If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"
- #
- if ModuleType == "DXE_SMM_DRIVER":
- PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
- if int(PiSpec, 0) >= 0x0001000A:
- ModuleType = "SMM_DRIVER"
- self.DriverType = gDriverTypeMap.get(ModuleType, "")
+ if not M.IsLibrary:
+ ModuleType = M.ModuleType
+ if not ModuleType:
+ ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
+ #
+ # If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"
+ #
+ if ModuleType == "DXE_SMM_DRIVER":
+ PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
+ if int(PiSpec, 0) >= 0x0001000A:
+ ModuleType = "SMM_DRIVER"
+ self.DriverType = gDriverTypeMap.get(ModuleType, "0x2 (FREE_FORM)")
self.UefiSpecVersion = M.Module.Specification.get("UEFI_SPECIFICATION_VERSION", "")
self.PiSpecVersion = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "")
self.PciDeviceId = M.Module.Defines.get("PCI_DEVICE_ID", "")
@@ -1310,9 +1312,11 @@ class PlatformReport(object):
self.ModuleReportList = []
if MaList != None:
+ self._IsModuleBuild = True
for Ma in MaList:
self.ModuleReportList.append(ModuleReport(Ma, ReportType))
else:
+ self._IsModuleBuild = False
for Pa in Wa.AutoGenObjectList:
for ModuleKey in Pa.Platform.Modules:
self.ModuleReportList.append(ModuleReport(Pa.Platform.Modules[ModuleKey].M, ReportType))
@@ -1343,18 +1347,20 @@ class PlatformReport(object):
FileWrite(File, "Build Duration: %s" % BuildDuration)
FileWrite(File, "Report Content: %s" % ", ".join(ReportType))
- if "PCD" in ReportType:
- self.PcdReport.GenerateReport(File, None)
-
- if "FLASH" in ReportType:
- for FdReportListItem in self.FdReportList:
- FdReportListItem.GenerateReport(File)
+ if not self._IsModuleBuild:
+ if "PCD" in ReportType:
+ self.PcdReport.GenerateReport(File, None)
+
+ if "FLASH" in ReportType:
+ for FdReportListItem in self.FdReportList:
+ FdReportListItem.GenerateReport(File)
for ModuleReportItem in self.ModuleReportList:
ModuleReportItem.GenerateReport(File, self.PcdReport, self.PredictionReport, ReportType)
- if "EXECUTION_ORDER" in ReportType:
- self.PredictionReport.GenerateReport(File, None)
+ if not self._IsModuleBuild:
+ if "EXECUTION_ORDER" in ReportType:
+ self.PredictionReport.GenerateReport(File, None)
## BuildReport class
#
@@ -1422,7 +1428,7 @@ class BuildReport(object):
EdkLogger.error("BuildReport", CODE_ERROR, "Unknown fatal error when generating build report", ExtraData=self.ReportFile, RaiseError=False)
EdkLogger.quiet("(Python %s on %s\n%s)" % (platform.python_version(), sys.platform, traceback.format_exc()))
File.close()
-
+
# This acts like the main() function for the script, unless it is 'import'ed into another script.
if __name__ == '__main__':
pass
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index e3a3dd9f3f..6129308011 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1090,9 +1090,10 @@ class Build():
## Collect MAP information of all FVs
#
- def _CollectFvMapBuffer (self, MapBuffer, Wa):
+ def _CollectFvMapBuffer (self, MapBuffer, Wa, ModuleList):
if self.Fdf != '':
# First get the XIP base address for FV map file.
+ GuidPattern = re.compile("[-a-fA-F0-9]+")
for FvName in Wa.FdfProfile.FvDict.keys():
FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map')
if not os.path.exists(FvMapBuffer):
@@ -1103,7 +1104,16 @@ class Build():
FvMap.readline()
FvMap.readline()
FvMap.readline()
- MapBuffer.write(FvMap.read())
+ for Line in FvMap:
+ MatchGuid = GuidPattern.match(Line)
+ if MatchGuid != None:
+ #
+ # Replace GUID with module name
+ #
+ GuidString = MatchGuid.group()
+ if GuidString.upper() in ModuleList:
+ Line = Line.replace(GuidString, ModuleList[GuidString.upper()].Name)
+ MapBuffer.write('%s' % (Line))
FvMap.close()
## Collect MAP information of all modules
@@ -1124,7 +1134,8 @@ class Build():
IsIpfPlatform = False
if 'IPF' in self.ArchList:
IsIpfPlatform = True
- for Module in ModuleList:
+ for ModuleGuid in ModuleList:
+ Module = ModuleList[ModuleGuid]
GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (Module.MetaFile, Module.Arch, Module.ToolChain, Module.BuildTarget)
OutputImageFile = ''
@@ -1259,7 +1270,8 @@ class Build():
#
SaveFileOnChange(MapFilePath, MapBuffer.getvalue(), False)
MapBuffer.close()
- sys.stdout.write ("\nLoad Module At Fix Address Map file saved to %s\n" %(MapFilePath))
+ if self.LoadFixAddress != 0:
+ sys.stdout.write ("\nLoad Module At Fix Address Map file saved to %s\n" %(MapFilePath))
sys.stdout.flush()
## Build active platform for different build targets and different tool chains
@@ -1286,7 +1298,7 @@ class Build():
self._Build(self.Target, Wa)
# Create MAP file when Load Fix Address is enabled.
- if self.Target in ["", "all", "fds"] and self.LoadFixAddress != 0:
+ if self.Target in ["", "all", "fds"]:
for Arch in self.ArchList:
#
# Check whether the set fix address is above 4G for 32bit image.
@@ -1296,19 +1308,20 @@ class Build():
#
# Get Module List
#
- ModuleList = []
+ ModuleList = {}
for Pa in Wa.AutoGenObjectList:
for Ma in Pa.ModuleAutoGenList:
if Ma == None:
continue
if not Ma.IsLibrary:
- ModuleList.append (Ma)
+ ModuleList[Ma.Guid.upper()] = Ma
MapBuffer = StringIO('')
- #
- # Rebase module to the preferred memory address before GenFds
- #
- self._CollectModuleMapBuffer(MapBuffer, ModuleList)
+ if self.LoadFixAddress != 0:
+ #
+ # Rebase module to the preferred memory address before GenFds
+ #
+ self._CollectModuleMapBuffer(MapBuffer, ModuleList)
if self.Fdf != '':
#
# create FDS again for the updated EFI image
@@ -1317,7 +1330,7 @@ class Build():
#
# Create MAP file for all platform FVs after GenFds.
#
- self._CollectFvMapBuffer(MapBuffer, Wa)
+ self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
#
# Save MAP buffer into MAP file.
#
@@ -1367,7 +1380,7 @@ class Build():
ExtraData=self.ModuleFile
)
# Create MAP file when Load Fix Address is enabled.
- if self.LoadFixAddress != 0 and self.Target == "fds" and self.Fdf != '':
+ if self.Target == "fds" and self.Fdf != '':
for Arch in self.ArchList:
#
# Check whether the set fix address is above 4G for 32bit image.
@@ -1377,27 +1390,28 @@ class Build():
#
# Get Module List
#
- ModuleList = []
+ ModuleList = {}
for Pa in Wa.AutoGenObjectList:
for Ma in Pa.ModuleAutoGenList:
if Ma == None:
continue
if not Ma.IsLibrary:
- ModuleList.append (Ma)
+ ModuleList[Ma.Guid.upper()] = Ma
MapBuffer = StringIO('')
- #
- # Rebase module to the preferred memory address before GenFds
- #
- self._CollectModuleMapBuffer(MapBuffer, ModuleList)
- #
- # create FDS again for the updated EFI image
- #
- self._Build("fds", Wa)
+ if self.LoadFixAddress != 0:
+ #
+ # Rebase module to the preferred memory address before GenFds
+ #
+ self._CollectModuleMapBuffer(MapBuffer, ModuleList)
+ #
+ # create FDS again for the updated EFI image
+ #
+ self._Build("fds", Wa)
#
# Create MAP file for all platform FVs after GenFds.
#
- self._CollectFvMapBuffer(MapBuffer, Wa)
+ self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
#
# Save MAP buffer into MAP file.
#
@@ -1483,7 +1497,7 @@ class Build():
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
# Create MAP file when Load Fix Address is enabled.
- if self.Target in ["", "all", "fds"] and self.LoadFixAddress != 0:
+ if self.Target in ["", "all", "fds"]:
for Arch in self.ArchList:
#
# Check whether the set fix address is above 4G for 32bit image.
@@ -1493,30 +1507,31 @@ class Build():
#
# Get Module List
#
- ModuleList = []
+ ModuleList = {}
for Pa in Wa.AutoGenObjectList:
for Ma in Pa.ModuleAutoGenList:
if Ma == None:
continue
if not Ma.IsLibrary:
- ModuleList.append (Ma)
+ ModuleList[Ma.Guid.upper()] = Ma
#
# Rebase module to the preferred memory address before GenFds
#
MapBuffer = StringIO('')
- self._CollectModuleMapBuffer(MapBuffer, ModuleList)
+ if self.LoadFixAddress != 0:
+ self._CollectModuleMapBuffer(MapBuffer, ModuleList)
# Generate FD image if there's a FDF file found
if self.Fdf != '' and self.Target in ["", "all", "fds"]:
LaunchCommand(Wa.BuildCommand + ["fds"], Wa.MakeFileDir)
# Create MAP file for all platform FV after GenFds
- if self.Target in ["", "all", "fds"] and self.LoadFixAddress != 0:
+ if self.Target in ["", "all", "fds"]:
if self.Fdf != '':
#
# Create MAP file for all platform FVs after GenFds.
#
- self._CollectFvMapBuffer(MapBuffer, Wa)
+ self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
#
# Save MAP buffer into MAP file.
#