BaseTools: Add a keyword FvNameString in FDF

The keyword with value TRUE OR FALSE is used to
indicate whether the FV UI name is included in
FV EXT header as a entry or not.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18090 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Yingke Liu 2015-07-28 05:53:08 +00:00 committed by yingke
parent 161b8359a8
commit aaf8aa7b2c
3 changed files with 40 additions and 20 deletions

View File

@ -58,6 +58,7 @@ class FvClassObject:
# FvAttributeDict[attribute] = TRUE/FALSE (1/0)
self.FvAttributeDict = {}
self.FvNameGuid = None
self.FvNameString = None
self.AprioriSectionList = []
self.FfsList = []
self.BsBaseAddress = None

View File

@ -2068,9 +2068,12 @@ class FdfParser:
if not (self.__GetBlockStatement(FvObj) or self.__GetFvBaseAddress(FvObj) or
self.__GetFvForceRebase(FvObj) or self.__GetFvAlignment(FvObj) or
self.__GetFvAttributes(FvObj) or self.__GetFvNameGuid(FvObj) or
self.__GetFvExtEntryStatement(FvObj)):
self.__GetFvExtEntryStatement(FvObj) or self.__GetFvNameString(FvObj)):
break
if FvObj.FvNameString == 'TRUE' and not FvObj.FvNameGuid:
raise Warning("FvNameString found but FvNameGuid was not found", self.FileName, self.CurrentLineNumber)
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
@ -2225,6 +2228,21 @@ class FdfParser:
return True
def __GetFvNameString(self, FvObj):
if not self.__IsKeyword( "FvNameString"):
return False
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken() or self.__Token not in ('TRUE', 'FALSE'):
raise Warning("expected TRUE or FALSE for FvNameString", self.FileName, self.CurrentLineNumber)
FvObj.FvNameString = self.__Token
return True
def __GetFvExtEntryStatement(self, FvObj):
if not self.__IsKeyword( "FV_EXT_ENTRY"):

View File

@ -296,25 +296,26 @@ class FV (FvClassObject):
if self.FvNameGuid <> None and self.FvNameGuid <> '':
TotalSize = 16 + 4
Buffer = ''
#
# Create EXT entry for FV UI name
# This GUID is used: A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C
#
FvUiLen = len(self.UiFvName)
TotalSize += (FvUiLen + 16 + 4)
Guid = FV_UI_EXT_ENTY_GUID.split('-')
#
# Layout:
# EFI_FIRMWARE_VOLUME_EXT_ENTRY : size 4
# GUID : size 16
# FV UI name
#
Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
+ pack('=LHHBBBBBBBB', int(Guid[0], 16), int(Guid[1], 16), int(Guid[2], 16),
int(Guid[3][-4:-2], 16), int(Guid[3][-2:], 16), int(Guid[4][-12:-10], 16),
int(Guid[4][-10:-8], 16), int(Guid[4][-8:-6], 16), int(Guid[4][-6:-4], 16),
int(Guid[4][-4:-2], 16), int(Guid[4][-2:], 16))
+ self.UiFvName)
if self.FvNameString == 'TRUE':
#
# Create EXT entry for FV UI name
# This GUID is used: A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C
#
FvUiLen = len(self.UiFvName)
TotalSize += (FvUiLen + 16 + 4)
Guid = FV_UI_EXT_ENTY_GUID.split('-')
#
# Layout:
# EFI_FIRMWARE_VOLUME_EXT_ENTRY : size 4
# GUID : size 16
# FV UI name
#
Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
+ pack('=LHHBBBBBBBB', int(Guid[0], 16), int(Guid[1], 16), int(Guid[2], 16),
int(Guid[3][-4:-2], 16), int(Guid[3][-2:], 16), int(Guid[4][-12:-10], 16),
int(Guid[4][-10:-8], 16), int(Guid[4][-8:-6], 16), int(Guid[4][-6:-4], 16),
int(Guid[4][-4:-2], 16), int(Guid[4][-2:], 16))
+ self.UiFvName)
for Index in range (0, len(self.FvExtEntryType)):
if self.FvExtEntryType[Index] == 'FILE':