BaseTools: Clean some coding style issues

This patch clean some coding style issues, majorly for space character.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19080 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Yonghong Zhu
2015-12-01 04:22:16 +00:00
committed by yzhu52
parent 9913dce8ae
commit 47fea6afd7
28 changed files with 557 additions and 557 deletions

View File

@ -34,7 +34,7 @@ import Common.DataType
import Common.GlobalData as GlobalData
from Common import EdkLogger
from Common.String import *
from Common.Misc import DirCache,PathClass
from Common.Misc import DirCache, PathClass
from Common.Misc import SaveFileOnChange
from Common.Misc import ClearDuplicatedInf
from Common.Misc import GuidStructureStringToGuidString
@ -93,7 +93,7 @@ def main():
if 'EDK_SOURCE' in os.environ.keys():
GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])
if (Options.debug):
GenFdsGlobalVariable.VerboseLogger( "Using Workspace:" + Workspace)
GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)
os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
# set multiple workspace
@ -106,7 +106,7 @@ def main():
if FdfFilename[0:2] == '..':
FdfFilename = os.path.realpath(FdfFilename)
if not os.path.isabs (FdfFilename):
if not os.path.isabs(FdfFilename):
FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename):
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename)
@ -287,7 +287,7 @@ def main():
GenFds.DisplayFvSpaceInfo(FdfParserObj)
except FdfParser.Warning, X:
EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)
ReturnCode = FORMAT_INVALID
except FatalError, X:
if Options.debug != None:
@ -326,7 +326,7 @@ def SingleCheckCallback(option, opt_str, value, parser):
#
def myOptionParser():
usage = "%prog [options] -f input_file -a arch_list -b build_target -p active_platform -t tool_chain_tag -D \"MacroName [= MacroValue]\""
Parser = OptionParser(usage=usage,description=__copyright__,version="%prog " + str(versionNumber))
Parser = OptionParser(usage=usage, description=__copyright__, version="%prog " + str(versionNumber))
Parser.add_option("-f", "--file", dest="filename", type="string", help="Name of FDF file to convert", action="callback", callback=SingleCheckCallback)
Parser.add_option("-a", "--arch", dest="archList", help="comma separated list containing one or more of: IA32, X64, IPF, ARM, AARCH64 or EBC which should be built, overrides target.txt?s TARGET_ARCH")
Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
@ -503,8 +503,8 @@ class GenFds :
if UsedSizeValue == TotalSizeValue:
Percentage = '100'
else:
Percentage = str((UsedSizeValue+0.0)/TotalSizeValue)[0:4].lstrip('0.')
Percentage = str((UsedSizeValue + 0.0) / TotalSizeValue)[0:4].lstrip('0.')
GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + Percentage + '%Full] ' + str(TotalSizeValue) + ' total, ' + str(UsedSizeValue) + ' used, ' + str(FreeSizeValue) + ' free')
## PreprocessImage()

View File

