Sync BaseTool trunk (version r2640) into EDKII BaseTools.
Signed-off-by: Gao, Liming <liming.gao@intel.com> Reviewed-by: Liu, Jiang A <jiang.a.liu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15089 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# generate capsule
|
||||
#
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007-2013, 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
|
||||
@ -133,5 +133,25 @@ class CapsuleAnyFile (CapsuleData):
|
||||
# @param self The object pointer
|
||||
# @retval string Generated file name
|
||||
#
|
||||
def GenCapsuleSubItem(self):
|
||||
return self.FileName
|
||||
|
||||
## Afile class for capsule data
|
||||
#
|
||||
#
|
||||
class CapsuleAfile (CapsuleData):
|
||||
## The constructor
|
||||
#
|
||||
# @param self The object pointer
|
||||
#
|
||||
def __init__(self) :
|
||||
self.Ffs = None
|
||||
self.FileName = None
|
||||
|
||||
## generate Afile capsule data
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @retval string Generated file name
|
||||
#
|
||||
def GenCapsuleSubItem(self):
|
||||
return self.FileName
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# parse FDF file
|
||||
#
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2014, 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
|
||||
@ -77,6 +77,7 @@ SEPERATOR_TUPLE = ('=', '|', ',', '{', '}')
|
||||
|
||||
RegionSizePattern = re.compile("\s*(?P<base>(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P<size>(?:0x|0X)?[a-fA-F0-9]+)\s*")
|
||||
RegionSizeGuidPattern = re.compile("\s*(?P<base>\w+\.\w+)\s*\|\s*(?P<size>\w+\.\w+)\s*")
|
||||
RegionOffsetPcdPattern = re.compile("\s*(?P<base>\w+\.\w+)\s*$")
|
||||
ShortcutPcdPattern = re.compile("\s*\w+\s*=\s*(?P<value>(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P<name>\w+\.\w+)\s*")
|
||||
|
||||
IncludeFileList = []
|
||||
@ -1732,8 +1733,7 @@ class FdfParser:
|
||||
try:
|
||||
return long(
|
||||
ValueExpression(Expr,
|
||||
dict(['%s.%s' % (Pcd[1], Pcd[0]), Val]
|
||||
for Pcd, Val in self.Profile.PcdDict.iteritems())
|
||||
self.__CollectMacroPcd()
|
||||
)(True),0)
|
||||
except Exception:
|
||||
self.SetFileBufferPos(StartPos)
|
||||
@ -1769,16 +1769,26 @@ class FdfParser:
|
||||
return True
|
||||
|
||||
if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE"):
|
||||
#
|
||||
# If next token is a word which is not a valid FV type, it might be part of [PcdOffset[|PcdSize]]
|
||||
# Or it might be next region's offset described by an expression which starts with a PCD.
|
||||
# PcdOffset[|PcdSize] or OffsetPcdExpression|Size
|
||||
#
|
||||
self.__UndoToken()
|
||||
RegionObj.PcdOffset = self.__GetNextPcdName()
|
||||
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[RegionObj.PcdOffset] = FileLineTuple
|
||||
if self.__IsToken( "|"):
|
||||
RegionObj.PcdSize = self.__GetNextPcdName()
|
||||
self.Profile.PcdDict[RegionObj.PcdSize] = "0x%08X" % RegionObj.Size
|
||||
IsRegionPcd = (RegionSizeGuidPattern.match(self.__CurrentLine()[self.CurrentOffsetWithinLine:]) or
|
||||
RegionOffsetPcdPattern.match(self.__CurrentLine()[self.CurrentOffsetWithinLine:]))
|
||||
if IsRegionPcd:
|
||||
RegionObj.PcdOffset = self.__GetNextPcdName()
|
||||
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))
|
||||
self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], RegionObj.PcdOffset[0])] = "0x%x" % RegionObj.Offset
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[RegionObj.PcdSize] = FileLineTuple
|
||||
self.Profile.PcdFileLineDict[RegionObj.PcdOffset] = FileLineTuple
|
||||
if self.__IsToken( "|"):
|
||||
RegionObj.PcdSize = self.__GetNextPcdName()
|
||||
self.Profile.PcdDict[RegionObj.PcdSize] = "0x%08X" % RegionObj.Size
|
||||
self.__PcdDict['%s.%s' % (RegionObj.PcdSize[1], RegionObj.PcdSize[0])] = "0x%x" % RegionObj.Size
|
||||
FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
|
||||
self.Profile.PcdFileLineDict[RegionObj.PcdSize] = FileLineTuple
|
||||
|
||||
if not self.__GetNextWord():
|
||||
return True
|
||||
@ -1805,6 +1815,9 @@ class FdfParser:
|
||||
self.__UndoToken()
|
||||
self.__GetRegionDataType( RegionObj)
|
||||
else:
|
||||
self.__UndoToken()
|
||||
if self.__GetRegionLayout(Fd):
|
||||
return True
|
||||
raise Warning("A valid region type was not found. "
|
||||
"Valid types are [SET, FV, CAPSULE, FILE, DATA]. This error occurred",
|
||||
self.FileName, self.CurrentLineNumber)
|
||||
@ -2158,8 +2171,9 @@ class FdfParser:
|
||||
# @retval None
|
||||
#
|
||||
def __GetFvAttributes(self, FvObj):
|
||||
|
||||
IsWordToken = False
|
||||
while self.__GetNextWord():
|
||||
IsWordToken = True
|
||||
name = self.__Token
|
||||
if name not in ("ERASE_POLARITY", "MEMORY_MAPPED", \
|
||||
"STICKY_WRITE", "LOCK_CAP", "LOCK_STATUS", "WRITE_ENABLED_CAP", \
|
||||
@ -2178,7 +2192,7 @@ class FdfParser:
|
||||
|
||||
FvObj.FvAttributeDict[name] = self.__Token
|
||||
|
||||
return True
|
||||
return IsWordToken
|
||||
|
||||
## __GetFvNameGuid() method
|
||||
#
|
||||
@ -2562,22 +2576,7 @@ class FdfParser:
|
||||
FfsFileObj.CurrentLineNum = self.CurrentLineNumber
|
||||
FfsFileObj.CurrentLineContent = self.__CurrentLine()
|
||||
FfsFileObj.FileName = self.__Token
|
||||
if FfsFileObj.FileName.replace('$(WORKSPACE)', '').find('$') == -1:
|
||||
#
|
||||
# For file in OUTPUT_DIRECTORY will not check whether it exist or not at AutoGen phase.
|
||||
#
|
||||
if not GlobalData.gAutoGenPhase:
|
||||
#do case sensitive check for file path
|
||||
ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
|
||||
if ErrorCode != 0:
|
||||
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
|
||||
else:
|
||||
if not self.__GetMacroValue("OUTPUT_DIRECTORY") in FfsFileObj.FileName:
|
||||
#do case sensitive check for file path
|
||||
ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
|
||||
if ErrorCode != 0:
|
||||
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
|
||||
|
||||
self.__VerifyFile(FfsFileObj.FileName)
|
||||
|
||||
if not self.__IsToken( "}"):
|
||||
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
|
||||
@ -2823,11 +2822,7 @@ class FdfParser:
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected section file path", self.FileName, self.CurrentLineNumber)
|
||||
DataSectionObj.SectFileName = self.__Token
|
||||
if DataSectionObj.SectFileName.replace('$(WORKSPACE)', '').find('$') == -1:
|
||||
#do case sensitive check for file path
|
||||
ErrorCode, ErrorInfo = PathClass(NormPath(DataSectionObj.SectFileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
|
||||
if ErrorCode != 0:
|
||||
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
|
||||
self.__VerifyFile(DataSectionObj.SectFileName)
|
||||
else:
|
||||
if not self.__GetCglSection(DataSectionObj):
|
||||
return False
|
||||
@ -2836,6 +2831,21 @@ class FdfParser:
|
||||
|
||||
return True
|
||||
|
||||
## __VerifyFile
|
||||
#
|
||||
# Check if file exists or not:
|
||||
# If current phase if GenFds, the file must exist;
|
||||
# If current phase is AutoGen and the file is not in $(OUTPUT_DIRECTORY), the file must exist
|
||||
# @param FileName: File path to be verified.
|
||||
#
|
||||
def __VerifyFile(self, FileName):
|
||||
if FileName.replace('$(WORKSPACE)', '').find('$') != -1:
|
||||
return
|
||||
if not GlobalData.gAutoGenPhase or not self.__GetMacroValue("OUTPUT_DIRECTORY") in FileName:
|
||||
ErrorCode, ErrorInfo = PathClass(NormPath(FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
|
||||
if ErrorCode != 0:
|
||||
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
|
||||
|
||||
## __GetCglSection() method
|
||||
#
|
||||
# Get compressed or GUIDed section for Obj
|
||||
@ -3066,12 +3076,14 @@ class FdfParser:
|
||||
Value += self.__Token.strip()
|
||||
elif Name == 'OEM_CAPSULE_FLAGS':
|
||||
Value = self.__Token.strip()
|
||||
if not Value.upper().startswith('0X'):
|
||||
raise Warning("expected hex value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
try:
|
||||
Value = int(Value, 0)
|
||||
except ValueError:
|
||||
raise Warning("expected integer value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
raise Warning("expected hex value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
if not 0x0000 <= Value <= 0xFFFF:
|
||||
raise Warning("expected integer value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
raise Warning("expected hex value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
|
||||
Value = self.__Token.strip()
|
||||
else:
|
||||
Value = self.__Token.strip()
|
||||
@ -3095,7 +3107,8 @@ class FdfParser:
|
||||
IsFv = self.__GetFvStatement(Obj)
|
||||
IsFd = self.__GetFdStatement(Obj)
|
||||
IsAnyFile = self.__GetAnyFileStatement(Obj)
|
||||
if not (IsInf or IsFile or IsFv or IsFd or IsAnyFile):
|
||||
IsAfile = self.__GetAfileStatement(Obj)
|
||||
if not (IsInf or IsFile or IsFv or IsFd or IsAnyFile or IsAfile):
|
||||
break
|
||||
|
||||
## __GetFvStatement() method
|
||||
@ -3187,6 +3200,47 @@ class FdfParser:
|
||||
CapsuleAnyFile.FileName = AnyFileName
|
||||
CapsuleObj.CapsuleDataList.append(CapsuleAnyFile)
|
||||
return True
|
||||
|
||||
## __GetAfileStatement() method
|
||||
#
|
||||
# Get Afile for capsule
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @param CapsuleObj for whom Afile is got
|
||||
# @retval True Successfully find a Afile statement
|
||||
# @retval False Not able to find a Afile statement
|
||||
#
|
||||
def __GetAfileStatement(self, CapsuleObj):
|
||||
|
||||
if not self.__IsKeyword("APPEND"):
|
||||
return False
|
||||
|
||||
if not self.__IsToken("="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected Afile name", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
AfileName = self.__Token
|
||||
AfileBaseName = os.path.basename(AfileName)
|
||||
|
||||
if os.path.splitext(AfileBaseName)[1] not in [".bin",".BIN",".Bin",".dat",".DAT",".Dat",".data",".DATA",".Data"]:
|
||||
raise Warning('invalid binary file type, should be one of "bin","BIN","Bin","dat","DAT","Dat","data","DATA","Data"', \
|
||||
self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not os.path.isabs(AfileName):
|
||||
AfileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(AfileName)
|
||||
self.__VerifyFile(AfileName)
|
||||
else:
|
||||
if not os.path.exists(AfileName):
|
||||
raise Warning('%s does not exist' % AfileName, self.FileName, self.CurrentLineNumber)
|
||||
else:
|
||||
pass
|
||||
|
||||
CapsuleAfile = CapsuleData.CapsuleAfile()
|
||||
CapsuleAfile.FileName = AfileName
|
||||
CapsuleObj.CapsuleDataList.append(CapsuleAfile)
|
||||
return True
|
||||
|
||||
## __GetRule() method
|
||||
#
|
||||
|
@ -43,6 +43,8 @@ from PatchPcdValue.PatchPcdValue import PatchBinaryFile
|
||||
#
|
||||
#
|
||||
class FfsInfStatement(FfsInfStatementClassObject):
|
||||
## The mapping dictionary from datum type to its maximum number.
|
||||
_MAX_SIZE_TYPE = {"BOOLEAN":0x01, "UINT8":0xFF, "UINT16":0xFFFF, "UINT32":0xFFFFFFFF, "UINT64":0xFFFFFFFFFFFFFFFF}
|
||||
## The constructor
|
||||
#
|
||||
# @param self The object pointer
|
||||
@ -204,10 +206,15 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
|
||||
if Inf._Defs != None and len(Inf._Defs) > 0:
|
||||
self.OptRomDefs.update(Inf._Defs)
|
||||
|
||||
self.PatchPcds = []
|
||||
InfPcds = Inf.Pcds
|
||||
Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
FdfPcdDict = GenFdsGlobalVariable.FdfParser.Profile.PcdDict
|
||||
|
||||
# Workaround here: both build and GenFds tool convert the workspace path to lower case
|
||||
# But INF file path in FDF and DSC file may have real case characters.
|
||||
# Try to convert the path to lower case to see if PCDs value are override by DSC.
|
||||
DscModules = {}
|
||||
for DscModule in Platform.Modules:
|
||||
DscModules[str(DscModule).lower()] = Platform.Modules[DscModule]
|
||||
@ -217,6 +224,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
continue
|
||||
if Pcd.Type != 'PatchableInModule':
|
||||
continue
|
||||
# Override Patchable PCD value by the value from DSC
|
||||
PatchPcd = None
|
||||
InfLowerPath = str(PathClassObj).lower()
|
||||
if InfLowerPath in DscModules and PcdKey in DscModules[InfLowerPath].Pcds:
|
||||
@ -227,16 +235,22 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
if PatchPcd and Pcd.Type == PatchPcd.Type:
|
||||
DefaultValue = PatchPcd.DefaultValue
|
||||
DscOverride = True
|
||||
|
||||
# Override Patchable PCD value by the value from FDF
|
||||
FdfOverride = False
|
||||
if PcdKey in FdfPcdDict:
|
||||
DefaultValue = FdfPcdDict[PcdKey]
|
||||
FdfOverride = True
|
||||
|
||||
if not DscOverride and not FdfOverride:
|
||||
continue
|
||||
# Check value, if value are equal, no need to patch
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if Pcd.DefaultValue == DefaultValue or DefaultValue in [None, '']:
|
||||
continue
|
||||
# Get the string size from FDF or DSC
|
||||
if DefaultValue[0] == 'L':
|
||||
# Remove L"", but the '\0' must be appended
|
||||
MaxDatumSize = str((len(DefaultValue) - 2) * 2)
|
||||
elif DefaultValue[0] == '{':
|
||||
MaxDatumSize = str(len(DefaultValue.split(',')))
|
||||
@ -244,6 +258,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
MaxDatumSize = str(len(DefaultValue) - 1)
|
||||
if DscOverride:
|
||||
Pcd.MaxDatumSize = PatchPcd.MaxDatumSize
|
||||
# If no defined the maximum size in DSC, try to get current size from INF
|
||||
if Pcd.MaxDatumSize in ['', None]:
|
||||
Pcd.MaxDatumSize = str(len(Pcd.DefaultValue.split(',')))
|
||||
else:
|
||||
@ -259,6 +274,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
continue
|
||||
except:
|
||||
continue
|
||||
# Check the Pcd size and data type
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if int(MaxDatumSize) > int(Pcd.MaxDatumSize):
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "The size of VOID* type PCD '%s.%s' exceeds its maximum size %d bytes." \
|
||||
@ -306,7 +322,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
return EfiFile
|
||||
Basename = os.path.basename(EfiFile)
|
||||
Output = os.path.join(self.OutputPath, Basename)
|
||||
CopyLongFilePath(EfiFile, Output)
|
||||
shutil.copy(EfiFile, Output)
|
||||
for Pcd in self.PatchPcds:
|
||||
RetVal, RetStr = PatchBinaryFile(Output, int(Pcd.Offset, 0), Pcd.DatumType, Pcd.DefaultValue, Pcd.MaxDatumSize)
|
||||
if RetVal:
|
||||
|
@ -86,6 +86,8 @@ class FV (FvClassObject):
|
||||
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))
|
||||
|
||||
GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)
|
||||
GenFdsGlobalVariable.LargeFileInFvFlags.append(False)
|
||||
FFSGuid = None
|
||||
|
||||
if self.FvBaseAddress != None:
|
||||
BaseAddress = self.FvBaseAddress
|
||||
@ -130,12 +132,15 @@ class FV (FvClassObject):
|
||||
OrigFvInfo = None
|
||||
if os.path.exists (FvInfoFileName):
|
||||
OrigFvInfo = open(FvInfoFileName, 'r').read()
|
||||
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
||||
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
||||
GenFdsGlobalVariable.GenerateFirmwareVolume(
|
||||
FvOutputFile,
|
||||
[self.InfFileName],
|
||||
AddressFile=FvInfoFileName,
|
||||
FfsList=FfsFileList,
|
||||
ForceRebase=self.FvForceRebase
|
||||
ForceRebase=self.FvForceRebase,
|
||||
FileSystemGuid=FFSGuid
|
||||
)
|
||||
|
||||
NewFvInfo = None
|
||||
@ -159,13 +164,16 @@ class FV (FvClassObject):
|
||||
for FfsFile in self.FfsList :
|
||||
FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress)
|
||||
|
||||
if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
|
||||
FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
|
||||
#Update GenFv again
|
||||
GenFdsGlobalVariable.GenerateFirmwareVolume(
|
||||
FvOutputFile,
|
||||
[self.InfFileName],
|
||||
AddressFile=FvInfoFileName,
|
||||
FfsList=FfsFileList,
|
||||
ForceRebase=self.FvForceRebase
|
||||
ForceRebase=self.FvForceRebase,
|
||||
FileSystemGuid=FFSGuid
|
||||
)
|
||||
|
||||
#
|
||||
@ -194,6 +202,7 @@ class FV (FvClassObject):
|
||||
self.FvAlignment = str (FvAlignmentValue)
|
||||
FvFileObj.close()
|
||||
GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
|
||||
GenFdsGlobalVariable.LargeFileInFvFlags.pop()
|
||||
return FvOutputFile
|
||||
|
||||
## __InitializeInf__()
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# generate flash image
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2013, 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
|
||||
@ -41,7 +41,7 @@ from Common.BuildVersion import gBUILD_VERSION
|
||||
## Version and Copyright
|
||||
versionNumber = "1.0" + ' ' + gBUILD_VERSION
|
||||
__version__ = "%prog Version " + versionNumber
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
__copyright__ = "Copyright (c) 2007 - 2013, Intel Corporation All rights reserved."
|
||||
|
||||
## Tool entrance method
|
||||
#
|
||||
|
@ -65,6 +65,19 @@ class GenFdsGlobalVariable:
|
||||
BuildRuleFamily = "MSFT"
|
||||
ToolChainFamily = "MSFT"
|
||||
__BuildRuleDatabase = None
|
||||
|
||||
#
|
||||
# The list whose element are flags to indicate if large FFS or SECTION files exist in FV.
|
||||
# At the beginning of each generation of FV, false flag is appended to the list,
|
||||
# after the call to GenerateSection returns, check the size of the output file,
|
||||
# if it is greater than 0xFFFFFF, the tail flag in list is set to true,
|
||||
# and EFI_FIRMWARE_FILE_SYSTEM3_GUID is passed to C GenFv.
|
||||
# At the end of generation of FV, pop the flag.
|
||||
# List is used as a stack to handle nested FV generation.
|
||||
#
|
||||
LargeFileInFvFlags = []
|
||||
EFI_FIRMWARE_FILE_SYSTEM3_GUID = '5473C07A-3DCB-4dca-BD6F-1E9689E7349A'
|
||||
LARGE_FILE_SIZE = 0x1000000
|
||||
|
||||
SectionHeader = struct.Struct("3B 1B")
|
||||
|
||||
@ -390,11 +403,13 @@ class GenFdsGlobalVariable:
|
||||
Cmd += Input
|
||||
|
||||
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
|
||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
||||
return
|
||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||
if GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
|
||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
||||
|
||||
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
|
||||
if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and
|
||||
GenFdsGlobalVariable.LargeFileInFvFlags):
|
||||
GenFdsGlobalVariable.LargeFileInFvFlags[-1] = True
|
||||
|
||||
@staticmethod
|
||||
def GetAlignment (AlignString):
|
||||
@ -432,7 +447,7 @@ class GenFdsGlobalVariable:
|
||||
|
||||
@staticmethod
|
||||
def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False,
|
||||
AddressFile=None, MapFile=None, FfsList=[]):
|
||||
AddressFile=None, MapFile=None, FfsList=[], FileSystemGuid=None):
|
||||
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input+FfsList):
|
||||
return
|
||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||
@ -454,6 +469,8 @@ class GenFdsGlobalVariable:
|
||||
Cmd += ["-a", AddressFile]
|
||||
if MapFile not in [None, '']:
|
||||
Cmd += ["-m", MapFile]
|
||||
if FileSystemGuid:
|
||||
Cmd += ["-g", FileSystemGuid]
|
||||
Cmd += ["-o", Output]
|
||||
for I in Input:
|
||||
Cmd += ["-i", I]
|
||||
|
Reference in New Issue
Block a user