mirror of https://github.com/acidanthera/audk.git
BaseTools: Update Makefile to support FFS file generation
Update Makefile to support FFS file generation with new build option --genfds-multi-thread. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
b37b108d92
commit
37de70b764
|
@ -1307,12 +1307,15 @@ class PlatformAutoGen(AutoGen):
|
||||||
# @param CreateModuleMakeFile Flag indicating if the makefile for
|
# @param CreateModuleMakeFile Flag indicating if the makefile for
|
||||||
# modules will be created as well
|
# modules will be created as well
|
||||||
#
|
#
|
||||||
def CreateMakeFile(self, CreateModuleMakeFile=False):
|
def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):
|
||||||
if CreateModuleMakeFile:
|
if CreateModuleMakeFile:
|
||||||
for ModuleFile in self.Platform.Modules:
|
for ModuleFile in self.Platform.Modules:
|
||||||
Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,
|
Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,
|
||||||
self.ToolChain, self.Arch, self.MetaFile)
|
self.ToolChain, self.Arch, self.MetaFile)
|
||||||
Ma.CreateMakeFile(True)
|
if (ModuleFile.File, self.Arch) in FfsCommand:
|
||||||
|
Ma.CreateMakeFile(True, FfsCommand[ModuleFile.File, self.Arch])
|
||||||
|
else:
|
||||||
|
Ma.CreateMakeFile(True)
|
||||||
#Ma.CreateAsBuiltInf()
|
#Ma.CreateAsBuiltInf()
|
||||||
|
|
||||||
# no need to create makefile for the platform more than once
|
# no need to create makefile for the platform more than once
|
||||||
|
@ -2760,6 +2763,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
|
|
||||||
self._BuildDir = None
|
self._BuildDir = None
|
||||||
self._OutputDir = None
|
self._OutputDir = None
|
||||||
|
self._FfsOutputDir = None
|
||||||
self._DebugDir = None
|
self._DebugDir = None
|
||||||
self._MakeFileDir = None
|
self._MakeFileDir = None
|
||||||
|
|
||||||
|
@ -2876,6 +2880,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
self._Macro["PLATFORM_RELATIVE_DIR" ] = self.PlatformInfo.SourceDir
|
self._Macro["PLATFORM_RELATIVE_DIR" ] = self.PlatformInfo.SourceDir
|
||||||
self._Macro["PLATFORM_DIR" ] = mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir)
|
self._Macro["PLATFORM_DIR" ] = mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir)
|
||||||
self._Macro["PLATFORM_OUTPUT_DIR" ] = self.PlatformInfo.OutputDir
|
self._Macro["PLATFORM_OUTPUT_DIR" ] = self.PlatformInfo.OutputDir
|
||||||
|
self._Macro["FFS_OUTPUT_DIR" ] = self.FfsOutputDir
|
||||||
return self._Macro
|
return self._Macro
|
||||||
|
|
||||||
## Return the module build data object
|
## Return the module build data object
|
||||||
|
@ -2966,6 +2971,15 @@ class ModuleAutoGen(AutoGen):
|
||||||
CreateDirectory(self._OutputDir)
|
CreateDirectory(self._OutputDir)
|
||||||
return self._OutputDir
|
return self._OutputDir
|
||||||
|
|
||||||
|
## Return the directory to store ffs file
|
||||||
|
def _GetFfsOutputDir(self):
|
||||||
|
if self._FfsOutputDir == None:
|
||||||
|
if GlobalData.gFdfParser != None:
|
||||||
|
self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name)
|
||||||
|
else:
|
||||||
|
self._FfsOutputDir = ''
|
||||||
|
return self._FfsOutputDir
|
||||||
|
|
||||||
## Return the directory to store auto-gened source files of the mdoule
|
## Return the directory to store auto-gened source files of the mdoule
|
||||||
def _GetDebugDir(self):
|
def _GetDebugDir(self):
|
||||||
if self._DebugDir == None:
|
if self._DebugDir == None:
|
||||||
|
@ -4222,14 +4236,14 @@ class ModuleAutoGen(AutoGen):
|
||||||
# @param CreateLibraryMakeFile Flag indicating if or not the makefiles of
|
# @param CreateLibraryMakeFile Flag indicating if or not the makefiles of
|
||||||
# dependent libraries will be created
|
# dependent libraries will be created
|
||||||
#
|
#
|
||||||
def CreateMakeFile(self, CreateLibraryMakeFile=True):
|
def CreateMakeFile(self, CreateLibraryMakeFile=True, GenFfsList = []):
|
||||||
# Ignore generating makefile when it is a binary module
|
# Ignore generating makefile when it is a binary module
|
||||||
if self.IsBinaryModule:
|
if self.IsBinaryModule:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.IsMakeFileCreated:
|
if self.IsMakeFileCreated:
|
||||||
return
|
return
|
||||||
|
self.GenFfsList = GenFfsList
|
||||||
if not self.IsLibrary and CreateLibraryMakeFile:
|
if not self.IsLibrary and CreateLibraryMakeFile:
|
||||||
for LibraryAutoGen in self.LibraryAutoGenList:
|
for LibraryAutoGen in self.LibraryAutoGenList:
|
||||||
LibraryAutoGen.CreateMakeFile()
|
LibraryAutoGen.CreateMakeFile()
|
||||||
|
@ -4457,6 +4471,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
IsBinaryModule = property(_IsBinaryModule)
|
IsBinaryModule = property(_IsBinaryModule)
|
||||||
BuildDir = property(_GetBuildDir)
|
BuildDir = property(_GetBuildDir)
|
||||||
OutputDir = property(_GetOutputDir)
|
OutputDir = property(_GetOutputDir)
|
||||||
|
FfsOutputDir = property(_GetFfsOutputDir)
|
||||||
DebugDir = property(_GetDebugDir)
|
DebugDir = property(_GetDebugDir)
|
||||||
MakeFileDir = property(_GetMakeFileDir)
|
MakeFileDir = property(_GetMakeFileDir)
|
||||||
CustomMakefile = property(_GetCustomMakefile)
|
CustomMakefile = property(_GetCustomMakefile)
|
||||||
|
|
|
@ -143,6 +143,11 @@ class BuildFile(object):
|
||||||
"nmake" : 'if exist %(dir)s $(RD) %(dir)s',
|
"nmake" : 'if exist %(dir)s $(RD) %(dir)s',
|
||||||
"gmake" : "$(RD) %(dir)s"
|
"gmake" : "$(RD) %(dir)s"
|
||||||
}
|
}
|
||||||
|
## cp if exist
|
||||||
|
_CP_TEMPLATE_ = {
|
||||||
|
"nmake" : 'if exist %(Src)s $(CP) %(Src)s %(Dst)s',
|
||||||
|
"gmake" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s"
|
||||||
|
}
|
||||||
|
|
||||||
_CD_TEMPLATE_ = {
|
_CD_TEMPLATE_ = {
|
||||||
"nmake" : 'if exist %(dir)s cd %(dir)s',
|
"nmake" : 'if exist %(dir)s cd %(dir)s',
|
||||||
|
@ -211,6 +216,8 @@ class BuildFile(object):
|
||||||
for MacroName in MacroDefinitions:
|
for MacroName in MacroDefinitions:
|
||||||
MacroValue = MacroDefinitions[MacroName]
|
MacroValue = MacroDefinitions[MacroName]
|
||||||
MacroValueLength = len(MacroValue)
|
MacroValueLength = len(MacroValue)
|
||||||
|
if MacroValueLength == 0:
|
||||||
|
continue
|
||||||
if MacroValueLength <= PathLength and Path.startswith(MacroValue):
|
if MacroValueLength <= PathLength and Path.startswith(MacroValue):
|
||||||
Path = "$(%s)%s" % (MacroName, Path[MacroValueLength:])
|
Path = "$(%s)%s" % (MacroName, Path[MacroValueLength:])
|
||||||
break
|
break
|
||||||
|
@ -250,6 +257,7 @@ BASE_NAME = $(MODULE_NAME)
|
||||||
MODULE_RELATIVE_DIR = ${module_relative_directory}
|
MODULE_RELATIVE_DIR = ${module_relative_directory}
|
||||||
PACKAGE_RELATIVE_DIR = ${package_relative_directory}
|
PACKAGE_RELATIVE_DIR = ${package_relative_directory}
|
||||||
MODULE_DIR = ${module_dir}
|
MODULE_DIR = ${module_dir}
|
||||||
|
FFS_OUTPUT_DIR = ${ffs_output_directory}
|
||||||
|
|
||||||
MODULE_ENTRY_POINT = ${module_entry_point}
|
MODULE_ENTRY_POINT = ${module_entry_point}
|
||||||
ARCH_ENTRY_POINT = ${arch_entry_point}
|
ARCH_ENTRY_POINT = ${arch_entry_point}
|
||||||
|
@ -441,6 +449,10 @@ cleanlib:
|
||||||
self.Macros["BIN_DIR" ] = self._AutoGenObject.Macros["BIN_DIR"]
|
self.Macros["BIN_DIR" ] = self._AutoGenObject.Macros["BIN_DIR"]
|
||||||
self.Macros["BUILD_DIR" ] = self._AutoGenObject.Macros["BUILD_DIR"]
|
self.Macros["BUILD_DIR" ] = self._AutoGenObject.Macros["BUILD_DIR"]
|
||||||
self.Macros["WORKSPACE" ] = self._AutoGenObject.Macros["WORKSPACE"]
|
self.Macros["WORKSPACE" ] = self._AutoGenObject.Macros["WORKSPACE"]
|
||||||
|
self.Macros["FFS_OUTPUT_DIR" ] = self._AutoGenObject.Macros["FFS_OUTPUT_DIR"]
|
||||||
|
self.GenFfsList = ModuleAutoGen.GenFfsList
|
||||||
|
self.MacroList = ['FFS_OUTPUT_DIR', 'MODULE_GUID', 'OUTPUT_DIR']
|
||||||
|
self.FfsOutputFileList = []
|
||||||
|
|
||||||
# Compose a dict object containing information used to do replacement in template
|
# Compose a dict object containing information used to do replacement in template
|
||||||
def _CreateTemplateDict(self):
|
def _CreateTemplateDict(self):
|
||||||
|
@ -555,6 +567,7 @@ cleanlib:
|
||||||
ExtraData="[%s]" % str(self._AutoGenObject))
|
ExtraData="[%s]" % str(self._AutoGenObject))
|
||||||
|
|
||||||
self.ProcessBuildTargetList()
|
self.ProcessBuildTargetList()
|
||||||
|
self.ParserGenerateFfsCmd()
|
||||||
|
|
||||||
# Generate macros used to represent input files
|
# Generate macros used to represent input files
|
||||||
FileMacroList = [] # macro name = file list
|
FileMacroList = [] # macro name = file list
|
||||||
|
@ -627,6 +640,7 @@ cleanlib:
|
||||||
"platform_version" : self.PlatformInfo.Version,
|
"platform_version" : self.PlatformInfo.Version,
|
||||||
"platform_relative_directory": self.PlatformInfo.SourceDir,
|
"platform_relative_directory": self.PlatformInfo.SourceDir,
|
||||||
"platform_output_directory" : self.PlatformInfo.OutputDir,
|
"platform_output_directory" : self.PlatformInfo.OutputDir,
|
||||||
|
"ffs_output_directory" : self._AutoGenObject.Macros["FFS_OUTPUT_DIR"],
|
||||||
"platform_dir" : self._AutoGenObject.Macros["PLATFORM_DIR"],
|
"platform_dir" : self._AutoGenObject.Macros["PLATFORM_DIR"],
|
||||||
|
|
||||||
"module_name" : self._AutoGenObject.Name,
|
"module_name" : self._AutoGenObject.Name,
|
||||||
|
@ -673,6 +687,79 @@ cleanlib:
|
||||||
|
|
||||||
return MakefileTemplateDict
|
return MakefileTemplateDict
|
||||||
|
|
||||||
|
def ParserGenerateFfsCmd(self):
|
||||||
|
#Add Ffs cmd to self.BuildTargetList
|
||||||
|
OutputFile = ''
|
||||||
|
DepsFileList = []
|
||||||
|
|
||||||
|
for Cmd in self.GenFfsList:
|
||||||
|
if Cmd[2]:
|
||||||
|
for CopyCmd in Cmd[2]:
|
||||||
|
Src, Dst = CopyCmd
|
||||||
|
Src = self.ReplaceMacro(Src)
|
||||||
|
Dst = self.ReplaceMacro(Dst)
|
||||||
|
if Dst not in self.ResultFileList:
|
||||||
|
self.ResultFileList.append('%s' % Dst)
|
||||||
|
if '%s :' %(Dst) not in self.BuildTargetList:
|
||||||
|
self.BuildTargetList.append("%s :" %(Dst))
|
||||||
|
self.BuildTargetList.append('\t' + self._CP_TEMPLATE_[self._FileType] %{'Src': Src, 'Dst': Dst})
|
||||||
|
|
||||||
|
FfsCmdList = Cmd[0]
|
||||||
|
for index, Str in enumerate(FfsCmdList):
|
||||||
|
if '-o' == Str:
|
||||||
|
OutputFile = FfsCmdList[index + 1]
|
||||||
|
if '-i' == Str:
|
||||||
|
if DepsFileList == []:
|
||||||
|
DepsFileList = [FfsCmdList[index + 1]]
|
||||||
|
else:
|
||||||
|
DepsFileList.append(FfsCmdList[index + 1])
|
||||||
|
DepsFileString = ' '.join(DepsFileList).strip()
|
||||||
|
if DepsFileString == '':
|
||||||
|
continue
|
||||||
|
OutputFile = self.ReplaceMacro(OutputFile)
|
||||||
|
self.ResultFileList.append('%s' % OutputFile)
|
||||||
|
DepsFileString = self.ReplaceMacro(DepsFileString)
|
||||||
|
self.BuildTargetList.append('%s : %s' % (OutputFile, DepsFileString))
|
||||||
|
CmdString = ' '.join(FfsCmdList).strip()
|
||||||
|
CmdString = self.ReplaceMacro(CmdString)
|
||||||
|
self.BuildTargetList.append('\t%s' % CmdString)
|
||||||
|
|
||||||
|
self.ParseSecCmd(DepsFileList, Cmd[1])
|
||||||
|
for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList :
|
||||||
|
self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile)))
|
||||||
|
self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd))
|
||||||
|
self.FfsOutputFileList = []
|
||||||
|
|
||||||
|
def ParseSecCmd(self, OutputFileList, CmdTuple):
|
||||||
|
for OutputFile in OutputFileList:
|
||||||
|
for SecCmdStr in CmdTuple:
|
||||||
|
SecDepsFileList = []
|
||||||
|
SecCmdList = SecCmdStr.split()
|
||||||
|
CmdName = SecCmdList[0]
|
||||||
|
for index, CmdItem in enumerate(SecCmdList):
|
||||||
|
if '-o' == CmdItem and OutputFile == SecCmdList[index + 1]:
|
||||||
|
index = index + 1
|
||||||
|
while index + 1 < len(SecCmdList):
|
||||||
|
if not SecCmdList[index+1].startswith('-'):
|
||||||
|
SecDepsFileList.append(SecCmdList[index + 1])
|
||||||
|
index = index + 1
|
||||||
|
if CmdName == 'Trim':
|
||||||
|
SecDepsFileList.append(os.path.join('$(DEBUG_DIR)', os.path.basename(OutputFile).replace('offset', 'efi')))
|
||||||
|
if OutputFile.endswith('.ui') or OutputFile.endswith('.ver'):
|
||||||
|
SecDepsFileList.append(os.path.join('$(MODULE_DIR)','$(MODULE_FILE)'))
|
||||||
|
self.FfsOutputFileList.append((OutputFile, ' '.join(SecDepsFileList), SecCmdStr))
|
||||||
|
if len(SecDepsFileList) > 0:
|
||||||
|
self.ParseSecCmd(SecDepsFileList, CmdTuple)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
def ReplaceMacro(self, str):
|
||||||
|
for Macro in self.MacroList:
|
||||||
|
if self._AutoGenObject.Macros[Macro] and self._AutoGenObject.Macros[Macro] in str:
|
||||||
|
str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + Macro + ')')
|
||||||
|
return str
|
||||||
|
|
||||||
def CommandExceedLimit(self):
|
def CommandExceedLimit(self):
|
||||||
FlagDict = {
|
FlagDict = {
|
||||||
'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False},
|
'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False},
|
||||||
|
@ -1453,7 +1540,8 @@ class TopLevelMakefile(BuildFile):
|
||||||
|
|
||||||
if GlobalData.gCaseInsensitive:
|
if GlobalData.gCaseInsensitive:
|
||||||
ExtraOption += " -c"
|
ExtraOption += " -c"
|
||||||
|
if GlobalData.gEnableGenfdsMultiThread:
|
||||||
|
ExtraOption += " --genfds-multi-thread"
|
||||||
if GlobalData.gIgnoreSource:
|
if GlobalData.gIgnoreSource:
|
||||||
ExtraOption += " --ignore-sources"
|
ExtraOption += " --ignore-sources"
|
||||||
|
|
||||||
|
|
|
@ -95,3 +95,4 @@ gBinCacheSource = None
|
||||||
gPlatformHash = None
|
gPlatformHash = None
|
||||||
gPackageHash = {}
|
gPackageHash = {}
|
||||||
gModuleHash = {}
|
gModuleHash = {}
|
||||||
|
gEnableGenfdsMultiThread = False
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process APRIORI file data and generate PEI/DXE APRIORI file
|
# process APRIORI file data and generate PEI/DXE APRIORI file
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -47,7 +47,7 @@ class AprioriSection (AprioriSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval string Generated file name
|
# @retval string Generated file name
|
||||||
#
|
#
|
||||||
def GenFfs (self, FvName, Dict = {}):
|
def GenFfs (self, FvName, Dict = {}, IsMakefile = False):
|
||||||
DXE_GUID = "FC510EE7-FFDC-11D4-BD41-0080C73C8881"
|
DXE_GUID = "FC510EE7-FFDC-11D4-BD41-0080C73C8881"
|
||||||
PEI_GUID = "1B45CC0A-156A-428A-AF62-49864DA0E6E6"
|
PEI_GUID = "1B45CC0A-156A-428A-AF62-49864DA0E6E6"
|
||||||
Buffer = StringIO.StringIO('')
|
Buffer = StringIO.StringIO('')
|
||||||
|
@ -66,6 +66,7 @@ class AprioriSection (AprioriSectionClassObject):
|
||||||
AprioriFileGuid + FvName + '.Ffs')
|
AprioriFileGuid + FvName + '.Ffs')
|
||||||
|
|
||||||
Dict.update(self.DefineVarDict)
|
Dict.update(self.DefineVarDict)
|
||||||
|
InfFileName = None
|
||||||
for FfsObj in self.FfsList :
|
for FfsObj in self.FfsList :
|
||||||
Guid = ""
|
Guid = ""
|
||||||
if isinstance(FfsObj, FfsFileStatement.FileStatement):
|
if isinstance(FfsObj, FfsFileStatement.FileStatement):
|
||||||
|
@ -110,9 +111,14 @@ class AprioriSection (AprioriSectionClassObject):
|
||||||
|
|
||||||
RawSectionFileName = os.path.join( OutputAprFilePath, \
|
RawSectionFileName = os.path.join( OutputAprFilePath, \
|
||||||
AprioriFileGuid + FvName + '.raw' )
|
AprioriFileGuid + FvName + '.raw' )
|
||||||
GenFdsGlobalVariable.GenerateSection(RawSectionFileName, [OutputAprFileName], 'EFI_SECTION_RAW')
|
MakefilePath = None
|
||||||
|
if IsMakefile:
|
||||||
|
if not InfFileName:
|
||||||
|
return None
|
||||||
|
MakefilePath = InfFileName, Arch
|
||||||
|
GenFdsGlobalVariable.GenerateSection(RawSectionFileName, [OutputAprFileName], 'EFI_SECTION_RAW', IsMakefile=IsMakefile)
|
||||||
GenFdsGlobalVariable.GenerateFfs(AprFfsFileName, [RawSectionFileName],
|
GenFdsGlobalVariable.GenerateFfs(AprFfsFileName, [RawSectionFileName],
|
||||||
'EFI_FV_FILETYPE_FREEFORM', AprioriFileGuid)
|
'EFI_FV_FILETYPE_FREEFORM', AprioriFileGuid, MakefilePath=MakefilePath)
|
||||||
|
|
||||||
return AprFfsFileName
|
return AprFfsFileName
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process compress section generation
|
# process compress section generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -53,7 +53,7 @@ class CompressSection (CompressSectionClassObject) :
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name, section alignment)
|
# @retval tuple (Generated file name, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):
|
||||||
|
|
||||||
if FfsInf != None:
|
if FfsInf != None:
|
||||||
self.CompType = FfsInf.__ExtendMacro__(self.CompType)
|
self.CompType = FfsInf.__ExtendMacro__(self.CompType)
|
||||||
|
@ -64,10 +64,10 @@ class CompressSection (CompressSectionClassObject) :
|
||||||
for Sect in self.SectionList:
|
for Sect in self.SectionList:
|
||||||
Index = Index + 1
|
Index = Index + 1
|
||||||
SecIndex = '%s.%d' %(SecNum, Index)
|
SecIndex = '%s.%d' %(SecNum, Index)
|
||||||
ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict)
|
ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
|
||||||
if ReturnSectList != []:
|
if ReturnSectList != []:
|
||||||
for FileData in ReturnSectList:
|
for FileData in ReturnSectList:
|
||||||
SectFiles += (FileData,)
|
SectFiles += (FileData,)
|
||||||
|
|
||||||
|
|
||||||
OutputFile = OutputPath + \
|
OutputFile = OutputPath + \
|
||||||
|
@ -79,7 +79,7 @@ class CompressSection (CompressSectionClassObject) :
|
||||||
OutputFile = os.path.normpath(OutputFile)
|
OutputFile = os.path.normpath(OutputFile)
|
||||||
|
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],
|
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, Section.Section.SectionType['COMPRESS'],
|
||||||
CompressionType=self.CompTypeDict[self.CompType])
|
CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
return OutputFileList, self.Alignment
|
return OutputFileList, self.Alignment
|
||||||
|
|
|
@ -48,7 +48,7 @@ class DataSection (DataSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name list, section alignment)
|
# @retval tuple (Generated file name list, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}, IsMakefile = False):
|
||||||
#
|
#
|
||||||
# Prepare the parameter of GenSection
|
# Prepare the parameter of GenSection
|
||||||
#
|
#
|
||||||
|
@ -69,10 +69,16 @@ class DataSection (DataSectionClassObject):
|
||||||
Filename = GenFdsGlobalVariable.MacroExtend(self.SectFileName)
|
Filename = GenFdsGlobalVariable.MacroExtend(self.SectFileName)
|
||||||
if Filename[(len(Filename)-4):] == '.efi':
|
if Filename[(len(Filename)-4):] == '.efi':
|
||||||
MapFile = Filename.replace('.efi', '.map')
|
MapFile = Filename.replace('.efi', '.map')
|
||||||
if os.path.exists(MapFile):
|
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
|
||||||
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
|
if IsMakefile:
|
||||||
if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
|
if GenFdsGlobalVariable.CopyList == []:
|
||||||
CopyLongFilePath(MapFile, CopyMapFile)
|
GenFdsGlobalVariable.CopyList = [(MapFile, CopyMapFile)]
|
||||||
|
else:
|
||||||
|
GenFdsGlobalVariable.CopyList.append((MapFile, CopyMapFile))
|
||||||
|
else:
|
||||||
|
if os.path.exists(MapFile):
|
||||||
|
if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
|
||||||
|
CopyLongFilePath(MapFile, CopyMapFile)
|
||||||
|
|
||||||
#Get PE Section alignment when align is set to AUTO
|
#Get PE Section alignment when align is set to AUTO
|
||||||
if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):
|
if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):
|
||||||
|
@ -96,24 +102,25 @@ class DataSection (DataSectionClassObject):
|
||||||
CopyLongFilePath(self.SectFileName, FileBeforeStrip)
|
CopyLongFilePath(self.SectFileName, FileBeforeStrip)
|
||||||
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
|
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
StrippedFile,
|
StrippedFile,
|
||||||
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
|
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
|
||||||
Strip=True
|
Strip=True,
|
||||||
)
|
IsMakefile = IsMakefile
|
||||||
|
)
|
||||||
self.SectFileName = StrippedFile
|
self.SectFileName = StrippedFile
|
||||||
|
|
||||||
if self.SecType == 'TE':
|
if self.SecType == 'TE':
|
||||||
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
|
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
TeFile,
|
TeFile,
|
||||||
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
|
[GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
|
||||||
Type='te'
|
Type='te',
|
||||||
)
|
IsMakefile = IsMakefile
|
||||||
|
)
|
||||||
self.SectFileName = TeFile
|
self.SectFileName = TeFile
|
||||||
|
|
||||||
OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))
|
OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))
|
||||||
OutputFile = os.path.normpath(OutputFile)
|
OutputFile = os.path.normpath(OutputFile)
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType))
|
|
||||||
FileList = [OutputFile]
|
FileList = [OutputFile]
|
||||||
return FileList, self.Alignment
|
return FileList, self.Alignment
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process depex section generation
|
# process depex section generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -76,7 +76,7 @@ class DepexSection (DepexSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name list, section alignment)
|
# @retval tuple (Generated file name list, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}, IsMakefile = False):
|
||||||
|
|
||||||
if self.ExpressionProcessed == False:
|
if self.ExpressionProcessed == False:
|
||||||
self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")
|
self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")
|
||||||
|
@ -119,6 +119,6 @@ class DepexSection (DepexSectionClassObject):
|
||||||
OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
|
OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')
|
||||||
OutputFile = os.path.normpath(OutputFile)
|
OutputFile = os.path.normpath(OutputFile)
|
||||||
|
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType))
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
|
||||||
FileList = [OutputFile]
|
FileList = [OutputFile]
|
||||||
return FileList, self.Alignment
|
return FileList, self.Alignment
|
||||||
|
|
|
@ -53,7 +53,7 @@ class EfiSection (EfiSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name list, section alignment)
|
# @retval tuple (Generated file name list, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}) :
|
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False) :
|
||||||
|
|
||||||
if self.FileName != None and self.FileName.startswith('PCD('):
|
if self.FileName != None and self.FileName.startswith('PCD('):
|
||||||
self.FileName = GenFdsGlobalVariable.GetPcdValue(self.FileName)
|
self.FileName = GenFdsGlobalVariable.GetPcdValue(self.FileName)
|
||||||
|
@ -91,6 +91,8 @@ 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:
|
||||||
|
FileList.append(Filename)
|
||||||
else:
|
else:
|
||||||
FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict)
|
FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict)
|
||||||
if IsSect :
|
if IsSect :
|
||||||
|
@ -119,8 +121,9 @@ class EfiSection (EfiSectionClassObject):
|
||||||
Num = SecNum
|
Num = SecNum
|
||||||
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_VERSION',
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
|
||||||
#Ui=StringData,
|
#Ui=StringData,
|
||||||
Ver=BuildNum)
|
Ver=BuildNum,
|
||||||
|
IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
elif FileList != []:
|
elif FileList != []:
|
||||||
|
@ -135,8 +138,9 @@ class EfiSection (EfiSectionClassObject):
|
||||||
if BuildNum != None and BuildNum != '':
|
if BuildNum != None and BuildNum != '':
|
||||||
BuildNumTuple = ('-j', BuildNum)
|
BuildNumTuple = ('-j', BuildNum)
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
|
||||||
#Ui=VerString,
|
#Ui=VerString,
|
||||||
Ver=BuildNum)
|
Ver=BuildNum,
|
||||||
|
IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -157,8 +161,9 @@ class EfiSection (EfiSectionClassObject):
|
||||||
Num = SecNum
|
Num = SecNum
|
||||||
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_VERSION',
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
|
||||||
#Ui=VerString,
|
#Ui=VerString,
|
||||||
Ver=BuildNum)
|
Ver=BuildNum,
|
||||||
|
IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -175,7 +180,7 @@ class EfiSection (EfiSectionClassObject):
|
||||||
Num = SecNum
|
Num = SecNum
|
||||||
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)
|
Ui=StringData, IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
elif FileList != []:
|
elif FileList != []:
|
||||||
|
@ -187,7 +192,7 @@ class EfiSection (EfiSectionClassObject):
|
||||||
UiString = f.read()
|
UiString = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
|
||||||
Ui=UiString)
|
Ui=UiString, IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
else:
|
else:
|
||||||
if StringData != None and len(StringData) > 0:
|
if StringData != None and len(StringData) > 0:
|
||||||
|
@ -204,7 +209,7 @@ class EfiSection (EfiSectionClassObject):
|
||||||
Num = SecNum
|
Num = SecNum
|
||||||
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)
|
Ui=StringData, IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
|
|
||||||
|
@ -238,23 +243,36 @@ class EfiSection (EfiSectionClassObject):
|
||||||
|
|
||||||
if File[(len(File)-4):] == '.efi':
|
if File[(len(File)-4):] == '.efi':
|
||||||
MapFile = File.replace('.efi', '.map')
|
MapFile = File.replace('.efi', '.map')
|
||||||
if os.path.exists(MapFile):
|
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
|
||||||
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
|
if IsMakefile:
|
||||||
if not os.path.exists(CopyMapFile) or \
|
if GenFdsGlobalVariable.CopyList == []:
|
||||||
(os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
|
GenFdsGlobalVariable.CopyList = [(MapFile, CopyMapFile)]
|
||||||
CopyLongFilePath(MapFile, CopyMapFile)
|
else:
|
||||||
|
GenFdsGlobalVariable.CopyList.append((MapFile, CopyMapFile))
|
||||||
|
else:
|
||||||
|
if os.path.exists(MapFile):
|
||||||
|
if not os.path.exists(CopyMapFile) or \
|
||||||
|
(os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
|
||||||
|
CopyLongFilePath(MapFile, CopyMapFile)
|
||||||
|
|
||||||
if not NoStrip:
|
if not NoStrip:
|
||||||
FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi')
|
FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi')
|
||||||
if not os.path.exists(FileBeforeStrip) or \
|
if IsMakefile:
|
||||||
(os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)):
|
if GenFdsGlobalVariable.CopyList == []:
|
||||||
CopyLongFilePath(File, FileBeforeStrip)
|
GenFdsGlobalVariable.CopyList = [(File, FileBeforeStrip)]
|
||||||
|
else:
|
||||||
|
GenFdsGlobalVariable.CopyList.append((File, FileBeforeStrip))
|
||||||
|
else:
|
||||||
|
if not os.path.exists(FileBeforeStrip) or \
|
||||||
|
(os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)):
|
||||||
|
CopyLongFilePath(File, FileBeforeStrip)
|
||||||
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
|
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
StrippedFile,
|
StrippedFile,
|
||||||
[File],
|
[File],
|
||||||
Strip=True
|
Strip=True,
|
||||||
)
|
IsMakefile = IsMakefile
|
||||||
|
)
|
||||||
File = StrippedFile
|
File = StrippedFile
|
||||||
|
|
||||||
"""For TE Section call GenFw to generate TE image"""
|
"""For TE Section call GenFw to generate TE image"""
|
||||||
|
@ -262,17 +280,19 @@ class EfiSection (EfiSectionClassObject):
|
||||||
if SectionType == 'TE':
|
if SectionType == 'TE':
|
||||||
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
|
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
TeFile,
|
TeFile,
|
||||||
[File],
|
[File],
|
||||||
Type='te'
|
Type='te',
|
||||||
)
|
IsMakefile = IsMakefile
|
||||||
|
)
|
||||||
File = TeFile
|
File = TeFile
|
||||||
|
|
||||||
"""Call GenSection"""
|
"""Call GenSection"""
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile,
|
GenFdsGlobalVariable.GenerateSection(OutputFile,
|
||||||
[File],
|
[File],
|
||||||
Section.Section.SectionType.get (SectionType)
|
Section.Section.SectionType.get (SectionType),
|
||||||
)
|
IsMakefile=IsMakefile
|
||||||
|
)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
return OutputFileList, Align
|
return OutputFileList, Align
|
||||||
|
|
|
@ -45,7 +45,7 @@ class FD(FDClassObject):
|
||||||
#
|
#
|
||||||
# @retval string Generated FD file name
|
# @retval string Generated FD file name
|
||||||
#
|
#
|
||||||
def GenFd (self):
|
def GenFd (self, Flag = False):
|
||||||
if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict.keys():
|
if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict.keys():
|
||||||
return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']
|
return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']
|
||||||
|
|
||||||
|
@ -53,7 +53,8 @@ class FD(FDClassObject):
|
||||||
# Print Information
|
# Print Information
|
||||||
#
|
#
|
||||||
FdFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.FdUiName + '.fd')
|
FdFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.FdUiName + '.fd')
|
||||||
GenFdsGlobalVariable.InfLogger("Fd File Name:%s (%s)" %(self.FdUiName, FdFileName))
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger("\nFd File Name:%s (%s)" %(self.FdUiName, FdFileName))
|
||||||
|
|
||||||
Offset = 0x00
|
Offset = 0x00
|
||||||
for item in self.BlockSizeList:
|
for item in self.BlockSizeList:
|
||||||
|
@ -85,11 +86,13 @@ class FD(FDClassObject):
|
||||||
elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):
|
elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):
|
||||||
pass
|
pass
|
||||||
elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
|
elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
|
||||||
GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
|
||||||
PadRegion = Region.Region()
|
PadRegion = Region.Region()
|
||||||
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
|
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
|
||||||
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
|
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
|
||||||
PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
|
if not Flag:
|
||||||
|
PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
|
||||||
PreviousRegionStart = RegionObj.Offset
|
PreviousRegionStart = RegionObj.Offset
|
||||||
PreviousRegionSize = RegionObj.Size
|
PreviousRegionSize = RegionObj.Size
|
||||||
#
|
#
|
||||||
|
@ -113,11 +116,13 @@ class FD(FDClassObject):
|
||||||
'Region offset 0x%X overlaps with Region starting from 0x%X, size 0x%X' \
|
'Region offset 0x%X overlaps with Region starting from 0x%X, size 0x%X' \
|
||||||
% (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))
|
% (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))
|
||||||
elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
|
elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
|
||||||
GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
|
||||||
PadRegion = Region.Region()
|
PadRegion = Region.Region()
|
||||||
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
|
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
|
||||||
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
|
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
|
||||||
PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
|
if not Flag:
|
||||||
|
PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
|
||||||
PreviousRegionStart = RegionObj.Offset
|
PreviousRegionStart = RegionObj.Offset
|
||||||
PreviousRegionSize = RegionObj.Size
|
PreviousRegionSize = RegionObj.Size
|
||||||
#
|
#
|
||||||
|
@ -131,13 +136,14 @@ class FD(FDClassObject):
|
||||||
# Call each region's AddToBuffer function
|
# Call each region's AddToBuffer function
|
||||||
#
|
#
|
||||||
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
|
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
|
||||||
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
|
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict,Flag=Flag)
|
||||||
#
|
#
|
||||||
# Write the buffer contents to Fd file
|
# Write the buffer contents to Fd file
|
||||||
#
|
#
|
||||||
GenFdsGlobalVariable.VerboseLogger('Write the buffer contents to Fd file')
|
GenFdsGlobalVariable.VerboseLogger('Write the buffer contents to Fd file')
|
||||||
SaveFileOnChange(FdFileName, FdBuffer.getvalue())
|
if not Flag:
|
||||||
FdBuffer.close();
|
SaveFileOnChange(FdFileName, FdBuffer.getvalue())
|
||||||
|
FdBuffer.close()
|
||||||
GenFds.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
|
GenFds.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
|
||||||
return FdFileName
|
return FdFileName
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process FFS generation from FILE statement
|
# process FFS generation from FILE statement
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -57,7 +57,7 @@ class FileStatement (FileStatementClassObject) :
|
||||||
# @param FvParentAddr Parent Fv base address
|
# @param FvParentAddr Parent Fv base address
|
||||||
# @retval string Generated FFS file name
|
# @retval string Generated FFS file name
|
||||||
#
|
#
|
||||||
def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None):
|
def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None, IsMakefile=False):
|
||||||
|
|
||||||
if self.NameGuid != None and self.NameGuid.startswith('PCD('):
|
if self.NameGuid != None and self.NameGuid.startswith('PCD('):
|
||||||
PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)
|
PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)
|
||||||
|
|
|
@ -44,6 +44,8 @@ from PatchPcdValue.PatchPcdValue import PatchBinaryFile
|
||||||
from Common.LongFilePathSupport import CopyLongFilePath
|
from Common.LongFilePathSupport import CopyLongFilePath
|
||||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||||
import Common.GlobalData as GlobalData
|
import Common.GlobalData as GlobalData
|
||||||
|
from DepexSection import DepexSection
|
||||||
|
from Common.Misc import SaveFileOnChange
|
||||||
|
|
||||||
## generate FFS from INF
|
## generate FFS from INF
|
||||||
#
|
#
|
||||||
|
@ -72,6 +74,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
self.OverrideGuid = None
|
self.OverrideGuid = None
|
||||||
self.PatchedBinFile = ''
|
self.PatchedBinFile = ''
|
||||||
self.MacroDict = {}
|
self.MacroDict = {}
|
||||||
|
self.Depex = False
|
||||||
|
|
||||||
## GetFinalTargetSuffixMap() method
|
## GetFinalTargetSuffixMap() method
|
||||||
#
|
#
|
||||||
|
@ -320,6 +323,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
self.InfModule = Inf
|
self.InfModule = Inf
|
||||||
self.PcdIsDriver = Inf.PcdIsDriver
|
self.PcdIsDriver = Inf.PcdIsDriver
|
||||||
self.IsBinaryModule = Inf.IsBinaryModule
|
self.IsBinaryModule = Inf.IsBinaryModule
|
||||||
|
Inf._GetDepex()
|
||||||
|
Inf._GetDepexExpression()
|
||||||
|
if len(Inf._Depex.data) > 0 and len(Inf._DepexExpression.data) > 0:
|
||||||
|
self.Depex = True
|
||||||
|
|
||||||
GenFdsGlobalVariable.VerboseLogger("BaseName : %s" % self.BaseName)
|
GenFdsGlobalVariable.VerboseLogger("BaseName : %s" % self.BaseName)
|
||||||
GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" % self.ModuleGuid)
|
GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" % self.ModuleGuid)
|
||||||
GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" % self.ModuleType)
|
GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" % self.ModuleType)
|
||||||
|
@ -335,7 +343,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
if not os.path.exists(self.OutputPath) :
|
if not os.path.exists(self.OutputPath) :
|
||||||
os.makedirs(self.OutputPath)
|
os.makedirs(self.OutputPath)
|
||||||
|
|
||||||
self.EfiOutputPath = self.__GetEFIOutPutPath__()
|
self.EfiOutputPath, self.EfiDebugPath = self.__GetEFIOutPutPath__()
|
||||||
GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)
|
GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)
|
||||||
|
|
||||||
## PatchEfiFile
|
## PatchEfiFile
|
||||||
|
@ -414,12 +422,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
# @param FvParentAddr Parent Fv base address
|
# @param FvParentAddr Parent Fv base address
|
||||||
# @retval string Generated FFS file name
|
# @retval string Generated FFS file name
|
||||||
#
|
#
|
||||||
def GenFfs(self, Dict = {}, FvChildAddr = [], FvParentAddr=None):
|
def GenFfs(self, Dict = {}, FvChildAddr = [], FvParentAddr=None, IsMakefile=False):
|
||||||
#
|
#
|
||||||
# Parse Inf file get Module related information
|
# Parse Inf file get Module related information
|
||||||
#
|
#
|
||||||
|
|
||||||
self.__InfParse__(Dict)
|
self.__InfParse__(Dict)
|
||||||
|
Arch = self.GetCurrentArch()
|
||||||
SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName);
|
SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName);
|
||||||
DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
|
DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
|
||||||
|
|
||||||
|
@ -451,7 +460,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
if len(self.BinFileList) > 0:
|
if len(self.BinFileList) > 0:
|
||||||
if self.Rule == None or self.Rule == "":
|
if self.Rule == None or self.Rule == "":
|
||||||
self.Rule = "BINARY"
|
self.Rule = "BINARY"
|
||||||
|
|
||||||
|
if not IsMakefile and GenFdsGlobalVariable.EnableGenfdsMultiThread and self.Rule != 'BINARY':
|
||||||
|
IsMakefile = True
|
||||||
#
|
#
|
||||||
# Get the rule of how to generate Ffs file
|
# Get the rule of how to generate Ffs file
|
||||||
#
|
#
|
||||||
|
@ -472,17 +483,19 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
#
|
#
|
||||||
# For the rule only has simpleFile
|
# For the rule only has simpleFile
|
||||||
#
|
#
|
||||||
|
MakefilePath = None
|
||||||
|
if IsMakefile:
|
||||||
|
MakefilePath = self.InfFileName, Arch
|
||||||
if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :
|
if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :
|
||||||
SectionOutputList = self.__GenSimpleFileSection__(Rule)
|
SectionOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)
|
||||||
FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList)
|
FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList, MakefilePath=MakefilePath)
|
||||||
return FfsOutput
|
return FfsOutput
|
||||||
#
|
#
|
||||||
# For Rule has ComplexFile
|
# For Rule has ComplexFile
|
||||||
#
|
#
|
||||||
elif isinstance(Rule, RuleComplexFile.RuleComplexFile):
|
elif isinstance(Rule, RuleComplexFile.RuleComplexFile):
|
||||||
InputSectList, InputSectAlignments = self.__GenComplexFileSection__(Rule, FvChildAddr, FvParentAddr)
|
InputSectList, InputSectAlignments = self.__GenComplexFileSection__(Rule, FvChildAddr, FvParentAddr, IsMakefile=IsMakefile)
|
||||||
FfsOutput = self.__GenComplexFileFfs__(Rule, InputSectList, InputSectAlignments)
|
FfsOutput = self.__GenComplexFileFfs__(Rule, InputSectList, InputSectAlignments, MakefilePath=MakefilePath)
|
||||||
|
|
||||||
return FfsOutput
|
return FfsOutput
|
||||||
|
|
||||||
## __ExtendMacro__() method
|
## __ExtendMacro__() method
|
||||||
|
@ -651,6 +664,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
def __GetEFIOutPutPath__(self):
|
def __GetEFIOutPutPath__(self):
|
||||||
Arch = ''
|
Arch = ''
|
||||||
OutputPath = ''
|
OutputPath = ''
|
||||||
|
DebugPath = ''
|
||||||
(ModulePath, FileName) = os.path.split(self.InfFileName)
|
(ModulePath, FileName) = os.path.split(self.InfFileName)
|
||||||
Index = FileName.rfind('.')
|
Index = FileName.rfind('.')
|
||||||
FileName = FileName[0:Index]
|
FileName = FileName[0:Index]
|
||||||
|
@ -666,8 +680,15 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
FileName,
|
FileName,
|
||||||
'OUTPUT'
|
'OUTPUT'
|
||||||
)
|
)
|
||||||
|
DebugPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],
|
||||||
|
Arch ,
|
||||||
|
ModulePath,
|
||||||
|
FileName,
|
||||||
|
'DEBUG'
|
||||||
|
)
|
||||||
OutputPath = os.path.realpath(OutputPath)
|
OutputPath = os.path.realpath(OutputPath)
|
||||||
return OutputPath
|
DebugPath = os.path.realpath(DebugPath)
|
||||||
|
return OutputPath, DebugPath
|
||||||
|
|
||||||
## __GenSimpleFileSection__() method
|
## __GenSimpleFileSection__() method
|
||||||
#
|
#
|
||||||
|
@ -677,7 +698,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
# @param Rule The rule object used to generate section
|
# @param Rule The rule object used to generate section
|
||||||
# @retval string File name of the generated section file
|
# @retval string File name of the generated section file
|
||||||
#
|
#
|
||||||
def __GenSimpleFileSection__(self, Rule):
|
def __GenSimpleFileSection__(self, Rule, IsMakefile = False):
|
||||||
#
|
#
|
||||||
# Prepare the parameter of GenSection
|
# Prepare the parameter of GenSection
|
||||||
#
|
#
|
||||||
|
@ -743,22 +764,23 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
CopyLongFilePath(File, FileBeforeStrip)
|
CopyLongFilePath(File, FileBeforeStrip)
|
||||||
StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')
|
StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
StrippedFile,
|
StrippedFile,
|
||||||
[File],
|
[File],
|
||||||
Strip=True
|
Strip=True,
|
||||||
)
|
IsMakefile=IsMakefile
|
||||||
|
)
|
||||||
File = StrippedFile
|
File = StrippedFile
|
||||||
|
|
||||||
if SectionType == 'TE':
|
if SectionType == 'TE':
|
||||||
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
|
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
TeFile,
|
TeFile,
|
||||||
[File],
|
[File],
|
||||||
Type='te'
|
Type='te',
|
||||||
)
|
IsMakefile=IsMakefile
|
||||||
|
)
|
||||||
File = TeFile
|
File = TeFile
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [File], Section.Section.SectionType[SectionType], IsMakefile=IsMakefile)
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [File], Section.Section.SectionType[SectionType])
|
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
else:
|
else:
|
||||||
SecNum = '%d' %Index
|
SecNum = '%d' %Index
|
||||||
|
@ -785,22 +807,23 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
|
|
||||||
StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')
|
StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
StrippedFile,
|
StrippedFile,
|
||||||
[GenSecInputFile],
|
[GenSecInputFile],
|
||||||
Strip=True
|
Strip=True,
|
||||||
)
|
IsMakefile=IsMakefile
|
||||||
|
)
|
||||||
GenSecInputFile = StrippedFile
|
GenSecInputFile = StrippedFile
|
||||||
|
|
||||||
if SectionType == 'TE':
|
if SectionType == 'TE':
|
||||||
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
|
TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
|
||||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||||
TeFile,
|
TeFile,
|
||||||
[GenSecInputFile],
|
[GenSecInputFile],
|
||||||
Type='te'
|
Type='te',
|
||||||
)
|
IsMakefile=IsMakefile
|
||||||
|
)
|
||||||
GenSecInputFile = TeFile
|
GenSecInputFile = TeFile
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [GenSecInputFile], Section.Section.SectionType[SectionType], IsMakefile=IsMakefile)
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [GenSecInputFile], Section.Section.SectionType[SectionType])
|
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
return OutputFileList
|
return OutputFileList
|
||||||
|
@ -814,7 +837,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
# @param InputFileList The output file list from GenSection
|
# @param InputFileList The output file list from GenSection
|
||||||
# @retval string Generated FFS file name
|
# @retval string Generated FFS file name
|
||||||
#
|
#
|
||||||
def __GenSimpleFileFfs__(self, Rule, InputFileList):
|
def __GenSimpleFileFfs__(self, Rule, InputFileList, MakefilePath = None):
|
||||||
FfsOutput = self.OutputPath + \
|
FfsOutput = self.OutputPath + \
|
||||||
os.sep + \
|
os.sep + \
|
||||||
self.__ExtendMacro__(Rule.NameGuid) + \
|
self.__ExtendMacro__(Rule.NameGuid) + \
|
||||||
|
@ -840,12 +863,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
% (Rule.NameGuid))
|
% (Rule.NameGuid))
|
||||||
self.ModuleGuid = RegistryGuidStr
|
self.ModuleGuid = RegistryGuidStr
|
||||||
|
|
||||||
GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection,
|
GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection,
|
||||||
Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType],
|
Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType],
|
||||||
self.ModuleGuid, Fixed=Rule.Fixed,
|
self.ModuleGuid, Fixed=Rule.Fixed,
|
||||||
CheckSum=Rule.CheckSum, Align=Rule.Alignment,
|
CheckSum=Rule.CheckSum, Align=Rule.Alignment,
|
||||||
SectionAlign=SectionAlignments
|
SectionAlign=SectionAlignments,
|
||||||
)
|
MakefilePath=MakefilePath
|
||||||
|
)
|
||||||
return FfsOutput
|
return FfsOutput
|
||||||
|
|
||||||
## __GenComplexFileSection__() method
|
## __GenComplexFileSection__() method
|
||||||
|
@ -858,14 +882,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
# @param FvParentAddr Parent Fv base address
|
# @param FvParentAddr Parent Fv base address
|
||||||
# @retval string File name of the generated section file
|
# @retval string File name of the generated section file
|
||||||
#
|
#
|
||||||
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr):
|
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
|
||||||
if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
|
if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
|
||||||
if Rule.KeepReloc != None:
|
if Rule.KeepReloc != None:
|
||||||
self.KeepRelocFromRule = Rule.KeepReloc
|
self.KeepRelocFromRule = Rule.KeepReloc
|
||||||
SectFiles = []
|
SectFiles = []
|
||||||
SectAlignments = []
|
SectAlignments = []
|
||||||
Index = 1
|
Index = 1
|
||||||
HasGneratedFlag = False
|
HasGeneratedFlag = False
|
||||||
if self.PcdIsDriver == 'PEI_PCD_DRIVER':
|
if self.PcdIsDriver == 'PEI_PCD_DRIVER':
|
||||||
if self.IsBinaryModule:
|
if self.IsBinaryModule:
|
||||||
PcdExDbFileName = os.path.join(GenFdsGlobalVariable.FvDir, "PEIPcdDataBase.raw")
|
PcdExDbFileName = os.path.join(GenFdsGlobalVariable.FvDir, "PEIPcdDataBase.raw")
|
||||||
|
@ -875,6 +899,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
|
GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
|
||||||
[PcdExDbFileName],
|
[PcdExDbFileName],
|
||||||
"EFI_SECTION_RAW",
|
"EFI_SECTION_RAW",
|
||||||
|
IsMakefile = IsMakefile
|
||||||
)
|
)
|
||||||
SectFiles.append(PcdExDbSecName)
|
SectFiles.append(PcdExDbSecName)
|
||||||
SectAlignments.append(None)
|
SectAlignments.append(None)
|
||||||
|
@ -885,9 +910,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
PcdExDbFileName = os.path.join(self.EfiOutputPath, "DXEPcdDataBase.raw")
|
PcdExDbFileName = os.path.join(self.EfiOutputPath, "DXEPcdDataBase.raw")
|
||||||
PcdExDbSecName = os.path.join(self.OutputPath, "DXEPcdDataBaseSec.raw")
|
PcdExDbSecName = os.path.join(self.OutputPath, "DXEPcdDataBaseSec.raw")
|
||||||
GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
|
GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
|
||||||
[PcdExDbFileName],
|
[PcdExDbFileName],
|
||||||
"EFI_SECTION_RAW",
|
"EFI_SECTION_RAW",
|
||||||
)
|
IsMakefile = IsMakefile
|
||||||
|
)
|
||||||
SectFiles.append(PcdExDbSecName)
|
SectFiles.append(PcdExDbSecName)
|
||||||
SectAlignments.append(None)
|
SectAlignments.append(None)
|
||||||
for Sect in Rule.SectionList:
|
for Sect in Rule.SectionList:
|
||||||
|
@ -917,11 +943,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
Sect.FvParentAddr = FvParentAddr
|
Sect.FvParentAddr = FvParentAddr
|
||||||
|
|
||||||
if Rule.KeyStringList != []:
|
if Rule.KeyStringList != []:
|
||||||
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)
|
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self, IsMakefile = IsMakefile)
|
||||||
else :
|
else :
|
||||||
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self)
|
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self, IsMakefile = IsMakefile)
|
||||||
|
|
||||||
if not HasGneratedFlag:
|
if not HasGeneratedFlag:
|
||||||
UniVfrOffsetFileSection = ""
|
UniVfrOffsetFileSection = ""
|
||||||
ModuleFileName = mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)
|
ModuleFileName = mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)
|
||||||
InfData = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(ModuleFileName), self.CurrentArch]
|
InfData = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(ModuleFileName), self.CurrentArch]
|
||||||
|
@ -944,27 +970,40 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
|
|
||||||
|
|
||||||
if len(VfrUniBaseName) > 0:
|
if len(VfrUniBaseName) > 0:
|
||||||
VfrUniOffsetList = self.__GetBuildOutputMapFileVfrUniInfo(VfrUniBaseName)
|
if IsMakefile:
|
||||||
#
|
if InfData.BuildType != 'UEFI_HII':
|
||||||
# Generate the Raw data of raw section
|
UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')
|
||||||
#
|
UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
|
||||||
if VfrUniOffsetList:
|
UniVfrOffsetFileNameList = []
|
||||||
os.path.join( self.OutputPath, self.BaseName + '.offset')
|
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
|
||||||
UniVfrOffsetFileName = os.path.join( self.OutputPath, self.BaseName + '.offset')
|
TrimCmd = "Trim --Vfr-Uni-Offset -o %s --ModuleName=%s --DebugDir=%s " % (UniVfrOffsetFileName, self.BaseName, self.EfiDebugPath)
|
||||||
UniVfrOffsetFileSection = os.path.join( self.OutputPath, self.BaseName + 'Offset' + '.raw')
|
GenFdsGlobalVariable.SecCmdList.append(TrimCmd)
|
||||||
|
GenFdsGlobalVariable.GenerateSection(UniVfrOffsetFileSection,
|
||||||
|
[UniVfrOffsetFileName],
|
||||||
|
"EFI_SECTION_RAW",
|
||||||
|
IsMakefile = True
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
VfrUniOffsetList = self.__GetBuildOutputMapFileVfrUniInfo(VfrUniBaseName)
|
||||||
|
#
|
||||||
|
# Generate the Raw data of raw section
|
||||||
|
#
|
||||||
|
if VfrUniOffsetList:
|
||||||
|
UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')
|
||||||
|
UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
|
||||||
|
self.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)
|
||||||
|
UniVfrOffsetFileNameList = []
|
||||||
|
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
|
||||||
|
"""Call GenSection"""
|
||||||
|
|
||||||
self.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)
|
GenFdsGlobalVariable.GenerateSection(UniVfrOffsetFileSection,
|
||||||
|
UniVfrOffsetFileNameList,
|
||||||
UniVfrOffsetFileNameList = []
|
"EFI_SECTION_RAW"
|
||||||
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
|
)
|
||||||
"""Call GenSection"""
|
#os.remove(UniVfrOffsetFileName)
|
||||||
GenFdsGlobalVariable.GenerateSection(UniVfrOffsetFileSection,
|
if UniVfrOffsetFileSection:
|
||||||
UniVfrOffsetFileNameList,
|
|
||||||
"EFI_SECTION_RAW"
|
|
||||||
)
|
|
||||||
os.remove(UniVfrOffsetFileName)
|
|
||||||
SectList.append(UniVfrOffsetFileSection)
|
SectList.append(UniVfrOffsetFileSection)
|
||||||
HasGneratedFlag = True
|
HasGeneratedFlag = True
|
||||||
|
|
||||||
for SecName in SectList :
|
for SecName in SectList :
|
||||||
SectFiles.append(SecName)
|
SectFiles.append(SecName)
|
||||||
|
@ -981,7 +1020,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
# @param InputFileList The output file list from GenSection
|
# @param InputFileList The output file list from GenSection
|
||||||
# @retval string Generated FFS file name
|
# @retval string Generated FFS file name
|
||||||
#
|
#
|
||||||
def __GenComplexFileFfs__(self, Rule, InputFile, Alignments):
|
def __GenComplexFileFfs__(self, Rule, InputFile, Alignments, MakefilePath = None):
|
||||||
|
|
||||||
if Rule.NameGuid != None and Rule.NameGuid.startswith('PCD('):
|
if Rule.NameGuid != None and Rule.NameGuid.startswith('PCD('):
|
||||||
PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)
|
PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)
|
||||||
|
@ -998,11 +1037,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
|
|
||||||
FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
|
FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
|
||||||
GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile,
|
GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile,
|
||||||
Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType],
|
Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType],
|
||||||
self.ModuleGuid, Fixed=Rule.Fixed,
|
self.ModuleGuid, Fixed=Rule.Fixed,
|
||||||
CheckSum=Rule.CheckSum, Align=Rule.Alignment,
|
CheckSum=Rule.CheckSum, Align=Rule.Alignment,
|
||||||
SectionAlign=Alignments
|
SectionAlign=Alignments,
|
||||||
)
|
MakefilePath=MakefilePath
|
||||||
|
)
|
||||||
return FfsOutput
|
return FfsOutput
|
||||||
|
|
||||||
## __GetGenFfsCmdParameter__() method
|
## __GetGenFfsCmdParameter__() method
|
||||||
|
@ -1048,12 +1088,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
# @param UniVfrOffsetFileName The output offset file name.
|
# @param UniVfrOffsetFileName The output offset file name.
|
||||||
#
|
#
|
||||||
def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName):
|
def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName):
|
||||||
|
|
||||||
try:
|
|
||||||
fInputfile = open(UniVfrOffsetFileName, "wb+", 0)
|
|
||||||
except:
|
|
||||||
EdkLogger.error("GenFds", FILE_OPEN_FAILURE, "File open failed for %s" %UniVfrOffsetFileName,None)
|
|
||||||
|
|
||||||
# Use a instance of StringIO to cache data
|
# Use a instance of StringIO to cache data
|
||||||
fStringIO = StringIO.StringIO('')
|
fStringIO = StringIO.StringIO('')
|
||||||
|
|
||||||
|
@ -1085,18 +1120,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||||
#
|
#
|
||||||
# write data into file.
|
# write data into file.
|
||||||
#
|
#
|
||||||
try :
|
try :
|
||||||
fInputfile.write (fStringIO.getvalue())
|
SaveFileOnChange(UniVfrOffsetFileName, fStringIO.getvalue())
|
||||||
except:
|
except:
|
||||||
EdkLogger.error("GenFds", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %UniVfrOffsetFileName,None)
|
EdkLogger.error("GenFds", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %UniVfrOffsetFileName,None)
|
||||||
|
|
||||||
fStringIO.close ()
|
fStringIO.close ()
|
||||||
fInputfile.close ()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ from struct import *
|
||||||
|
|
||||||
import Ffs
|
import Ffs
|
||||||
import AprioriSection
|
import AprioriSection
|
||||||
|
import FfsFileStatement
|
||||||
from GenFdsGlobalVariable import GenFdsGlobalVariable
|
from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||||
from GenFds import GenFds
|
from GenFds import GenFds
|
||||||
from CommonDataClass.FdfClass import FvClassObject
|
from CommonDataClass.FdfClass import FvClassObject
|
||||||
|
@ -67,7 +68,7 @@ class FV (FvClassObject):
|
||||||
# @param MacroDict macro value pair
|
# @param MacroDict macro value pair
|
||||||
# @retval string Generated FV file path
|
# @retval string Generated FV file path
|
||||||
#
|
#
|
||||||
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}) :
|
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :
|
||||||
|
|
||||||
if BaseAddress == None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
|
if BaseAddress == None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
|
||||||
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
|
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
|
||||||
|
@ -88,15 +89,15 @@ class FV (FvClassObject):
|
||||||
continue
|
continue
|
||||||
elif self.UiFvName.upper() == RegionData.upper():
|
elif self.UiFvName.upper() == RegionData.upper():
|
||||||
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))
|
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))
|
||||||
|
if not Flag:
|
||||||
GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)
|
GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)
|
||||||
GenFdsGlobalVariable.LargeFileInFvFlags.append(False)
|
GenFdsGlobalVariable.LargeFileInFvFlags.append(False)
|
||||||
FFSGuid = None
|
FFSGuid = None
|
||||||
|
|
||||||
if self.FvBaseAddress != None:
|
if self.FvBaseAddress != None:
|
||||||
BaseAddress = self.FvBaseAddress
|
BaseAddress = self.FvBaseAddress
|
||||||
|
if not Flag:
|
||||||
self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)
|
self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)
|
||||||
#
|
#
|
||||||
# First Process the Apriori section
|
# First Process the Apriori section
|
||||||
#
|
#
|
||||||
|
@ -105,23 +106,30 @@ class FV (FvClassObject):
|
||||||
GenFdsGlobalVariable.VerboseLogger('First generate Apriori file !')
|
GenFdsGlobalVariable.VerboseLogger('First generate Apriori file !')
|
||||||
FfsFileList = []
|
FfsFileList = []
|
||||||
for AprSection in self.AprioriSectionList:
|
for AprSection in self.AprioriSectionList:
|
||||||
FileName = AprSection.GenFfs (self.UiFvName, MacroDict)
|
FileName = AprSection.GenFfs (self.UiFvName, MacroDict, IsMakefile=Flag)
|
||||||
FfsFileList.append(FileName)
|
FfsFileList.append(FileName)
|
||||||
# Add Apriori file name to Inf file
|
# Add Apriori file name to Inf file
|
||||||
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
if not Flag:
|
||||||
FileName + \
|
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
||||||
T_CHAR_LF)
|
FileName + \
|
||||||
|
T_CHAR_LF)
|
||||||
|
|
||||||
# Process Modules in FfsList
|
# Process Modules in FfsList
|
||||||
for FfsFile in self.FfsList :
|
for FfsFile in self.FfsList :
|
||||||
FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress)
|
if Flag:
|
||||||
|
if isinstance(FfsFile, FfsFileStatement.FileStatement):
|
||||||
|
continue
|
||||||
|
if GenFdsGlobalVariable.EnableGenfdsMultiThread and GenFdsGlobalVariable.ModuleFile and GenFdsGlobalVariable.ModuleFile.Path.find(os.path.normpath(FfsFile.InfFileName)) == -1:
|
||||||
|
continue
|
||||||
|
FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress, IsMakefile=Flag)
|
||||||
FfsFileList.append(FileName)
|
FfsFileList.append(FileName)
|
||||||
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
if not Flag:
|
||||||
FileName + \
|
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
||||||
T_CHAR_LF)
|
FileName + \
|
||||||
|
T_CHAR_LF)
|
||||||
SaveFileOnChange(self.InfFileName, self.FvInfFile.getvalue(), False)
|
if not Flag:
|
||||||
self.FvInfFile.close()
|
SaveFileOnChange(self.InfFileName, self.FvInfFile.getvalue(), False)
|
||||||
|
self.FvInfFile.close()
|
||||||
#
|
#
|
||||||
# Call GenFv tool
|
# Call GenFv tool
|
||||||
#
|
#
|
||||||
|
@ -131,88 +139,91 @@ class FV (FvClassObject):
|
||||||
if self.CreateFileName != None:
|
if self.CreateFileName != None:
|
||||||
FvOutputFile = self.CreateFileName
|
FvOutputFile = self.CreateFileName
|
||||||
|
|
||||||
FvInfoFileName = os.path.join(GenFdsGlobalVariable.FfsDir, self.UiFvName + '.inf')
|
if Flag:
|
||||||
CopyLongFilePath(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName)
|
|
||||||
OrigFvInfo = None
|
|
||||||
if os.path.exists (FvInfoFileName):
|
|
||||||
OrigFvInfo = open(FvInfoFileName, 'r').read()
|
|
||||||
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
|
||||||
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
|
||||||
GenFdsGlobalVariable.GenerateFirmwareVolume(
|
|
||||||
FvOutputFile,
|
|
||||||
[self.InfFileName],
|
|
||||||
AddressFile=FvInfoFileName,
|
|
||||||
FfsList=FfsFileList,
|
|
||||||
ForceRebase=self.FvForceRebase,
|
|
||||||
FileSystemGuid=FFSGuid
|
|
||||||
)
|
|
||||||
|
|
||||||
NewFvInfo = None
|
|
||||||
if os.path.exists (FvInfoFileName):
|
|
||||||
NewFvInfo = open(FvInfoFileName, 'r').read()
|
|
||||||
if NewFvInfo != None and NewFvInfo != OrigFvInfo:
|
|
||||||
FvChildAddr = []
|
|
||||||
AddFileObj = open(FvInfoFileName, 'r')
|
|
||||||
AddrStrings = AddFileObj.readlines()
|
|
||||||
AddrKeyFound = False
|
|
||||||
for AddrString in AddrStrings:
|
|
||||||
if AddrKeyFound:
|
|
||||||
#get base address for the inside FvImage
|
|
||||||
FvChildAddr.append (AddrString)
|
|
||||||
elif AddrString.find ("[FV_BASE_ADDRESS]") != -1:
|
|
||||||
AddrKeyFound = True
|
|
||||||
AddFileObj.close()
|
|
||||||
|
|
||||||
if FvChildAddr != []:
|
|
||||||
# Update Ffs again
|
|
||||||
for FfsFile in self.FfsList :
|
|
||||||
FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress)
|
|
||||||
|
|
||||||
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
|
||||||
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
|
||||||
#Update GenFv again
|
|
||||||
GenFdsGlobalVariable.GenerateFirmwareVolume(
|
|
||||||
FvOutputFile,
|
|
||||||
[self.InfFileName],
|
|
||||||
AddressFile=FvInfoFileName,
|
|
||||||
FfsList=FfsFileList,
|
|
||||||
ForceRebase=self.FvForceRebase,
|
|
||||||
FileSystemGuid=FFSGuid
|
|
||||||
)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Write the Fv contents to Buffer
|
|
||||||
#
|
|
||||||
if os.path.isfile(FvOutputFile):
|
|
||||||
FvFileObj = open ( FvOutputFile,'rb')
|
|
||||||
|
|
||||||
GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" %self.UiFvName)
|
|
||||||
GenFdsGlobalVariable.SharpCounter = 0
|
|
||||||
|
|
||||||
Buffer.write(FvFileObj.read())
|
|
||||||
FvFileObj.seek(0)
|
|
||||||
# PI FvHeader is 0x48 byte
|
|
||||||
FvHeaderBuffer = FvFileObj.read(0x48)
|
|
||||||
# FV alignment position.
|
|
||||||
FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
|
|
||||||
# FvAlignmentValue is larger than or equal to 1K
|
|
||||||
if FvAlignmentValue >= 0x400:
|
|
||||||
if FvAlignmentValue >= 0x100000:
|
|
||||||
#The max alignment supported by FFS is 16M.
|
|
||||||
if FvAlignmentValue >= 0x1000000:
|
|
||||||
self.FvAlignment = "16M"
|
|
||||||
else:
|
|
||||||
self.FvAlignment = str(FvAlignmentValue / 0x100000) + "M"
|
|
||||||
else:
|
|
||||||
self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
|
|
||||||
else:
|
|
||||||
# FvAlignmentValue is less than 1K
|
|
||||||
self.FvAlignment = str (FvAlignmentValue)
|
|
||||||
FvFileObj.close()
|
|
||||||
GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
|
GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
|
||||||
GenFdsGlobalVariable.LargeFileInFvFlags.pop()
|
return FvOutputFile
|
||||||
else:
|
|
||||||
GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." %self.UiFvName)
|
FvInfoFileName = os.path.join(GenFdsGlobalVariable.FfsDir, self.UiFvName + '.inf')
|
||||||
|
if not Flag:
|
||||||
|
CopyLongFilePath(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName)
|
||||||
|
OrigFvInfo = None
|
||||||
|
if os.path.exists (FvInfoFileName):
|
||||||
|
OrigFvInfo = open(FvInfoFileName, 'r').read()
|
||||||
|
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
||||||
|
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID
|
||||||
|
GenFdsGlobalVariable.GenerateFirmwareVolume(
|
||||||
|
FvOutputFile,
|
||||||
|
[self.InfFileName],
|
||||||
|
AddressFile=FvInfoFileName,
|
||||||
|
FfsList=FfsFileList,
|
||||||
|
ForceRebase=self.FvForceRebase,
|
||||||
|
FileSystemGuid=FFSGuid
|
||||||
|
)
|
||||||
|
|
||||||
|
NewFvInfo = None
|
||||||
|
if os.path.exists (FvInfoFileName):
|
||||||
|
NewFvInfo = open(FvInfoFileName, 'r').read()
|
||||||
|
if NewFvInfo != None and NewFvInfo != OrigFvInfo:
|
||||||
|
FvChildAddr = []
|
||||||
|
AddFileObj = open(FvInfoFileName, 'r')
|
||||||
|
AddrStrings = AddFileObj.readlines()
|
||||||
|
AddrKeyFound = False
|
||||||
|
for AddrString in AddrStrings:
|
||||||
|
if AddrKeyFound:
|
||||||
|
#get base address for the inside FvImage
|
||||||
|
FvChildAddr.append (AddrString)
|
||||||
|
elif AddrString.find ("[FV_BASE_ADDRESS]") != -1:
|
||||||
|
AddrKeyFound = True
|
||||||
|
AddFileObj.close()
|
||||||
|
|
||||||
|
if FvChildAddr != []:
|
||||||
|
# Update Ffs again
|
||||||
|
for FfsFile in self.FfsList :
|
||||||
|
FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress, IsMakefile=Flag)
|
||||||
|
|
||||||
|
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
||||||
|
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
||||||
|
#Update GenFv again
|
||||||
|
GenFdsGlobalVariable.GenerateFirmwareVolume(
|
||||||
|
FvOutputFile,
|
||||||
|
[self.InfFileName],
|
||||||
|
AddressFile=FvInfoFileName,
|
||||||
|
FfsList=FfsFileList,
|
||||||
|
ForceRebase=self.FvForceRebase,
|
||||||
|
FileSystemGuid=FFSGuid
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Write the Fv contents to Buffer
|
||||||
|
#
|
||||||
|
if os.path.isfile(FvOutputFile):
|
||||||
|
FvFileObj = open(FvOutputFile, 'rb')
|
||||||
|
GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName)
|
||||||
|
GenFdsGlobalVariable.SharpCounter = 0
|
||||||
|
|
||||||
|
Buffer.write(FvFileObj.read())
|
||||||
|
FvFileObj.seek(0)
|
||||||
|
# PI FvHeader is 0x48 byte
|
||||||
|
FvHeaderBuffer = FvFileObj.read(0x48)
|
||||||
|
# FV alignment position.
|
||||||
|
FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
|
||||||
|
if FvAlignmentValue >= 0x400:
|
||||||
|
if FvAlignmentValue >= 0x100000:
|
||||||
|
if FvAlignmentValue >= 0x1000000:
|
||||||
|
#The max alignment supported by FFS is 16M.
|
||||||
|
self.FvAlignment = "16M"
|
||||||
|
else:
|
||||||
|
self.FvAlignment = str(FvAlignmentValue / 0x100000) + "M"
|
||||||
|
else:
|
||||||
|
self.FvAlignment = str(FvAlignmentValue / 0x400) + "K"
|
||||||
|
else:
|
||||||
|
# FvAlignmentValue is less than 1K
|
||||||
|
self.FvAlignment = str (FvAlignmentValue)
|
||||||
|
FvFileObj.close()
|
||||||
|
GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
|
||||||
|
GenFdsGlobalVariable.LargeFileInFvFlags.pop()
|
||||||
|
else:
|
||||||
|
GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." %self.UiFvName)
|
||||||
return FvOutputFile
|
return FvOutputFile
|
||||||
|
|
||||||
## _GetBlockSize()
|
## _GetBlockSize()
|
||||||
|
|
|
@ -50,7 +50,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name, section alignment)
|
# @retval tuple (Generated file name, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):
|
||||||
|
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
if self.FvFileType != None:
|
if self.FvFileType != None:
|
||||||
|
@ -75,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||||
MaxFvAlignment = FvAlignmentValue
|
MaxFvAlignment = FvAlignmentValue
|
||||||
|
|
||||||
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
|
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE')
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
# MaxFvAlignment is larger than or equal to 1K
|
# MaxFvAlignment is larger than or equal to 1K
|
||||||
|
@ -101,7 +101,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||||
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)
|
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)
|
||||||
if Fv != None:
|
if Fv != None:
|
||||||
self.Fv = Fv
|
self.Fv = Fv
|
||||||
FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict)
|
FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict, Flag=IsMakefile)
|
||||||
if Fv.FvAlignment != None:
|
if Fv.FvAlignment != None:
|
||||||
if self.Alignment == None:
|
if self.Alignment == None:
|
||||||
self.Alignment = Fv.FvAlignment
|
self.Alignment = Fv.FvAlignment
|
||||||
|
@ -139,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||||
# Prepare the parameter of GenSection
|
# Prepare the parameter of GenSection
|
||||||
#
|
#
|
||||||
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
|
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE')
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
||||||
return OutputFileList, self.Alignment
|
return OutputFileList, self.Alignment
|
||||||
|
|
|
@ -99,6 +99,8 @@ def main():
|
||||||
GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])
|
GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])
|
||||||
if (Options.debug):
|
if (Options.debug):
|
||||||
GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)
|
GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)
|
||||||
|
if Options.GenfdsMultiThread:
|
||||||
|
GenFdsGlobalVariable.EnableGenfdsMultiThread = True
|
||||||
os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
|
os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
|
||||||
|
|
||||||
# set multiple workspace
|
# set multiple workspace
|
||||||
|
@ -538,6 +540,7 @@ def myOptionParser():
|
||||||
Parser.add_option("--conf", action="store", type="string", dest="ConfDirectory", help="Specify the customized Conf directory.")
|
Parser.add_option("--conf", action="store", type="string", dest="ConfDirectory", help="Specify the customized Conf directory.")
|
||||||
Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")
|
Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")
|
||||||
Parser.add_option("--pcd", action="append", dest="OptionPcd", help="Set PCD value by command line. Format: \"PcdName=Value\" ")
|
Parser.add_option("--pcd", action="append", dest="OptionPcd", help="Set PCD value by command line. Format: \"PcdName=Value\" ")
|
||||||
|
Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=False, help="Enable GenFds multi thread to generate ffs file.")
|
||||||
|
|
||||||
(Options, args) = Parser.parse_args()
|
(Options, args) = Parser.parse_args()
|
||||||
return Options
|
return Options
|
||||||
|
@ -611,6 +614,23 @@ class GenFds :
|
||||||
for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
|
for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
|
||||||
OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
|
OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
|
||||||
OptRomObj.AddToBuffer(None)
|
OptRomObj.AddToBuffer(None)
|
||||||
|
@staticmethod
|
||||||
|
def GenFfsMakefile(OutputDir, FdfParser, WorkSpace, ArchList, GlobalData):
|
||||||
|
GenFdsGlobalVariable.SetEnv(FdfParser, WorkSpace, ArchList, GlobalData)
|
||||||
|
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||||
|
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
|
||||||
|
FdObj.GenFd(Flag=True)
|
||||||
|
|
||||||
|
for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||||
|
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
|
||||||
|
FvObj.AddToBuffer(Buffer=None, Flag=True)
|
||||||
|
|
||||||
|
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
|
||||||
|
for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
|
||||||
|
OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
|
||||||
|
OptRomObj.AddToBuffer(Buffer=None, Flag=True)
|
||||||
|
|
||||||
|
return GenFdsGlobalVariable.FfsCmdDict
|
||||||
|
|
||||||
## GetFvBlockSize()
|
## GetFvBlockSize()
|
||||||
#
|
#
|
||||||
|
|
|
@ -69,6 +69,11 @@ class GenFdsGlobalVariable:
|
||||||
ToolChainFamily = "MSFT"
|
ToolChainFamily = "MSFT"
|
||||||
__BuildRuleDatabase = None
|
__BuildRuleDatabase = None
|
||||||
GuidToolDefinition = {}
|
GuidToolDefinition = {}
|
||||||
|
FfsCmdDict = {}
|
||||||
|
SecCmdList = []
|
||||||
|
CopyList = []
|
||||||
|
ModuleFile = ''
|
||||||
|
EnableGenfdsMultiThread = False
|
||||||
|
|
||||||
#
|
#
|
||||||
# The list whose element are flags to indicate if large FFS or SECTION files exist in FV.
|
# The list whose element are flags to indicate if large FFS or SECTION files exist in FV.
|
||||||
|
@ -264,6 +269,10 @@ class GenFdsGlobalVariable:
|
||||||
SourceList.extend(Target.Outputs)
|
SourceList.extend(Target.Outputs)
|
||||||
LastTarget = Target
|
LastTarget = Target
|
||||||
FileType = DataType.TAB_UNKNOWN_FILE
|
FileType = DataType.TAB_UNKNOWN_FILE
|
||||||
|
for Cmd in Target.Commands:
|
||||||
|
if "$(CP)" == Cmd.split()[0]:
|
||||||
|
CpTarget = Cmd.split()[2]
|
||||||
|
TargetList.add(CpTarget)
|
||||||
|
|
||||||
return list(TargetList)
|
return list(TargetList)
|
||||||
|
|
||||||
|
@ -317,6 +326,73 @@ class GenFdsGlobalVariable:
|
||||||
|
|
||||||
FvAddressFile.close()
|
FvAddressFile.close()
|
||||||
|
|
||||||
|
def SetEnv(FdfParser, WorkSpace, ArchList, GlobalData):
|
||||||
|
GenFdsGlobalVariable.ModuleFile = WorkSpace.ModuleFile
|
||||||
|
GenFdsGlobalVariable.FdfParser = FdfParser
|
||||||
|
GenFdsGlobalVariable.WorkSpace = WorkSpace.Db
|
||||||
|
GenFdsGlobalVariable.ArchList = ArchList
|
||||||
|
GenFdsGlobalVariable.ToolChainTag = GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]
|
||||||
|
GenFdsGlobalVariable.TargetName = GlobalData.gGlobalDefines["TARGET"]
|
||||||
|
GenFdsGlobalVariable.ActivePlatform = GlobalData.gActivePlatform
|
||||||
|
GenFdsGlobalVariable.EdkSourceDir = GlobalData.gGlobalDefines["EDK_SOURCE"]
|
||||||
|
GenFdsGlobalVariable.ConfDir = GlobalData.gConfDirectory
|
||||||
|
GenFdsGlobalVariable.EnableGenfdsMultiThread = GlobalData.gEnableGenfdsMultiThread
|
||||||
|
for Arch in ArchList:
|
||||||
|
GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.normpath(
|
||||||
|
os.path.join(GlobalData.gWorkspace,
|
||||||
|
WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,GlobalData.gGlobalDefines['TARGET'],
|
||||||
|
GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory,
|
||||||
|
GlobalData.gGlobalDefines['TARGET'] +'_' + GlobalData.gGlobalDefines['TOOLCHAIN']))
|
||||||
|
GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = os.path.normpath(
|
||||||
|
WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
|
||||||
|
GlobalData.gGlobalDefines['TARGET'], GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory)
|
||||||
|
GenFdsGlobalVariable.PlatformName = WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
|
||||||
|
GlobalData.gGlobalDefines['TARGET'],
|
||||||
|
GlobalData.gGlobalDefines['TOOLCHAIN']].PlatformName
|
||||||
|
GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV')
|
||||||
|
if not os.path.exists(GenFdsGlobalVariable.FvDir):
|
||||||
|
os.makedirs(GenFdsGlobalVariable.FvDir)
|
||||||
|
GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
|
||||||
|
if not os.path.exists(GenFdsGlobalVariable.FfsDir):
|
||||||
|
os.makedirs(GenFdsGlobalVariable.FfsDir)
|
||||||
|
|
||||||
|
T_CHAR_LF = '\n'
|
||||||
|
#
|
||||||
|
# Create FV Address inf file
|
||||||
|
#
|
||||||
|
GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf')
|
||||||
|
FvAddressFile = open(GenFdsGlobalVariable.FvAddressFileName, 'w')
|
||||||
|
#
|
||||||
|
# Add [Options]
|
||||||
|
#
|
||||||
|
FvAddressFile.writelines("[options]" + T_CHAR_LF)
|
||||||
|
BsAddress = '0'
|
||||||
|
for Arch in ArchList:
|
||||||
|
BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
|
||||||
|
GlobalData.gGlobalDefines['TARGET'],
|
||||||
|
GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].BsBaseAddress
|
||||||
|
if BsAddress:
|
||||||
|
break
|
||||||
|
|
||||||
|
FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \
|
||||||
|
BsAddress + \
|
||||||
|
T_CHAR_LF)
|
||||||
|
|
||||||
|
RtAddress = '0'
|
||||||
|
for Arch in ArchList:
|
||||||
|
if GenFdsGlobalVariable.WorkSpace.BuildObject[
|
||||||
|
GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],
|
||||||
|
GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseAddress:
|
||||||
|
RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[
|
||||||
|
GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],
|
||||||
|
GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseAddress
|
||||||
|
|
||||||
|
FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \
|
||||||
|
RtAddress + \
|
||||||
|
T_CHAR_LF)
|
||||||
|
|
||||||
|
FvAddressFile.close()
|
||||||
|
|
||||||
## ReplaceWorkspaceMacro()
|
## ReplaceWorkspaceMacro()
|
||||||
#
|
#
|
||||||
# @param String String that may contain macro
|
# @param String String that may contain macro
|
||||||
|
@ -363,7 +439,7 @@ class GenFdsGlobalVariable:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None,
|
def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None,
|
||||||
GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None, BuildNumber=None):
|
GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None, BuildNumber=None, DummyFile=None, IsMakefile=False):
|
||||||
Cmd = ["GenSec"]
|
Cmd = ["GenSec"]
|
||||||
if Type not in [None, '']:
|
if Type not in [None, '']:
|
||||||
Cmd += ["-s", Type]
|
Cmd += ["-s", Type]
|
||||||
|
@ -371,6 +447,8 @@ class GenFdsGlobalVariable:
|
||||||
Cmd += ["-c", CompressionType]
|
Cmd += ["-c", CompressionType]
|
||||||
if Guid != None:
|
if Guid != None:
|
||||||
Cmd += ["-g", Guid]
|
Cmd += ["-g", Guid]
|
||||||
|
if DummyFile != None:
|
||||||
|
Cmd += ["--dummy", DummyFile]
|
||||||
if GuidHdrLen not in [None, '']:
|
if GuidHdrLen not in [None, '']:
|
||||||
Cmd += ["-l", GuidHdrLen]
|
Cmd += ["-l", GuidHdrLen]
|
||||||
if len(GuidAttr) != 0:
|
if len(GuidAttr) != 0:
|
||||||
|
@ -385,13 +463,21 @@ class GenFdsGlobalVariable:
|
||||||
CommandFile = Output + '.txt'
|
CommandFile = Output + '.txt'
|
||||||
if Ui not in [None, '']:
|
if Ui not in [None, '']:
|
||||||
#Cmd += ["-n", '"' + Ui + '"']
|
#Cmd += ["-n", '"' + Ui + '"']
|
||||||
SectionData = array.array('B', [0, 0, 0, 0])
|
if IsMakefile:
|
||||||
SectionData.fromstring(Ui.encode("utf_16_le"))
|
Cmd += ["-n", "$(MODULE_NAME)"]
|
||||||
SectionData.append(0)
|
Cmd += ["-o", Output]
|
||||||
SectionData.append(0)
|
#SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
||||||
Len = len(SectionData)
|
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15)
|
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
|
||||||
SaveFileOnChange(Output, SectionData.tostring())
|
else:
|
||||||
|
SectionData = array.array('B', [0, 0, 0, 0])
|
||||||
|
SectionData.fromstring(Ui.encode("utf_16_le"))
|
||||||
|
SectionData.append(0)
|
||||||
|
SectionData.append(0)
|
||||||
|
Len = len(SectionData)
|
||||||
|
GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15)
|
||||||
|
SaveFileOnChange(Output, SectionData.tostring())
|
||||||
|
|
||||||
elif Ver not in [None, '']:
|
elif Ver not in [None, '']:
|
||||||
Cmd += ["-n", Ver]
|
Cmd += ["-n", Ver]
|
||||||
if BuildNumber:
|
if BuildNumber:
|
||||||
|
@ -399,22 +485,27 @@ class GenFdsGlobalVariable:
|
||||||
Cmd += ["-o", Output]
|
Cmd += ["-o", Output]
|
||||||
|
|
||||||
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
||||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
if IsMakefile:
|
||||||
return
|
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
|
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
else:
|
||||||
|
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
||||||
|
return
|
||||||
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
||||||
else:
|
else:
|
||||||
Cmd += ["-o", Output]
|
Cmd += ["-o", Output]
|
||||||
Cmd += Input
|
Cmd += Input
|
||||||
|
|
||||||
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
||||||
if GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
if IsMakefile:
|
||||||
|
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
|
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
|
||||||
|
elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input)):
|
||||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
||||||
|
if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and
|
||||||
if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and
|
GenFdsGlobalVariable.LargeFileInFvFlags):
|
||||||
GenFdsGlobalVariable.LargeFileInFvFlags):
|
GenFdsGlobalVariable.LargeFileInFvFlags[-1] = True
|
||||||
GenFdsGlobalVariable.LargeFileInFvFlags[-1] = True
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GetAlignment (AlignString):
|
def GetAlignment (AlignString):
|
||||||
|
@ -429,7 +520,7 @@ class GenFdsGlobalVariable:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,
|
def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,
|
||||||
SectionAlign=None):
|
SectionAlign=None, MakefilePath=None):
|
||||||
Cmd = ["GenFfs", "-t", Type, "-g", Guid]
|
Cmd = ["GenFfs", "-t", Type, "-g", Guid]
|
||||||
mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"]
|
mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"]
|
||||||
if Fixed == True:
|
if Fixed == True:
|
||||||
|
@ -453,11 +544,17 @@ class GenFdsGlobalVariable:
|
||||||
|
|
||||||
CommandFile = Output + '.txt'
|
CommandFile = Output + '.txt'
|
||||||
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
||||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
|
||||||
return
|
|
||||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
|
||||||
|
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")
|
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||||
|
if MakefilePath:
|
||||||
|
if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict.keys():
|
||||||
|
GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath
|
||||||
|
GenFdsGlobalVariable.SecCmdList = []
|
||||||
|
GenFdsGlobalVariable.CopyList = []
|
||||||
|
else:
|
||||||
|
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input)):
|
||||||
|
return
|
||||||
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False,
|
def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False,
|
||||||
|
@ -511,8 +608,8 @@ class GenFdsGlobalVariable:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GenerateFirmwareImage(Output, Input, Type="efi", SubType=None, Zero=False,
|
def GenerateFirmwareImage(Output, Input, Type="efi", SubType=None, Zero=False,
|
||||||
Strip=False, Replace=False, TimeStamp=None, Join=False,
|
Strip=False, Replace=False, TimeStamp=None, Join=False,
|
||||||
Align=None, Padding=None, Convert=False):
|
Align=None, Padding=None, Convert=False, IsMakefile=False):
|
||||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
|
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input) and not IsMakefile:
|
||||||
return
|
return
|
||||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||||
|
|
||||||
|
@ -539,12 +636,15 @@ class GenFdsGlobalVariable:
|
||||||
Cmd += ["-m"]
|
Cmd += ["-m"]
|
||||||
Cmd += ["-o", Output]
|
Cmd += ["-o", Output]
|
||||||
Cmd += Input
|
Cmd += Input
|
||||||
|
if IsMakefile:
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate firmware image")
|
if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
|
GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
|
||||||
|
else:
|
||||||
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate firmware image")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,
|
def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,
|
||||||
Revision=None, DeviceId=None, VendorId=None):
|
Revision=None, DeviceId=None, VendorId=None, IsMakefile=False):
|
||||||
InputList = []
|
InputList = []
|
||||||
Cmd = ["EfiRom"]
|
Cmd = ["EfiRom"]
|
||||||
if len(EfiInput) > 0:
|
if len(EfiInput) > 0:
|
||||||
|
@ -565,7 +665,7 @@ class GenFdsGlobalVariable:
|
||||||
InputList.append (BinFile)
|
InputList.append (BinFile)
|
||||||
|
|
||||||
# Check List
|
# Check List
|
||||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList):
|
if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList) and not IsMakefile:
|
||||||
return
|
return
|
||||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
|
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
|
||||||
|
|
||||||
|
@ -579,11 +679,15 @@ class GenFdsGlobalVariable:
|
||||||
Cmd += ["-f", VendorId]
|
Cmd += ["-f", VendorId]
|
||||||
|
|
||||||
Cmd += ["-o", Output]
|
Cmd += ["-o", Output]
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom")
|
if IsMakefile:
|
||||||
|
if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
|
GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
|
||||||
|
else:
|
||||||
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GuidTool(Output, Input, ToolPath, Options='', returnValue=[]):
|
def GuidTool(Output, Input, ToolPath, Options='', returnValue=[], IsMakefile=False):
|
||||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
|
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input) and not IsMakefile:
|
||||||
return
|
return
|
||||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||||
|
|
||||||
|
@ -591,8 +695,11 @@ class GenFdsGlobalVariable:
|
||||||
Cmd += Options.split(' ')
|
Cmd += Options.split(' ')
|
||||||
Cmd += ["-o", Output]
|
Cmd += ["-o", Output]
|
||||||
Cmd += Input
|
Cmd += Input
|
||||||
|
if IsMakefile:
|
||||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath, returnValue)
|
if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
|
||||||
|
GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
|
||||||
|
else:
|
||||||
|
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath, returnValue)
|
||||||
|
|
||||||
def CallExternalTool (cmd, errorMess, returnValue=[]):
|
def CallExternalTool (cmd, errorMess, returnValue=[]):
|
||||||
|
|
||||||
|
@ -727,6 +834,7 @@ class GenFdsGlobalVariable:
|
||||||
return PcdValue
|
return PcdValue
|
||||||
|
|
||||||
SetDir = staticmethod(SetDir)
|
SetDir = staticmethod(SetDir)
|
||||||
|
SetEnv = staticmethod(SetEnv)
|
||||||
ReplaceWorkspaceMacro = staticmethod(ReplaceWorkspaceMacro)
|
ReplaceWorkspaceMacro = staticmethod(ReplaceWorkspaceMacro)
|
||||||
CallExternalTool = staticmethod(CallExternalTool)
|
CallExternalTool = staticmethod(CallExternalTool)
|
||||||
VerboseLogger = staticmethod(VerboseLogger)
|
VerboseLogger = staticmethod(VerboseLogger)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process GUIDed section generation
|
# process GUIDed section generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -54,7 +54,7 @@ class GuidSection(GuidSectionClassObject) :
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name, section alignment)
|
# @retval tuple (Generated file name, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}, IsMakefile=False):
|
||||||
#
|
#
|
||||||
# Generate all section
|
# Generate all section
|
||||||
#
|
#
|
||||||
|
@ -94,7 +94,7 @@ class GuidSection(GuidSectionClassObject) :
|
||||||
elif isinstance(Sect, GuidSection):
|
elif isinstance(Sect, GuidSection):
|
||||||
Sect.FvAddr = self.FvAddr
|
Sect.FvAddr = self.FvAddr
|
||||||
Sect.FvParentAddr = self.FvParentAddr
|
Sect.FvParentAddr = self.FvParentAddr
|
||||||
ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict)
|
ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
|
||||||
if isinstance(Sect, GuidSection):
|
if isinstance(Sect, GuidSection):
|
||||||
if Sect.IncludeFvSection:
|
if Sect.IncludeFvSection:
|
||||||
self.IncludeFvSection = Sect.IncludeFvSection
|
self.IncludeFvSection = Sect.IncludeFvSection
|
||||||
|
@ -137,7 +137,7 @@ class GuidSection(GuidSectionClassObject) :
|
||||||
#
|
#
|
||||||
if self.NameGuid == None :
|
if self.NameGuid == None :
|
||||||
GenFdsGlobalVariable.VerboseLogger("Use GenSection function Generate CRC32 Section")
|
GenFdsGlobalVariable.VerboseLogger("Use GenSection function Generate CRC32 Section")
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFile, Section.Section.SectionType[self.SectionType], InputAlign=SectAlign)
|
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFile, Section.Section.SectionType[self.SectionType], InputAlign=SectAlign, IsMakefile=IsMakefile)
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
return OutputFileList, self.Alignment
|
return OutputFileList, self.Alignment
|
||||||
|
@ -149,7 +149,7 @@ class GuidSection(GuidSectionClassObject) :
|
||||||
#
|
#
|
||||||
# Call GenSection with DUMMY section type.
|
# Call GenSection with DUMMY section type.
|
||||||
#
|
#
|
||||||
GenFdsGlobalVariable.GenerateSection(DummyFile, SectFile, InputAlign=SectAlign)
|
GenFdsGlobalVariable.GenerateSection(DummyFile, SectFile, InputAlign=SectAlign, IsMakefile=IsMakefile)
|
||||||
#
|
#
|
||||||
# Use external tool process the Output
|
# Use external tool process the Output
|
||||||
#
|
#
|
||||||
|
@ -172,75 +172,99 @@ class GuidSection(GuidSectionClassObject) :
|
||||||
CmdOption = '-e'
|
CmdOption = '-e'
|
||||||
if ExternalOption != None:
|
if ExternalOption != None:
|
||||||
CmdOption = CmdOption + ' ' + ExternalOption
|
CmdOption = CmdOption + ' ' + ExternalOption
|
||||||
if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr != None:
|
if not GenFdsGlobalVariable.EnableGenfdsMultiThread:
|
||||||
#FirstCall is only set for the encapsulated flash FV image without process required attribute.
|
if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr != None:
|
||||||
FirstCall = True
|
#FirstCall is only set for the encapsulated flash FV image without process required attribute.
|
||||||
#
|
FirstCall = True
|
||||||
# Call external tool
|
#
|
||||||
#
|
# Call external tool
|
||||||
ReturnValue = [1]
|
#
|
||||||
if FirstCall:
|
ReturnValue = [1]
|
||||||
#first try to call the guided tool with -z option and CmdOption for the no process required guided tool.
|
if FirstCall:
|
||||||
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, '-z' + ' ' + CmdOption, ReturnValue)
|
#first try to call the guided tool with -z option and CmdOption for the no process required guided tool.
|
||||||
|
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, '-z' + ' ' + CmdOption, ReturnValue)
|
||||||
|
|
||||||
#
|
#
|
||||||
# when no call or first call failed, ReturnValue are not 1.
|
# when no call or first call failed, ReturnValue are not 1.
|
||||||
# Call the guided tool with CmdOption
|
# Call the guided tool with CmdOption
|
||||||
#
|
#
|
||||||
if ReturnValue[0] != 0:
|
if ReturnValue[0] != 0:
|
||||||
FirstCall = False
|
FirstCall = False
|
||||||
ReturnValue[0] = 0
|
ReturnValue[0] = 0
|
||||||
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
|
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
|
||||||
#
|
#
|
||||||
# There is external tool which does not follow standard rule which return nonzero if tool fails
|
# There is external tool which does not follow standard rule which return nonzero if tool fails
|
||||||
# The output file has to be checked
|
# The output file has to be checked
|
||||||
#
|
#
|
||||||
if not os.path.exists(TempFile):
|
|
||||||
EdkLogger.error("GenFds", COMMAND_FAILURE, 'Fail to call %s, no output file was generated' % ExternalTool)
|
|
||||||
|
|
||||||
FileHandleIn = open(DummyFile, 'rb')
|
if not os.path.exists(TempFile) :
|
||||||
FileHandleIn.seek(0, 2)
|
EdkLogger.error("GenFds", COMMAND_FAILURE, 'Fail to call %s, no output file was generated' % ExternalTool)
|
||||||
InputFileSize = FileHandleIn.tell()
|
|
||||||
|
|
||||||
FileHandleOut = open(TempFile, 'rb')
|
FileHandleIn = open(DummyFile, 'rb')
|
||||||
FileHandleOut.seek(0, 2)
|
FileHandleIn.seek(0, 2)
|
||||||
TempFileSize = FileHandleOut.tell()
|
InputFileSize = FileHandleIn.tell()
|
||||||
|
|
||||||
Attribute = []
|
FileHandleOut = open(TempFile, 'rb')
|
||||||
HeaderLength = None
|
FileHandleOut.seek(0, 2)
|
||||||
if self.ExtraHeaderSize != -1:
|
TempFileSize = FileHandleOut.tell()
|
||||||
HeaderLength = str(self.ExtraHeaderSize)
|
|
||||||
|
|
||||||
if self.ProcessRequired == "NONE" and HeaderLength == None:
|
Attribute = []
|
||||||
if TempFileSize > InputFileSize:
|
HeaderLength = None
|
||||||
FileHandleIn.seek(0)
|
if self.ExtraHeaderSize != -1:
|
||||||
BufferIn = FileHandleIn.read()
|
HeaderLength = str(self.ExtraHeaderSize)
|
||||||
FileHandleOut.seek(0)
|
|
||||||
BufferOut = FileHandleOut.read()
|
|
||||||
if BufferIn == BufferOut[TempFileSize - InputFileSize:]:
|
|
||||||
HeaderLength = str(TempFileSize - InputFileSize)
|
|
||||||
#auto sec guided attribute with process required
|
|
||||||
if HeaderLength == None:
|
|
||||||
Attribute.append('PROCESSING_REQUIRED')
|
|
||||||
|
|
||||||
FileHandleIn.close()
|
if self.ProcessRequired == "NONE" and HeaderLength == None:
|
||||||
FileHandleOut.close()
|
if TempFileSize > InputFileSize:
|
||||||
|
FileHandleIn.seek(0)
|
||||||
|
BufferIn = FileHandleIn.read()
|
||||||
|
FileHandleOut.seek(0)
|
||||||
|
BufferOut = FileHandleOut.read()
|
||||||
|
if BufferIn == BufferOut[TempFileSize - InputFileSize:]:
|
||||||
|
HeaderLength = str(TempFileSize - InputFileSize)
|
||||||
|
#auto sec guided attribute with process required
|
||||||
|
if HeaderLength == None:
|
||||||
|
Attribute.append('PROCESSING_REQUIRED')
|
||||||
|
|
||||||
if FirstCall and 'PROCESSING_REQUIRED' in Attribute:
|
FileHandleIn.close()
|
||||||
# Guided data by -z option on first call is the process required data. Call the guided tool with the real option.
|
FileHandleOut.close()
|
||||||
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
|
|
||||||
|
|
||||||
#
|
if FirstCall and 'PROCESSING_REQUIRED' in Attribute:
|
||||||
# Call Gensection Add Section Header
|
# Guided data by -z option on first call is the process required data. Call the guided tool with the real option.
|
||||||
#
|
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
|
||||||
if self.ProcessRequired in ("TRUE", "1"):
|
|
||||||
if 'PROCESSING_REQUIRED' not in Attribute:
|
#
|
||||||
Attribute.append('PROCESSING_REQUIRED')
|
# Call Gensection Add Section Header
|
||||||
|
#
|
||||||
|
if self.ProcessRequired in ("TRUE", "1"):
|
||||||
|
if 'PROCESSING_REQUIRED' not in Attribute:
|
||||||
|
Attribute.append('PROCESSING_REQUIRED')
|
||||||
|
|
||||||
|
if self.AuthStatusValid in ("TRUE", "1"):
|
||||||
|
Attribute.append('AUTH_STATUS_VALID')
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
|
||||||
|
Guid=self.NameGuid, GuidAttr=Attribute, GuidHdrLen=HeaderLength)
|
||||||
|
|
||||||
|
else:
|
||||||
|
#add input file for GenSec get PROCESSING_REQUIRED
|
||||||
|
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption, IsMakefile=IsMakefile)
|
||||||
|
Attribute = []
|
||||||
|
HeaderLength = None
|
||||||
|
if self.ExtraHeaderSize != -1:
|
||||||
|
HeaderLength = str(self.ExtraHeaderSize)
|
||||||
|
if self.AuthStatusValid in ("TRUE", "1"):
|
||||||
|
Attribute.append('AUTH_STATUS_VALID')
|
||||||
|
if self.ProcessRequired == "NONE" and HeaderLength == None:
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
|
||||||
|
Guid=self.NameGuid, GuidAttr=Attribute,
|
||||||
|
GuidHdrLen=HeaderLength, DummyFile=DummyFile, IsMakefile=IsMakefile)
|
||||||
|
else:
|
||||||
|
if self.ProcessRequired in ("TRUE", "1"):
|
||||||
|
if 'PROCESSING_REQUIRED' not in Attribute:
|
||||||
|
Attribute.append('PROCESSING_REQUIRED')
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
|
||||||
|
Guid=self.NameGuid, GuidAttr=Attribute,
|
||||||
|
GuidHdrLen=HeaderLength, IsMakefile=IsMakefile)
|
||||||
|
|
||||||
if self.AuthStatusValid in ("TRUE", "1"):
|
|
||||||
Attribute.append('AUTH_STATUS_VALID')
|
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
|
|
||||||
Guid=self.NameGuid, GuidAttr=Attribute, GuidHdrLen=HeaderLength)
|
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
if 'PROCESSING_REQUIRED' in Attribute:
|
if 'PROCESSING_REQUIRED' in Attribute:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process OptionROM generation from FILE statement
|
# process OptionROM generation from FILE statement
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -39,7 +39,7 @@ class OptRomFileStatement:
|
||||||
# @param Dict dictionary contains macro and value pair
|
# @param Dict dictionary contains macro and value pair
|
||||||
# @retval string Generated FFS file name
|
# @retval string Generated FFS file name
|
||||||
#
|
#
|
||||||
def GenFfs(self, Dict = {}):
|
def GenFfs(self, Dict = {}, IsMakefile=False):
|
||||||
|
|
||||||
if self.FileName != None:
|
if self.FileName != None:
|
||||||
self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
|
self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process OptionROM generation from INF statement
|
# process OptionROM generation from INF statement
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -81,7 +81,7 @@ class OptRomInfStatement (FfsInfStatement):
|
||||||
# @param self The object pointer
|
# @param self The object pointer
|
||||||
# @retval string Generated .efi file name
|
# @retval string Generated .efi file name
|
||||||
#
|
#
|
||||||
def GenFfs(self):
|
def GenFfs(self, IsMakefile=False):
|
||||||
#
|
#
|
||||||
# Parse Inf file get Module related information
|
# Parse Inf file get Module related information
|
||||||
#
|
#
|
||||||
|
@ -98,13 +98,13 @@ class OptRomInfStatement (FfsInfStatement):
|
||||||
# For the rule only has simpleFile
|
# For the rule only has simpleFile
|
||||||
#
|
#
|
||||||
if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :
|
if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :
|
||||||
EfiOutputList = self.__GenSimpleFileSection__(Rule)
|
EfiOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)
|
||||||
return EfiOutputList
|
return EfiOutputList
|
||||||
#
|
#
|
||||||
# For Rule has ComplexFile
|
# For Rule has ComplexFile
|
||||||
#
|
#
|
||||||
elif isinstance(Rule, RuleComplexFile.RuleComplexFile):
|
elif isinstance(Rule, RuleComplexFile.RuleComplexFile):
|
||||||
EfiOutputList = self.__GenComplexFileSection__(Rule)
|
EfiOutputList = self.__GenComplexFileSection__(Rule, IsMakefile=IsMakefile)
|
||||||
return EfiOutputList
|
return EfiOutputList
|
||||||
|
|
||||||
## __GenSimpleFileSection__() method
|
## __GenSimpleFileSection__() method
|
||||||
|
@ -115,7 +115,7 @@ class OptRomInfStatement (FfsInfStatement):
|
||||||
# @param Rule The rule object used to generate section
|
# @param Rule The rule object used to generate section
|
||||||
# @retval string File name of the generated section file
|
# @retval string File name of the generated section file
|
||||||
#
|
#
|
||||||
def __GenSimpleFileSection__(self, Rule):
|
def __GenSimpleFileSection__(self, Rule, IsMakefile = False):
|
||||||
#
|
#
|
||||||
# Prepare the parameter of GenSection
|
# Prepare the parameter of GenSection
|
||||||
#
|
#
|
||||||
|
@ -138,7 +138,7 @@ class OptRomInfStatement (FfsInfStatement):
|
||||||
# @param Rule The rule object used to generate section
|
# @param Rule The rule object used to generate section
|
||||||
# @retval string File name of the generated section file
|
# @retval string File name of the generated section file
|
||||||
#
|
#
|
||||||
def __GenComplexFileSection__(self, Rule):
|
def __GenComplexFileSection__(self, Rule, IsMakefile=False):
|
||||||
|
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
for Sect in Rule.SectionList:
|
for Sect in Rule.SectionList:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process OptionROM generation
|
# process OptionROM generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -49,9 +49,9 @@ class OPTIONROM (OptionRomClassObject):
|
||||||
# @param Buffer The buffer generated OptROM data will be put
|
# @param Buffer The buffer generated OptROM data will be put
|
||||||
# @retval string Generated OptROM file path
|
# @retval string Generated OptROM file path
|
||||||
#
|
#
|
||||||
def AddToBuffer (self, Buffer) :
|
def AddToBuffer (self, Buffer, Flag=False) :
|
||||||
|
if not Flag:
|
||||||
GenFdsGlobalVariable.InfLogger( "\nGenerating %s Option ROM ..." %self.DriverName)
|
GenFdsGlobalVariable.InfLogger( "\nGenerating %s Option ROM ..." %self.DriverName)
|
||||||
|
|
||||||
EfiFileList = []
|
EfiFileList = []
|
||||||
BinFileList = []
|
BinFileList = []
|
||||||
|
@ -60,7 +60,7 @@ class OPTIONROM (OptionRomClassObject):
|
||||||
for FfsFile in self.FfsList :
|
for FfsFile in self.FfsList :
|
||||||
|
|
||||||
if isinstance(FfsFile, OptRomInfStatement.OptRomInfStatement):
|
if isinstance(FfsFile, OptRomInfStatement.OptRomInfStatement):
|
||||||
FilePathNameList = FfsFile.GenFfs()
|
FilePathNameList = FfsFile.GenFfs(IsMakefile=Flag)
|
||||||
if len(FilePathNameList) == 0:
|
if len(FilePathNameList) == 0:
|
||||||
EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s not produce .efi files, so NO file could be put into option ROM." % (FfsFile.InfFileName))
|
EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s not produce .efi files, so NO file could be put into option ROM." % (FfsFile.InfFileName))
|
||||||
if FfsFile.OverrideAttribs == None:
|
if FfsFile.OverrideAttribs == None:
|
||||||
|
@ -79,10 +79,11 @@ class OPTIONROM (OptionRomClassObject):
|
||||||
FfsFile.OverrideAttribs.PciClassCode,
|
FfsFile.OverrideAttribs.PciClassCode,
|
||||||
FfsFile.OverrideAttribs.PciRevision,
|
FfsFile.OverrideAttribs.PciRevision,
|
||||||
FfsFile.OverrideAttribs.PciDeviceId,
|
FfsFile.OverrideAttribs.PciDeviceId,
|
||||||
FfsFile.OverrideAttribs.PciVendorId)
|
FfsFile.OverrideAttribs.PciVendorId,
|
||||||
|
IsMakefile = Flag)
|
||||||
BinFileList.append(TmpOutputFile)
|
BinFileList.append(TmpOutputFile)
|
||||||
else:
|
else:
|
||||||
FilePathName = FfsFile.GenFfs()
|
FilePathName = FfsFile.GenFfs(IsMakefile=Flag)
|
||||||
if FfsFile.OverrideAttribs != None:
|
if FfsFile.OverrideAttribs != None:
|
||||||
FileName = os.path.basename(FilePathName)
|
FileName = os.path.basename(FilePathName)
|
||||||
TmpOutputDir = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName, FfsFile.CurrentArch)
|
TmpOutputDir = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName, FfsFile.CurrentArch)
|
||||||
|
@ -97,7 +98,8 @@ class OPTIONROM (OptionRomClassObject):
|
||||||
FfsFile.OverrideAttribs.PciClassCode,
|
FfsFile.OverrideAttribs.PciClassCode,
|
||||||
FfsFile.OverrideAttribs.PciRevision,
|
FfsFile.OverrideAttribs.PciRevision,
|
||||||
FfsFile.OverrideAttribs.PciDeviceId,
|
FfsFile.OverrideAttribs.PciDeviceId,
|
||||||
FfsFile.OverrideAttribs.PciVendorId)
|
FfsFile.OverrideAttribs.PciVendorId,
|
||||||
|
IsMakefile=Flag)
|
||||||
BinFileList.append(TmpOutputFile)
|
BinFileList.append(TmpOutputFile)
|
||||||
else:
|
else:
|
||||||
if FfsFile.FileType == 'EFI':
|
if FfsFile.FileType == 'EFI':
|
||||||
|
@ -114,10 +116,11 @@ class OPTIONROM (OptionRomClassObject):
|
||||||
GenFdsGlobalVariable.GenerateOptionRom(
|
GenFdsGlobalVariable.GenerateOptionRom(
|
||||||
OutputFile,
|
OutputFile,
|
||||||
EfiFileList,
|
EfiFileList,
|
||||||
BinFileList
|
BinFileList,
|
||||||
)
|
IsMakefile=Flag)
|
||||||
|
|
||||||
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Option ROM Successfully" %self.DriverName)
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Option ROM Successfully" %self.DriverName)
|
||||||
GenFdsGlobalVariable.SharpCounter = 0
|
GenFdsGlobalVariable.SharpCounter = 0
|
||||||
|
|
||||||
return OutputFile
|
return OutputFile
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process FD Region generation
|
# process FD Region generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -74,11 +74,14 @@ class Region(RegionClassObject):
|
||||||
# @retval string Generated FV file path
|
# @retval string Generated FV file path
|
||||||
#
|
#
|
||||||
|
|
||||||
def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict=None, MacroDict={}):
|
def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict=None, MacroDict={}, Flag=False):
|
||||||
Size = self.Size
|
Size = self.Size
|
||||||
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
|
if not Flag:
|
||||||
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
|
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
|
||||||
|
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
|
||||||
GenFdsGlobalVariable.SharpCounter = 0
|
GenFdsGlobalVariable.SharpCounter = 0
|
||||||
|
if Flag and (self.RegionType != 'FV'):
|
||||||
|
return
|
||||||
|
|
||||||
if self.RegionType == 'FV':
|
if self.RegionType == 'FV':
|
||||||
#
|
#
|
||||||
|
@ -91,7 +94,8 @@ class Region(RegionClassObject):
|
||||||
FileName = None
|
FileName = None
|
||||||
if RegionData.endswith(".fv"):
|
if RegionData.endswith(".fv"):
|
||||||
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
|
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
|
||||||
GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s' % RegionData)
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s' % RegionData)
|
||||||
if RegionData[1] != ':' :
|
if RegionData[1] != ':' :
|
||||||
RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
|
RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
|
||||||
if not os.path.exists(RegionData):
|
if not os.path.exists(RegionData):
|
||||||
|
@ -99,7 +103,8 @@ class Region(RegionClassObject):
|
||||||
|
|
||||||
FileName = RegionData
|
FileName = RegionData
|
||||||
elif RegionData.upper() + 'fv' in ImageBinDict.keys():
|
elif RegionData.upper() + 'fv' in ImageBinDict.keys():
|
||||||
GenFdsGlobalVariable.InfLogger(' Region Name = FV')
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger(' Region Name = FV')
|
||||||
FileName = ImageBinDict[RegionData.upper() + 'fv']
|
FileName = ImageBinDict[RegionData.upper() + 'fv']
|
||||||
else:
|
else:
|
||||||
#
|
#
|
||||||
|
@ -110,7 +115,8 @@ class Region(RegionClassObject):
|
||||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
|
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
|
||||||
|
|
||||||
if FvObj != None :
|
if FvObj != None :
|
||||||
GenFdsGlobalVariable.InfLogger(' Region Name = FV')
|
if not Flag:
|
||||||
|
GenFdsGlobalVariable.InfLogger(' Region Name = FV')
|
||||||
#
|
#
|
||||||
# Call GenFv tool
|
# Call GenFv tool
|
||||||
#
|
#
|
||||||
|
@ -124,7 +130,10 @@ class Region(RegionClassObject):
|
||||||
FvBaseAddress = '0x%X' % self.FvAddress
|
FvBaseAddress = '0x%X' % self.FvAddress
|
||||||
BlockSize = None
|
BlockSize = None
|
||||||
BlockNum = None
|
BlockNum = None
|
||||||
FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)
|
FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict, Flag=Flag)
|
||||||
|
if Flag:
|
||||||
|
continue
|
||||||
|
|
||||||
if FvBuffer.len > Size:
|
if FvBuffer.len > Size:
|
||||||
FvBuffer.close()
|
FvBuffer.close()
|
||||||
EdkLogger.error("GenFds", GENFDS_ERROR,
|
EdkLogger.error("GenFds", GENFDS_ERROR,
|
||||||
|
@ -142,20 +151,22 @@ class Region(RegionClassObject):
|
||||||
#
|
#
|
||||||
# Add the exist Fv image into FD buffer
|
# Add the exist Fv image into FD buffer
|
||||||
#
|
#
|
||||||
if FileName != None:
|
if not Flag:
|
||||||
FileLength = os.stat(FileName)[ST_SIZE]
|
if FileName != None:
|
||||||
if FileLength > Size:
|
FileLength = os.stat(FileName)[ST_SIZE]
|
||||||
EdkLogger.error("GenFds", GENFDS_ERROR,
|
if FileLength > Size:
|
||||||
"Size of FV File (%s) is larger than Region Size 0x%X specified." \
|
EdkLogger.error("GenFds", GENFDS_ERROR,
|
||||||
% (RegionData, Size))
|
"Size of FV File (%s) is larger than Region Size 0x%X specified." \
|
||||||
BinFile = open(FileName, 'rb')
|
% (RegionData, Size))
|
||||||
Buffer.write(BinFile.read())
|
BinFile = open(FileName, 'rb')
|
||||||
BinFile.close()
|
Buffer.write(BinFile.read())
|
||||||
Size = Size - FileLength
|
BinFile.close()
|
||||||
|
Size = Size - FileLength
|
||||||
#
|
#
|
||||||
# Pad the left buffer
|
# Pad the left buffer
|
||||||
#
|
#
|
||||||
self.PadBuffer(Buffer, ErasePolarity, Size)
|
if not Flag:
|
||||||
|
self.PadBuffer(Buffer, ErasePolarity, Size)
|
||||||
|
|
||||||
if self.RegionType == 'CAPSULE':
|
if self.RegionType == 'CAPSULE':
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# section base class
|
# section base class
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007-2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007-2017, 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
|
||||||
|
@ -141,7 +141,7 @@ class Section (SectionClassObject):
|
||||||
else:
|
else:
|
||||||
GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
|
GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
|
||||||
|
|
||||||
if Suffix != None and os.path.exists(FfsInf.EfiOutputPath):
|
if Suffix != None:
|
||||||
#
|
#
|
||||||
# Get Makefile path and time stamp
|
# Get Makefile path and time stamp
|
||||||
#
|
#
|
||||||
|
|
|
@ -48,7 +48,7 @@ class UiSection (UiSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name, section alignment)
|
# @retval tuple (Generated file name, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}, IsMakefile = False):
|
||||||
#
|
#
|
||||||
# Prepare the parameter of GenSection
|
# Prepare the parameter of GenSection
|
||||||
#
|
#
|
||||||
|
@ -69,8 +69,7 @@ class UiSection (UiSectionClassObject):
|
||||||
FileObj.close()
|
FileObj.close()
|
||||||
else:
|
else:
|
||||||
NameString = ''
|
NameString = ''
|
||||||
|
GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString, IsMakefile=IsMakefile)
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString)
|
|
||||||
|
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# process Version section generation
|
# process Version section generation
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, 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
|
||||||
|
@ -48,7 +48,7 @@ class VerSection (VerSectionClassObject):
|
||||||
# @param Dict dictionary contains macro and its value
|
# @param Dict dictionary contains macro and its value
|
||||||
# @retval tuple (Generated file name, section alignment)
|
# @retval tuple (Generated file name, section alignment)
|
||||||
#
|
#
|
||||||
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}):
|
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}, IsMakefile = False):
|
||||||
#
|
#
|
||||||
# Prepare the parameter of GenSection
|
# Prepare the parameter of GenSection
|
||||||
#
|
#
|
||||||
|
@ -65,7 +65,7 @@ class VerSection (VerSectionClassObject):
|
||||||
# Get String Data
|
# Get String Data
|
||||||
StringData = ''
|
StringData = ''
|
||||||
if self.StringData != None:
|
if self.StringData != None:
|
||||||
StringData = self.StringData
|
StringData = self.StringData
|
||||||
elif self.FileName != None:
|
elif self.FileName != None:
|
||||||
FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
|
FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
|
||||||
FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)
|
FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)
|
||||||
|
@ -75,9 +75,8 @@ class VerSection (VerSectionClassObject):
|
||||||
FileObj.close()
|
FileObj.close()
|
||||||
else:
|
else:
|
||||||
StringData = ''
|
StringData = ''
|
||||||
|
|
||||||
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
|
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
|
||||||
Ver=StringData, BuildNumber=self.BuildNum)
|
Ver=StringData, BuildNumber=self.BuildNum, IsMakefile=IsMakefile)
|
||||||
OutputFileList = []
|
OutputFileList = []
|
||||||
OutputFileList.append(OutputFile)
|
OutputFileList.append(OutputFile)
|
||||||
return OutputFileList, self.Alignment
|
return OutputFileList, self.Alignment
|
||||||
|
|
|
@ -50,6 +50,7 @@ from PatchPcdValue.PatchPcdValue import *
|
||||||
|
|
||||||
import Common.EdkLogger
|
import Common.EdkLogger
|
||||||
import Common.GlobalData as GlobalData
|
import Common.GlobalData as GlobalData
|
||||||
|
from GenFds.GenFds import GenFds
|
||||||
|
|
||||||
# Version and Copyright
|
# Version and Copyright
|
||||||
VersionNumber = "0.60" + ' ' + gBUILD_VERSION
|
VersionNumber = "0.60" + ' ' + gBUILD_VERSION
|
||||||
|
@ -774,6 +775,7 @@ class Build():
|
||||||
GlobalData.gUseHashCache = BuildOptions.UseHashCache
|
GlobalData.gUseHashCache = BuildOptions.UseHashCache
|
||||||
GlobalData.gBinCacheDest = BuildOptions.BinCacheDest
|
GlobalData.gBinCacheDest = BuildOptions.BinCacheDest
|
||||||
GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
|
GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
|
||||||
|
GlobalData.gEnableGenfdsMultiThread = BuildOptions.GenfdsMultiThread
|
||||||
|
|
||||||
if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
|
if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
|
||||||
EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")
|
EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")
|
||||||
|
@ -1208,7 +1210,7 @@ class Build():
|
||||||
# @param CreateDepModuleMakeFile Flag used to indicate creating makefile
|
# @param CreateDepModuleMakeFile Flag used to indicate creating makefile
|
||||||
# for dependent modules/Libraries
|
# for dependent modules/Libraries
|
||||||
#
|
#
|
||||||
def _BuildPa(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False):
|
def _BuildPa(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False, FfsCommand={}):
|
||||||
if AutoGenObject == None:
|
if AutoGenObject == None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1224,7 +1226,7 @@ class Build():
|
||||||
|
|
||||||
if not self.SkipAutoGen or Target == 'genmake':
|
if not self.SkipAutoGen or Target == 'genmake':
|
||||||
self.Progress.Start("Generating makefile")
|
self.Progress.Start("Generating makefile")
|
||||||
AutoGenObject.CreateMakeFile(CreateDepsMakeFile)
|
AutoGenObject.CreateMakeFile(CreateDepsMakeFile, FfsCommand)
|
||||||
self.Progress.Stop("done!")
|
self.Progress.Stop("done!")
|
||||||
if Target == "genmake":
|
if Target == "genmake":
|
||||||
return True
|
return True
|
||||||
|
@ -1731,6 +1733,12 @@ class Build():
|
||||||
self.LoadFixAddress = Wa.Platform.LoadFixAddress
|
self.LoadFixAddress = Wa.Platform.LoadFixAddress
|
||||||
self.BuildReport.AddPlatformReport(Wa)
|
self.BuildReport.AddPlatformReport(Wa)
|
||||||
self.Progress.Stop("done!")
|
self.Progress.Stop("done!")
|
||||||
|
|
||||||
|
# Add ffs build to makefile
|
||||||
|
CmdListDict = {}
|
||||||
|
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
|
||||||
|
CmdListDict = self._GenFfsCmd()
|
||||||
|
|
||||||
for Arch in Wa.ArchList:
|
for Arch in Wa.ArchList:
|
||||||
GlobalData.gGlobalDefines['ARCH'] = Arch
|
GlobalData.gGlobalDefines['ARCH'] = Arch
|
||||||
Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
|
Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
|
||||||
|
@ -1740,7 +1748,7 @@ class Build():
|
||||||
if Ma == None:
|
if Ma == None:
|
||||||
continue
|
continue
|
||||||
self.BuildModules.append(Ma)
|
self.BuildModules.append(Ma)
|
||||||
self._BuildPa(self.Target, Pa)
|
self._BuildPa(self.Target, Pa, FfsCommand=CmdListDict)
|
||||||
|
|
||||||
# Create MAP file when Load Fix Address is enabled.
|
# Create MAP file when Load Fix Address is enabled.
|
||||||
if self.Target in ["", "all", "fds"]:
|
if self.Target in ["", "all", "fds"]:
|
||||||
|
@ -1819,6 +1827,10 @@ class Build():
|
||||||
self.Fdf = Wa.FdfFile
|
self.Fdf = Wa.FdfFile
|
||||||
self.LoadFixAddress = Wa.Platform.LoadFixAddress
|
self.LoadFixAddress = Wa.Platform.LoadFixAddress
|
||||||
Wa.CreateMakeFile(False)
|
Wa.CreateMakeFile(False)
|
||||||
|
# Add ffs build to makefile
|
||||||
|
CmdListDict = None
|
||||||
|
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
|
||||||
|
CmdListDict = self._GenFfsCmd()
|
||||||
self.Progress.Stop("done!")
|
self.Progress.Stop("done!")
|
||||||
MaList = []
|
MaList = []
|
||||||
ExitFlag = threading.Event()
|
ExitFlag = threading.Event()
|
||||||
|
@ -1838,7 +1850,11 @@ class Build():
|
||||||
if not self.SkipAutoGen or self.Target == 'genc':
|
if not self.SkipAutoGen or self.Target == 'genc':
|
||||||
Ma.CreateCodeFile(True)
|
Ma.CreateCodeFile(True)
|
||||||
if not self.SkipAutoGen or self.Target == 'genmake':
|
if not self.SkipAutoGen or self.Target == 'genmake':
|
||||||
Ma.CreateMakeFile(True)
|
if CmdListDict and self.Fdf and (Module.File, Arch) in CmdListDict:
|
||||||
|
Ma.CreateMakeFile(True, CmdListDict[Module.File, Arch])
|
||||||
|
del CmdListDict[Module.File, Arch]
|
||||||
|
else:
|
||||||
|
Ma.CreateMakeFile(True)
|
||||||
MaList.append(Ma)
|
MaList.append(Ma)
|
||||||
self.BuildModules.append(Ma)
|
self.BuildModules.append(Ma)
|
||||||
self.AutoGenTime += int(round((time.time() - AutoGenStart)))
|
self.AutoGenTime += int(round((time.time() - AutoGenStart)))
|
||||||
|
@ -1922,6 +1938,17 @@ class Build():
|
||||||
#
|
#
|
||||||
self._SaveMapFile (MapBuffer, Wa)
|
self._SaveMapFile (MapBuffer, Wa)
|
||||||
|
|
||||||
|
def _GenFfsCmd(self):
|
||||||
|
CmdListDict = {}
|
||||||
|
GenFfsDict = GenFds.GenFfsMakefile('', GlobalData.gFdfParser, self, self.ArchList, GlobalData)
|
||||||
|
for Cmd in GenFfsDict:
|
||||||
|
tmpInf, tmpArch = GenFfsDict[Cmd]
|
||||||
|
if (tmpInf, tmpArch) not in CmdListDict.keys():
|
||||||
|
CmdListDict[tmpInf, tmpArch] = [Cmd]
|
||||||
|
else:
|
||||||
|
CmdListDict[tmpInf, tmpArch].append(Cmd)
|
||||||
|
return CmdListDict
|
||||||
|
|
||||||
## Build a platform in multi-thread mode
|
## Build a platform in multi-thread mode
|
||||||
#
|
#
|
||||||
def _MultiThreadBuildPlatform(self):
|
def _MultiThreadBuildPlatform(self):
|
||||||
|
@ -1957,6 +1984,11 @@ class Build():
|
||||||
self.BuildReport.AddPlatformReport(Wa)
|
self.BuildReport.AddPlatformReport(Wa)
|
||||||
Wa.CreateMakeFile(False)
|
Wa.CreateMakeFile(False)
|
||||||
|
|
||||||
|
# Add ffs build to makefile
|
||||||
|
CmdListDict = None
|
||||||
|
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
|
||||||
|
CmdListDict = self._GenFfsCmd()
|
||||||
|
|
||||||
# multi-thread exit flag
|
# multi-thread exit flag
|
||||||
ExitFlag = threading.Event()
|
ExitFlag = threading.Event()
|
||||||
ExitFlag.clear()
|
ExitFlag.clear()
|
||||||
|
@ -1995,7 +2027,11 @@ class Build():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not self.SkipAutoGen or self.Target == 'genmake':
|
if not self.SkipAutoGen or self.Target == 'genmake':
|
||||||
Ma.CreateMakeFile(True)
|
if CmdListDict and self.Fdf and (Module.File, Arch) in CmdListDict:
|
||||||
|
Ma.CreateMakeFile(True, CmdListDict[Module.File, Arch])
|
||||||
|
del CmdListDict[Module.File, Arch]
|
||||||
|
else:
|
||||||
|
Ma.CreateMakeFile(True)
|
||||||
if self.Target == "genmake":
|
if self.Target == "genmake":
|
||||||
continue
|
continue
|
||||||
self.BuildModules.append(Ma)
|
self.BuildModules.append(Ma)
|
||||||
|
@ -2311,7 +2347,7 @@ def MyOptionParser():
|
||||||
Parser.add_option("--hash", action="store_true", dest="UseHashCache", default=False, help="Enable hash-based caching during build process.")
|
Parser.add_option("--hash", action="store_true", dest="UseHashCache", default=False, help="Enable hash-based caching during build process.")
|
||||||
Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")
|
Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")
|
||||||
Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")
|
Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")
|
||||||
|
Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=False, help="Enable GenFds multi thread to generate ffs file.")
|
||||||
(Opt, Args) = Parser.parse_args()
|
(Opt, Args) = Parser.parse_args()
|
||||||
return (Opt, Args)
|
return (Opt, Args)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue