From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.20848.1683268046298784027 for ; Thu, 04 May 2023 23:27:26 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=iu+W7LGn; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: kasimx.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683268046; x=1714804046; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Imzgu20wMq3SadfJcEfCbp7BuR/ikFGxNRioKPvi+R4=; b=iu+W7LGnwtgJMJpFWSFNFtCzo6W8UsssezhCoL++Ahuye2bNkGT/9Rpn cAVO+EOa7RYxaZ/nTJ6dl3rimsAp7C0n8upXYuHxoMhykwnFoO+0+91oL knQnXwC87TsPJu8FN1m+ELUkhC3aHGPeVjHZE6P009VKtkUHqTTmz8ikl Tor0tBYxY3Ov61D9odRE3366vcgoCNEW7eQZmH9ljTvawaT+s3CLtyBet uY3bNJvs6KfyOiiG8a07kSba69bDR5lkYm6Az6cTOOqpsPswJzbv+zAiQ uEScX0tTNvN/BP0LLnMcYXEmmiWJrla6S9HK4o6xJ1AAx9uCgDj9WL8DK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10700"; a="352182599" X-IronPort-AV: E=Sophos;i="5.99,251,1677571200"; d="scan'208";a="352182599" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2023 23:27:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10700"; a="841560296" X-IronPort-AV: E=Sophos;i="5.99,251,1677571200"; d="scan'208";a="841560296" Received: from jenkailx-desk1.gar.corp.intel.com ([10.227.107.51]) by fmsmga001.fm.intel.com with ESMTP; 04 May 2023 23:27:24 -0700 From: kasimx.liu@intel.com To: devel@edk2.groups.io Cc: KasimX Liu , Guo Dong , Ray Ni , James Lu , Gua Guo Subject: [PATCH] UefiPayloadPkg:Add YAML support version configuration Date: Fri, 5 May 2023 14:27:19 +0800 Message-Id: X-Mailer: git-send-email 2.39.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: KasimX Liu REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4445 To record the default value of SpecRevision and Revision. add '-st' command of input YAML setting file Cc: Guo Dong Cc: Ray Ni Cc: James Lu Cc: Gua Guo Signed-off-by: KasimX Liu --- 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/Sett= ings/UplSettings.yaml new file mode 100644 index 0000000000..959170ae76 --- /dev/null +++ b/UefiPayloadPkg/Settings/UplSettings.yaml @@ -0,0 +1,11 @@ +## @file=0D +# Set shell variable EDK_TOOL_PATH to this folder=0D +#=0D +# Copyright (c) Microsoft Corporation.=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +=0D +{=0D + 'SpecRevision': '0x0070',=0D + 'Revision': '0x0000010105'=0D +}=0D diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/Unive= rsalPayloadBuild.py index 416946a431..a32c76a2da 100644 --- a/UefiPayloadPkg/UniversalPayloadBuild.py +++ b/UefiPayloadPkg/UniversalPayloadBuild.py @@ -13,6 +13,7 @@ import sys from ctypes import *=0D from Tools.ElfFv import ReplaceFv=0D sys.dont_write_bytecode =3D True=0D +import re=0D =0D class UPLD_INFO_HEADER(LittleEndianStructure):=0D _pack_ =3D 1=0D @@ -153,6 +154,18 @@ def main(): =0D return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0)=0D =0D + def GetUplVerFile(Argument):=0D + FilePath =3D open(os.path.abspath(Argument), 'r')=0D + FileControl =3D FilePath.read()=0D + SpecRevision =3D ""=0D + Revision =3D ""=0D + Rule1 =3D r"\{\n*.+: *'(?P.+)', *.+: '(?P.+)= '\n\}"=0D + ModuleObjs =3D re.finditer(Rule1, FileControl, re.I|re.S)=0D + for ModeObj in ModuleObjs:=0D + SpecRevision =3D ModeObj.group("SpecRevision")=0D + Revision =3D ModeObj.group("Revision")=0D + return SpecRevision, Revision=0D +=0D def Validate32BitInteger (Argument):=0D try:=0D Value =3D int (Argument, 0)=0D @@ -184,14 +197,25 @@ def main(): parser.add_argument('-i', '--ImageId', type=3Dstr, help=3D'Specify pay= load ID (16 bytes maximal).', default =3D'UEFI')=0D parser.add_argument('-q', '--Quiet', action=3D'store_true', help=3D'Di= sable all build messages except FATAL ERRORS.')=0D parser.add_argument("-p", "--pcd", action=3D"append")=0D - parser.add_argument("-s", "--SpecRevision", type=3DValidateSpecRevisio= n, default =3D'0.7', help=3D'Indicates compliance with a revision of this s= pecification in the BCD format.')=0D - parser.add_argument("-r", "--Revision", type=3DValidate32BitInteger, d= efault =3D'0x0000010105', help=3D'Revision of the Payload binary. Major.Min= or.Revision.Build')=0D + group1 =3D parser.add_mutually_exclusive_group()=0D + arg_a =3D group1.add_argument('-st',"--Settings",type=3DGetUplVerFile,= default=3D"UefiPayloadPkg\\Settings\\UplSettings.yaml", help=3D'Get the Up= lSettings.yaml')=0D + group1.add_argument('-s', "--SpecRevision", type=3DValidateSpecRevisio= n, default =3D'0.7', help=3D'Indicates compliance with a revision of this s= pecification in the BCD format.')=0D + group2 =3D parser.add_mutually_exclusive_group()=0D + group2.add_argument('-r', "--Revision", type=3DValidate32BitInteger, d= efault =3D'0x0000010105', help=3D'Revision of the Payload binary. Major.Min= or.Revision.Build')=0D + group2._group_actions.append(arg_a)=0D +=0D parser.add_argument("-o", "--ProducerId", default =3D'INTEL', help=3D'= A null-terminated OEM-supplied string that identifies the payload producer = (16 bytes maximal).')=0D parser.add_argument("-e", "--BuildEntryOnly", action=3D'store_true', h= elp=3D'Build UniversalPayload Entry file')=0D parser.add_argument("-pb", "--PreBuildUplBinary", default=3DNone, help= =3D'Specify the UniversalPayload file')=0D parser.add_argument("-sk", "--SkipBuild", action=3D'store_true', help= =3D'Skip UniversalPayload build')=0D parser.add_argument("-af", "--AddFv", type=3DValidateAddFv, action=3D'= append', help=3D'Add or replace specific FV into payload, Ex: uefi_fv=3DXXX= .fv')=0D args =3D parser.parse_args()=0D + SpecRevision, Revision=3D args.Settings=0D + if SpecRevision !=3D args.SpecRevision:=0D + args.SpecRevision =3D SpecRevision=0D + if Revision !=3D args.Revision:=0D + args.Revision =3D Revision=0D + print(args)=0D =0D MultiFvList =3D []=0D UniversalPayloadBinary =3D args.PreBuildUplBinary=0D --=20 2.39.1.windows.1