From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F93C21163271 for ; Mon, 8 Oct 2018 00:55:47 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2018 00:55:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,356,1534834800"; d="scan'208";a="80743824" Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.23]) by orsmga006.jf.intel.com with ESMTP; 08 Oct 2018 00:55:44 -0700 From: "Chasel, Chiu" To: edk2-devel@lists.01.org Cc: Jiewen Yao , Gao Liming , Zhu Yonghong , Chasel Chiu Date: Mon, 8 Oct 2018 15:55:33 +0800 Message-Id: <20181008075533.9212-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 Subject: [PATCH] IntelFsp2Pkg/GenCfgOpt.py: Support PCD input from command line X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2018 07:55:47 -0000 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 Cc: Gao Liming Cc: Zhu Yonghong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu --- 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