@ -274,7 +274,7 @@ class GenFdsGlobalVariable:
# @param ArchList The Arch list of platform
#
def SetDir (OutputDir, FdfParser, WorkSpace, ArchList):
GenFdsGlobalVariable.VerboseLogger( "GenFdsGlobalVariable.OutputDir :%s" %OutputDir)
GenFdsGlobalVariable.VerboseLogger("GenFdsGlobalVariable.OutputDir :%s" % OutputDir)
# GenFdsGlobalVariable.OutputDirDict = OutputDir
GenFdsGlobalVariable.FdfParser = FdfParser
GenFdsGlobalVariable.WorkSpace = WorkSpace
@ -292,7 +292,7 @@ class GenFdsGlobalVariable:
# Create FV Address inf file
#
GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf')
FvAddressFile = open (GenFdsGlobalVariable.FvAddressFileName, 'w')
FvAddressFile = open(GenFdsGlobalVariable.FvAddressFileName, 'w')
#
# Add [Options]
#
@ -304,7 +304,7 @@ class GenFdsGlobalVariable:
break
FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \
BsAddress + \
BsAddress + \
T_CHAR_LF)
RtAddress = '0'
@ -313,7 +313,7 @@ class GenFdsGlobalVariable:
RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress
FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \
RtAddress + \
RtAddress + \
T_CHAR_LF)
FvAddressFile.close()
@ -386,13 +386,13 @@ class GenFdsGlobalVariable:
CommandFile = Output + '.txt'
if Ui not in [None, '']:
#Cmd += ["-n", '"' + Ui + '"']
SectionData = array.array('B', [0,0,0,0])
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())
SaveFileOnChange(Output, SectionData.tostring())
elif Ver not in [None, '']:
Cmd += ["-n", Ver]
if BuildNumber:
@ -461,12 +461,12 @@ class GenFdsGlobalVariable:
Cmd = ["GenFv"]
if BaseAddress not in [None, '']:
Cmd += ["-r", BaseAddress]
if ForceRebase == False:
Cmd +=["-F", "FALSE"]
Cmd += ["-F", "FALSE"]
elif ForceRebase == True:
Cmd +=["-F", "TRUE"]
Cmd += ["-F", "TRUE"]
if Capsule:
Cmd += ["-c"]
if Dump:
@ -570,7 +570,7 @@ class GenFdsGlobalVariable:
if VendorId != None:
Cmd += ["-f", VendorId]
Cmd += ["-o", Output]
Cmd += ["-o", Output]
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom")
@staticmethod
@ -606,7 +606,7 @@ class GenFdsGlobalVariable:
sys.stdout.write('\n')
try:
PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr= subprocess.PIPE, shell=True)
PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
except Exception, X:
EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
(out, error) = PopenObject.communicate()
@ -618,7 +618,7 @@ class GenFdsGlobalVariable:
returnValue[0] = PopenObject.returncode
return
if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1:
GenFdsGlobalVariable.InfLogger ("Return Value = %d" %PopenObject.returncode)
GenFdsGlobalVariable.InfLogger ("Return Value = %d" % PopenObject.returncode)
GenFdsGlobalVariable.InfLogger (out)
GenFdsGlobalVariable.InfLogger (error)
if PopenObject.returncode != 0:
@ -631,7 +631,7 @@ class GenFdsGlobalVariable:
def InfLogger (msg):
EdkLogger.info(msg)
def ErrorLogger (msg, File = None, Line = None, ExtraData = None):
def ErrorLogger (msg, File=None, Line=None, ExtraData=None):
EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData)
def DebugLogger (Level, msg):
@ -642,7 +642,7 @@ class GenFdsGlobalVariable:
# @param Str String that may contain macro
# @param MacroDict Dictionary that contains macro value pair
#
def MacroExtend (Str, MacroDict = {}, Arch = 'COMMON'):
def MacroExtend (Str, MacroDict={}, Arch='COMMON'):
if Str == None :
return None
@ -699,10 +699,10 @@ class GenFdsGlobalVariable:
PcdValue = PcdObj.DefaultValue
return PcdValue
for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
Arch,
GenFdsGlobalVariable.TargetName,
for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
Arch,
GenFdsGlobalVariable.TargetName,
GenFdsGlobalVariable.ToolChainTag):
PcdDict = Package.Pcds
for Key in PcdDict:

View File

