public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Steven Shi" <steven.shi@intel.com>
To: devel@edk2.groups.io
Cc: Steven Shi <steven.shi@intel.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>
Subject: [PATCH] BaseTools: Fix build failure of "modules" option
Date: Fri, 26 Feb 2021 14:07:18 +0800	[thread overview]
Message-ID: <20210226060718.378-1-steven.shi@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3238

The "modules" option in build command is to build all modules
only but not to generate the final FV image. The option doesn't
work now and report makefile missing build failure. This patch
fix this issue.

Signed-off-by: Steven Shi <steven.shi@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 BaseTools/Source/Python/build/build.py | 45 +++++++-------------------
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index c4cfe38ad9..810881c146 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -368,7 +368,7 @@ class ModuleMakeUnit(BuildUnit):
     def __init__(self, Obj, BuildCommand,Target):
         Dependency = [ModuleMakeUnit(La, BuildCommand,Target) for La in Obj.LibraryAutoGenList]
         BuildUnit.__init__(self, Obj, BuildCommand, Target, Dependency, Obj.MakeFileDir)
-        if Target in [None, "", "all"]:
+        if Target in [None, "", "all", "modules"]:
             self.Target = "tbuild"
 
 ## The smallest platform unit that can be built by nmake/make command in multi-thread build mode
@@ -868,14 +868,14 @@ class Build():
                     # CanSkipbyPreMakeCache and CreateCodeFile/CreateMakeFile.
                     RetVal = PcdMa.SourceFileList
                     # Force cache miss for PCD driver
-                    if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and self.Target in [None, "", "all"]:
+                    if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and self.Target in [None, "", "all", "modules"]:
                         cqueue.put((PcdMa.MetaFile.Path, PcdMa.Arch, "PreMakeCache", False))
 
                     PcdMa.CreateCodeFile(False)
                     PcdMa.CreateMakeFile(False,GenFfsList = DataPipe.Get("FfsCommand").get((PcdMa.MetaFile.Path, PcdMa.Arch),[]))
                     PcdMa.CreateAsBuiltInf()
                     # Force cache miss for PCD driver
-                    if GlobalData.gBinCacheSource and self.Target in [None, "", "all"]:
+                    if GlobalData.gBinCacheSource and self.Target in [None, "", "all", "modules"]:
                         cqueue.put((PcdMa.MetaFile.Path, PcdMa.Arch, "MakeCache", False))
 
             self.AutoGenMgr.join()
@@ -1212,7 +1212,7 @@ class Build():
         if FfsCommand is None:
             FfsCommand = {}
         # skip file generation for cleanxxx targets, run and fds target
-        if Target not in ['clean', 'cleanlib', 'cleanall', 'run', 'fds']:
+        if Target not in ['cleanall', 'run', 'fds']:
             # for target which must generate AutoGen code and makefile
             mqueue = mp.Queue()
             for m in AutoGenObject.GetAllModuleInfo:
@@ -1224,6 +1224,10 @@ class Build():
             AutoGenObject.DataPipe.DataContainer = {"LibraryBuildDirectoryList":AutoGenObject.LibraryBuildDirectoryList}
             AutoGenObject.DataPipe.DataContainer = {"ModuleBuildDirectoryList":AutoGenObject.ModuleBuildDirectoryList}
             AutoGenObject.DataPipe.DataContainer = {"FdsCommandDict": AutoGenObject.Workspace.GenFdsCommandDict}
+            # Fetch the MakeFileName.
+            self.MakeFileName = AutoGenObject.MakeFileName
+            if not self.MakeFileName:
+                self.MakeFileName = AutoGenObject.MakeFile
             self.Progress.Start("Generating makefile and code")
             data_pipe_file = os.path.join(AutoGenObject.BuildDir, "GlobalVar_%s_%s.bin" % (str(AutoGenObject.Guid),AutoGenObject.Arch))
             AutoGenObject.DataPipe.dump(data_pipe_file)
@@ -1285,33 +1289,6 @@ class Build():
                 LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir,LibAutoGen)
             return True
 
-        # build module
-        if Target == 'modules':
-            DirList = []
-            for Lib in AutoGenObject.LibraryAutoGenList:
-                if not Lib.IsBinaryModule:
-                    DirList.append((os.path.join(AutoGenObject.BuildDir, Lib.BuildDir),Lib))
-            for Lib, LibAutoGen in DirList:
-                NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Lib, self.MakeFileName)), 'pbuild']
-                LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir,LibAutoGen)
-
-            DirList = []
-            for ModuleAutoGen in AutoGenObject.ModuleAutoGenList:
-                if not ModuleAutoGen.IsBinaryModule:
-                    DirList.append((os.path.join(AutoGenObject.BuildDir, ModuleAutoGen.BuildDir),ModuleAutoGen))
-            for Mod,ModAutoGen in DirList:
-                NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Mod, self.MakeFileName)), 'pbuild']
-                LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir,ModAutoGen)
-            self.CreateAsBuiltInf()
-            if GlobalData.gBinCacheDest:
-                self.GenDestCache()
-            elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
-                # Only for --hash
-                # Update PreMakeCacheChain files
-                self.GenLocalPreMakeCache()
-            self.BuildModules = []
-            return True
-
         # cleanlib
         if Target == 'cleanlib':
             for Lib in AutoGenObject.LibraryBuildDirectoryList:
@@ -1881,7 +1858,7 @@ class Build():
                                 Ma.Workspace = Wa
                             MaList.append(Ma)
 
-                            if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and self.Target in [None, "", "all"]:
+                            if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and self.Target in [None, "", "all", "modules"]:
                                 if Ma.CanSkipbyPreMakeCache():
                                     continue
                                 else:
@@ -1907,7 +1884,7 @@ class Build():
                                 if self.Target == "genmake":
                                     return True
 
-                                if GlobalData.gBinCacheSource and self.Target in [None, "", "all"]:
+                                if GlobalData.gBinCacheSource and self.Target in [None, "", "all", "modules"]:
                                     if Ma.CanSkipbyMakeCache():
                                         continue
                                     else:
@@ -2423,7 +2400,7 @@ class Build():
         self.MakeCacheMiss = set()
         self.MakeCacheHit = set()
         if not self.ModuleFile:
-            if not self.SpawnMode or self.Target not in ["", "all"]:
+            if not self.SpawnMode or self.Target not in ["", "all", "modules"]:
                 self.SpawnMode = False
                 self._BuildPlatform()
             else:
-- 
2.28.0.windows.1


             reply	other threads:[~2021-02-26  6:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  6:07 Steven Shi [this message]
2021-03-08  1:17 ` 回复: [edk2-devel] [PATCH] BaseTools: Fix build failure of "modules" option gaoliming
2021-03-08  1:28 ` Bob Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210226060718.378-1-steven.shi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox