BaseTools/Source/Python/build/build.py | 45 +++++++------------------- 1 file changed, 11 insertions(+), 34 deletions(-)
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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72224): https://edk2.groups.io/g/devel/message/72224
Mute This Topic: https://groups.io/mt/80921642/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Steven: With this fix, I find modules, libraries targets both work. Do you verify other build targets? Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Steven Shi > 发送时间: 2021年2月26日 14:07 > 收件人: devel@edk2.groups.io > 抄送: Steven Shi <steven.shi@intel.com>; Bob Feng <bob.c.feng@intel.com>; > Liming Gao <gaoliming@byosoft.com.cn> > 主题: [edk2-devel] [PATCH] BaseTools: Fix build failure of "modules" option > > 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 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72514): https://edk2.groups.io/g/devel/message/72514 Mute This Topic: https://groups.io/mt/81164351/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
This patch looks good to me. Reviewed-by: Bob Feng <bob.c.feng@intel.com> -----Original Message----- From: Shi, Steven <steven.shi@intel.com> Sent: Friday, February 26, 2021 2:07 PM To: devel@edk2.groups.io Cc: Shi, Steven <steven.shi@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: [PATCH] BaseTools: Fix build failure of "modules" option 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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72517): https://edk2.groups.io/g/devel/message/72517 Mute This Topic: https://groups.io/mt/80921642/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.