From: "Chen Lin Z" <lin.z.chen@intel.com>
To: bob.c.feng@intel.com, gaoliming@byosoft.com.cn,
yuwei.chen@intel.com, devel@edk2.groups.io
Cc: zhuangzhi.li@intel.com, di.zhang@intel.com, "Chen,
Lin Z" <lin.z.chen@intel.com>,
Chen
Subject: [PATCH] BaseTools: Fix wrong variable header size
Date: Tue, 11 Jan 2022 13:01:12 +0000 [thread overview]
Message-ID: <5e26f08910b67c693d37fd843fd32e429c6d2401.1641876123.git.lin.z.chen@intel.com> (raw)
From: "Chen, Lin Z" <lin.z.chen@intel.com>
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>
---
BaseTools/Source/Python/AutoGen/GenVar.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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":
--
2.26.2.windows.1
next reply other threads:[~2022-01-11 4:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 13:01 Chen Lin Z [this message]
2022-01-11 5:25 ` [PATCH] BaseTools: Fix wrong variable header size Bob Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e26f08910b67c693d37fd843fd32e429c6d2401.1641876123.git.lin.z.chen@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox