BaseTools: Remove unused logic for IPF

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
Remove IPF support from BaseTools C code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Feng, Bob C
2019-01-09 14:44:36 +08:00
parent 8229250132
commit 39879ef267
13 changed files with 20 additions and 582 deletions

View File

@ -1,29 +0,0 @@
## @file
# VTF components
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
# Import Modules
#
from CommonDataClass.FdfClass import ComponentStatementClassObject
## VTF components
#
#
class ComponentStatement (ComponentStatementClassObject) :
## The constructor
#
# @param self The object pointer
#
def __init__(self):
ComponentStatementClassObject.__init__(self)

View File

@ -66,9 +66,6 @@ class FD(FDClassObject):
for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
GenFdsGlobalVariable.VerboseLogger(FvObj)
GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################')
self.GenVtfFile()
HasCapsuleRegion = False
for RegionObj in self.RegionList:
if RegionObj.RegionType == 'CAPSULE':
@ -93,7 +90,7 @@ class FD(FDClassObject):
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
if not Flag:
PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
PreviousRegionStart = RegionObj.Offset
PreviousRegionSize = RegionObj.Size
#
@ -102,7 +99,7 @@ class FD(FDClassObject):
if PreviousRegionSize > self.Size:
pass
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
FdBuffer = BytesIO('')
PreviousRegionStart = -1
@ -123,7 +120,7 @@ class FD(FDClassObject):
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
if not Flag:
PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
PreviousRegionStart = RegionObj.Offset
PreviousRegionSize = RegionObj.Size
#
@ -137,7 +134,7 @@ class FD(FDClassObject):
# Call each region's AddToBuffer function
#
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict, Flag=Flag)
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict, Flag=Flag)
#
# Write the buffer contents to Fd file
#
@ -148,51 +145,6 @@ class FD(FDClassObject):
GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
return FdFileName
## generate VTF
#
# @param self The object pointer
#
def GenVtfFile (self) :
#
# Get this Fd's all Fv name
#
FvAddDict ={}
FvList = []
for RegionObj in self.RegionList:
if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
if len(RegionObj.RegionDataList) == 1:
RegionData = RegionObj.RegionDataList[0]
FvList.append(RegionData.upper())
FvAddDict[RegionData.upper()] = (int(self.BaseAddress, 16) + \
RegionObj.Offset, RegionObj.Size)
else:
Offset = RegionObj.Offset
for RegionData in RegionObj.RegionDataList:
FvList.append(RegionData.upper())
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
if len(FvObj.BlockSizeList) < 1:
EdkLogger.error("GenFds", GENFDS_ERROR,
'FV.%s must point out FVs blocksize and Fv BlockNum' \
% FvObj.UiFvName)
else:
Size = 0
for blockStatement in FvObj.BlockSizeList:
Size = Size + blockStatement[0] * blockStatement[1]
FvAddDict[RegionData.upper()] = (int(self.BaseAddress, 16) + \
Offset, Size)
Offset = Offset + Size
#
# Check whether this Fd need VTF
#
Flag = False
for VtfObj in GenFdsGlobalVariable.FdfParser.Profile.VtfList:
compLocList = VtfObj.GetFvList()
if set(compLocList).issubset(FvList):
Flag = True
break
if Flag == True:
self.vtfRawDict = VtfObj.GenVtf(FvAddDict)
## generate flash map file
#
# @param self The object pointer

View File

