[edk2-devel] [Patch 1/1 V2] BaseTools: Fix a bug of genffs command generation

Bob Feng bob.c.feng at intel.com
Mon Sep 30 03:14:00 UTC 2019


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

The command used by multiple thread genffs feature in makefile
for testing if file exist is generated based on the toolchain family.
It should be based on the make program name.

Cc: Liming Gao <liming.gao at intel.com>
Signed-off-by: Bob Feng <bob.c.feng at intel.com>
---
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +++-
 BaseTools/Source/Python/build/build.py                 | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 4d8b2bdee299..1b4c75034333 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -68,10 +68,11 @@ class GenFdsGlobalVariable:
     FfsCmdDict = {}
     SecCmdList = []
     CopyList   = []
     ModuleFile = ''
     EnableGenfdsMultiThread = True
+    Make = ""
 
     #
     # The list whose element are flags to indicate if large FFS or SECTION files exist in FV.
     # At the beginning of each generation of FV, false flag is appended to the list,
     # after the call to GenerateSection returns, check the size of the output file,
@@ -320,10 +321,11 @@ class GenFdsGlobalVariable:
         GenFdsGlobalVariable.ModuleFile = WorkSpace.ModuleFile
         GenFdsGlobalVariable.FdfParser = FdfParser
         GenFdsGlobalVariable.WorkSpace = WorkSpace.Db
         GenFdsGlobalVariable.ArchList = ArchList
         GenFdsGlobalVariable.ToolChainTag = GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]
+        GenFdsGlobalVariable.Make = GlobalData.gGlobalDefines['Make']
         GenFdsGlobalVariable.TargetName = GlobalData.gGlobalDefines["TARGET"]
         GenFdsGlobalVariable.ActivePlatform = GlobalData.gActivePlatform
         GenFdsGlobalVariable.ConfDir  = GlobalData.gConfDirectory
         GenFdsGlobalVariable.EnableGenfdsMultiThread = GlobalData.gEnableGenfdsMultiThread
         for Arch in ArchList:
@@ -484,11 +486,11 @@ class GenFdsGlobalVariable:
             Cmd += ("-o", Output)
             Cmd += Input
 
             SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
             if IsMakefile:
-                if GlobalData.gGlobalDefines.get("FAMILY") == "MSFT":
+                if "nmake" in GenFdsGlobalVariable.Make:
                     Cmd = ['if', 'exist', Input[0]] + Cmd
                 else:
                     Cmd = ['-test', '-e', Input[0], "&&"] + Cmd
                 if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
                     GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index bcd832c525f1..1c02d144d19d 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1726,11 +1726,11 @@ class Build():
                         )
                 self.Fdf = Wa.FdfFile
                 self.LoadFixAddress = Wa.Platform.LoadFixAddress
                 self.BuildReport.AddPlatformReport(Wa)
                 self.Progress.Stop("done!")
-
+                GlobalData.gGlobalDefines['Make'] = os.path.basename(Wa.ToolDefinition["MAKE"]["PATH"])
                 # Add ffs build to makefile
                 CmdListDict = {}
                 if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
                     CmdListDict = self._GenFfsCmd(Wa.ArchList)
 
@@ -1827,10 +1827,11 @@ class Build():
                         self.Progress,
                         self.ModuleFile
                         )
                 self.Fdf = Wa.FdfFile
                 self.LoadFixAddress = Wa.Platform.LoadFixAddress
+                GlobalData.gGlobalDefines['Make'] = os.path.basename(Wa.ToolDefinition["MAKE"]["PATH"])
                 Wa.CreateMakeFile(False)
                 # Add ffs build to makefile
                 CmdListDict = None
                 if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
                     CmdListDict = self._GenFfsCmd(Wa.ArchList)
@@ -2096,11 +2097,11 @@ class Build():
                 )
         self.Fdf = Wa.FdfFile
         self.LoadFixAddress = Wa.Platform.LoadFixAddress
         self.BuildReport.AddPlatformReport(Wa)
         Wa.CreateMakeFile(False)
-
+        GlobalData.gGlobalDefines['Make'] = os.path.basename(Wa.ToolDefinition["MAKE"]["PATH"])
                 # Add ffs build to makefile
         CmdListDict = {}
         if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
             CmdListDict = self._GenFfsCmd(Wa.ArchList)
 
@@ -2214,11 +2215,10 @@ class Build():
                         self.BuildModules = self.SetupMakeSetting(Wa)
                 else:
                     Wa, self.BuildModules = self.PerformAutoGen(BuildTarget,ToolChain)
                 Pa = Wa.AutoGenObjectList[0]
                 GlobalData.gAutoGenPhase = False
-
                 if GlobalData.gBinCacheSource:
                     EdkLogger.quiet("Total cache hit driver num: %s, cache miss driver num: %s" % (len(set(self.HashSkipModules)), len(set(self.BuildModules))))
                     CacheHitMa = set()
                     CacheNotHitMa = set()
                     for IR in GlobalData.gCacheIR.keys():
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48274): https://edk2.groups.io/g/devel/message/48274
Mute This Topic: https://groups.io/mt/34341109/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list