BaseTools: Handle the bytes and str difference
Deal with bytes and str is different, remove the unicode(), correct open file parameter. Using utcfromtimestamp instead of fromtimestamp. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
@ -53,7 +53,7 @@ class AprioriSection (object):
|
||||
# @retval string Generated file name
|
||||
#
|
||||
def GenFfs (self, FvName, Dict = {}, IsMakefile = False):
|
||||
Buffer = BytesIO('')
|
||||
Buffer = BytesIO()
|
||||
if self.AprioriType == "PEI":
|
||||
AprioriFileGuid = PEI_APRIORI_GUID
|
||||
else:
|
||||
|
@ -181,7 +181,7 @@ class Capsule (CapsuleClassObject):
|
||||
#
|
||||
# The real capsule header structure is 28 bytes
|
||||
#
|
||||
Header.write('\x00'*(HdrSize-28))
|
||||
Header.write(b'\x00'*(HdrSize-28))
|
||||
Header.write(FwMgrHdr.getvalue())
|
||||
Header.write(Content.getvalue())
|
||||
#
|
||||
@ -206,18 +206,17 @@ class Capsule (CapsuleClassObject):
|
||||
return self.GenFmpCapsule()
|
||||
|
||||
CapInfFile = self.GenCapInf()
|
||||
CapInfFile.writelines("[files]" + TAB_LINE_BREAK)
|
||||
CapInfFile.append("[files]" + TAB_LINE_BREAK)
|
||||
CapFileList = []
|
||||
for CapsuleDataObj in self.CapsuleDataList:
|
||||
CapsuleDataObj.CapsuleName = self.CapsuleName
|
||||
FileName = CapsuleDataObj.GenCapsuleSubItem()
|
||||
CapsuleDataObj.CapsuleName = None
|
||||
CapFileList.append(FileName)
|
||||
CapInfFile.writelines("EFI_FILE_NAME = " + \
|
||||
CapInfFile.append("EFI_FILE_NAME = " + \
|
||||
FileName + \
|
||||
TAB_LINE_BREAK)
|
||||
SaveFileOnChange(self.CapInfFileName, CapInfFile.getvalue(), False)
|
||||
CapInfFile.close()
|
||||
SaveFileOnChange(self.CapInfFileName, ''.join(CapInfFile), False)
|
||||
#
|
||||
# Call GenFv tool to generate capsule
|
||||
#
|
||||
@ -243,12 +242,12 @@ class Capsule (CapsuleClassObject):
|
||||
def GenCapInf(self):
|
||||
self.CapInfFileName = os.path.join(GenFdsGlobalVariable.FvDir,
|
||||
self.UiCapsuleName + "_Cap" + '.inf')
|
||||
CapInfFile = BytesIO() #open (self.CapInfFileName , 'w+')
|
||||
CapInfFile = []
|
||||
|
||||
CapInfFile.writelines("[options]" + TAB_LINE_BREAK)
|
||||
CapInfFile.append("[options]" + TAB_LINE_BREAK)
|
||||
|
||||
for Item in self.TokensDict:
|
||||
CapInfFile.writelines("EFI_" + \
|
||||
CapInfFile.append("EFI_" + \
|
||||
Item + \
|
||||
' = ' + \
|
||||
self.TokensDict[Item] + \
|
||||
|
@ -82,7 +82,7 @@ class CapsuleFv (CapsuleData):
|
||||
if self.FvName.find('.fv') == -1:
|
||||
if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[self.FvName.upper()]
|
||||
FdBuffer = BytesIO('')
|
||||
FdBuffer = BytesIO()
|
||||
FvObj.CapsuleName = self.CapsuleName
|
||||
FvFile = FvObj.AddToBuffer(FdBuffer)
|
||||
FvObj.CapsuleName = None
|
||||
|
@ -72,7 +72,7 @@ class FD(FDClassObject):
|
||||
HasCapsuleRegion = True
|
||||
break
|
||||
if HasCapsuleRegion:
|
||||
TempFdBuffer = BytesIO('')
|
||||
TempFdBuffer = BytesIO()
|
||||
PreviousRegionStart = -1
|
||||
PreviousRegionSize = 1
|
||||
|
||||
@ -101,7 +101,7 @@ class FD(FDClassObject):
|
||||
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
|
||||
RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
|
||||
|
||||
FdBuffer = BytesIO('')
|
||||
FdBuffer = BytesIO()
|
||||
PreviousRegionStart = -1
|
||||
PreviousRegionSize = 1
|
||||
for RegionObj in self.RegionList :
|
||||
|
@ -159,7 +159,7 @@ class IncludeFileProfile:
|
||||
self.FileName = FileName
|
||||
self.FileLinesList = []
|
||||
try:
|
||||
with open(FileName, "rb", 0) as fsock:
|
||||
with open(FileName, "r") as fsock:
|
||||
self.FileLinesList = fsock.readlines()
|
||||
for index, line in enumerate(self.FileLinesList):
|
||||
if not line.endswith(TAB_LINE_BREAK):
|
||||
@ -213,7 +213,7 @@ class FileProfile:
|
||||
def __init__(self, FileName):
|
||||
self.FileLinesList = []
|
||||
try:
|
||||
with open(FileName, "rb", 0) as fsock:
|
||||
with open(FileName, "r") as fsock:
|
||||
self.FileLinesList = fsock.readlines()
|
||||
|
||||
except:
|
||||
|
@ -79,7 +79,7 @@ class FileStatement (FileStatementClassObject):
|
||||
Dict.update(self.DefineVarDict)
|
||||
SectionAlignments = None
|
||||
if self.FvName:
|
||||
Buffer = BytesIO('')
|
||||
Buffer = BytesIO()
|
||||
if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))
|
||||
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())
|
||||
@ -96,7 +96,7 @@ class FileStatement (FileStatementClassObject):
|
||||
elif self.FileName:
|
||||
if hasattr(self, 'FvFileType') and self.FvFileType == 'RAW':
|
||||
if isinstance(self.FileName, list) and isinstance(self.SubAlignment, list) and len(self.FileName) == len(self.SubAlignment):
|
||||
FileContent = ''
|
||||
FileContent = BytesIO()
|
||||
MaxAlignIndex = 0
|
||||
MaxAlignValue = 1
|
||||
for Index, File in enumerate(self.FileName):
|
||||
@ -112,15 +112,15 @@ class FileStatement (FileStatementClassObject):
|
||||
if AlignValue > MaxAlignValue:
|
||||
MaxAlignIndex = Index
|
||||
MaxAlignValue = AlignValue
|
||||
FileContent += Content
|
||||
if len(FileContent) % AlignValue != 0:
|
||||
Size = AlignValue - len(FileContent) % AlignValue
|
||||
FileContent.write(Content)
|
||||
if len(FileContent.getvalue()) % AlignValue != 0:
|
||||
Size = AlignValue - len(FileContent.getvalue()) % AlignValue
|
||||
for i in range(0, Size):
|
||||
FileContent += pack('B', 0xFF)
|
||||
FileContent.write(pack('B', 0xFF))
|
||||
|
||||
if FileContent:
|
||||
if FileContent.getvalue() != b'':
|
||||
OutputRAWFile = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid, self.NameGuid + '.raw')
|
||||
SaveFileOnChange(OutputRAWFile, FileContent, True)
|
||||
SaveFileOnChange(OutputRAWFile, FileContent.getvalue(), True)
|
||||
self.FileName = OutputRAWFile
|
||||
self.SubAlignment = self.SubAlignment[MaxAlignIndex]
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName):
|
||||
|
||||
# Use a instance of StringIO to cache data
|
||||
fStringIO = BytesIO('')
|
||||
fStringIO = BytesIO()
|
||||
|
||||
for Item in VfrUniOffsetList:
|
||||
if (Item[0].find("Strings") != -1):
|
||||
@ -1097,9 +1097,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
# GUID + Offset
|
||||
# { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }
|
||||
#
|
||||
UniGuid = [0xe0, 0xc5, 0x13, 0x89, 0xf6, 0x33, 0x86, 0x4d, 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66]
|
||||
UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]
|
||||
fStringIO.write(''.join(UniGuid))
|
||||
UniGuid = b'\xe0\xc5\x13\x89\xf63\x86M\x9b\xf1C\xef\x89\xfc\x06f'
|
||||
fStringIO.write(UniGuid)
|
||||
UniValue = pack ('Q', int (Item[1], 16))
|
||||
fStringIO.write (UniValue)
|
||||
else:
|
||||
@ -1108,9 +1107,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
# GUID + Offset
|
||||
# { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };
|
||||
#
|
||||
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]
|
||||
VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]
|
||||
fStringIO.write(''.join(VfrGuid))
|
||||
VfrGuid = b'\xb4|\xbc\xd0Gj_I\xaa\x11q\x07F\xda\x06\xa2'
|
||||
fStringIO.write(VfrGuid)
|
||||
type (Item[1])
|
||||
VfrValue = pack ('Q', int (Item[1], 16))
|
||||
fStringIO.write (VfrValue)
|
||||
|
@ -117,7 +117,7 @@ class FV (object):
|
||||
FfsFileList.append(FileName)
|
||||
# Add Apriori file name to Inf file
|
||||
if not Flag:
|
||||
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
||||
self.FvInfFile.append("EFI_FILE_NAME = " + \
|
||||
FileName + \
|
||||
TAB_LINE_BREAK)
|
||||
|
||||
@ -131,12 +131,12 @@ class FV (object):
|
||||
FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)
|
||||
FfsFileList.append(FileName)
|
||||
if not Flag:
|
||||
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
||||
self.FvInfFile.append("EFI_FILE_NAME = " + \
|
||||
FileName + \
|
||||
TAB_LINE_BREAK)
|
||||
if not Flag:
|
||||
SaveFileOnChange(self.InfFileName, self.FvInfFile.getvalue(), False)
|
||||
self.FvInfFile.close()
|
||||
FvInfFile = ''.join(self.FvInfFile)
|
||||
SaveFileOnChange(self.InfFileName, FvInfFile, False)
|
||||
#
|
||||
# Call GenFv tool
|
||||
#
|
||||
@ -208,14 +208,14 @@ class FV (object):
|
||||
# PI FvHeader is 0x48 byte
|
||||
FvHeaderBuffer = FvFileObj.read(0x48)
|
||||
Signature = FvHeaderBuffer[0x28:0x32]
|
||||
if Signature and Signature.startswith('_FVH'):
|
||||
if Signature and Signature.startswith(b'_FVH'):
|
||||
GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName)
|
||||
GenFdsGlobalVariable.SharpCounter = 0
|
||||
|
||||
FvFileObj.seek(0)
|
||||
Buffer.write(FvFileObj.read())
|
||||
# FV alignment position.
|
||||
FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
|
||||
FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E:0x2F]) & 0x1F)
|
||||
if FvAlignmentValue >= 0x400:
|
||||
if FvAlignmentValue >= 0x100000:
|
||||
if FvAlignmentValue >= 0x1000000:
|
||||
@ -276,54 +276,54 @@ class FV (object):
|
||||
#
|
||||
self.InfFileName = os.path.join(GenFdsGlobalVariable.FvDir,
|
||||
self.UiFvName + '.inf')
|
||||
self.FvInfFile = BytesIO()
|
||||
self.FvInfFile = []
|
||||
|
||||
#
|
||||
# Add [Options]
|
||||
#
|
||||
self.FvInfFile.writelines("[options]" + TAB_LINE_BREAK)
|
||||
self.FvInfFile.append("[options]" + TAB_LINE_BREAK)
|
||||
if BaseAddress is not None:
|
||||
self.FvInfFile.writelines("EFI_BASE_ADDRESS = " + \
|
||||
self.FvInfFile.append("EFI_BASE_ADDRESS = " + \
|
||||
BaseAddress + \
|
||||
TAB_LINE_BREAK)
|
||||
|
||||
if BlockSize is not None:
|
||||
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
|
||||
self.FvInfFile.append("EFI_BLOCK_SIZE = " + \
|
||||
'0x%X' %BlockSize + \
|
||||
TAB_LINE_BREAK)
|
||||
if BlockNum is not None:
|
||||
self.FvInfFile.writelines("EFI_NUM_BLOCKS = " + \
|
||||
self.FvInfFile.append("EFI_NUM_BLOCKS = " + \
|
||||
' 0x%X' %BlockNum + \
|
||||
TAB_LINE_BREAK)
|
||||
else:
|
||||
if self.BlockSizeList == []:
|
||||
if not self._GetBlockSize():
|
||||
#set default block size is 1
|
||||
self.FvInfFile.writelines("EFI_BLOCK_SIZE = 0x1" + TAB_LINE_BREAK)
|
||||
self.FvInfFile.append("EFI_BLOCK_SIZE = 0x1" + TAB_LINE_BREAK)
|
||||
|
||||
for BlockSize in self.BlockSizeList:
|
||||
if BlockSize[0] is not None:
|
||||
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
|
||||
self.FvInfFile.append("EFI_BLOCK_SIZE = " + \
|
||||
'0x%X' %BlockSize[0] + \
|
||||
TAB_LINE_BREAK)
|
||||
|
||||
if BlockSize[1] is not None:
|
||||
self.FvInfFile.writelines("EFI_NUM_BLOCKS = " + \
|
||||
self.FvInfFile.append("EFI_NUM_BLOCKS = " + \
|
||||
' 0x%X' %BlockSize[1] + \
|
||||
TAB_LINE_BREAK)
|
||||
|
||||
if self.BsBaseAddress is not None:
|
||||
self.FvInfFile.writelines('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \
|
||||
self.FvInfFile.append('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \
|
||||
'0x%X' %self.BsBaseAddress)
|
||||
if self.RtBaseAddress is not None:
|
||||
self.FvInfFile.writelines('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \
|
||||
self.FvInfFile.append('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \
|
||||
'0x%X' %self.RtBaseAddress)
|
||||
#
|
||||
# Add attribute
|
||||
#
|
||||
self.FvInfFile.writelines("[attributes]" + TAB_LINE_BREAK)
|
||||
self.FvInfFile.append("[attributes]" + TAB_LINE_BREAK)
|
||||
|
||||
self.FvInfFile.writelines("EFI_ERASE_POLARITY = " + \
|
||||
self.FvInfFile.append("EFI_ERASE_POLARITY = " + \
|
||||
' %s' %ErasePloarity + \
|
||||
TAB_LINE_BREAK)
|
||||
if not (self.FvAttributeDict is None):
|
||||
@ -332,13 +332,13 @@ class FV (object):
|
||||
if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1'):
|
||||
self.UsedSizeEnable = True
|
||||
continue
|
||||
self.FvInfFile.writelines("EFI_" + \
|
||||
self.FvInfFile.append("EFI_" + \
|
||||
FvAttribute + \
|
||||
' = ' + \
|
||||
self.FvAttributeDict[FvAttribute] + \
|
||||
TAB_LINE_BREAK )
|
||||
if self.FvAlignment is not None:
|
||||
self.FvInfFile.writelines("EFI_FVB2_ALIGNMENT_" + \
|
||||
self.FvInfFile.append("EFI_FVB2_ALIGNMENT_" + \
|
||||
self.FvAlignment.strip() + \
|
||||
" = TRUE" + \
|
||||
TAB_LINE_BREAK)
|
||||
@ -351,7 +351,7 @@ class FV (object):
|
||||
GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))
|
||||
else:
|
||||
TotalSize = 16 + 4
|
||||
Buffer = ''
|
||||
Buffer = bytearray()
|
||||
if self.UsedSizeEnable:
|
||||
TotalSize += (4 + 4)
|
||||
## define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
|
||||
@ -378,7 +378,7 @@ class FV (object):
|
||||
#
|
||||
Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
|
||||
+ PackGUID(Guid)
|
||||
+ self.UiFvName)
|
||||
+ self.UiFvName.encode('utf-8'))
|
||||
|
||||
for Index in range (0, len(self.FvExtEntryType)):
|
||||
if self.FvExtEntryType[Index] == 'FILE':
|
||||
@ -425,11 +425,11 @@ class FV (object):
|
||||
if Changed:
|
||||
if os.path.exists (self.InfFileName):
|
||||
os.remove (self.InfFileName)
|
||||
self.FvInfFile.writelines("EFI_FV_EXT_HEADER_FILE_NAME = " + \
|
||||
self.FvInfFile.append("EFI_FV_EXT_HEADER_FILE_NAME = " + \
|
||||
FvExtHeaderFileName + \
|
||||
TAB_LINE_BREAK)
|
||||
|
||||
#
|
||||
# Add [Files]
|
||||
#
|
||||
self.FvInfFile.writelines("[files]" + TAB_LINE_BREAK)
|
||||
self.FvInfFile.append("[files]" + TAB_LINE_BREAK)
|
||||
|
@ -102,7 +102,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||
# Generate Fv
|
||||
#
|
||||
if self.FvName is not None:
|
||||
Buffer = BytesIO('')
|
||||
Buffer = BytesIO()
|
||||
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)
|
||||
if Fv is not None:
|
||||
self.Fv = Fv
|
||||
|
@ -522,7 +522,7 @@ class GenFds(object):
|
||||
return
|
||||
elif GenFds.OnlyGenerateThisFv is None:
|
||||
for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():
|
||||
Buffer = BytesIO('')
|
||||
Buffer = BytesIO()
|
||||
FvObj.AddToBuffer(Buffer)
|
||||
Buffer.close()
|
||||
|
||||
@ -673,7 +673,7 @@ class GenFds(object):
|
||||
@staticmethod
|
||||
def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
|
||||
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
|
||||
GuidXRefFile = BytesIO('')
|
||||
GuidXRefFile = []
|
||||
PkgGuidDict = {}
|
||||
GuidDict = {}
|
||||
ModuleList = []
|
||||
@ -700,9 +700,9 @@ class GenFds(object):
|
||||
else:
|
||||
ModuleList.append(Module)
|
||||
if GlobalData.gGuidPattern.match(ModuleFile.BaseName):
|
||||
GuidXRefFile.write("%s %s\n" % (ModuleFile.BaseName, Module.BaseName))
|
||||
GuidXRefFile.append("%s %s\n" % (ModuleFile.BaseName, Module.BaseName))
|
||||
else:
|
||||
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
|
||||
GuidXRefFile.append("%s %s\n" % (Module.Guid, Module.BaseName))
|
||||
GuidDict.update(Module.Protocols)
|
||||
GuidDict.update(Module.Guids)
|
||||
GuidDict.update(Module.Ppis)
|
||||
@ -715,7 +715,7 @@ class GenFds(object):
|
||||
continue
|
||||
else:
|
||||
ModuleList.append(FdfModule)
|
||||
GuidXRefFile.write("%s %s\n" % (FdfModule.Guid, FdfModule.BaseName))
|
||||
GuidXRefFile.append("%s %s\n" % (FdfModule.Guid, FdfModule.BaseName))
|
||||
GuidDict.update(FdfModule.Protocols)
|
||||
GuidDict.update(FdfModule.Guids)
|
||||
GuidDict.update(FdfModule.Ppis)
|
||||
@ -776,19 +776,19 @@ class GenFds(object):
|
||||
continue
|
||||
|
||||
Name = ' '.join(Name) if isinstance(Name, type([])) else Name
|
||||
GuidXRefFile.write("%s %s\n" %(FileStatementGuid, Name))
|
||||
GuidXRefFile.append("%s %s\n" %(FileStatementGuid, Name))
|
||||
|
||||
# Append GUIDs, Protocols, and PPIs to the Xref file
|
||||
GuidXRefFile.write("\n")
|
||||
GuidXRefFile.append("\n")
|
||||
for key, item in GuidDict.items():
|
||||
GuidXRefFile.write("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
|
||||
GuidXRefFile.append("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
|
||||
|
||||
if GuidXRefFile.getvalue():
|
||||
SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)
|
||||
if GuidXRefFile:
|
||||
GuidXRefFile = ''.join(GuidXRefFile)
|
||||
SaveFileOnChange(GuidXRefFileName, GuidXRefFile, False)
|
||||
GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)
|
||||
elif os.path.exists(GuidXRefFileName):
|
||||
os.remove(GuidXRefFileName)
|
||||
GuidXRefFile.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -722,8 +722,8 @@ class GenFdsGlobalVariable:
|
||||
return
|
||||
if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1:
|
||||
GenFdsGlobalVariable.InfLogger ("Return Value = %d" % PopenObject.returncode)
|
||||
GenFdsGlobalVariable.InfLogger (out)
|
||||
GenFdsGlobalVariable.InfLogger (error)
|
||||
GenFdsGlobalVariable.InfLogger(out.decode(encoding='utf-8', errors='ignore'))
|
||||
GenFdsGlobalVariable.InfLogger(error.decode(encoding='utf-8', errors='ignore'))
|
||||
if PopenObject.returncode != 0:
|
||||
print("###", cmd)
|
||||
EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
|
||||
|
@ -62,8 +62,8 @@ class Region(object):
|
||||
PadByte = pack('B', 0xFF)
|
||||
else:
|
||||
PadByte = pack('B', 0)
|
||||
PadData = ''.join(PadByte for i in range(0, Size))
|
||||
Buffer.write(PadData)
|
||||
for i in range(0, Size):
|
||||
Buffer.write(PadByte)
|
||||
|
||||
## AddToBuffer()
|
||||
#
|
||||
@ -131,7 +131,7 @@ class Region(object):
|
||||
if self.FvAddress % FvAlignValue != 0:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR,
|
||||
"FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))
|
||||
FvBuffer = BytesIO('')
|
||||
FvBuffer = BytesIO()
|
||||
FvBaseAddress = '0x%X' % self.FvAddress
|
||||
BlockSize = None
|
||||
BlockNum = None
|
||||
|
Reference in New Issue
Block a user