summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen, Lin Z <lin.z.chen@intel.com>2022-01-11 21:01:12 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-01-13 09:35:35 +0000
commit7438a85bf1388add286a89707079d9afca735814 (patch)
tree0c1aa9ed04e0cb4ba0a0e3e2c4f7c6564c588f16
parent6062002bd5a394fef46243dd866860c3480d918e (diff)
downloadedk2-7438a85bf1388add286a89707079d9afca735814.tar.gz
edk2-7438a85bf1388add286a89707079d9afca735814.tar.bz2
edk2-7438a85bf1388add286a89707079d9afca735814.zip
BaseTools: Fix wrong variable header size
There are two type variable header and their size are different, need to use matched size when calculating offset info, otherwise it'll destroy other variables content when patching. Signed-off-by: Chen, Lin Z <lin.z.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-rw-r--r--BaseTools/Source/Python/AutoGen/GenVar.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index 3f3dc69e90..f2ad54ba63 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -20,6 +20,7 @@ import Common.GlobalData as GlobalData
var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type,PcdDscLine,StructurePcd")
NvStorageHeaderSize = 28
VariableHeaderSize = 32
+AuthenticatedVariableHeaderSize = 60
class VariableMgr(object):
def __init__(self, DefaultStoreMap, SkuIdMap):
@@ -171,7 +172,10 @@ class VariableMgr(object):
DataBuffer = VariableMgr.AlignData(var_name_buffer + default_data)
data_size = len(DataBuffer)
- offset += VariableHeaderSize + len(default_info.var_name.split(","))
+ if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":
+ offset += AuthenticatedVariableHeaderSize + len(default_info.var_name.split(","))
+ else:
+ offset += VariableHeaderSize + len(default_info.var_name.split(","))
var_data_offset[default_info.pcdindex] = offset
offset += data_size - len(default_info.var_name.split(","))
if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_VPD_AUTHENTICATED_VARIABLE_STORE,"FALSE").upper() == "TRUE":