From: kasimx.liu@intel.com
To: devel@edk2.groups.io
Cc: KasimX Liu <kasimx.liu@intel.com>, Guo Dong <guo.dong@intel.com>,
Ray Ni <ray.ni@intel.com>, James Lu <james.lu@intel.com>,
Gua Guo <gua.guo@intel.com>
Subject: [PATCH] UefiPayloadPkg:Add YAML support version configuration
Date: Fri, 5 May 2023 14:27:19 +0800 [thread overview]
Message-ID: <ece7722725898924cd5eeb37355de2ff46e6bb7a.1683267850.git.kasimx.liu@intel.com> (raw)
From: KasimX Liu <kasimx.liu@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4445
To record the default value of SpecRevision and Revision.
add '-st' command of input YAML setting file
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
---
UefiPayloadPkg/Settings/UplSettings.yaml | 11 ++++++++++
UefiPayloadPkg/UniversalPayloadBuild.py | 28 ++++++++++++++++++++++--
2 files changed, 37 insertions(+), 2 deletions(-)
create mode 100644 UefiPayloadPkg/Settings/UplSettings.yaml
diff --git a/UefiPayloadPkg/Settings/UplSettings.yaml b/UefiPayloadPkg/Settings/UplSettings.yaml
new file mode 100644
index 0000000000..959170ae76
--- /dev/null
+++ b/UefiPayloadPkg/Settings/UplSettings.yaml
@@ -0,0 +1,11 @@
+## @file
+# Set shell variable EDK_TOOL_PATH to this folder
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+{
+ 'SpecRevision': '0x0070',
+ 'Revision': '0x0000010105'
+}
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 416946a431..a32c76a2da 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -13,6 +13,7 @@ import sys
from ctypes import *
from Tools.ElfFv import ReplaceFv
sys.dont_write_bytecode = True
+import re
class UPLD_INFO_HEADER(LittleEndianStructure):
_pack_ = 1
@@ -153,6 +154,18 @@ def main():
return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0)
+ def GetUplVerFile(Argument):
+ FilePath = open(os.path.abspath(Argument), 'r')
+ FileControl = FilePath.read()
+ SpecRevision = ""
+ Revision = ""
+ Rule1 = r"\{\n*.+: *'(?P<SpecRevision>.+)', *.+: '(?P<Revision>.+)'\n\}"
+ ModuleObjs = re.finditer(Rule1, FileControl, re.I|re.S)
+ for ModeObj in ModuleObjs:
+ SpecRevision = ModeObj.group("SpecRevision")
+ Revision = ModeObj.group("Revision")
+ return SpecRevision, Revision
+
def Validate32BitInteger (Argument):
try:
Value = int (Argument, 0)
@@ -184,14 +197,25 @@ def main():
parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI')
parser.add_argument('-q', '--Quiet', action='store_true', help='Disable all build messages except FATAL ERRORS.')
parser.add_argument("-p", "--pcd", action="append")
- parser.add_argument("-s", "--SpecRevision", type=ValidateSpecRevision, default ='0.7', help='Indicates compliance with a revision of this specification in the BCD format.')
- parser.add_argument("-r", "--Revision", type=Validate32BitInteger, default ='0x0000010105', help='Revision of the Payload binary. Major.Minor.Revision.Build')
+ group1 = parser.add_mutually_exclusive_group()
+ arg_a = group1.add_argument('-st',"--Settings",type=GetUplVerFile, default="UefiPayloadPkg\\Settings\\UplSettings.yaml", help='Get the UplSettings.yaml')
+ group1.add_argument('-s', "--SpecRevision", type=ValidateSpecRevision, default ='0.7', help='Indicates compliance with a revision of this specification in the BCD format.')
+ group2 = parser.add_mutually_exclusive_group()
+ group2.add_argument('-r', "--Revision", type=Validate32BitInteger, default ='0x0000010105', help='Revision of the Payload binary. Major.Minor.Revision.Build')
+ group2._group_actions.append(arg_a)
+
parser.add_argument("-o", "--ProducerId", default ='INTEL', help='A null-terminated OEM-supplied string that identifies the payload producer (16 bytes maximal).')
parser.add_argument("-e", "--BuildEntryOnly", action='store_true', help='Build UniversalPayload Entry file')
parser.add_argument("-pb", "--PreBuildUplBinary", default=None, help='Specify the UniversalPayload file')
parser.add_argument("-sk", "--SkipBuild", action='store_true', help='Skip UniversalPayload build')
parser.add_argument("-af", "--AddFv", type=ValidateAddFv, action='append', help='Add or replace specific FV into payload, Ex: uefi_fv=XXX.fv')
args = parser.parse_args()
+ SpecRevision, Revision= args.Settings
+ if SpecRevision != args.SpecRevision:
+ args.SpecRevision = SpecRevision
+ if Revision != args.Revision:
+ args.Revision = Revision
+ print(args)
MultiFvList = []
UniversalPayloadBinary = args.PreBuildUplBinary
--
2.39.1.windows.1
reply other threads:[~2023-05-05 6:27 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=ece7722725898924cd5eeb37355de2ff46e6bb7a.1683267850.git.kasimx.liu@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