BaseTools: fix --genfds-multi-thread generate makefile issue

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>
This commit is contained in:
Feng, YunhuaX
2018-04-10 09:12:49 +08:00
committed by Yonghong Zhu
parent 9a8d7aa7f7
commit a146c532c7
5 changed files with 23 additions and 9 deletions

View File

@ -1,7 +1,7 @@
## @file ## @file
# process rule section generation # process rule section generation
# #
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -64,6 +64,7 @@ class EfiSection (EfiSectionClassObject):
Filename = FfsInf.__ExtendMacro__(self.FileName) Filename = FfsInf.__ExtendMacro__(self.FileName)
BuildNum = FfsInf.__ExtendMacro__(self.BuildNum) BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)
StringData = FfsInf.__ExtendMacro__(self.StringData) StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
NoStrip = True NoStrip = True
if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'): if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):
if FfsInf.KeepReloc is not None: if FfsInf.KeepReloc is not None:
@ -91,8 +92,9 @@ class EfiSection (EfiSectionClassObject):
FileList.append(Filename) FileList.append(Filename)
elif os.path.exists(Filename): elif os.path.exists(Filename):
FileList.append(Filename) FileList.append(Filename)
elif '.depex' in FfsInf.FinalTargetSuffixMap or FfsInf.Depex: elif IsMakefile:
if IsMakefile: SuffixMap = FfsInf.GetFinalTargetSuffixMap()
if '.depex' in SuffixMap:
FileList.append(Filename) FileList.append(Filename)
else: else:
FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile) FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile)
@ -179,6 +181,8 @@ class EfiSection (EfiSectionClassObject):
if InfOverrideUiString: if InfOverrideUiString:
Num = SecNum Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType)) OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile) Ui=StringData, IsMakefile=IsMakefile)
@ -192,6 +196,8 @@ class EfiSection (EfiSectionClassObject):
f = open(File, 'r') f = open(File, 'r')
UiString = f.read() UiString = f.read()
f.close() f.close()
if IsMakefile and UiString == ModuleNameStr:
UiString = "$(MODULE_NAME)"
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=UiString, IsMakefile=IsMakefile) Ui=UiString, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile) OutputFileList.append(OutputFile)
@ -208,6 +214,8 @@ class EfiSection (EfiSectionClassObject):
EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss UI Section value" %InfFileName) EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss UI Section value" %InfFileName)
Num = SecNum Num = SecNum
if IsMakefile and StringData == ModuleNameStr:
StringData = "$(MODULE_NAME)"
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType)) OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE', GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
Ui=StringData, IsMakefile=IsMakefile) Ui=StringData, IsMakefile=IsMakefile)

View File

@ -502,9 +502,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
# For the rule only has simpleFile # For the rule only has simpleFile
# #
MakefilePath = None MakefilePath = None
if self.IsBinaryModule:
IsMakefile = False
if IsMakefile: if IsMakefile:
MakefilePath = self.InfFileName, Arch MakefilePath = self.InfFileName, Arch
if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) : if isinstance (Rule, RuleSimpleFile.RuleSimpleFile):
SectionOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile) SectionOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)
FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList, MakefilePath=MakefilePath) FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList, MakefilePath=MakefilePath)
return FfsOutput return FfsOutput

View File

@ -464,9 +464,11 @@ class GenFdsGlobalVariable:
if Ui not in [None, '']: if Ui not in [None, '']:
#Cmd += ["-n", '"' + Ui + '"'] #Cmd += ["-n", '"' + Ui + '"']
if IsMakefile: if IsMakefile:
Cmd += ["-n", "$(MODULE_NAME)"] if Ui == "$(MODULE_NAME)":
Cmd += ['-n', Ui]
else:
Cmd += ["-n", '"' + Ui + '"']
Cmd += ["-o", Output] Cmd += ["-o", Output]
#SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList: if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip()) GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
else: else:

View File

@ -1,7 +1,7 @@
## @file ## @file
# process GUIDed section generation # process GUIDed section generation
# #
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -272,6 +272,8 @@ class GuidSection(GuidSectionClassObject) :
self.Alignment = None self.Alignment = None
self.IncludeFvSection = False self.IncludeFvSection = False
self.ProcessRequired = "TRUE" self.ProcessRequired = "TRUE"
if IsMakefile and self.Alignment.strip() == '0':
self.Alignment = '1'
return OutputFileList, self.Alignment return OutputFileList, self.Alignment

View File

@ -1,7 +1,7 @@
## @file ## @file
# Trim files preprocessed by compiler # Trim files preprocessed by compiler
# #
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -437,7 +437,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile):
for CurrentDir, Dirs, Files in os.walk(DebugDir): for CurrentDir, Dirs, Files in os.walk(DebugDir):
for FileName in Files: for FileName in Files:
Name, Ext = os.path.splitext(FileName) Name, Ext = os.path.splitext(FileName)
if Ext == '.lst': if Ext == '.c' and Name != 'AutoGen':
VfrNameList.append (Name + 'Bin') VfrNameList.append (Name + 'Bin')
VfrNameList.append (ModuleName + 'Strings') VfrNameList.append (ModuleName + 'Strings')