## @file\r
# build a platform or a module\r
#\r
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
##\r
# Import Modules\r
#\r
-import os\r
+import Common.LongFilePathOs as os\r
import re\r
import StringIO\r
import sys\r
import time\r
import platform\r
import traceback\r
-import encodings.ascii \r
+import encodings.ascii\r
+import itertools\r
\r
from struct import *\r
from threading import *\r
from subprocess import *\r
from Common import Misc as Utils\r
\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.LongFilePathSupport import LongFilePath\r
from Common.TargetTxtClassObject import *\r
from Common.ToolDefClassObject import *\r
from Common.DataType import *\r
from AutoGen.AutoGen import *\r
from Common.BuildToolError import *\r
from Workspace.WorkspaceDatabase import *\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
\r
from BuildReport import BuildReport\r
from GenPatchPcdTable.GenPatchPcdTable import *\r
import Common.GlobalData as GlobalData\r
\r
# Version and Copyright\r
-VersionNumber = "0.5" + ' ' + gBUILD_VERSION\r
+VersionNumber = "0.60" + ' ' + gBUILD_VERSION\r
__version__ = "%prog Version " + VersionNumber\r
-__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."\r
+__copyright__ = "Copyright (c) 2007 - 2017, Intel Corporation All rights reserved."\r
\r
## standard targets of build command\r
gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run']\r
\r
## build configuration file\r
-gBuildConfiguration = "Conf/target.txt"\r
-gBuildCacheDir = "Conf/.cache"\r
-gToolsDefinition = "Conf/tools_def.txt"\r
+gBuildConfiguration = "target.txt"\r
+gToolsDefinition = "tools_def.txt"\r
+\r
+TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')\r
+TmpTableDict = {}\r
\r
## Check environment PATH variable to make sure the specified tool is found\r
#\r
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in WORKSPACE path",\r
ExtraData=WorkspaceDir)\r
os.environ["WORKSPACE"] = WorkspaceDir\r
+ \r
+ # set multiple workspace\r
+ PackagesPath = os.getenv("PACKAGES_PATH")\r
+ mws.setWs(WorkspaceDir, PackagesPath)\r
+ if mws.PACKAGES_PATH:\r
+ for Path in mws.PACKAGES_PATH:\r
+ if not os.path.exists(Path):\r
+ EdkLogger.error("build", FILE_NOT_FOUND, "One Path in PACKAGES_PATH doesn't exist", ExtraData="%s" % Path)\r
+ elif ' ' in Path:\r
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path)\r
\r
#\r
# Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP\r
#\r
if "ECP_SOURCE" not in os.environ:\r
- os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)\r
+ os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)\r
if "EFI_SOURCE" not in os.environ:\r
os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]\r
if "EDK_SOURCE" not in os.environ:\r
EfiSourceDir = os.path.normcase(os.path.normpath(os.environ["EFI_SOURCE"]))\r
EdkSourceDir = os.path.normcase(os.path.normpath(os.environ["EDK_SOURCE"]))\r
EcpSourceDir = os.path.normcase(os.path.normpath(os.environ["ECP_SOURCE"]))\r
- \r
+\r
os.environ["EFI_SOURCE"] = EfiSourceDir\r
os.environ["EDK_SOURCE"] = EdkSourceDir\r
os.environ["ECP_SOURCE"] = EcpSourceDir\r
os.environ["EDK_TOOLS_PATH"] = os.path.normcase(os.environ["EDK_TOOLS_PATH"])\r
- \r
+\r
if not os.path.exists(EcpSourceDir):\r
EdkLogger.verbose("ECP_SOURCE = %s doesn't exist. Edk modules could not be built." % EcpSourceDir)\r
elif ' ' in EcpSourceDir:\r
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in EFI_SOURCE path",\r
ExtraData=EfiSourceDir)\r
\r
- # change absolute path to relative path to WORKSPACE\r
- if EfiSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
- EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE is not under WORKSPACE",\r
- ExtraData="WORKSPACE = %s\n EFI_SOURCE = %s" % (WorkspaceDir, EfiSourceDir))\r
- if EdkSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
- EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE is not under WORKSPACE",\r
- ExtraData="WORKSPACE = %s\n EDK_SOURCE = %s" % (WorkspaceDir, EdkSourceDir))\r
- if EcpSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
- EdkLogger.error("build", PARAMETER_INVALID, "ECP_SOURCE is not under WORKSPACE",\r
- ExtraData="WORKSPACE = %s\n ECP_SOURCE = %s" % (WorkspaceDir, EcpSourceDir))\r
+ # check those variables on single workspace case\r
+ if not PackagesPath:\r
+ # change absolute path to relative path to WORKSPACE\r
+ if EfiSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
+ EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE is not under WORKSPACE",\r
+ ExtraData="WORKSPACE = %s\n EFI_SOURCE = %s" % (WorkspaceDir, EfiSourceDir))\r
+ if EdkSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
+ EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE is not under WORKSPACE",\r
+ ExtraData="WORKSPACE = %s\n EDK_SOURCE = %s" % (WorkspaceDir, EdkSourceDir))\r
+ if EcpSourceDir.upper().find(WorkspaceDir.upper()) != 0:\r
+ EdkLogger.error("build", PARAMETER_INVALID, "ECP_SOURCE is not under WORKSPACE",\r
+ ExtraData="WORKSPACE = %s\n ECP_SOURCE = %s" % (WorkspaceDir, EcpSourceDir))\r
\r
# check EDK_TOOLS_PATH\r
if "EDK_TOOLS_PATH" not in os.environ:\r
GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir\r
GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir\r
GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]\r
-\r
+ \r
## Get normalized file path\r
#\r
# Convert the path to be local format, and remove the WORKSPACE path at the\r
if os.path.isabs(FilePath):\r
FileFullPath = os.path.normpath(FilePath)\r
else:\r
- FileFullPath = os.path.normpath(os.path.join(Workspace, FilePath))\r
+ FileFullPath = os.path.normpath(mws.join(Workspace, FilePath))\r
+ Workspace = mws.getWs(Workspace, FilePath)\r
\r
# check if the file path exists or not\r
if not os.path.isfile(FileFullPath):\r
- EdkLogger.error("build", FILE_NOT_FOUND, ExtraData="\t%s (Please give file in absolute path or relative to WORKSPACE)" % FileFullPath)\r
+ EdkLogger.error("build", FILE_NOT_FOUND, ExtraData="\t%s (Please give file in absolute path or relative to WORKSPACE)" % FileFullPath)\r
\r
# remove workspace directory from the beginning part of the file path\r
if Workspace[-1] in ["\\", "/"]:\r
# if working directory doesn't exist, Popen() will raise an exception\r
if not os.path.isdir(WorkingDir):\r
EdkLogger.error("build", FILE_NOT_FOUND, ExtraData=WorkingDir)\r
+ \r
+ # Command is used as the first Argument in following Popen().\r
+ # It could be a string or sequence. We find that if command is a string in following Popen(),\r
+ # ubuntu may fail with an error message that the command is not found.\r
+ # So here we may need convert command from string to list instance.\r
+ if platform.system() != 'Windows':\r
+ if not isinstance(Command, list):\r
+ Command = Command.split()\r
+ Command = ' '.join(Command)\r
\r
Proc = None\r
EndOfProcedure = None\r
try:\r
# launch the command\r
- Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1)\r
+ Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)\r
\r
# launch two threads to read the STDOUT and STDERR\r
EndOfProcedure = Event()\r
Proc.wait()\r
except: # in case of aborting\r
# terminate the threads redirecting the program output\r
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
if EndOfProcedure != None:\r
EndOfProcedure.set()\r
if Proc == None:\r
if Proc.returncode != 0:\r
if type(Command) != type(""):\r
Command = " ".join(Command)\r
+ # print out the Response file and its content when make failure\r
+ RespFile = os.path.join(WorkingDir, 'OUTPUT', 'respfilelist.txt')\r
+ if os.path.isfile(RespFile):\r
+ f = open(RespFile)\r
+ RespContent = f.read()\r
+ f.close()\r
+ EdkLogger.info(RespContent)\r
+\r
EdkLogger.error("build", COMMAND_FAILURE, ExtraData="%s [%s]" % (Command, WorkingDir))\r
\r
## The smallest unit that can be built in multi-thread build mode\r
if not BuildCommand:\r
EdkLogger.error("build", OPTION_MISSING,\r
"No build command found for this module. "\r
- "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." % \r
+ "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %\r
(Obj.BuildTarget, Obj.ToolChain, Obj.Arch),\r
ExtraData=str(Obj))\r
\r
#\r
def AddDependency(self, Dependency):\r
for Dep in Dependency:\r
- self.DependencyList.append(BuildTask.New(Dep)) # BuildTask list\r
+ if not Dep.BuildObject.IsBinaryModule:\r
+ self.DependencyList.append(BuildTask.New(Dep)) # BuildTask list\r
\r
## The thread wrapper of LaunchCommand function\r
#\r
#\r
# Constructor will load all required image information.\r
#\r
- # @param BaseName The full file path of image. \r
+ # @param BaseName The full file path of image.\r
# @param Guid The GUID for image.\r
# @param Arch Arch of this image.\r
# @param OutputDir The output directory for image.\r
self.SkipAutoGen = BuildOptions.SkipAutoGen\r
self.Reparse = BuildOptions.Reparse\r
self.SkuId = BuildOptions.SkuId\r
+ self.ConfDirectory = BuildOptions.ConfDirectory\r
self.SpawnMode = True\r
self.BuildReport = BuildReport(BuildOptions.ReportFile, BuildOptions.ReportType)\r
self.TargetTxt = TargetTxtClassObject()\r
self.ToolDef = ToolDefClassObject()\r
+ GlobalData.BuildOptionPcd = BuildOptions.OptionPcd\r
+ #Set global flag for build mode\r
+ GlobalData.gIgnoreSource = BuildOptions.IgnoreSources\r
+\r
+ if self.ConfDirectory:\r
+ # Get alternate Conf location, if it is absolute, then just use the absolute directory name\r
+ ConfDirectoryPath = os.path.normpath(self.ConfDirectory)\r
+\r
+ if not os.path.isabs(ConfDirectoryPath):\r
+ # Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE\r
+ # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf\r
+ ConfDirectoryPath = mws.join(self.WorkspaceDir, ConfDirectoryPath)\r
+ else:\r
+ if "CONF_PATH" in os.environ:\r
+ ConfDirectoryPath = os.path.normcase(os.path.normpath(os.environ["CONF_PATH"]))\r
+ else:\r
+ # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf\r
+ ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')\r
+ GlobalData.gConfDirectory = ConfDirectoryPath\r
+ GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))\r
+\r
if BuildOptions.DisableCache:\r
self.Db = WorkspaceDatabase(":memory:")\r
else:\r
- self.Db = WorkspaceDatabase(None, self.Reparse)\r
- self.BuildDatabase = self.Db.BuildObject\r
- self.Platform = None\r
+ self.Db = WorkspaceDatabase(GlobalData.gDatabasePath, self.Reparse)\r
+ self.BuildDatabase = self.Db.BuildObject\r
+ self.Platform = None\r
+ self.ToolChainFamily = None\r
self.LoadFixAddress = 0\r
self.UniFlag = BuildOptions.Flag\r
+ self.BuildModules = []\r
+ self.Db_Flag = False\r
+ self.LaunchPrebuildFlag = False\r
+ self.PrebuildScript = ''\r
+ self.PostbuildScript = ''\r
+ self.PlatformBuildPath = os.path.join(GlobalData.gConfDirectory,'.cache', '.PlatformBuild')\r
+ if BuildOptions.CommandLength:\r
+ GlobalData.gCommandMaxLength = BuildOptions.CommandLength\r
\r
# print dot character during doing some time-consuming work\r
self.Progress = Utils.Progressor()\r
-\r
- self.InitBuild()\r
-\r
# print current build environment and configuration\r
EdkLogger.quiet("%-16s = %s" % ("WORKSPACE", os.environ["WORKSPACE"]))\r
+ if "PACKAGES_PATH" in os.environ:\r
+ # WORKSPACE env has been converted before. Print the same path style with WORKSPACE env. \r
+ EdkLogger.quiet("%-16s = %s" % ("PACKAGES_PATH", os.path.normcase(os.path.normpath(os.environ["PACKAGES_PATH"]))))\r
EdkLogger.quiet("%-16s = %s" % ("ECP_SOURCE", os.environ["ECP_SOURCE"]))\r
EdkLogger.quiet("%-16s = %s" % ("EDK_SOURCE", os.environ["EDK_SOURCE"]))\r
EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))\r
EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))\r
+ if "EDK_TOOLS_BIN" in os.environ:\r
+ # Print the same path style with WORKSPACE env. \r
+ EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN", os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"]))))\r
+ EdkLogger.quiet("%-16s = %s" % ("CONF_PATH", GlobalData.gConfDirectory))\r
+ self.InitPreBuild()\r
+ self.InitPostBuild()\r
+ if self.PrebuildScript:\r
+ EdkLogger.quiet("%-16s = %s" % ("PREBUILD", self.PrebuildScript))\r
+ if self.PostbuildScript:\r
+ EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.PostbuildScript))\r
+ if self.PrebuildScript:\r
+ self.LaunchPrebuild()\r
+ self.TargetTxt = TargetTxtClassObject()\r
+ self.ToolDef = ToolDefClassObject()\r
+ if not (self.LaunchPrebuildFlag and os.path.exists(self.PlatformBuildPath)):\r
+ self.InitBuild()\r
\r
EdkLogger.info("")\r
- if self.ArchList:\r
- EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' '.join(self.ArchList)))\r
- EdkLogger.info('%-16s = %s' % ("Build target", ' '.join(self.BuildTargetList)))\r
- EdkLogger.info('%-16s = %s' % ("Toolchain", ' '.join(self.ToolChainList)))\r
-\r
- EdkLogger.info('\n%-16s = %s' % ("Active Platform", self.PlatformFile))\r
- if self.ModuleFile:\r
- EdkLogger.info('%-16s = %s' % ("Active Module", self.ModuleFile))\r
-\r
os.chdir(self.WorkspaceDir)\r
- self.Progress.Start("\nProcessing meta-data")\r
\r
## Load configuration\r
#\r
#\r
# Check target.txt and tools_def.txt and Init them\r
#\r
- BuildConfigurationFile = os.path.normpath(os.path.join(self.WorkspaceDir, gBuildConfiguration))\r
+ BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, gBuildConfiguration))\r
if os.path.isfile(BuildConfigurationFile) == True:\r
StatusCode = self.TargetTxt.LoadTargetTxtFile(BuildConfigurationFile)\r
\r
ToolDefinitionFile = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]\r
if ToolDefinitionFile == '':\r
ToolDefinitionFile = gToolsDefinition\r
- ToolDefinitionFile = os.path.normpath(os.path.join(self.WorkspaceDir, ToolDefinitionFile))\r
+ ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile))\r
if os.path.isfile(ToolDefinitionFile) == True:\r
StatusCode = self.ToolDef.LoadToolDefFile(ToolDefinitionFile)\r
else:\r
else:\r
self.ToolChainList = NewToolChainList\r
\r
+ ToolChainFamily = []\r
+ ToolDefinition = self.ToolDef.ToolsDefTxtDatabase\r
+ for Tool in self.ToolChainList:\r
+ if TAB_TOD_DEFINES_FAMILY not in ToolDefinition or Tool not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \\r
+ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]:\r
+ EdkLogger.warn("No tool chain family found in configuration for %s. Default to MSFT." % Tool)\r
+ ToolChainFamily.append("MSFT")\r
+ else:\r
+ ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool])\r
+ self.ToolChainFamily = ToolChainFamily\r
+\r
if self.ThreadNumber == None:\r
self.ThreadNumber = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER]\r
if self.ThreadNumber == '':\r
#\r
def InitBuild(self):\r
# parse target.txt, tools_def.txt, and platform file\r
- self.LoadConfiguration() \r
+ self.LoadConfiguration()\r
\r
# Allow case-insensitive for those from command line or configuration file\r
ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)\r
EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
\r
# create metafile database\r
- self.Db.InitDatabase()\r
+ if not self.Db_Flag:\r
+ self.Db.InitDatabase()\r
\r
+ def InitPreBuild(self):\r
+ self.LoadConfiguration()\r
+ ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)\r
+ if ErrorCode != 0:\r
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
+ if self.BuildTargetList:\r
+ GlobalData.gGlobalDefines['TARGET'] = self.BuildTargetList[0]\r
+ if self.ArchList:\r
+ GlobalData.gGlobalDefines['ARCH'] = self.ArchList[0]\r
+ if self.ToolChainList:\r
+ GlobalData.gGlobalDefines['TOOLCHAIN'] = self.ToolChainList[0]\r
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = self.ToolChainList[0]\r
+ if self.ToolChainFamily:\r
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[0]\r
+ if 'PREBUILD' in GlobalData.gCommandLineDefines.keys():\r
+ self.Prebuild = GlobalData.gCommandLineDefines.get('PREBUILD')\r
+ else:\r
+ self.Db.InitDatabase()\r
+ self.Db_Flag = True\r
+ Platform = self.Db._MapPlatform(str(self.PlatformFile))\r
+ self.Prebuild = str(Platform.Prebuild)\r
+ if self.Prebuild:\r
+ PrebuildList = self.Prebuild.split()\r
+ if not os.path.isabs(PrebuildList[0]):\r
+ PrebuildList[0] = mws.join(self.WorkspaceDir, PrebuildList[0])\r
+ if os.path.isfile(PrebuildList[0]):\r
+ self.PrebuildScript = PrebuildList[0]\r
+ self.Prebuild = ' '.join(PrebuildList)\r
+ self.Prebuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList)\r
+ #self.LaunchPrebuild()\r
+ else:\r
+ EdkLogger.error("Prebuild", PREBUILD_ERROR, "the prebuild script %s is not exist.\n If you'd like to disable the Prebuild process, please use the format: -D PREBUILD=\"\" " %(PrebuildList[0]))\r
+\r
+ def InitPostBuild(self):\r
+ if 'POSTBUILD' in GlobalData.gCommandLineDefines.keys():\r
+ self.Postbuild = GlobalData.gCommandLineDefines.get('POSTBUILD')\r
+ else:\r
+ Platform = self.Db._MapPlatform(str(self.PlatformFile))\r
+ self.Postbuild = str(Platform.Postbuild)\r
+ if self.Postbuild:\r
+ PostbuildList = self.Postbuild.split()\r
+ if not os.path.isabs(PostbuildList[0]):\r
+ PostbuildList[0] = mws.join(self.WorkspaceDir, PostbuildList[0])\r
+ if os.path.isfile(PostbuildList[0]):\r
+ self.PostbuildScript = PostbuildList[0]\r
+ self.Postbuild = ' '.join(PostbuildList)\r
+ self.Postbuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList)\r
+ else:\r
+ EdkLogger.error("Postbuild", POSTBUILD_ERROR, "the postbuild script %s is not exist.\n If you'd like to disable the Postbuild process, please use the format: -D POSTBUILD=\"\" " %(PostbuildList[0]))\r
+\r
+ def PassCommandOption(self, BuildTarget, TargetArch, ToolChain):\r
+ BuildStr = ''\r
+ if GlobalData.gCommand and isinstance(GlobalData.gCommand, list):\r
+ BuildStr += ' ' + ' '.join(GlobalData.gCommand)\r
+ TargetFlag = False\r
+ ArchFlag = False\r
+ ToolChainFlag = False\r
+\r
+ if GlobalData.gOptions and not GlobalData.gOptions.BuildTarget:\r
+ TargetFlag = True\r
+ if GlobalData.gOptions and not GlobalData.gOptions.TargetArch:\r
+ ArchFlag = True\r
+ if GlobalData.gOptions and not GlobalData.gOptions.ToolChain:\r
+ ToolChainFlag = True\r
+\r
+ if TargetFlag and BuildTarget:\r
+ if isinstance(BuildTarget, list) or isinstance(BuildTarget, tuple):\r
+ BuildStr += ' -b ' + ' -b '.join(BuildTarget)\r
+ elif isinstance(BuildTarget, str):\r
+ BuildStr += ' -b ' + BuildTarget\r
+ if ArchFlag and TargetArch:\r
+ if isinstance(TargetArch, list) or isinstance(TargetArch, tuple):\r
+ BuildStr += ' -a ' + ' -a '.join(TargetArch)\r
+ elif isinstance(TargetArch, str):\r
+ BuildStr += ' -a ' + TargetArch\r
+ if ToolChainFlag and ToolChain:\r
+ if isinstance(ToolChain, list) or isinstance(ToolChain, tuple):\r
+ BuildStr += ' -t ' + ' -t '.join(ToolChain)\r
+ elif isinstance(ToolChain, str):\r
+ BuildStr += ' -t ' + ToolChain\r
+\r
+ return BuildStr\r
+\r
+ def LaunchPrebuild(self):\r
+ if self.Prebuild:\r
+ EdkLogger.info("\n- Prebuild Start -\n")\r
+ self.LaunchPrebuildFlag = True\r
+ PrebuildEnvFile = os.path.join(GlobalData.gConfDirectory,'.cache','.PrebuildEnv')\r
+ if os.path.isfile(PrebuildEnvFile):\r
+ os.remove(PrebuildEnvFile)\r
+ if os.path.isfile(self.PlatformBuildPath):\r
+ os.remove(self.PlatformBuildPath)\r
+ if sys.platform == "win32":\r
+ args = ' && '.join((self.Prebuild, 'set > ' + PrebuildEnvFile))\r
+ Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True)\r
+ else:\r
+ args = ' && '.join((self.Prebuild, 'env > ' + PrebuildEnvFile))\r
+ Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True)\r
+\r
+ # launch two threads to read the STDOUT and STDERR\r
+ EndOfProcedure = Event()\r
+ EndOfProcedure.clear()\r
+ if Process.stdout:\r
+ StdOutThread = Thread(target=ReadMessage, args=(Process.stdout, EdkLogger.info, EndOfProcedure))\r
+ StdOutThread.setName("STDOUT-Redirector")\r
+ StdOutThread.setDaemon(False)\r
+ StdOutThread.start()\r
+\r
+ if Process.stderr:\r
+ StdErrThread = Thread(target=ReadMessage, args=(Process.stderr, EdkLogger.quiet, EndOfProcedure))\r
+ StdErrThread.setName("STDERR-Redirector")\r
+ StdErrThread.setDaemon(False)\r
+ StdErrThread.start()\r
+ # waiting for program exit\r
+ Process.wait()\r
+\r
+ if Process.stdout:\r
+ StdOutThread.join()\r
+ if Process.stderr:\r
+ StdErrThread.join()\r
+ if Process.returncode != 0 :\r
+ EdkLogger.error("Prebuild", PREBUILD_ERROR, 'Prebuild process is not success!')\r
+\r
+ if os.path.exists(PrebuildEnvFile):\r
+ f = open(PrebuildEnvFile)\r
+ envs = f.readlines()\r
+ f.close()\r
+ envs = itertools.imap(lambda l: l.split('=',1), envs)\r
+ envs = itertools.ifilter(lambda l: len(l) == 2, envs)\r
+ envs = itertools.imap(lambda l: [i.strip() for i in l], envs)\r
+ os.environ.update(dict(envs))\r
+ EdkLogger.info("\n- Prebuild Done -\n")\r
+\r
+ def LaunchPostbuild(self):\r
+ if self.Postbuild:\r
+ EdkLogger.info("\n- Postbuild Start -\n")\r
+ if sys.platform == "win32":\r
+ Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True)\r
+ else:\r
+ Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True)\r
+ # launch two threads to read the STDOUT and STDERR\r
+ EndOfProcedure = Event()\r
+ EndOfProcedure.clear()\r
+ if Process.stdout:\r
+ StdOutThread = Thread(target=ReadMessage, args=(Process.stdout, EdkLogger.info, EndOfProcedure))\r
+ StdOutThread.setName("STDOUT-Redirector")\r
+ StdOutThread.setDaemon(False)\r
+ StdOutThread.start()\r
+\r
+ if Process.stderr:\r
+ StdErrThread = Thread(target=ReadMessage, args=(Process.stderr, EdkLogger.quiet, EndOfProcedure))\r
+ StdErrThread.setName("STDERR-Redirector")\r
+ StdErrThread.setDaemon(False)\r
+ StdErrThread.start()\r
+ # waiting for program exit\r
+ Process.wait()\r
+\r
+ if Process.stdout:\r
+ StdOutThread.join()\r
+ if Process.stderr:\r
+ StdErrThread.join()\r
+ if Process.returncode != 0 :\r
+ EdkLogger.error("Postbuild", POSTBUILD_ERROR, 'Postbuild process is not success!')\r
+ EdkLogger.info("\n- Postbuild Done -\n")\r
## Build a module or platform\r
#\r
# Create autogen code and makefile for a module or platform, and the launch\r
# @param CreateDepModuleMakeFile Flag used to indicate creating makefile\r
# for dependent modules/Libraries\r
#\r
- def _Build(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True):\r
+ def _BuildPa(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False):\r
if AutoGenObject == None:\r
return False\r
\r
if not self.SkipAutoGen or Target == 'genmake':\r
self.Progress.Start("Generating makefile")\r
AutoGenObject.CreateMakeFile(CreateDepsMakeFile)\r
- AutoGenObject.CreateAsBuiltInf()\r
self.Progress.Stop("done!")\r
if Target == "genmake":\r
return True\r
if BuildCommand == None or len(BuildCommand) == 0:\r
EdkLogger.error("build", OPTION_MISSING,\r
"No build command found for this module. "\r
- "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." % \r
+ "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %\r
(AutoGenObject.BuildTarget, AutoGenObject.ToolChain, AutoGenObject.Arch),\r
ExtraData=str(AutoGenObject))\r
\r
- BuildCommand = BuildCommand + [Target]\r
- LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
+ makefile = GenMake.BuildFile(AutoGenObject)._FILE_NAME_[GenMake.gMakeType]\r
+\r
+ # run\r
+ if Target == 'run':\r
+ RunDir = os.path.normpath(os.path.join(AutoGenObject.BuildDir, GlobalData.gGlobalDefines['ARCH']))\r
+ Command = '.\SecMain'\r
+ os.chdir(RunDir)\r
+ LaunchCommand(Command, RunDir)\r
+ return True\r
+\r
+ # build modules\r
+ if BuildModule:\r
+ BuildCommand = BuildCommand + [Target]\r
+ LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
+ self.CreateAsBuiltInf()\r
+ return True\r
+\r
+ # build library\r
+ if Target == 'libraries':\r
+ for Lib in AutoGenObject.LibraryBuildDirectoryList:\r
+ NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Lib, makefile)), 'pbuild']\r
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+ return True\r
+\r
+ # build module\r
+ if Target == 'modules':\r
+ for Lib in AutoGenObject.LibraryBuildDirectoryList:\r
+ NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Lib, makefile)), 'pbuild']\r
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+ for Mod in AutoGenObject.ModuleBuildDirectoryList:\r
+ NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Mod, makefile)), 'pbuild']\r
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+ self.CreateAsBuiltInf()\r
+ return True\r
+\r
+ # cleanlib\r
+ if Target == 'cleanlib':\r
+ for Lib in AutoGenObject.LibraryBuildDirectoryList:\r
+ LibMakefile = os.path.normpath(os.path.join(Lib, makefile))\r
+ if os.path.exists(LibMakefile):\r
+ NewBuildCommand = BuildCommand + ['-f', LibMakefile, 'cleanall']\r
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+ return True\r
+\r
+ # clean\r
+ if Target == 'clean':\r
+ for Mod in AutoGenObject.ModuleBuildDirectoryList:\r
+ ModMakefile = os.path.normpath(os.path.join(Mod, makefile))\r
+ if os.path.exists(ModMakefile):\r
+ NewBuildCommand = BuildCommand + ['-f', ModMakefile, 'cleanall']\r
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+ for Lib in AutoGenObject.LibraryBuildDirectoryList:\r
+ LibMakefile = os.path.normpath(os.path.join(Lib, makefile))\r
+ if os.path.exists(LibMakefile):\r
+ NewBuildCommand = BuildCommand + ['-f', LibMakefile, 'cleanall']\r
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+ return True\r
+\r
+ # cleanall\r
+ if Target == 'cleanall':\r
+ try:\r
+ #os.rmdir(AutoGenObject.BuildDir)\r
+ RemoveDirectory(AutoGenObject.BuildDir, True)\r
+ except WindowsError, X:\r
+ EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))\r
+ return True\r
+\r
+ ## Build a module or platform\r
+ #\r
+ # Create autogen code and makefile for a module or platform, and the launch\r
+ # "make" command to build it\r
+ #\r
+ # @param Target The target of build command\r
+ # @param Platform The platform file\r
+ # @param Module The module file\r
+ # @param BuildTarget The name of build target, one of "DEBUG", "RELEASE"\r
+ # @param ToolChain The name of toolchain to build\r
+ # @param Arch The arch of the module/platform\r
+ # @param CreateDepModuleCodeFile Flag used to indicate creating code\r
+ # for dependent modules/Libraries\r
+ # @param CreateDepModuleMakeFile Flag used to indicate creating makefile\r
+ # for dependent modules/Libraries\r
+ #\r
+ def _Build(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False):\r
+ if AutoGenObject == None:\r
+ return False\r
+\r
+ # skip file generation for cleanxxx targets, run and fds target\r
+ if Target not in ['clean', 'cleanlib', 'cleanall', 'run', 'fds']:\r
+ # for target which must generate AutoGen code and makefile\r
+ if not self.SkipAutoGen or Target == 'genc':\r
+ self.Progress.Start("Generating code")\r
+ AutoGenObject.CreateCodeFile(CreateDepsCodeFile)\r
+ self.Progress.Stop("done!")\r
+ if Target == "genc":\r
+ return True\r
+\r
+ if not self.SkipAutoGen or Target == 'genmake':\r
+ self.Progress.Start("Generating makefile")\r
+ AutoGenObject.CreateMakeFile(CreateDepsMakeFile)\r
+ #AutoGenObject.CreateAsBuiltInf()\r
+ self.Progress.Stop("done!")\r
+ if Target == "genmake":\r
+ return True\r
+ else:\r
+ # always recreate top/platform makefile when clean, just in case of inconsistency\r
+ AutoGenObject.CreateCodeFile(False)\r
+ AutoGenObject.CreateMakeFile(False)\r
+\r
+ if EdkLogger.GetLevel() == EdkLogger.QUIET:\r
+ EdkLogger.quiet("Building ... %s" % repr(AutoGenObject))\r
+\r
+ BuildCommand = AutoGenObject.BuildCommand\r
+ if BuildCommand == None or len(BuildCommand) == 0:\r
+ EdkLogger.error("build", OPTION_MISSING,\r
+ "No build command found for this module. "\r
+ "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %\r
+ (AutoGenObject.BuildTarget, AutoGenObject.ToolChain, AutoGenObject.Arch),\r
+ ExtraData=str(AutoGenObject))\r
+\r
+ # build modules\r
+ if BuildModule:\r
+ if Target != 'fds':\r
+ BuildCommand = BuildCommand + [Target]\r
+ LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
+ self.CreateAsBuiltInf()\r
+ return True\r
+\r
+ # genfds\r
+ if Target == 'fds':\r
+ LaunchCommand(AutoGenObject.GenFdsCommand, AutoGenObject.MakeFileDir)\r
+ return True\r
+\r
+ # run\r
+ if Target == 'run':\r
+ RunDir = os.path.normpath(os.path.join(AutoGenObject.BuildDir, GlobalData.gGlobalDefines['ARCH']))\r
+ Command = '.\SecMain'\r
+ os.chdir(RunDir)\r
+ LaunchCommand(Command, RunDir)\r
+ return True\r
+\r
+ # build library\r
+ if Target == 'libraries':\r
+ pass\r
+\r
+ # not build modules\r
+\r
+\r
+ # cleanall\r
if Target == 'cleanall':\r
try:\r
#os.rmdir(AutoGenObject.BuildDir)\r
RemoveDirectory(AutoGenObject.BuildDir, True)\r
- #\r
- # First should close DB.\r
- #\r
- self.Db.Close()\r
- RemoveDirectory(gBuildCacheDir, True)\r
except WindowsError, X:\r
EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))\r
return True\r
# Update Image to new BaseAddress by GenFw tool\r
#\r
LaunchCommand(["GenFw", "--rebase", str(BaseAddress), "-r", ModuleOutputImage], ModuleInfo.OutputDir)\r
- LaunchCommand(["GenFw", "--rebase", str(BaseAddress), "-r", ModuleDebugImage], ModuleInfo.DebugDir)\r
+ LaunchCommand(["GenFw", "--rebase", str(BaseAddress), "-r", ModuleDebugImage], ModuleInfo.DebugDir)\r
else:\r
#\r
# Set new address to the section header only for SMM driver.\r
#\r
LaunchCommand(["GenFw", "--address", str(BaseAddress), "-r", ModuleOutputImage], ModuleInfo.OutputDir)\r
- LaunchCommand(["GenFw", "--address", str(BaseAddress), "-r", ModuleDebugImage], ModuleInfo.DebugDir)\r
+ LaunchCommand(["GenFw", "--address", str(BaseAddress), "-r", ModuleDebugImage], ModuleInfo.DebugDir)\r
#\r
# Collect funtion address from Map file\r
#\r
FunctionList = []\r
if os.path.exists(ImageMapTable):\r
OrigImageBaseAddress = 0\r
- ImageMap = open (ImageMapTable, 'r')\r
+ ImageMap = open(ImageMapTable, 'r')\r
for LinStr in ImageMap:\r
if len (LinStr.strip()) == 0:\r
continue\r
\r
StrList = LinStr.split()\r
if len (StrList) > 4:\r
- if StrList[3] == 'f' or StrList[3] =='F':\r
+ if StrList[3] == 'f' or StrList[3] == 'F':\r
Name = StrList[1]\r
RelativeAddress = int (StrList[2], 16) - OrigImageBaseAddress\r
FunctionList.append ((Name, RelativeAddress))\r
elif SectionHeader[0] in ['.data', '.sdata']:\r
DataSectionAddress = SectionHeader[1]\r
if AddrIsOffset:\r
- MapBuffer.write('(GUID=%s, .textbaseaddress=-0x%010X, .databaseaddress=-0x%010X)\n' % (ModuleInfo.Guid, 0 - (BaseAddress + TextSectionAddress), 0 - (BaseAddress + DataSectionAddress))) \r
+ MapBuffer.write('(GUID=%s, .textbaseaddress=-0x%010X, .databaseaddress=-0x%010X)\n' % (ModuleInfo.Guid, 0 - (BaseAddress + TextSectionAddress), 0 - (BaseAddress + DataSectionAddress)))\r
else:\r
- MapBuffer.write('(GUID=%s, .textbaseaddress=0x%010X, .databaseaddress=0x%010X)\n' % (ModuleInfo.Guid, BaseAddress + TextSectionAddress, BaseAddress + DataSectionAddress)) \r
+ MapBuffer.write('(GUID=%s, .textbaseaddress=0x%010X, .databaseaddress=0x%010X)\n' % (ModuleInfo.Guid, BaseAddress + TextSectionAddress, BaseAddress + DataSectionAddress))\r
#\r
# Add debug image full path.\r
#\r
FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map')\r
if not os.path.exists(FvMapBuffer):\r
continue\r
- FvMap = open (FvMapBuffer, 'r')\r
+ FvMap = open(FvMapBuffer, 'r')\r
#skip FV size information\r
FvMap.readline()\r
FvMap.readline()\r
for ModuleGuid in ModuleList:\r
Module = ModuleList[ModuleGuid]\r
GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (Module.MetaFile, Module.Arch, Module.ToolChain, Module.BuildTarget)\r
- \r
+\r
OutputImageFile = ''\r
for ResultFile in Module.CodaTargetList:\r
if str(ResultFile.Target).endswith('.efi'):\r
if not ImageClass.IsValid:\r
EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo)\r
ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass)\r
- if Module.ModuleType in ['PEI_CORE', 'PEIM', 'COMBINED_PEIM_DRIVER','PIC_PEIM', 'RELOCATABLE_PEIM', 'DXE_CORE']:\r
+ if Module.ModuleType in ['PEI_CORE', 'PEIM', 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', 'DXE_CORE']:\r
PeiModuleList[Module.MetaFile] = ImageInfo\r
PeiSize += ImageInfo.Image.Size\r
elif Module.ModuleType in ['BS_DRIVER', 'DXE_DRIVER', 'UEFI_DRIVER']:\r
if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:\r
ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000\r
RtSize += ImageInfo.Image.Size\r
- elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER']:\r
+ elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER', 'MM_STANDALONE', 'MM_CORE_STANDALONE']:\r
SmmModuleList[Module.MetaFile] = ImageInfo\r
SmmSize += ImageInfo.Image.Size\r
if Module.ModuleType == 'DXE_SMM_DRIVER':\r
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE and Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST:\r
ModuleIsPatch = True\r
break\r
- \r
+\r
if not ModuleIsPatch:\r
continue\r
#\r
# Module includes the patchable load fix address PCDs.\r
- # It will be fixed up later. \r
+ # It will be fixed up later.\r
#\r
PatchEfiImageList.append (OutputImageFile)\r
- \r
+\r
#\r
# Get Top Memory address\r
#\r
#\r
# Patch FixAddress related PCDs into EFI image\r
#\r
- for EfiImage in PatchEfiImageList: \r
+ for EfiImage in PatchEfiImageList:\r
EfiImageMap = EfiImage.replace('.efi', '.map')\r
if not os.path.exists(EfiImageMap):\r
continue\r
#\r
# Get PCD offset in EFI image by GenPatchPcdTable function\r
#\r
- PcdTable = parsePcdInfoFromMapFile(EfiImageMap, EfiImage) \r
+ PcdTable = parsePcdInfoFromMapFile(EfiImageMap, EfiImage)\r
#\r
# Patch real PCD value by PatchPcdValue tool\r
#\r
for PcdInfo in PcdTable:\r
ReturnValue = 0\r
if PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE:\r
- ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE, str (PeiSize/0x1000))\r
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE, str (PeiSize / 0x1000))\r
elif PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE:\r
- ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE_DATA_TYPE, str (BtSize/0x1000))\r
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE_DATA_TYPE, str (BtSize / 0x1000))\r
elif PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE:\r
- ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE, str (RtSize/0x1000))\r
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE, str (RtSize / 0x1000))\r
elif PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE and len (SmmModuleList) > 0:\r
- ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE, str (SmmSize/0x1000))\r
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE, str (SmmSize / 0x1000))\r
if ReturnValue != 0:\r
EdkLogger.error("build", PARAMETER_INVALID, "Patch PCD value failed", ExtraData=ErrorInfo)\r
- \r
- MapBuffer.write('PEI_CODE_PAGE_NUMBER = 0x%x\n' % (PeiSize/0x1000))\r
- MapBuffer.write('BOOT_CODE_PAGE_NUMBER = 0x%x\n' % (BtSize/0x1000))\r
- MapBuffer.write('RUNTIME_CODE_PAGE_NUMBER = 0x%x\n' % (RtSize/0x1000))\r
+\r
+ MapBuffer.write('PEI_CODE_PAGE_NUMBER = 0x%x\n' % (PeiSize / 0x1000))\r
+ MapBuffer.write('BOOT_CODE_PAGE_NUMBER = 0x%x\n' % (BtSize / 0x1000))\r
+ MapBuffer.write('RUNTIME_CODE_PAGE_NUMBER = 0x%x\n' % (RtSize / 0x1000))\r
if len (SmmModuleList) > 0:\r
- MapBuffer.write('SMM_CODE_PAGE_NUMBER = 0x%x\n' % (SmmSize/0x1000))\r
- \r
- PeiBaseAddr = TopMemoryAddress - RtSize - BtSize \r
+ MapBuffer.write('SMM_CODE_PAGE_NUMBER = 0x%x\n' % (SmmSize / 0x1000))\r
+\r
+ PeiBaseAddr = TopMemoryAddress - RtSize - BtSize\r
BtBaseAddr = TopMemoryAddress - RtSize\r
- RtBaseAddr = TopMemoryAddress - ReservedRuntimeMemorySize \r
+ RtBaseAddr = TopMemoryAddress - ReservedRuntimeMemorySize\r
\r
self._RebaseModule (MapBuffer, PeiBaseAddr, PeiModuleList, TopMemoryAddress == 0)\r
self._RebaseModule (MapBuffer, BtBaseAddr, BtModuleList, TopMemoryAddress == 0)\r
self._RebaseModule (MapBuffer, RtBaseAddr, RtModuleList, TopMemoryAddress == 0)\r
- self._RebaseModule (MapBuffer, 0x1000, SmmModuleList, AddrIsOffset = False, ModeIsSmm = True)\r
+ self._RebaseModule (MapBuffer, 0x1000, SmmModuleList, AddrIsOffset=False, ModeIsSmm=True)\r
MapBuffer.write('\n\n')\r
sys.stdout.write ("\n")\r
sys.stdout.flush()\r
- \r
+\r
## Save platform Map file\r
#\r
def _SaveMapFile (self, MapBuffer, Wa):\r
SaveFileOnChange(MapFilePath, MapBuffer.getvalue(), False)\r
MapBuffer.close()\r
if self.LoadFixAddress != 0:\r
- sys.stdout.write ("\nLoad Module At Fix Address Map file can be found at %s\n" %(MapFilePath))\r
+ sys.stdout.write ("\nLoad Module At Fix Address Map file can be found at %s\n" % (MapFilePath))\r
sys.stdout.flush()\r
\r
## Build active platform for different build targets and different tool chains\r
#\r
def _BuildPlatform(self):\r
+ SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)\r
for BuildTarget in self.BuildTargetList:\r
GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
+ index = 0\r
for ToolChain in self.ToolChainList:\r
GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]\r
+ index += 1\r
Wa = WorkspaceAutoGen(\r
self.WorkspaceDir,\r
self.PlatformFile,\r
self.FvList,\r
self.CapList,\r
self.SkuId,\r
- self.UniFlag\r
+ self.UniFlag,\r
+ self.Progress\r
)\r
self.Fdf = Wa.FdfFile\r
self.LoadFixAddress = Wa.Platform.LoadFixAddress\r
self.BuildReport.AddPlatformReport(Wa)\r
self.Progress.Stop("done!")\r
- self._Build(self.Target, Wa)\r
- \r
+ for Arch in Wa.ArchList:\r
+ GlobalData.gGlobalDefines['ARCH'] = Arch\r
+ Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
+ for Module in Pa.Platform.Modules:\r
+ # Get ModuleAutoGen object to generate C code file and makefile\r
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
+ if Ma == None:\r
+ continue\r
+ self.BuildModules.append(Ma)\r
+ self._BuildPa(self.Target, Pa)\r
+\r
# Create MAP file when Load Fix Address is enabled.\r
if self.Target in ["", "all", "fds"]:\r
for Arch in Wa.ArchList:\r
# Rebase module to the preferred memory address before GenFds\r
#\r
self._CollectModuleMapBuffer(MapBuffer, ModuleList)\r
- if self.Fdf:\r
- #\r
- # create FDS again for the updated EFI image\r
- #\r
- self._Build("fds", Wa)\r
if self.Fdf:\r
+ #\r
+ # create FDS again for the updated EFI image\r
+ #\r
+ self._Build("fds", Wa)\r
#\r
# Create MAP file for all platform FVs after GenFds.\r
#\r
def _BuildModule(self):\r
for BuildTarget in self.BuildTargetList:\r
GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
+ index = 0\r
for ToolChain in self.ToolChainList:\r
GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
- GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain \r
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]\r
+ index += 1\r
#\r
# module build needs platform build information, so get platform\r
# AutoGen first\r
self.FvList,\r
self.CapList,\r
self.SkuId,\r
- self.UniFlag\r
+ self.UniFlag,\r
+ self.Progress,\r
+ self.ModuleFile\r
)\r
self.Fdf = Wa.FdfFile\r
self.LoadFixAddress = Wa.Platform.LoadFixAddress\r
MaList = []\r
for Arch in Wa.ArchList:\r
GlobalData.gGlobalDefines['ARCH'] = Arch\r
- Ma = ModuleAutoGen(Wa, self.ModuleFile, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
- if Ma == None: continue\r
- MaList.append(Ma)\r
- self._Build(self.Target, Ma)\r
+ Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
+ for Module in Pa.Platform.Modules:\r
+ if self.ModuleFile.Dir == Module.Dir and self.ModuleFile.File == Module.File:\r
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
+ if Ma == None: continue\r
+ MaList.append(Ma)\r
+ self.BuildModules.append(Ma)\r
+ if not Ma.IsBinaryModule:\r
+ self._Build(self.Target, Ma, BuildModule=True)\r
\r
self.BuildReport.AddPlatformReport(Wa, MaList)\r
if MaList == []:\r
BUILD_ERROR,\r
"Module for [%s] is not a component of active platform."\\r
" Please make sure that the ARCH and inf file path are"\\r
- " given in the same as in [%s]" %\\r
+ " given in the same as in [%s]" % \\r
(', '.join(Wa.ArchList), self.PlatformFile),\r
ExtraData=self.ModuleFile\r
)\r
# Rebase module to the preferred memory address before GenFds\r
#\r
self._CollectModuleMapBuffer(MapBuffer, ModuleList)\r
- #\r
- # create FDS again for the updated EFI image\r
- #\r
- self._Build("fds", Wa)\r
+ #\r
+ # create FDS again for the updated EFI image\r
+ #\r
+ self._Build("fds", Wa)\r
#\r
# Create MAP file for all platform FVs after GenFds.\r
#\r
## Build a platform in multi-thread mode\r
#\r
def _MultiThreadBuildPlatform(self):\r
+ SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)\r
for BuildTarget in self.BuildTargetList:\r
GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
+ index = 0\r
for ToolChain in self.ToolChainList:\r
GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
- GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain \r
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]\r
+ index += 1\r
Wa = WorkspaceAutoGen(\r
self.WorkspaceDir,\r
self.PlatformFile,\r
self.FvList,\r
self.CapList,\r
self.SkuId,\r
- self.UniFlag\r
+ self.UniFlag,\r
+ self.Progress\r
)\r
self.Fdf = Wa.FdfFile\r
self.LoadFixAddress = Wa.Platform.LoadFixAddress\r
Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
if Pa == None:\r
continue\r
- for Module in Pa.Platform.Modules:\r
+ ModuleList = []\r
+ for Inf in Pa.Platform.Modules:\r
+ ModuleList.append(Inf)\r
+ # Add the INF only list in FDF\r
+ if GlobalData.gFdfParser != None:\r
+ for InfName in GlobalData.gFdfParser.Profile.InfList:\r
+ Inf = PathClass(NormPath(InfName), self.WorkspaceDir, Arch)\r
+ if Inf in Pa.Platform.Modules:\r
+ continue\r
+ ModuleList.append(Inf)\r
+ for Module in ModuleList:\r
# Get ModuleAutoGen object to generate C code file and makefile\r
Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
+ \r
if Ma == None:\r
continue\r
# Not to auto-gen for targets 'clean', 'cleanlib', 'cleanall', 'run', 'fds'\r
\r
if not self.SkipAutoGen or self.Target == 'genmake':\r
Ma.CreateMakeFile(True)\r
- Ma.CreateAsBuiltInf()\r
if self.Target == "genmake":\r
continue\r
- self.Progress.Stop("done!")\r
+ self.BuildModules.append(Ma)\r
+ self.Progress.Stop("done!")\r
+\r
+ for Ma in self.BuildModules:\r
# Generate build task for the module\r
- Bt = BuildTask.New(ModuleMakeUnit(Ma, self.Target))\r
+ if not Ma.IsBinaryModule:\r
+ Bt = BuildTask.New(ModuleMakeUnit(Ma, self.Target))\r
# Break build if any build thread has error\r
if BuildTask.HasError():\r
# we need a full version of makefile for platform\r
if BuildTask.HasError():\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
\r
+ #\r
+ # Save temp tables to a TmpTableDict.\r
+ #\r
+ for Key in Wa.BuildDatabase._CACHE_:\r
+ if Wa.BuildDatabase._CACHE_[Key]._RawData and Wa.BuildDatabase._CACHE_[Key]._RawData._Table and Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table:\r
+ if TemporaryTablePattern.match(Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table):\r
+ TmpTableDict[Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table] = Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Cur\r
+ #\r
#\r
# All modules have been put in build tasks queue. Tell task scheduler\r
# to exit if all tasks are completed\r
#\r
ExitFlag.set()\r
BuildTask.WaitForComplete()\r
+ self.CreateAsBuiltInf()\r
\r
#\r
# Check for build error, and raise exception if one\r
#\r
# Generate FD image if there's a FDF file found\r
#\r
- LaunchCommand(Wa.BuildCommand + ["fds"], Wa.MakeFileDir)\r
+ LaunchCommand(Wa.GenFdsCommand, os.getcwd())\r
+\r
#\r
# Create MAP file for all platform FVs after GenFds.\r
#\r
if not os.path.exists(FvDir):\r
continue\r
\r
- for Arch in self.ArchList: \r
+ for Arch in self.ArchList:\r
# Build up the list of supported architectures for this build\r
prefix = '%s_%s_%s_' % (BuildTarget, ToolChain, Arch)\r
- \r
+\r
# Look through the tool definitions for GUIDed tools\r
guidAttribs = []\r
for (attrib, value) in self.ToolDef.ToolsDefTxtDictionary.iteritems():\r
path = self.ToolDef.ToolsDefTxtDictionary[path]\r
path = self.GetFullPathOfTool(path)\r
guidAttribs.append((guid, toolName, path))\r
- \r
+\r
# Write out GuidedSecTools.txt\r
toolsFile = os.path.join(FvDir, 'GuidedSectionTools.txt')\r
toolsFile = open(toolsFile, 'wt')\r
self.SpawnMode = False\r
self._BuildModule()\r
\r
+ if self.Target == 'cleanall':\r
+ self.Db.Close()\r
+ RemoveDirectory(os.path.dirname(GlobalData.gDatabasePath), True)\r
+\r
+ def CreateAsBuiltInf(self):\r
+ for Module in self.BuildModules:\r
+ Module.CreateAsBuiltInf()\r
+ self.BuildModules = []\r
## Do some clean-up works when error occurred\r
def Relinquish(self):\r
OldLogLevel = EdkLogger.GetLevel()\r
EdkLogger.SetLevel(OldLogLevel)\r
\r
def DumpBuildData(self):\r
- CacheDirectory = os.path.join(self.WorkspaceDir, gBuildCacheDir)\r
+ CacheDirectory = os.path.dirname(GlobalData.gDatabasePath)\r
Utils.CreateDirectory(CacheDirectory)\r
Utils.DataDump(Utils.gFileTimeStampCache, os.path.join(CacheDirectory, "gFileTimeStampCache"))\r
Utils.DataDump(Utils.gDependencyDatabase, os.path.join(CacheDirectory, "gDependencyDatabase"))\r
\r
def RestoreBuildData(self):\r
- FilePath = os.path.join(self.WorkspaceDir, gBuildCacheDir, "gFileTimeStampCache")\r
+ FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), "gFileTimeStampCache")\r
if Utils.gFileTimeStampCache == {} and os.path.isfile(FilePath):\r
Utils.gFileTimeStampCache = Utils.DataRestore(FilePath)\r
if Utils.gFileTimeStampCache == None:\r
Utils.gFileTimeStampCache = {}\r
\r
- FilePath = os.path.join(self.WorkspaceDir, gBuildCacheDir, "gDependencyDatabase")\r
+ FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), "gDependencyDatabase")\r
if Utils.gDependencyDatabase == {} and os.path.isfile(FilePath):\r
Utils.gDependencyDatabase = Utils.DataRestore(FilePath)\r
if Utils.gDependencyDatabase == None:\r
EdkLogger.error('build', FORMAT_INVALID,\r
"The macro name must be in the pattern [A-Z][A-Z0-9_]*",\r
ExtraData=DefineTokenList[0])\r
- \r
+\r
if len(DefineTokenList) == 1:\r
DefineDict[DefineTokenList[0]] = "TRUE"\r
else:\r
# @retval Args Target of build command\r
#\r
def MyOptionParser():\r
- Parser = OptionParser(description=__copyright__,version=__version__,prog="build.exe",usage="%prog [options] [all|fds|genc|genmake|clean|cleanall|cleanlib|modules|libraries|run]")\r
- Parser.add_option("-a", "--arch", action="append", type="choice", choices=['IA32','X64','IPF','EBC','ARM'], dest="TargetArch",\r
- help="ARCHS is one of list: IA32, X64, IPF, ARM or EBC, which overrides target.txt's TARGET_ARCH definition. To specify more archs, please repeat this option.")\r
+ Parser = OptionParser(description=__copyright__, version=__version__, prog="build.exe", usage="%prog [options] [all|fds|genc|genmake|clean|cleanall|cleanlib|modules|libraries|run]")\r
+ Parser.add_option("-a", "--arch", action="append", type="choice", choices=['IA32', 'X64', 'IPF', 'EBC', 'ARM', 'AARCH64'], dest="TargetArch",\r
+ help="ARCHS is one of list: IA32, X64, IPF, ARM, AARCH64 or EBC, which overrides target.txt's TARGET_ARCH definition. To specify more archs, please repeat this option.")\r
Parser.add_option("-p", "--platform", action="callback", type="string", dest="PlatformFile", callback=SingleCheckCallback,\r
help="Build the platform specified by the DSC file name argument, overriding target.txt's ACTIVE_PLATFORM definition.")\r
Parser.add_option("-m", "--module", action="callback", type="string", dest="ModuleFile", callback=SingleCheckCallback,\r
help="Build the module specified by the INF file name argument.")\r
- Parser.add_option("-b", "--buildtarget", action="append", type="choice", choices=['DEBUG','RELEASE','NOOPT'], dest="BuildTarget",\r
- help="BuildTarget is one of list: DEBUG, RELEASE, NOOPT, which overrides target.txt's TARGET definition. To specify more TARGET, please repeat this option.")\r
+ Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Using the TARGET to build the platform, overriding target.txt's TARGET definition.",\r
+ action="append")\r
Parser.add_option("-t", "--tagname", action="append", type="string", dest="ToolChain",\r
help="Using the Tool Chain Tagname to build the platform, overriding target.txt's TOOL_CHAIN_TAG definition.")\r
Parser.add_option("-x", "--sku-id", action="callback", type="string", dest="SkuId", callback=SingleCheckCallback,\r
Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")\r
\r
Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Create/overwrite the report to the specified filename.")\r
- Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS', 'EXECUTION_ORDER'], dest="ReportType", default=[],\r
- help="Flags that control the type of build report to generate. Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, EXECUTION_ORDER]. "\\r
+ Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[],\r
+ help="Flags that control the type of build report to generate. Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HASH, EXECUTION_ORDER]. "\\r
"To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS]")\r
Parser.add_option("-F", "--flag", action="store", type="string", dest="Flag",\r
help="Specify the specific option to parse EDK UNI file. Must be one of: [-c, -s]. -c is for EDK framework UNI file, and -s is for EDK UEFI UNI file. "\\r
"This option can also be specified by setting *_*_*_BUILD_FLAGS in [BuildOptions] section of platform DSC. If they are both specified, this value "\\r
"will override the setting in [BuildOptions] section of platform DSC.")\r
Parser.add_option("-N", "--no-cache", action="store_true", dest="DisableCache", default=False, help="Disable build cache mechanism")\r
+ Parser.add_option("--conf", action="store", type="string", dest="ConfDirectory", help="Specify the customized Conf directory.")\r
+ Parser.add_option("--check-usage", action="store_true", dest="CheckUsage", default=False, help="Check usage content of entries listed in INF file.")\r
+ Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")\r
+ Parser.add_option("--pcd", action="append", dest="OptionPcd", help="Set PCD value by command line. Format: \"PcdName=Value\" ")\r
+ Parser.add_option("-l", "--cmd-len", action="store", type="int", dest="CommandLength", help="Specify the maximum line length of build command. Default is 4096.")\r
\r
- (Opt, Args)=Parser.parse_args()\r
+ (Opt, Args) = Parser.parse_args()\r
return (Opt, Args)\r
\r
## Tool entrance method\r
\r
# Initialize log system\r
EdkLogger.Initialize()\r
-\r
+ GlobalData.gCommand = sys.argv[1:]\r
#\r
# Parse the options and args\r
#\r
EdkLogger.quiet(time.strftime("Build start time: %H:%M:%S, %b.%d %Y\n", time.localtime()));\r
ReturnCode = 0\r
MyBuild = None\r
+ BuildError = True\r
try:\r
if len(Target) == 0:\r
Target = "all"\r
elif len(Target) >= 2:\r
EdkLogger.error("build", OPTION_NOT_SUPPORTED, "More than one targets are not supported.",\r
- ExtraData="Please select one of: %s" %(' '.join(gSupportedTarget)))\r
+ ExtraData="Please select one of: %s" % (' '.join(gSupportedTarget)))\r
else:\r
Target = Target[0].lower()\r
\r
if Target not in gSupportedTarget:\r
EdkLogger.error("build", OPTION_NOT_SUPPORTED, "Not supported target [%s]." % Target,\r
- ExtraData="Please select one of: %s" %(' '.join(gSupportedTarget)))\r
+ ExtraData="Please select one of: %s" % (' '.join(gSupportedTarget)))\r
\r
#\r
# Check environment variable: EDK_TOOLS_PATH, WORKSPACE, PATH\r
EdkLogger.error("build", OPTION_VALUE_INVALID, "UNI flag must be one of -c or -s")\r
\r
MyBuild = Build(Target, Workspace, Option)\r
- MyBuild.Launch()\r
+ GlobalData.gCommandLineDefines['ARCH'] = ' '.join(MyBuild.ArchList)\r
+ if not (MyBuild.LaunchPrebuildFlag and os.path.exists(MyBuild.PlatformBuildPath)):\r
+ MyBuild.Launch()\r
+ # Drop temp tables to avoid database locked.\r
+ for TmpTableName in TmpTableDict:\r
+ SqlCommand = """drop table IF EXISTS %s""" % TmpTableName\r
+ TmpTableDict[TmpTableName].execute(SqlCommand)\r
#MyBuild.DumpBuildData()\r
+ #\r
+ # All job done, no error found and no exception raised\r
+ #\r
+ BuildError = False\r
except FatalError, X:\r
if MyBuild != None:\r
# for multi-thread build exits safely\r
if Option != None and Option.debug != None:\r
EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
else:\r
- EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)\r
+ EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)\r
ReturnCode = FORMAT_INVALID\r
except KeyboardInterrupt:\r
ReturnCode = ABORT_ERROR\r
"\nbuild",\r
CODE_ERROR,\r
"Unknown fatal error when processing [%s]" % MetaFile,\r
- ExtraData="\n(Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!)\n",\r
+ ExtraData="\n(Please send email to edk2-devel@lists.01.org for help, attaching following call stack trace!)\n",\r
RaiseError=False\r
)\r
EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
ReturnCode = CODE_ERROR\r
finally:\r
Utils.Progressor.Abort()\r
+ Utils.ClearDuplicatedInf()\r
\r
if ReturnCode == 0:\r
- Conclusion = "Done"\r
+ try:\r
+ MyBuild.LaunchPostbuild()\r
+ Conclusion = "Done"\r
+ except:\r
+ Conclusion = "Failed"\r
elif ReturnCode == ABORT_ERROR:\r
Conclusion = "Aborted"\r
else:\r
BuildDuration = time.gmtime(int(round(FinishTime - StartTime)))\r
BuildDurationStr = ""\r
if BuildDuration.tm_yday > 1:\r
- BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration) + ", %d day(s)"%(BuildDuration.tm_yday - 1)\r
+ BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration) + ", %d day(s)" % (BuildDuration.tm_yday - 1)\r
else:\r
BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration)\r
if MyBuild != None:\r
- MyBuild.BuildReport.GenerateReport(BuildDurationStr)\r
+ if not BuildError:\r
+ MyBuild.BuildReport.GenerateReport(BuildDurationStr)\r
MyBuild.Db.Close()\r
EdkLogger.SetLevel(EdkLogger.QUIET)\r
EdkLogger.quiet("\n- %s -" % Conclusion)\r