X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FGenFds%2FFv.py;h=0d005ebf5bb630fa9e5a6124be2b690da4dd1e54;hb=1ccc4d895dd8d659d016efcd6ef8a48749aba1d0;hp=7653cf692ba42c805463162f0dc928d8f50d9f1d;hpb=86e6cf98a8493574878286522078050ac4dd505d;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 7653cf692b..0d005ebf5b 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import ## @file # process FV generation # @@ -18,7 +19,6 @@ import Common.LongFilePathOs as os import subprocess from io import BytesIO -from io import StringIO from struct import * from . import Ffs @@ -205,7 +205,7 @@ class FV (FvClassObject): # PI FvHeader is 0x48 byte FvHeaderBuffer = FvFileObj.read(0x48) # FV alignment position. - FvAlignmentValue = 1 << (FvHeaderBuffer[0x2E] & 0x1F) + FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F) if FvAlignmentValue >= 0x400: if FvAlignmentValue >= 0x100000: if FvAlignmentValue >= 0x1000000: @@ -265,7 +265,7 @@ class FV (FvClassObject): # self.InfFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName + '.inf') - self.FvInfFile = StringIO() + self.FvInfFile = BytesIO() # # Add [Options] @@ -340,7 +340,7 @@ class FV (FvClassObject): GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName)) else: TotalSize = 16 + 4 - Buffer = bytearray() + Buffer = '' if self.UsedSizeEnable: TotalSize += (4 + 4) ## define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03 @@ -367,7 +367,7 @@ class FV (FvClassObject): # Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002) + PackGUID(Guid) - + bytes(self.UiFvName, 'utf-8')) + + self.UiFvName) for Index in range (0, len(self.FvExtEntryType)): if self.FvExtEntryType[Index] == 'FILE':