@ -53,7 +53,7 @@ class GuidSection(GuidSectionClassObject) :
# @param Dict dictionary contains macro and its value
# @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={}):
#
# Generate all section
#
@ -65,7 +65,7 @@ class GuidSection(GuidSectionClassObject) :
self.SectionType = FfsInf.__ExtendMacro__(self.SectionType)
self.CurrentArchList = [FfsInf.CurrentArch]
SectFile = tuple()
SectFile = tuple()
SectAlign = []
Index = 0
MaxAlign = None
@ -84,7 +84,7 @@ class GuidSection(GuidSectionClassObject) :
for Sect in self.SectionList:
Index = Index + 1
SecIndex = '%s.%d' %(SecNum,Index)
SecIndex = '%s.%d' % (SecNum, Index)
# set base address for inside FvImage
if isinstance(Sect, FvImageSection):
if self.FvAddr != []:
@ -93,7 +93,7 @@ class GuidSection(GuidSectionClassObject) :
elif isinstance(Sect, GuidSection):
Sect.FvAddr = self.FvAddr
Sect.FvParentAddr = self.FvParentAddr
ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList,FfsInf, Dict)
ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict)
if isinstance(Sect, GuidSection):
if Sect.IncludeFvSection:
self.IncludeFvSection = Sect.IncludeFvSection
@ -118,10 +118,10 @@ class GuidSection(GuidSectionClassObject) :
self.Alignment = MaxAlign
OutputFile = OutputPath + \
os.sep + \
os.sep + \
ModuleName + \
'SEC' + \
SecNum + \
'SEC' + \
SecNum + \
Ffs.SectionSuffix['GUIDED']
OutputFile = os.path.normpath(OutputFile)
@ -135,7 +135,7 @@ class GuidSection(GuidSectionClassObject) :
# GENCRC32 section
#
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)
OutputFileList = []
OutputFileList.append(OutputFile)
@ -144,7 +144,7 @@ class GuidSection(GuidSectionClassObject) :
elif ExternalTool == None:
EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % self.NameGuid)
else:
DummyFile = OutputFile+".dummy"
DummyFile = OutputFile + ".dummy"
#
# Call GenSection with DUMMY section type.
#
@ -153,10 +153,10 @@ class GuidSection(GuidSectionClassObject) :
# Use external tool process the Output
#
TempFile = OutputPath + \
os.sep + \
os.sep + \
ModuleName + \
'SEC' + \
SecNum + \
'SEC' + \
SecNum + \
'.tmp'
TempFile = os.path.normpath(TempFile)
#
@ -197,12 +197,12 @@ class GuidSection(GuidSectionClassObject) :
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')
FileHandleIn.seek(0,2)
FileHandleIn = open(DummyFile, 'rb')
FileHandleIn.seek(0, 2)
InputFileSize = FileHandleIn.tell()
FileHandleOut = open(TempFile,'rb')
FileHandleOut.seek(0,2)
FileHandleOut = open(TempFile, 'rb')
FileHandleOut.seek(0, 2)
TempFileSize = FileHandleOut.tell()
Attribute = []
@ -213,7 +213,7 @@ class GuidSection(GuidSectionClassObject) :
if self.ProcessRequired == "NONE" and HeaderLength == None:
if TempFileSize > InputFileSize:
FileHandleIn.seek(0)
BufferIn = FileHandleIn.read()
BufferIn = FileHandleIn.read()
FileHandleOut.seek(0)
BufferOut = FileHandleOut.read()
if BufferIn == BufferOut[TempFileSize - InputFileSize:]:
@ -224,18 +224,18 @@ class GuidSection(GuidSectionClassObject) :
FileHandleIn.close()
FileHandleOut.close()
if FirstCall and 'PROCESSING_REQUIRED' in Attribute:
# 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)
#
# 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'],
@ -263,7 +263,7 @@ class GuidSection(GuidSectionClassObject) :
ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatabase
if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:
EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external tool because tool tag %s is not defined in tools_def.txt!" % ToolChain)
self.KeyStringList = [Target+'_'+ToolChain+'_'+self.CurrentArchList[0]]
self.KeyStringList = [Target + '_' + ToolChain + '_' + self.CurrentArchList[0]]
for Arch in self.CurrentArchList:
if Target + '_' + ToolChain + '_' + Arch not in self.KeyStringList:
self.KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)
@ -275,30 +275,30 @@ class GuidSection(GuidSectionClassObject) :
if self.NameGuid == ToolDef[1]:
KeyList = ToolDef[0].split('_')
Key = KeyList[0] + \
'_' + \
'_' + \
KeyList[1] + \
'_' + \
'_' + \
KeyList[2]
if Key in self.KeyStringList and KeyList[4] == 'GUID':
ToolPath = ToolDefinition.get( Key + \
'_' + \
ToolPath = ToolDefinition.get(Key + \
'_' + \
KeyList[3] + \
'_' + \
'_' + \
'PATH')
ToolOption = ToolDefinition.get( Key + \
'_' + \
ToolOption = ToolDefinition.get(Key + \
'_' + \
KeyList[3] + \
'_' + \
'_' + \
'FLAGS')
if ToolPathTmp == None:
ToolPathTmp = ToolPath
else:
if ToolPathTmp != ToolPath:
EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))
return ToolPathTmp, ToolOption

View File

