public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chasel, Chiu" <chasel.chiu@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiewen Yao <Jiewen.yao@intel.com>,
	Gao Liming <liming.gao@intel.com>,
	Zhu Yonghong <yonghong.zhu@intel.com>,
	Chasel Chiu <chasel.chiu@intel.com>
Subject: [PATCH] IntelFsp2Pkg/GenCfgOpt.py: Support PCD input from command line
Date: Mon,  8 Oct 2018 15:55:33 +0800	[thread overview]
Message-ID: <20181008075533.9212-1-chasel.chiu@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1231

Build system already support override PCD value by command
line so add this support to GenCfgOpt.py

Test: Verified UPD header files generated can reflect different
      PCD values from --pcd build command input

Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Gao Liming <liming.gao@intel.com>
Cc: Zhu Yonghong <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
 IntelFsp2Pkg/Tools/GenCfgOpt.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 059cfcb7e4..efc2eea6ab 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -88,6 +88,8 @@ are permitted provided that the following conditions are met:
 **/
 """
 
+BuildOptionPcd = []
+
 class CLogicalExpression:
     def __init__(self):
         self.index    = 0
@@ -561,6 +563,12 @@ EndList
                     self._PcdsDict[Match.group(1)] = Match.group(2)
                     if self.Debug:
                         print "INFO : PCD %s = [ %s ]" % (Match.group(1), Match.group(2))
+                    i = 0
+                    while i < len(BuildOptionPcd):
+                        Match = re.match("\s*([\w\.]+)\s*\=\s*(\w+)", BuildOptionPcd[i])
+                        if Match:
+                            self._PcdsDict[Match.group(1)] = Match.group(2)
+                        i += 1
             else:
                 Match = re.match("^\s*#\s+(!BSF|@Bsf|!HDR)\s+(.+)", DscLine)
                 if Match:
@@ -1472,7 +1480,14 @@ def Main():
     #
     # Parse the options and args
     #
+    i = 1
+
     GenCfgOpt = CGenCfgOpt()
+    while i < len(sys.argv):
+        if sys.argv[i].strip().lower() == "--pcd":
+            BuildOptionPcd.append(sys.argv[i+1])
+            i += 1
+        i += 1
     argc = len(sys.argv)
     if argc < 4:
         Usage()
-- 
2.13.3.windows.1



                 reply	other threads:[~2018-10-08  7:55 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=20181008075533.9212-1-chasel.chiu@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