diff options
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Fv.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/Fv.py | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index c66fc38327..30525bd11f 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import
## @file
# process FV generation
#
@@ -16,16 +15,13 @@ from __future__ import absolute_import ##
# Import Modules
#
+from __future__ import absolute_import
import Common.LongFilePathOs as os
import subprocess
from io import BytesIO
from struct import *
-
-from . import Ffs
-from . import AprioriSection
from . import FfsFileStatement
from .GenFdsGlobalVariable import GenFdsGlobalVariable
-from CommonDataClass.FdfClass import FvClassObject
from Common.Misc import SaveFileOnChange, PackGUID
from Common.LongFilePathSupport import CopyLongFilePath
from Common.LongFilePathSupport import OpenLongFilePath as open
@@ -36,13 +32,25 @@ FV_UI_EXT_ENTY_GUID = 'A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C' ## generate FV
#
#
-class FV (FvClassObject):
+class FV (object):
## The constructor
#
# @param self The object pointer
#
def __init__(self):
- FvClassObject.__init__(self)
+ self.UiFvName = None
+ self.CreateFileName = None
+ self.BlockSizeList = []
+ self.DefineVarDict = {}
+ self.SetVarDict = {}
+ self.FvAlignment = None
+ self.FvAttributeDict = {}
+ self.FvNameGuid = None
+ self.FvNameString = None
+ self.AprioriSectionList = []
+ self.FfsList = []
+ self.BsBaseAddress = None
+ self.RtBaseAddress = None
self.FvInfFile = None
self.FvAddressFile = None
self.BaseAddress = None
@@ -68,7 +76,7 @@ class FV (FvClassObject): # @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', VtfDict=None, MacroDict = {}, Flag=False):
if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFdsGlobalVariable.ImageBinDict:
return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv']
@@ -96,7 +104,7 @@ class FV (FvClassObject): 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, VtfDict)
#
# First Process the Apriori section
#
@@ -114,7 +122,7 @@ class FV (FvClassObject): TAB_LINE_BREAK)
# Process Modules in FfsList
- for FfsFile in self.FfsList :
+ for FfsFile in self.FfsList:
if Flag:
if isinstance(FfsFile, FfsFileStatement.FileStatement):
continue
@@ -177,7 +185,7 @@ class FV (FvClassObject): if FvChildAddr != []:
# Update Ffs again
- for FfsFile in self.FfsList :
+ for FfsFile in self.FfsList:
FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
@@ -252,7 +260,7 @@ class FV (FvClassObject): return True
return False
- ## __InitializeInf__()
+ ## _InitializeInf()
#
# Initilize the inf file to create FV
#
@@ -263,7 +271,7 @@ class FV (FvClassObject): # @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', VtfDict=None):
#
# Create FV inf file
#
@@ -275,7 +283,7 @@ class FV (FvClassObject): # Add [Options]
#
self.FvInfFile.writelines("[options]" + TAB_LINE_BREAK)
- if BaseAddress is not None :
+ if BaseAddress is not None:
self.FvInfFile.writelines("EFI_BASE_ADDRESS = " + \
BaseAddress + \
TAB_LINE_BREAK)
@@ -294,7 +302,7 @@ class FV (FvClassObject): #set default block size is 1
self.FvInfFile.writelines("EFI_BLOCK_SIZE = 0x1" + TAB_LINE_BREAK)
- for BlockSize in self.BlockSizeList :
+ for BlockSize in self.BlockSizeList:
if BlockSize[0] is not None:
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
'0x%X' %BlockSize[0] + \
@@ -320,9 +328,9 @@ class FV (FvClassObject): ' %s' %ErasePloarity + \
TAB_LINE_BREAK)
if not (self.FvAttributeDict is None):
- for FvAttribute in self.FvAttributeDict.keys() :
+ for FvAttribute in self.FvAttributeDict.keys():
if FvAttribute == "FvUsedSizeEnable":
- if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1') :
+ if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1'):
self.UsedSizeEnable = True
continue
self.FvInfFile.writelines("EFI_" + \
@@ -365,8 +373,8 @@ class FV (FvClassObject): Guid = FV_UI_EXT_ENTY_GUID.split('-')
#
# Layout:
- # EFI_FIRMWARE_VOLUME_EXT_ENTRY : size 4
- # GUID : size 16
+ # EFI_FIRMWARE_VOLUME_EXT_ENTRY: size 4
+ # GUID: size 16
# FV UI name
#
Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
@@ -422,7 +430,6 @@ class FV (FvClassObject): FvExtHeaderFileName + \
TAB_LINE_BREAK)
-
#
# Add [Files]
#
|