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:
@ -58,6 +58,7 @@ class FvClassObject:
|
|||||||
# FvAttributeDict[attribute] = TRUE/FALSE (1/0)
|
# FvAttributeDict[attribute] = TRUE/FALSE (1/0)
|
||||||
self.FvAttributeDict = {}
|
self.FvAttributeDict = {}
|
||||||
self.FvNameGuid = None
|
self.FvNameGuid = None
|
||||||
|
self.FvNameString = None
|
||||||
self.AprioriSectionList = []
|
self.AprioriSectionList = []
|
||||||
self.FfsList = []
|
self.FfsList = []
|
||||||
self.BsBaseAddress = None
|
self.BsBaseAddress = None
|
||||||
|
@ -2068,9 +2068,12 @@ class FdfParser:
|
|||||||
if not (self.__GetBlockStatement(FvObj) or self.__GetFvBaseAddress(FvObj) or
|
if not (self.__GetBlockStatement(FvObj) or self.__GetFvBaseAddress(FvObj) or
|
||||||
self.__GetFvForceRebase(FvObj) or self.__GetFvAlignment(FvObj) or
|
self.__GetFvForceRebase(FvObj) or self.__GetFvAlignment(FvObj) or
|
||||||
self.__GetFvAttributes(FvObj) or self.__GetFvNameGuid(FvObj) or
|
self.__GetFvAttributes(FvObj) or self.__GetFvNameGuid(FvObj) or
|
||||||
self.__GetFvExtEntryStatement(FvObj)):
|
self.__GetFvExtEntryStatement(FvObj) or self.__GetFvNameString(FvObj)):
|
||||||
break
|
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())
|
||||||
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
|
self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
|
||||||
|
|
||||||
@ -2225,6 +2228,21 @@ class FdfParser:
|
|||||||
|
|
||||||
return True
|
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):
|
def __GetFvExtEntryStatement(self, FvObj):
|
||||||
|
|
||||||
if not self.__IsKeyword( "FV_EXT_ENTRY"):
|
if not self.__IsKeyword( "FV_EXT_ENTRY"):
|
||||||
|
@ -296,25 +296,26 @@ class FV (FvClassObject):
|
|||||||
if self.FvNameGuid <> None and self.FvNameGuid <> '':
|
if self.FvNameGuid <> None and self.FvNameGuid <> '':
|
||||||
TotalSize = 16 + 4
|
TotalSize = 16 + 4
|
||||||
Buffer = ''
|
Buffer = ''
|
||||||
#
|
if self.FvNameString == 'TRUE':
|
||||||
# Create EXT entry for FV UI name
|
#
|
||||||
# This GUID is used: A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C
|
# Create EXT entry for FV UI name
|
||||||
#
|
# This GUID is used: A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C
|
||||||
FvUiLen = len(self.UiFvName)
|
#
|
||||||
TotalSize += (FvUiLen + 16 + 4)
|
FvUiLen = len(self.UiFvName)
|
||||||
Guid = FV_UI_EXT_ENTY_GUID.split('-')
|
TotalSize += (FvUiLen + 16 + 4)
|
||||||
#
|
Guid = FV_UI_EXT_ENTY_GUID.split('-')
|
||||||
# Layout:
|
#
|
||||||
# EFI_FIRMWARE_VOLUME_EXT_ENTRY : size 4
|
# Layout:
|
||||||
# GUID : size 16
|
# EFI_FIRMWARE_VOLUME_EXT_ENTRY : size 4
|
||||||
# FV UI name
|
# 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),
|
Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
|
||||||
int(Guid[3][-4:-2], 16), int(Guid[3][-2:], 16), int(Guid[4][-12:-10], 16),
|
+ pack('=LHHBBBBBBBB', int(Guid[0], 16), int(Guid[1], 16), int(Guid[2], 16),
|
||||||
int(Guid[4][-10:-8], 16), int(Guid[4][-8:-6], 16), int(Guid[4][-6:-4], 16),
|
int(Guid[3][-4:-2], 16), int(Guid[3][-2:], 16), int(Guid[4][-12:-10], 16),
|
||||||
int(Guid[4][-4:-2], 16), int(Guid[4][-2:], 16))
|
int(Guid[4][-10:-8], 16), int(Guid[4][-8:-6], 16), int(Guid[4][-6:-4], 16),
|
||||||
+ self.UiFvName)
|
int(Guid[4][-4:-2], 16), int(Guid[4][-2:], 16))
|
||||||
|
+ self.UiFvName)
|
||||||
|
|
||||||
for Index in range (0, len(self.FvExtEntryType)):
|
for Index in range (0, len(self.FvExtEntryType)):
|
||||||
if self.FvExtEntryType[Index] == 'FILE':
|
if self.FvExtEntryType[Index] == 'FILE':
|
||||||
|
Reference in New Issue
Block a user