BaseTools: fix --genfds-multi-thread generate makefile issue
authorFeng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1>
Tue, 10 Apr 2018 01:12:49 +0000 (09:12 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 11 Apr 2018 06:47:55 +0000 (14:47 +0800)
1. when inf file is binary module, not generate makefile,
  so need generate ffs with previous method.
2. generate Ui section maybe override and the string is not
  $(MODULE_NAME)
  like as:
  INF  RuleOverride = UI MdeModulePkg/Application/UiApp/UiApp.inf
3. Trim generate incorrect Offset.raw when some vfr not generate .lst
   file in Debug directory, Trim get the VFR name with the .c files
   replacement.
4. fix some depex file not generate issue

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
BaseTools/Source/Python/GenFds/GuidSection.py
BaseTools/Source/Python/Trim/Trim.py

index 7e6c88a0594e643c97766feb76216c781c0b4714..5bb1ae6f664c8649fbbb75e8befac7a70899d3ce 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process rule section generation\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, 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
@@ -64,6 +64,7 @@ class EfiSection (EfiSectionClassObject):
             Filename = FfsInf.__ExtendMacro__(self.FileName)\r
             BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)\r
             StringData = FfsInf.__ExtendMacro__(self.StringData)\r
+            ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')\r
             NoStrip = True\r
             if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):\r
                 if FfsInf.KeepReloc is not None:\r
@@ -91,8 +92,9 @@ class EfiSection (EfiSectionClassObject):
                 FileList.append(Filename)\r
             elif os.path.exists(Filename):\r
                 FileList.append(Filename)\r
-            elif '.depex' in FfsInf.FinalTargetSuffixMap or FfsInf.Depex:\r
-                if IsMakefile:\r
+            elif IsMakefile:\r
+                SuffixMap = FfsInf.GetFinalTargetSuffixMap()\r
+                if '.depex' in SuffixMap:\r
                     FileList.append(Filename)\r
         else:\r
             FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile)\r
@@ -179,6 +181,8 @@ class EfiSection (EfiSectionClassObject):
 \r
             if InfOverrideUiString:\r
                 Num = SecNum\r
+                if IsMakefile and StringData == ModuleNameStr:\r
+                    StringData = "$(MODULE_NAME)"\r
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
@@ -192,6 +196,8 @@ class EfiSection (EfiSectionClassObject):
                     f = open(File, 'r')\r
                     UiString = f.read()\r
                     f.close()\r
+                    if IsMakefile and UiString == ModuleNameStr:\r
+                        UiString = "$(MODULE_NAME)"\r
                     GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                         Ui=UiString, IsMakefile=IsMakefile)\r
                     OutputFileList.append(OutputFile)\r
@@ -208,6 +214,8 @@ class EfiSection (EfiSectionClassObject):
                         EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss UI Section value" %InfFileName)\r
 \r
                 Num = SecNum\r
+                if IsMakefile and StringData == ModuleNameStr:\r
+                    StringData = "$(MODULE_NAME)"\r
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
index 0dbffffc9a151b5529197a8d8830cf292befc2c0..5364569b96d7725a99a7bdb1b9057747437a722a 100644 (file)
@@ -502,9 +502,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
         # For the rule only has simpleFile\r
         #\r
         MakefilePath = None\r
+        if self.IsBinaryModule:\r
+            IsMakefile = False\r
         if IsMakefile:\r
             MakefilePath = self.InfFileName, Arch\r
-        if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :\r
+        if isinstance (Rule, RuleSimpleFile.RuleSimpleFile):\r
             SectionOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)\r
             FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList, MakefilePath=MakefilePath)\r
             return FfsOutput\r
index fcb191981c95a75489a4134cc51392eaab41cea2..2f9d58f6bf37f58ffb0502eb1896c0e702c2057c 100644 (file)
@@ -464,9 +464,11 @@ class GenFdsGlobalVariable:
         if Ui not in [None, '']:\r
             #Cmd += ["-n", '"' + Ui + '"']\r
             if IsMakefile:\r
-                Cmd += ["-n", "$(MODULE_NAME)"]\r
+                if Ui == "$(MODULE_NAME)":\r
+                    Cmd += ['-n', Ui]\r
+                else:\r
+                    Cmd += ["-n", '"' + Ui + '"']\r
                 Cmd += ["-o", Output]\r
-                #SaveFileOnChange(CommandFile, ' '.join(Cmd), False)\r
                 if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:\r
                     GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())\r
             else:\r
index 8362073f97a30c533ad4484cb53a8656a4df213b..08665a3d4d491a25b95d012fbe234d8d07cc57d0 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process GUIDed section generation\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, 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
@@ -272,6 +272,8 @@ class GuidSection(GuidSectionClassObject) :
                 self.Alignment = None\r
                 self.IncludeFvSection = False\r
                 self.ProcessRequired = "TRUE"\r
+            if IsMakefile and self.Alignment.strip() == '0':\r
+                self.Alignment = '1'\r
             return OutputFileList, self.Alignment\r
 \r
 \r
index d07edbd5d8722ff7783a6c6c42e4182d622d687e..3eb7fa39209d74b6872d66c5fd4b63b84f03f8ca 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Trim files preprocessed by compiler\r
 #\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -437,7 +437,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile):
         for CurrentDir, Dirs, Files in os.walk(DebugDir):\r
             for FileName in Files:\r
                 Name, Ext = os.path.splitext(FileName)\r
-                if Ext == '.lst':\r
+                if Ext == '.c' and Name != 'AutoGen':\r
                     VfrNameList.append (Name + 'Bin')\r
 \r
     VfrNameList.append (ModuleName + 'Strings')\r