@ -53,8 +53,6 @@ from .CapsuleData import CapsuleFfs, CapsulePayload, CapsuleFv, CapsuleFd, Capsu
from .RuleComplexFile import RuleComplexFile
from .RuleSimpleFile import RuleSimpleFile
from .EfiSection import EfiSection
from .Vtf import Vtf
from .ComponentStatement import ComponentStatement
from .OptionRom import OPTIONROM
from .OptRomInfStatement import OptRomInfStatement, OverrideAttribs
from .OptRomFileStatement import OptRomFileStatement
@ -234,7 +232,6 @@ class FileProfile:
self.FdNameNotSet = False
self.FvDict = {}
self.CapsuleDict = {}
self.VtfList = []
self.RuleDict = {}
self.OptRomDict = {}
self.FmpPayloadDict = {}
@ -478,7 +475,6 @@ class FdfParser:
# [FV.UiName]
# [Capsule.UiName]
# [Rule]: don't take rule section into account, macro is not allowed in this section
# [VTF.arch.UiName, arch]
# [OptionRom.DriverName]
self._CurSection = []
Section = Section.strip()[1:-1].upper().replace(' ', '').strip(TAB_SPLIT)
@ -489,12 +485,6 @@ class FdfParser:
if Item == TAB_COMMON_DEFINES.upper():
self._CurSection = [TAB_COMMON, TAB_COMMON, TAB_COMMON]
elif Item == 'VTF' and len(ItemList) == 3:
UiName = ItemList[2]
Pos = UiName.find(TAB_COMMA_SPLIT)
if Pos != -1:
UiName = UiName[:Pos]
self._CurSection = ['VTF', UiName, ItemList[1]]
elif len(ItemList) > 1:
self._CurSection = [ItemList[0], ItemList[1], TAB_COMMON]
elif len(ItemList) > 0:
@ -1330,7 +1320,7 @@ class FdfParser:
#
# Keep processing sections of the FDF until no new sections or a syntax error is found
#
while self._GetFd() or self._GetFv() or self._GetFmp() or self._GetCapsule() or self._GetVtf() or self._GetRule() or self._GetOptionRom():
while self._GetFd() or self._GetFv() or self._GetFmp() or self._GetCapsule() or self._GetRule() or self._GetOptionRom():
pass
except Warning as X:
@ -1358,8 +1348,8 @@ class FdfParser:
def SectionParser(self, section):
S = section.upper()
if not S.startswith("[DEFINES") and not S.startswith("[FD.") and not S.startswith("[FV.") and not S.startswith("[CAPSULE.") \
and not S.startswith("[VTF.") and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM.") and not S.startswith('[FMPPAYLOAD.'):
raise Warning("Unknown section or section appear sequence error (The correct sequence should be [DEFINES], [FD.], [FV.], [Capsule.], [VTF.], [Rule.], [OptionRom.], [FMPPAYLOAD.])", self.FileName, self.CurrentLineNumber)
and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM.") and not S.startswith('[FMPPAYLOAD.'):
raise Warning("Unknown section or section appear sequence error (The correct sequence should be [DEFINES], [FD.], [FV.], [Capsule.], [Rule.], [OptionRom.], [FMPPAYLOAD.])", self.FileName, self.CurrentLineNumber)
## _GetDefines() method
#
@ -1432,7 +1422,7 @@ class FdfParser:
S = self._Token.upper()
if S.startswith(TAB_SECTION_START) and not S.startswith("[FD."):
if not S.startswith("[FV.") and not S.startswith('[FMPPAYLOAD.') and not S.startswith("[CAPSULE.") \
and not S.startswith("[VTF.") and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM."):
and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM."):
raise Warning("Unknown section", self.FileName, self.CurrentLineNumber)
self._UndoToken()
return False
@ -4081,211 +4071,6 @@ class FdfParser:
return False
## _GetVtf() method
#
# Get VTF section contents and store its data into VTF list of self.Profile
#
# @param self The object pointer
# @retval True Successfully find a VTF
# @retval False Not able to find a VTF
#
def _GetVtf(self):
HW_ARCH_SET = {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM, TAB_ARCH_AARCH64}
if not self._GetNextToken():
return False
S = self._Token.upper()
if S.startswith(TAB_SECTION_START) and not S.startswith("[VTF."):
self.SectionParser(S)
self._UndoToken()
return False
self._UndoToken()
if not self._IsToken("[VTF.", True):
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
#print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \
# % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)
raise Warning.Expected("[VTF.]", self.FileName, self.CurrentLineNumber)
if not self._SkipToToken(TAB_SPLIT):
raise Warning.Expected("'.'", self.FileName, self.CurrentLineNumber)
Arch = self._SkippedChars.rstrip(TAB_SPLIT).upper()
if Arch not in HW_ARCH_SET:
raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.CurrentLineNumber)
if not self._GetNextWord():
raise Warning.Expected("VTF name", self.FileName, self.CurrentLineNumber)
Name = self._Token.upper()
VtfObj = Vtf()
VtfObj.UiName = Name
VtfObj.KeyArch = Arch
if self._IsToken(TAB_COMMA_SPLIT):
if not self._GetNextWord():
raise Warning.Expected("Arch list", self.FileName, self.CurrentLineNumber)
if self._Token.upper() not in HW_ARCH_SET:
raise Warning("Unknown Arch '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
VtfObj.ArchList = self._Token.upper()
if not self._IsToken(TAB_SECTION_END):
raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
if self._IsKeyword("IA32_RST_BIN"):
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextToken():
raise Warning.Expected("Reset file", self.FileName, self.CurrentLineNumber)
VtfObj.ResetBin = self._Token
if VtfObj.ResetBin.replace(TAB_WORKSPACE, '').find('$') == -1:
#check for file path
ErrorCode, ErrorInfo = PathClass(NormPath(VtfObj.ResetBin), GenFdsGlobalVariable.WorkSpaceDir).Validate()
if ErrorCode != 0:
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
while self._GetComponentStatement(VtfObj):
pass
self.Profile.VtfList.append(VtfObj)
return True
## _GetComponentStatement() method
#
# Get components in VTF
#
# @param self The object pointer
# @param VtfObj for whom component is got
# @retval True Successfully find a component
# @retval False Not able to find a component
#
def _GetComponentStatement(self, VtfObj):
if not self._IsKeyword("COMP_NAME"):
return False
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextWord():
raise Warning.Expected("Component Name", self.FileName, self.CurrentLineNumber)
CompStatementObj = ComponentStatement()
CompStatementObj.CompName = self._Token
if not self._IsKeyword("COMP_LOC"):
raise Warning.Expected("COMP_LOC", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
CompStatementObj.CompLoc = ""
if self._GetNextWord():
CompStatementObj.CompLoc = self._Token
if self._IsToken(TAB_VALUE_SPLIT):
if not self._GetNextWord():
raise Warning.Expected("Region Name", self.FileName, self.CurrentLineNumber)
if self._Token not in {"F", "N", "S"}: #, "H", "L", "PH", "PL"): not support
raise Warning("Unknown location type '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
CompStatementObj.FilePos = self._Token
else:
self.CurrentLineNumber += 1
self.CurrentOffsetWithinLine = 0
if not self._IsKeyword("COMP_TYPE"):
raise Warning.Expected("COMP_TYPE", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextToken():
raise Warning.Expected("Component type", self.FileName, self.CurrentLineNumber)
if self._Token not in {"FIT", "PAL_B", "PAL_A", "OEM"}:
if not self._Token.startswith("0x") or len(self._Token) < 3 or len(self._Token) > 4 or \
not self._Token[2] in hexdigits or not self._Token[-1] in hexdigits:
raise Warning("Unknown location type '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
CompStatementObj.CompType = self._Token
if not self._IsKeyword("COMP_VER"):
raise Warning.Expected("COMP_VER", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextToken():
raise Warning.Expected("Component version", self.FileName, self.CurrentLineNumber)
Pattern = compile('-$|[0-9a-fA-F]{1,2}\.[0-9a-fA-F]{1,2}$', DOTALL)
if Pattern.match(self._Token) is None:
raise Warning("Unknown version format '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
CompStatementObj.CompVer = self._Token
if not self._IsKeyword("COMP_CS"):
raise Warning.Expected("COMP_CS", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextToken():
raise Warning.Expected("Component CS", self.FileName, self.CurrentLineNumber)
if self._Token not in {"1", "0"}:
raise Warning("Unknown Component CS '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
CompStatementObj.CompCs = self._Token
if not self._IsKeyword("COMP_BIN"):
raise Warning.Expected("COMP_BIN", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextToken():
raise Warning.Expected("Component file", self.FileName, self.CurrentLineNumber)
CompStatementObj.CompBin = self._Token
if CompStatementObj.CompBin != '-' and CompStatementObj.CompBin.replace(TAB_WORKSPACE, '').find('$') == -1:
#check for file path
ErrorCode, ErrorInfo = PathClass(NormPath(CompStatementObj.CompBin), GenFdsGlobalVariable.WorkSpaceDir).Validate()
if ErrorCode != 0:
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
if not self._IsKeyword("COMP_SYM"):
raise Warning.Expected("COMP_SYM", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if not self._GetNextToken():
raise Warning.Expected("Component symbol file", self.FileName, self.CurrentLineNumber)
CompStatementObj.CompSym = self._Token
if CompStatementObj.CompSym != '-' and CompStatementObj.CompSym.replace(TAB_WORKSPACE, '').find('$') == -1:
#check for file path
ErrorCode, ErrorInfo = PathClass(NormPath(CompStatementObj.CompSym), GenFdsGlobalVariable.WorkSpaceDir).Validate()
if ErrorCode != 0:
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
if not self._IsKeyword("COMP_SIZE"):
raise Warning.Expected("COMP_SIZE", self.FileName, self.CurrentLineNumber)
if not self._IsToken(TAB_EQUAL_SPLIT):
raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
if self._IsToken("-"):
CompStatementObj.CompSize = self._Token
elif self._GetNextDecimalNumber():
CompStatementObj.CompSize = self._Token
elif self._GetNextHexNumber():
CompStatementObj.CompSize = self._Token
else:
raise Warning("Unknown size '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
VtfObj.ComponentStatementList.append(CompStatementObj)
return True
## _GetOptionRom() method
#
# Get OptionROM section contents and store its data into OptionROM list of self.Profile

View File

@ -74,11 +74,10 @@ class FV (object):
# @param BlockSize block size of FV
# @param BlockNum How many blocks in FV
# @param ErasePolarity Flash erase polarity
# @param VtfDict VTF objects
# @param MacroDict macro value pair
# @retval string Generated FV file path
#
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False):
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', MacroDict = {}, Flag=False):
if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFdsGlobalVariable.ImageBinDict:
return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv']
@ -105,7 +104,7 @@ class FV (object):
if self.FvBaseAddress is not None:
BaseAddress = self.FvBaseAddress
if not Flag:
self._InitializeInf(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)
self._InitializeInf(BaseAddress, BlockSize, BlockNum, ErasePloarity)
#
# First Process the Apriori section
#
@ -270,9 +269,8 @@ class FV (object):
# @param BlockSize block size of FV
# @param BlockNum How many blocks in FV
# @param ErasePolarity Flash erase polarity
# @param VtfDict VTF objects
#
def _InitializeInf (self, BaseAddress = None, BlockSize= None, BlockNum = None, ErasePloarity='1', VtfDict=None):
def _InitializeInf (self, BaseAddress = None, BlockSize= None, BlockNum = None, ErasePloarity='1'):
#
# Create FV inf file
#
@ -435,7 +433,3 @@ class FV (object):
# Add [Files]
#
self.FvInfFile.writelines("[files]" + TAB_LINE_BREAK)
if VtfDict and self.UiFvName in VtfDict:
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
VtfDict[self.UiFvName] + \
TAB_LINE_BREAK)

View File

@ -81,7 +81,6 @@ def resetFdsGlobalVariable():
GenFdsGlobalVariable.ToolChainTag = ''
GenFdsGlobalVariable.RuleDict = {}
GenFdsGlobalVariable.ArchList = None
GenFdsGlobalVariable.VtfDict = {}
GenFdsGlobalVariable.ActivePlatform = None
GenFdsGlobalVariable.FvAddressFileName = ''
GenFdsGlobalVariable.VerboseMode = False
@ -251,15 +250,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
if len(List) == 2:
if not List[1].strip():
EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="No Value given for Macro %s" %List[0])
if List[0].strip() == "EFI_SOURCE":
GlobalData.gEfiSource = List[1].strip()
GlobalData.gGlobalDefines["EFI_SOURCE"] = GlobalData.gEfiSource
continue
elif List[0].strip() == "EDK_SOURCE":
GlobalData.gEdkSource = List[1].strip()
GlobalData.gGlobalDefines["EDK_SOURCE"] = GlobalData.gEdkSource
continue
elif List[0].strip() in ["WORKSPACE", "TARGET", "TOOLCHAIN"]:
if List[0].strip() in ["WORKSPACE", "TARGET", "TOOLCHAIN"]:
GlobalData.gGlobalDefines[List[0].strip()] = List[1].strip()
else:
GlobalData.gCommandLineDefines[List[0].strip()] = List[1].strip()

View File

@ -56,7 +56,6 @@ class GenFdsGlobalVariable:
ToolChainTag = ''
RuleDict = {}
ArchList = None
VtfDict = {}
ActivePlatform = None
FvAddressFileName = ''
VerboseMode = False

View File

@ -75,12 +75,11 @@ class Region(object):
# @param BlockSize block size of region
# @param BlockNum How many blocks in region
# @param ErasePolarity Flash erase polarity
# @param VtfDict VTF objects
# @param MacroDict macro value pair
# @retval string Generated FV file path
#
def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict=None, MacroDict={}, Flag=False):
def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, MacroDict={}, Flag=False):
Size = self.Size
if not Flag:
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
@ -136,7 +135,7 @@ class Region(object):
FvBaseAddress = '0x%X' % self.FvAddress
BlockSize = None
BlockNum = None
FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict, Flag=Flag)
FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, Flag=Flag)
if Flag:
continue

View File

@ -1,200 +0,0 @@
## @file
# process VTF generation
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
# Import Modules
#
from __future__ import absolute_import
from .GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import TAB_LINE_BREAK
## generate VTF
#
#
class Vtf (object):
## The constructor
#
# @param self The object pointer
#
def __init__(self):
self.KeyArch = None
self.ArchList = None
self.UiName = None
self.ResetBin = None
self.ComponentStatementList = []
## GenVtf() method
#
# Generate VTF
#
# @param self The object pointer
# @param FdAddressDict dictionary contains FV name and its base address
# @retval Dict FV and corresponding VTF file name
#
def GenVtf(self, FdAddressDict) :
self.GenBsfInf()
BaseAddArg = self.GetBaseAddressArg(FdAddressDict)
OutputArg, VtfRawDict = self.GenOutputArg()
Cmd = (
'GenVtf',
) + OutputArg + (
'-f', self.BsfInfName,
) + BaseAddArg
GenFdsGlobalVariable.CallExternalTool(Cmd, "GenFv -Vtf Failed!")
GenFdsGlobalVariable.SharpCounter = 0
return VtfRawDict
## GenBsfInf() method
#
# Generate inf used to generate VTF
#
# @param self The object pointer
#
def GenBsfInf (self):
FvList = self.GetFvList()
self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')
BsfInf = open(self.BsfInfName, 'w+')
if self.ResetBin:
BsfInf.writelines ("[OPTIONS]" + TAB_LINE_BREAK)
BsfInf.writelines ("IA32_RST_BIN" + \
" = " + \
GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.ResetBin)) + \
TAB_LINE_BREAK)
BsfInf.writelines (TAB_LINE_BREAK)
BsfInf.writelines ("[COMPONENTS]" + TAB_LINE_BREAK)
for ComponentObj in self.ComponentStatementList :
BsfInf.writelines ("COMP_NAME" + \
" = " + \
ComponentObj.CompName + \
TAB_LINE_BREAK)
if ComponentObj.CompLoc.upper() == 'NONE':
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'N' + \
TAB_LINE_BREAK)
elif ComponentObj.FilePos:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
ComponentObj.FilePos + \
TAB_LINE_BREAK)
else:
Index = FvList.index(ComponentObj.CompLoc.upper())
if Index == 0:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'F' + \
TAB_LINE_BREAK)
elif Index == 1:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'S' + \
TAB_LINE_BREAK)
BsfInf.writelines ("COMP_TYPE" + \
" = " + \
ComponentObj.CompType + \
TAB_LINE_BREAK)
BsfInf.writelines ("COMP_VER" + \
" = " + \
ComponentObj.CompVer + \
TAB_LINE_BREAK)
BsfInf.writelines ("COMP_CS" + \
" = " + \
ComponentObj.CompCs + \
TAB_LINE_BREAK)
BinPath = ComponentObj.CompBin
if BinPath != '-':
BinPath = GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(BinPath))
BsfInf.writelines ("COMP_BIN" + \
" = " + \
BinPath + \
TAB_LINE_BREAK)
SymPath = ComponentObj.CompSym
if SymPath != '-':
SymPath = GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(SymPath))
BsfInf.writelines ("COMP_SYM" + \
" = " + \
SymPath + \
TAB_LINE_BREAK)
BsfInf.writelines ("COMP_SIZE" + \
" = " + \
ComponentObj.CompSize + \
TAB_LINE_BREAK)
BsfInf.writelines (TAB_LINE_BREAK)
BsfInf.close()
## GenFvList() method
#
# Get FV list referenced by VTF components
#
# @param self The object pointer
#
def GetFvList(self):
FvList = []
for component in self.ComponentStatementList :
if component.CompLoc.upper() != 'NONE' and not (component.CompLoc.upper() in FvList):
FvList.append(component.CompLoc.upper())
return FvList
## GetBaseAddressArg() method
#
# Get base address arguments for GenVtf
#
# @param self The object pointer
#
def GetBaseAddressArg(self, FdAddressDict):
FvList = self.GetFvList()
CmdStr = tuple()
for i in FvList:
(BaseAddress, Size) = FdAddressDict.get(i)
CmdStr += (
'-r', '0x%x' % BaseAddress,
'-s', '0x%x' % Size,
)
return CmdStr
## GenOutputArg() method
#
# Get output arguments for GenVtf
#
# @param self The object pointer
#
def GenOutputArg(self):
FvVtfDict = {}
OutputFileName = ''
FvList = self.GetFvList()
Index = 0
Arg = tuple()
for FvObj in FvList:
Index = Index + 1
OutputFileName = 'Vtf%d.raw' % Index
OutputFileName = os.path.join(GenFdsGlobalVariable.FvDir, OutputFileName)
Arg += ('-o', OutputFileName)
FvVtfDict[FvObj.upper()] = OutputFileName
return Arg, FvVtfDict