From: yuanhao.xie@intel.com
To: devel@edk2.groups.io
Cc: Guo Dong <guo.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Maurice Ma <maurice.ma@intel.com>,
Benjamin You <benjamin.you@intel.com>
Subject: [PATCH] UefiPayloadPkg: Add the capability to override pcd when build the payload.
Date: Wed, 17 Nov 2021 13:59:22 +0800 [thread overview]
Message-ID: <20211117055922.1171-1-yuanhao.xie@intel.com> (raw)
Add the capability to override pcd when building the payload, one can use
'--pcd a=b' to pass the argument.
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
---
UefiPayloadPkg/UniversalPayloadBuild.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index e624ec5874..c7f31f5089 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -50,7 +50,7 @@ def RunCommand(cmd):
print("- Failed - error happened when run command: %s"%cmd)
raise Exception("ERROR: when run command: %s"%cmd)
-def BuildUniversalPayload(Args, MacroList):
+def BuildUniversalPayload(Args, MacroList, PcdList):
BuildTarget = Args.Target
ToolChain = Args.ToolChain
ElfToolChain = 'CLANGDWARF'
@@ -77,18 +77,23 @@ def BuildUniversalPayload(Args, MacroList):
Defines = ""
for key in MacroList:
Defines +=" -D {0}={1}".format(key, MacroList[key])
+ Pcd = ""
+ for key in PcdList:
+ Pcd +=" --pcd {0}={1}".format(key, PcdList[key])
#
# Building DXE core and DXE drivers as DXEFV.
#
BuildPayload = f"build -p {DscPath} -b {BuildTarget} -a X64 -t {ToolChain} -y {PayloadReportPath}"
BuildPayload += Defines
+ BuildPayload += Pcd
RunCommand(BuildPayload)
#
# Building Universal Payload entry.
#
BuildModule = f"build -p {DscPath} -b {BuildTarget} -a X64 -m {EntryModuleInf} -t {ElfToolChain} -y {ModuleReportPath}"
BuildModule += Defines
+ BuildModule += Pcd
RunCommand(BuildModule)
#
@@ -118,6 +123,7 @@ def main():
parser.add_argument('-b', '--Target', default='DEBUG')
parser.add_argument("-D", "--Macro", action="append", default=["UNIVERSAL_PAYLOAD=TRUE"])
parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI')
+ parser.add_argument("--pcd", action="append", default=[])
MacroList = {}
args = parser.parse_args()
if args.Macro is not None:
@@ -127,7 +133,15 @@ def main():
raise Exception("ERROR: Unknown variable passed in: %s"%Argument)
tokens = Argument.strip().split('=')
MacroList[tokens[0].upper()] = tokens[1]
- BuildUniversalPayload(args, MacroList)
+ PcdList = {}
+ if args.pcd is not None:
+ for Argument in args.pcd:
+ if Argument.count('=') != 1:
+ print("Unknown variable passed in: %s"%Argument)
+ raise Exception("ERROR: Unknown variable passed in: %s"%Argument)
+ tokens = Argument.strip().split('=')
+ PcdList[tokens[0]] = tokens[1]
+ BuildUniversalPayload(args, MacroList, PcdList)
print ("Successfully build Universal Payload")
if __name__ == '__main__':
--
2.26.2.windows.1
reply other threads:[~2021-11-17 5:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211117055922.1171-1-yuanhao.xie@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