Revert BaseTools: PYTHON3 migration
This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52..
678f851312
.
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>
This commit is contained in:
@ -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':
|
||||
|
Reference in New Issue
Block a user