public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Feng, YunhuaX" <yunhuax.feng@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>
Subject: [PATCH 3/3] BaseTools: fix --genfds-multi-thread generate makefile issue
Date: Tue, 10 Apr 2018 01:12:49 +0000	[thread overview]
Message-ID: <47C64442C08CCD4089DC43B6B5E46BC484BAB6@shsmsx102.ccr.corp.intel.com> (raw)

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>
---
 BaseTools/Source/Python/GenFds/EfiSection.py           | 12 ++++++++++--
 BaseTools/Source/Python/GenFds/FfsInfStatement.py      |  4 +++-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  6 ++++--
 BaseTools/Source/Python/GenFds/GuidSection.py          |  2 ++
 BaseTools/Source/Python/Trim/Trim.py                   |  2 +-
 5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index 5029ec7a18..e6323c7879 100644
--- a/BaseTools/Source/Python/GenFds/EfiSection.py
+++ b/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -62,10 +62,11 @@ class EfiSection (EfiSectionClassObject):
             InfFileName = FfsInf.InfFileName
             SectionType = FfsInf.__ExtendMacro__(self.SectionType)
             Filename = FfsInf.__ExtendMacro__(self.FileName)
             BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)
             StringData = FfsInf.__ExtendMacro__(self.StringData)
+            ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
             NoStrip = True
             if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):
                 if FfsInf.KeepReloc != None:
                     NoStrip = FfsInf.KeepReloc
                 elif FfsInf.KeepRelocFromRule != None:
@@ -89,12 +90,13 @@ class EfiSection (EfiSectionClassObject):
 
             if not self.Optional:
                 FileList.append(Filename)
             elif os.path.exists(Filename):
                 FileList.append(Filename)
-            elif '.depex' in FfsInf.FinalTargetSuffixMap or FfsInf.Depex:
-                if IsMakefile:
+            elif IsMakefile:
+                SuffixMap = FfsInf.GetFinalTargetSuffixMap()
+                if '.depex' in SuffixMap:
                     FileList.append(Filename)
         else:
             FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile)
             if IsSect :
                 return FileList, self.Alignment
@@ -177,10 +179,12 @@ class EfiSection (EfiSectionClassObject):
                 StringData = FfsInf.Ui
                 InfOverrideUiString = True
 
             if InfOverrideUiString:
                 Num = SecNum
+                if IsMakefile and StringData == ModuleNameStr:
+                    StringData = "$(MODULE_NAME)"
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
                                                      Ui=StringData, IsMakefile=IsMakefile)
                 OutputFileList.append(OutputFile)
 
@@ -190,10 +194,12 @@ class EfiSection (EfiSectionClassObject):
                     Num = '%s.%d' %(SecNum , Index)
                     OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
                     f = open(File, 'r')
                     UiString = f.read()
                     f.close()
+                    if IsMakefile and UiString == ModuleNameStr:
+                        UiString = "$(MODULE_NAME)"
                     GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
                                                         Ui=UiString, IsMakefile=IsMakefile)
                     OutputFileList.append(OutputFile)
             else:
                 if StringData != None and len(StringData) > 0:
@@ -206,10 +212,12 @@ class EfiSection (EfiSectionClassObject):
                         return '', None
                     else:
                         EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss UI Section value" %InfFileName)
 
                 Num = SecNum
+                if IsMakefile and StringData == ModuleNameStr:
+                    StringData = "$(MODULE_NAME)"
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
                                                      Ui=StringData, IsMakefile=IsMakefile)
                 OutputFileList.append(OutputFile)
 
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index a348233911..84450ef3fe 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -500,13 +500,15 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
         #
         # For the rule only has simpleFile
         #
         MakefilePath = None
+        if self.IsBinaryModule:
+            IsMakefile = False
         if IsMakefile:
             MakefilePath = self.InfFileName, Arch
-        if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :
+        if isinstance (Rule, RuleSimpleFile.RuleSimpleFile):
             SectionOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)
             FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList, MakefilePath=MakefilePath)
             return FfsOutput
         #
         # For Rule has ComplexFile
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 97e20753ae..6437e5fa30 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -462,13 +462,15 @@ class GenFdsGlobalVariable:
 
         CommandFile = Output + '.txt'
         if Ui not in [None, '']:
             #Cmd += ["-n", '"' + Ui + '"']
             if IsMakefile:
-                Cmd += ["-n", "$(MODULE_NAME)"]
+                if Ui == "$(MODULE_NAME)":
+                    Cmd += ['-n', Ui]
+                else:
+                    Cmd += ["-n", '"' + Ui + '"']
                 Cmd += ["-o", Output]
-                #SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
                 if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
                     GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
             else:
                 SectionData = array.array('B', [0, 0, 0, 0])
                 SectionData.fromstring(Ui.encode("utf_16_le"))
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py
index ea737bb9a7..b8612be05f 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -270,9 +270,11 @@ class GuidSection(GuidSectionClassObject) :
             if 'PROCESSING_REQUIRED' in Attribute:
                 # reset guided section alignment to none for the processed required guided data
                 self.Alignment = None
                 self.IncludeFvSection = False
                 self.ProcessRequired = "TRUE"
+            if IsMakefile and self.Alignment.strip() == '0':
+                self.Alignment = '1'
             return OutputFileList, self.Alignment
 
 
 
diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py
index d1e40b025c..b98c8ff779 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -435,11 +435,11 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile):
     VfrNameList = []
     if os.path.isdir(DebugDir):
         for CurrentDir, Dirs, Files in os.walk(DebugDir):
             for FileName in Files:
                 Name, Ext = os.path.splitext(FileName)
-                if Ext == '.lst':
+                if Ext == '.c' and Name != 'AutoGen':
                     VfrNameList.append (Name + 'Bin')
 
     VfrNameList.append (ModuleName + 'Strings')
 
     EfiFileName = os.path.join(DebugDir, ModuleName + '.efi')
-- 
2.12.2.windows.2



             reply	other threads:[~2018-04-10  1:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  1:12 Feng, YunhuaX [this message]
2018-04-11  6:33 ` [PATCH 3/3] BaseTools: fix --genfds-multi-thread generate makefile issue Zhu, Yonghong

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=47C64442C08CCD4089DC43B6B5E46BC484BAB6@shsmsx102.ccr.corp.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