@ -54,10 +54,10 @@ class Region(RegionClassObject):
# @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={}):
Size = self.Size
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" %Size)
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
GenFdsGlobalVariable.SharpCounter = 0
if self.RegionType == 'FV':
@ -65,13 +65,13 @@ class Region(RegionClassObject):
# Get Fv from FvDict
#
self.FvAddress = int(BaseAddress, 16) + self.Offset
FvBaseAddress = '0x%X' %self.FvAddress
FvOffset = 0
FvBaseAddress = '0x%X' % self.FvAddress
FvOffset = 0
for RegionData in self.RegionDataList:
FileName = None
if RegionData.endswith(".fv"):
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s'%RegionData)
GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s' % RegionData)
if RegionData[1] != ':' :
RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
if not os.path.exists(RegionData):
@ -101,7 +101,7 @@ class Region(RegionClassObject):
EdkLogger.error("GenFds", GENFDS_ERROR,
"FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))
FvBuffer = StringIO.StringIO('')
FvBaseAddress = '0x%X' %self.FvAddress
FvBaseAddress = '0x%X' % self.FvAddress
BlockSize = None
BlockNum = None
FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)
@ -128,7 +128,7 @@ class Region(RegionClassObject):
EdkLogger.error("GenFds", GENFDS_ERROR,
"Size of FV File (%s) is larger than Region Size 0x%X specified." \
% (RegionData, Size))
BinFile = open (FileName, 'r+b')
BinFile = open(FileName, 'r+b')
Buffer.write(BinFile.read())
BinFile.close()
Size = Size - FileLength
@ -150,7 +150,7 @@ class Region(RegionClassObject):
for RegionData in self.RegionDataList:
if RegionData.endswith(".cap"):
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
GenFdsGlobalVariable.InfLogger(' Region CAPSULE Image Name = .cap : %s'%RegionData)
GenFdsGlobalVariable.InfLogger(' Region CAPSULE Image Name = .cap : %s' % RegionData)
if RegionData[1] != ':' :
RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
if not os.path.exists(RegionData):
@ -187,7 +187,7 @@ class Region(RegionClassObject):
EdkLogger.error("GenFds", GENFDS_ERROR,
"Size 0x%X of Capsule File (%s) is larger than Region Size 0x%X specified." \
% (FileLength, RegionData, Size))
BinFile = open (FileName, 'r+b')
BinFile = open(FileName, 'r+b')
Buffer.write(BinFile.read())
BinFile.close()
Size = Size - FileLength
@ -217,8 +217,8 @@ class Region(RegionClassObject):
EdkLogger.error("GenFds", GENFDS_ERROR,
"Size of File (%s) is larger than Region Size 0x%X specified." \
% (RegionData, Size))
GenFdsGlobalVariable.InfLogger(' Region File Name = %s'%RegionData)
BinFile = open (RegionData, 'rb')
GenFdsGlobalVariable.InfLogger(' Region File Name = %s' % RegionData)
BinFile = open(RegionData, 'rb')
Buffer.write(BinFile.read())
BinFile.close()
Size = Size - FileLength
@ -273,17 +273,17 @@ class Region(RegionClassObject):
Granu = 1024
Str = Str[:-1]
elif Str.endswith('M'):
Granu = 1024*1024
Granu = 1024 * 1024
Str = Str[:-1]
elif Str.endswith('G'):
Granu = 1024*1024*1024
Granu = 1024 * 1024 * 1024
Str = Str[:-1]
else:
pass
AlignValue = int(Str)*Granu
AlignValue = int(Str) * Granu
return AlignValue
## BlockSizeOfRegion()
#
# @param BlockSizeList List of block information
@ -304,7 +304,7 @@ class Region(RegionClassObject):
else:
# region ended within current blocks
if self.Offset + self.Size <= End:
ExpectedList.append((BlockSize, (RemindingSize + BlockSize - 1)/BlockSize))
ExpectedList.append((BlockSize, (RemindingSize + BlockSize - 1) / BlockSize))
break
# region not ended yet
else:
@ -313,11 +313,11 @@ class Region(RegionClassObject):
UsedBlockNum = BlockNum
# region started in middle of current blocks
else:
UsedBlockNum = (End - self.Offset)/BlockSize
UsedBlockNum = (End - self.Offset) / BlockSize
Start = End
ExpectedList.append((BlockSize, UsedBlockNum))
RemindingSize -= BlockSize * UsedBlockNum
if FvObj.BlockSizeList == []:
FvObj.BlockSizeList = ExpectedList
else:
@ -333,22 +333,22 @@ class Region(RegionClassObject):
Sum += Item[0] * Item[1]
if self.Size < Sum:
EdkLogger.error("GenFds", GENFDS_ERROR, "Total Size of FV %s 0x%x is larger than Region Size 0x%x "
%(FvObj.UiFvName, Sum, self.Size))
% (FvObj.UiFvName, Sum, self.Size))
# check whether the BlockStatements in FV section is appropriate
ExpectedListData = ''
for Item in ExpectedList:
ExpectedListData += "BlockSize = 0x%x\n\tNumBlocks = 0x%x\n\t"%Item
ExpectedListData += "BlockSize = 0x%x\n\tNumBlocks = 0x%x\n\t" % Item
Index = 0
for Item in FvObj.BlockSizeList:
if Item[0] != ExpectedList[Index][0]:
EdkLogger.error("GenFds", GENFDS_ERROR, "BlockStatements of FV %s are not align with FD's, suggested FV BlockStatement"
%FvObj.UiFvName, ExtraData = ExpectedListData)
% FvObj.UiFvName, ExtraData=ExpectedListData)
elif Item[1] != ExpectedList[Index][1]:
if (Item[1] < ExpectedList[Index][1]) and (Index == len(FvObj.BlockSizeList) - 1):
break;
else:
EdkLogger.error("GenFds", GENFDS_ERROR, "BlockStatements of FV %s are not align with FD's, suggested FV BlockStatement"
%FvObj.UiFvName, ExtraData = ExpectedListData)
% FvObj.UiFvName, ExtraData=ExpectedListData)
else:
Index += 1

