summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/Fv.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-04-28 06:32:48 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-05-04 13:07:34 +0800
commitd0a0c52c221e5dcf82f24d4346c1cf52109d6dfb (patch)
tree093b255c1d0235ab8cbbea57be4ccbd0a37fecff /BaseTools/Source/Python/GenFds/Fv.py
parent31ff1c443e25d6bff758bdcd9a248a907cff651b (diff)
downloadedk2-d0a0c52c221e5dcf82f24d4346c1cf52109d6dfb.tar.gz
edk2-d0a0c52c221e5dcf82f24d4346c1cf52109d6dfb.tar.bz2
edk2-d0a0c52c221e5dcf82f24d4346c1cf52109d6dfb.zip
BaseTools: standardize GUID and pack size
currently GUID packing and pack size determination is spread throughout the code. This introduces a shared function and dict and routes all code paths through them. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Fv.py')
-rw-r--r--BaseTools/Source/Python/GenFds/Fv.py22
1 files changed, 3 insertions, 19 deletions
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index adb7c185b8..c6721b8828 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -26,7 +26,7 @@ import FfsFileStatement
from GenFdsGlobalVariable import GenFdsGlobalVariable
from GenFds import GenFds
from CommonDataClass.FdfClass import FvClassObject
-from Common.Misc import SaveFileOnChange
+from Common.Misc import SaveFileOnChange, PackGUID
from Common.LongFilePathSupport import CopyLongFilePath
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import *
@@ -367,10 +367,7 @@ class FV (FvClassObject):
# FV UI name
#
Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
- + pack('=LHHBBBBBBBB', int(Guid[0], 16), int(Guid[1], 16), int(Guid[2], 16),
- int(Guid[3][-4:-2], 16), int(Guid[3][-2:], 16), int(Guid[4][-12:-10], 16),
- int(Guid[4][-10:-8], 16), int(Guid[4][-8:-6], 16), int(Guid[4][-6:-4], 16),
- int(Guid[4][-4:-2], 16), int(Guid[4][-2:], 16))
+ + PackGUID(Guid)
+ self.UiFvName)
for Index in range (0, len(self.FvExtEntryType)):
@@ -404,20 +401,7 @@ class FV (FvClassObject):
Buffer += pack('B', int(ByteList[Index1], 16))
Guid = self.FvNameGuid.split('-')
- Buffer = pack('=LHHBBBBBBBBL',
- int(Guid[0], 16),
- int(Guid[1], 16),
- int(Guid[2], 16),
- int(Guid[3][-4:-2], 16),
- int(Guid[3][-2:], 16),
- int(Guid[4][-12:-10], 16),
- int(Guid[4][-10:-8], 16),
- int(Guid[4][-8:-6], 16),
- int(Guid[4][-6:-4], 16),
- int(Guid[4][-4:-2], 16),
- int(Guid[4][-2:], 16),
- TotalSize
- ) + Buffer
+ Buffer = PackGUID(Guid) + pack('=L', TotalSize) + Buffer
#
# Generate FV extension header file if the total size is not zero