X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2Fbuild%2Fbuild.py;h=1e14fb4dcc7d259f48347fc9a6f61a36e7930ef5;hp=d9afdcc6b2dab9118e84a17fac53ee096f285e3e;hb=b926f2f2a4cd404df1d2c1dddbcd1178acc63b5e;hpb=40b4e21dbc6c4c3ba2a1748be97bf90acb3b45b8 diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index d9afdcc6b2..1e14fb4dcc 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -2,7 +2,7 @@ # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, 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 @@ -54,7 +54,7 @@ import Common.GlobalData as GlobalData # Version and Copyright VersionNumber = "0.60" + ' ' + gBUILD_VERSION __version__ = "%prog Version " + VersionNumber -__copyright__ = "Copyright (c) 2007 - 2016, Intel Corporation All rights reserved." +__copyright__ = "Copyright (c) 2007 - 2017, Intel Corporation All rights reserved." ## standard targets of build command gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run'] @@ -265,15 +265,16 @@ def LaunchCommand(Command, WorkingDir): # It could be a string or sequence. We find that if command is a string in following Popen(), # ubuntu may fail with an error message that the command is not found. # So here we may need convert command from string to list instance. - if not isinstance(Command, list): - if platform.system() != 'Windows': + if platform.system() != 'Windows': + if not isinstance(Command, list): Command = Command.split() + Command = ' '.join(Command) Proc = None EndOfProcedure = None try: # launch the command - Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1) + Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True) # launch two threads to read the STDOUT and STDERR EndOfProcedure = Event() @@ -775,8 +776,11 @@ class Build(): # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf ConfDirectoryPath = mws.join(self.WorkspaceDir, ConfDirectoryPath) else: - # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf - ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf') + if "CONF_PATH" in os.environ: + ConfDirectoryPath = os.path.normcase(os.path.normpath(os.environ["CONF_PATH"])) + else: + # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf + ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf') GlobalData.gConfDirectory = ConfDirectoryPath GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath)) @@ -812,7 +816,7 @@ class Build(): if "EDK_TOOLS_BIN" in os.environ: # Print the same path style with WORKSPACE env. EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN", os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"])))) - + EdkLogger.quiet("%-16s = %s" % ("CONF_PATH", GlobalData.gConfDirectory)) self.InitPreBuild() self.InitPostBuild() if self.PrebuildScript: @@ -821,6 +825,8 @@ class Build(): EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.PostbuildScript)) if self.PrebuildScript: self.LaunchPrebuild() + self.TargetTxt = TargetTxtClassObject() + self.ToolDef = ToolDefClassObject() if not (self.LaunchPrebuildFlag and os.path.exists(self.PlatformBuildPath)): self.InitBuild() @@ -983,7 +989,6 @@ class Build(): self.PostbuildScript = PostbuildList[0] self.Postbuild = ' '.join(PostbuildList) self.Postbuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList) - #self.LanuchPostbuild() else: 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])) @@ -1031,10 +1036,10 @@ class Build(): os.remove(self.PlatformBuildPath) if sys.platform == "win32": args = ' && '.join((self.Prebuild, 'set > ' + PrebuildEnvFile)) - Process = Popen(args, stdout=PIPE, stderr=PIPE) + Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True) else: args = ' && '.join((self.Prebuild, 'env > ' + PrebuildEnvFile)) - Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True, executable="/bin/bash") + Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True) # launch two threads to read the STDOUT and STDERR EndOfProcedure = Event() @@ -1070,13 +1075,13 @@ class Build(): os.environ.update(dict(envs)) EdkLogger.info("\n- Prebuild Done -\n") - def LanuchPostbuild(self): + def LaunchPostbuild(self): if self.Postbuild: EdkLogger.info("\n- Postbuild Start -\n") if sys.platform == "win32": - Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE) + Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True) else: - Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True, executable="/bin/bash") + Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True) # launch two threads to read the STDOUT and STDERR EndOfProcedure = Event() EndOfProcedure.clear() @@ -1494,7 +1499,7 @@ class Build(): if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0: ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000 RtSize += ImageInfo.Image.Size - elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER']: + elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER', 'MM_STANDALONE', 'MM_CORE_STANDALONE']: SmmModuleList[Module.MetaFile] = ImageInfo SmmSize += ImageInfo.Image.Size if Module.ModuleType == 'DXE_SMM_DRIVER': @@ -1731,12 +1736,15 @@ class Build(): MaList = [] for Arch in Wa.ArchList: GlobalData.gGlobalDefines['ARCH'] = Arch - Ma = ModuleAutoGen(Wa, self.ModuleFile, BuildTarget, ToolChain, Arch, self.PlatformFile) - if Ma == None: continue - MaList.append(Ma) - self.BuildModules.append(Ma) - if not Ma.IsBinaryModule: - self._Build(self.Target, Ma, BuildModule=True) + Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch) + for Module in Pa.Platform.Modules: + if self.ModuleFile.Dir == Module.Dir and self.ModuleFile.File == Module.File: + Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile) + if Ma == None: continue + MaList.append(Ma) + self.BuildModules.append(Ma) + if not Ma.IsBinaryModule: + self._Build(self.Target, Ma, BuildModule=True) self.BuildReport.AddPlatformReport(Wa, MaList) if MaList == []: @@ -2325,7 +2333,7 @@ def Main(): if ReturnCode == 0: try: - MyBuild.LanuchPostbuild() + MyBuild.LaunchPostbuild() Conclusion = "Done" except: Conclusion = "Failed"