diff options
author | Liming Gao <liming.gao@intel.com> | 2018-10-15 08:27:53 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-10-15 08:29:14 +0800 |
commit | 1ccc4d895dd8d659d016efcd6ef8a48749aba1d0 (patch) | |
tree | 0d5f58643cc72275887d3bb322813609906a9334 /BaseTools/Source/Python/GenFds/Fv.py | |
parent | 678f85131238622e576705117e299d81cff755c9 (diff) | |
download | edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.tar.gz edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.tar.bz2 edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.zip |
Revert BaseTools: PYTHON3 migration
This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52..
678f85131238622e576705117e299d81cff755c9.
Python3 migration is the fundamental change. It requires every developer
to install Python3. Before this migration, the well communication and wide
verification must be done. But now, most people is not aware of this change,
and not try it. So, Python3 migration is reverted and be moved to edk2-staging
Python3 branch for the edk2 user evaluation.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Fv.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/Fv.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 3c3cd0b308..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,16 +205,16 @@ 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:
#The max alignment supported by FFS is 16M.
self.FvAlignment = "16M"
else:
- self.FvAlignment = str(FvAlignmentValue // 0x100000) + "M"
+ self.FvAlignment = str(FvAlignmentValue / 0x100000) + "M"
else:
- self.FvAlignment = str(FvAlignmentValue // 0x400) + "K"
+ self.FvAlignment = str(FvAlignmentValue / 0x400) + "K"
else:
# FvAlignmentValue is less than 1K
self.FvAlignment = str (FvAlignmentValue)
@@ -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':
|