View File

@ -48,7 +48,7 @@ class UiSection (UiSectionClassObject):
# @param Dict dictionary contains macro and its value
# @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={}):
#
# Prepare the parameter of GenSection
#

View File

@ -48,7 +48,7 @@ class VerSection (VerSectionClassObject):
# @param Dict dictionary contains macro and its value
# @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={}):
#
# Prepare the parameter of GenSection
#

View File

@ -67,80 +67,80 @@ class Vtf (VtfClassObject):
def GenBsfInf (self):
FvList = self.GetFvList()
self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')
BsfInf = open (self.BsfInfName, 'w+')
BsfInf = open(self.BsfInfName, 'w+')
if self.ResetBin != None:
BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)
BsfInf.writelines ("IA32_RST_BIN" + \
" = " + \
BsfInf.writelines ("IA32_RST_BIN" + \
" = " + \
GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.ResetBin)) + \
T_CHAR_LF )
BsfInf.writelines (T_CHAR_LF )
T_CHAR_LF)
BsfInf.writelines (T_CHAR_LF)
BsfInf.writelines ("[COMPONENTS]" + T_CHAR_LF)
for ComponentObj in self.ComponentStatementList :
BsfInf.writelines ("COMP_NAME" + \
" = " + \
BsfInf.writelines ("COMP_NAME" + \
" = " + \
ComponentObj.CompName + \
T_CHAR_LF )
T_CHAR_LF)
if ComponentObj.CompLoc.upper() == 'NONE':
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'N' + \
T_CHAR_LF )
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'N' + \
T_CHAR_LF)
elif ComponentObj.FilePos != None:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
BsfInf.writelines ("COMP_LOC" + \
" = " + \
ComponentObj.FilePos + \
T_CHAR_LF )
T_CHAR_LF)
else:
Index = FvList.index(ComponentObj.CompLoc.upper())
if Index == 0:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'F' + \
T_CHAR_LF )
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'F' + \
T_CHAR_LF)
elif Index == 1:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'S' + \
T_CHAR_LF )
BsfInf.writelines ("COMP_TYPE" + \
" = " + \
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'S' + \
T_CHAR_LF)
BsfInf.writelines ("COMP_TYPE" + \
" = " + \
ComponentObj.CompType + \
T_CHAR_LF )
BsfInf.writelines ("COMP_VER" + \
" = " + \
T_CHAR_LF)
BsfInf.writelines ("COMP_VER" + \
" = " + \
ComponentObj.CompVer + \
T_CHAR_LF )
BsfInf.writelines ("COMP_CS" + \
" = " + \
T_CHAR_LF)
BsfInf.writelines ("COMP_CS" + \
" = " + \
ComponentObj.CompCs + \
T_CHAR_LF )
T_CHAR_LF)
BinPath = ComponentObj.CompBin
if BinPath != '-':
BinPath = GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(BinPath))
BsfInf.writelines ("COMP_BIN" + \
" = " + \
BsfInf.writelines ("COMP_BIN" + \
" = " + \
BinPath + \
T_CHAR_LF )
T_CHAR_LF)
SymPath = ComponentObj.CompSym
if SymPath != '-':
SymPath = GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(SymPath))
BsfInf.writelines ("COMP_SYM" + \
" = " + \
BsfInf.writelines ("COMP_SYM" + \
" = " + \
SymPath + \
T_CHAR_LF )
BsfInf.writelines ("COMP_SIZE" + \
" = " + \
T_CHAR_LF)
BsfInf.writelines ("COMP_SIZE" + \
" = " + \
ComponentObj.CompSize + \
T_CHAR_LF )
BsfInf.writelines (T_CHAR_LF )
T_CHAR_LF)
BsfInf.writelines (T_CHAR_LF)
BsfInf.close()
## GenFvList() method
@ -170,7 +170,7 @@ class Vtf (VtfClassObject):
(BaseAddress, Size) = FdAddressDict.get(i)
CmdStr += (
'-r', '0x%x' % BaseAddress,
'-s', '0x%x' %Size,
'-s', '0x%x' % Size,
)
return CmdStr