summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/FfsInfStatement.py
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/GenFds/FfsInfStatement.py')
-rw-r--r--BaseTools/Source/Python/GenFds/FfsInfStatement.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 9ef03edecc..6149bc81b4 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -16,6 +16,7 @@
##
# Import Modules
#
+from __future__ import absolute_import
from . import Rule
import Common.LongFilePathOs as os
from io import BytesIO
@@ -770,9 +771,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
elif ImageObj.SectionAlignment < 0x100000:
- self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'
+ self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'
else:
- self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'
+ self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'
if not NoStrip:
FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')
@@ -812,9 +813,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
elif ImageObj.SectionAlignment < 0x100000:
- self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'
+ self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'
else:
- self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'
+ self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'
if not NoStrip:
FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')
@@ -1073,7 +1074,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
def __GetBuildOutputMapFileVfrUniInfo(self, VfrUniBaseName):
MapFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".map")
EfiFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".efi")
- return GetVariableOffset(MapFileName, EfiFileName, list(VfrUniBaseName.values()))
+ return GetVariableOffset(MapFileName, EfiFileName, VfrUniBaseName.values())
## __GenUniVfrOffsetFile() method
#
@@ -1086,7 +1087,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):
@@ -1096,7 +1097,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
# { 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]
- fStringIO.write(bytes(UniGuid))
+ UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]
+ fStringIO.write(''.join(UniGuid))
UniValue = pack ('Q', int (Item[1], 16))
fStringIO.write (UniValue)
else:
@@ -1106,7 +1108,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
# { 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]
- fStringIO.write(bytes(VfrGuid))
+ VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]
+ fStringIO.write(''.join(VfrGuid))
type (Item[1])
VfrValue = pack ('Q', int (Item[1], 16))
fStringIO.write (VfrValue)