From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.20999.1680085360758761207 for ; Wed, 29 Mar 2023 03:22:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=hLbtuQJO; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: gua.guo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680085360; x=1711621360; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=KcMwvmr4qJzZjkPCGXaFavbHmHbGTiMw+iFooCbu8+w=; b=hLbtuQJOsEYbYK07zaZVTvR4H2WvsBfazADkZEr/ntF5Z4UOZj5QyjAs McdxpTwlh7lOSN28vUo6zRAkiHYdGl1KUcGWxgzgd3rhTRQ27NsvwMxBn X6FR9Hb62ZwmnqunFjV2xsE5SqTAX566M4ZVQQVROveXR3fCGk/ndLiQM InaP99XPkNxOVQE5xsiDddZO9WBpz2lfhXBR7hWm/KRS20I4bCsm9uhsW 15n6SiYXTQ8FbPxt/XKLDaAttzL8xhw443SSRc7r6ffJzS8J5KImoeTn0 SABNP098wba0+rvkaxP+TvutHm2uHArvjaCAY5bCmd6XZuKhV8DcjVbG6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="339562472" X-IronPort-AV: E=Sophos;i="5.98,300,1673942400"; d="scan'208";a="339562472" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 03:22:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="634419897" X-IronPort-AV: E=Sophos;i="5.98,300,1673942400"; d="scan'208";a="634419897" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2023 03:22:39 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 29 Mar 2023 03:22:39 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 29 Mar 2023 03:22:39 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Wed, 29 Mar 2023 03:22:39 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.43) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Wed, 29 Mar 2023 03:22:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DhGXnuIFeH+sA69iNNv9GtT5/7JJ5ahIxtmt+lbiJN58w/m12wpsDnclojLRvLQD8dEsm0Z5XMERhsMEEZNAYQGzjKyb4RxcVI8cLJDiNMnWlzKNkFd026e2Pvs9nOUrs4iAoZqY0Dot+ztySUF0znSXfHIqb0saAy6Cr7FrXqHuCBCtAfiH7H2qPnH2pA3Up0pahEheI4Ui7zFnQVFDWumk8JvfCWM8e/W2I2aae1LxM0BPM/kGb5tNjlir8CqHsYg5Y9muQ7AdyKroHHSbqoeiaVJmL7NUY9hw80IhX5+nbaXm3lxDyBK5aVvWtsQp/UrY3oCf7luT7CQQibK3uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fl/265V7dWE56Xqis8hOprzDpzcktkBQAwqx4Ety3tE=; b=RM65WfctHi5eVCw3Kvuak0sBkQ2C/VVOgbMmCpc+uWWfy+l+ooXMvLXbzdacppuhyQ1rrO5ChmNeTPijuJM5aQBjwI0uSU0B0Csm08cG7xcMavx7HKWtpC9IOegZEQbr7btElycwWynjBzyZkzGviuO3npIr6JiFjRSO57AYEYt8ESUaCGt29gBm0C1AqPFNOOorfO63avNdeIAcE+Wq0H54c5SuWobzivmtc/Z+B+OP8pww/5RQQc1rrFw+0A44C4AAVcKD42KqPOoq9oxH/d77sisjfo0WYLRRVLP84c8WoAZh9AJAZXAl7RZ7RsR8zzikKmbQsups852FFfKSdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by DS0PR11MB7560.namprd11.prod.outlook.com (2603:10b6:8:14b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.35; Wed, 29 Mar 2023 10:22:36 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::2ac6:e032:8994:2e12]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::2ac6:e032:8994:2e12%4]) with mapi id 15.20.6222.033; Wed, 29 Mar 2023 10:22:36 +0000 From: "Guo, Gua" To: "Wu, LinusX" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Ni, Ray" , "Rhodes, Sean" , "Lu, James" Subject: Re: [PATCH] UefiPayloadPkg: Support more input parameter Thread-Topic: [PATCH] UefiPayloadPkg: Support more input parameter Thread-Index: AQHZYigunAjb/sgFlUCe5m8fA0RWN68RjE1Q Date: Wed, 29 Mar 2023 10:22:36 +0000 Message-ID: References: <29d9e1b5a1b44b615c8a7e4fa78b60e76c22aa06.1680082801.git.linusx.wu@intel.com> In-Reply-To: <29d9e1b5a1b44b615c8a7e4fa78b60e76c22aa06.1680082801.git.linusx.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5483:EE_|DS0PR11MB7560:EE_ x-ms-office365-filtering-correlation-id: 7b9909d7-beb0-4717-6228-08db303f843a x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nwzqglD+mtyVvMWorU1t7A1G84xVR4g3OVxRAbfk0SERPqp4aX8esZPeIBiTB3pxghaKU4HUljfisjepF6nXWAT1vyNpvTWbPkP7x9idN3xUYXl+pcpmgbKhlvEHT0AdW4GsCf+6eVubwjcVth1XYXy2bNkNuMpBOd4wB4OHjxvnvDPAHLwOFbHdWH3bNdOvrwoD/hX54SGXw3IGd/SUUP4ILEC1THGWnQAD0llN/MajePwPVzTJOyyoTsoeroczG4QP2f8FfOEF+jCemVUBcUaBXeglPzBoc4ps1sS11lslbYF/YwxdWr46/OPQ07YWx8mDBckJvoY4u6DHgYpaj5v0eiuF4RK8YYL0OXV3ttssfjmqN/dDHJDzQip5fyIcdpfMis6UJSPyLxUHTvKIjz4p9GtK3HHCfPthqT1afUS4kt28L+uH9hdpIsAiWy1VcB96PCFmH7XaIfbMXtsq5e0zdHF3r73AgL3giLYqQNjEjiv/zzUxcF8hdQOq4/6mLkxWa8ExJD/AwmFzLMuvwksXSxu6bfzZbLk1G3f/6NzePJwVie7dZclzLkOPN0BhHu4/G2VvOemR6vcyajtc/CxzAWKZugznoo8VbuArDlk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(376002)(39860400002)(136003)(366004)(346002)(451199021)(83380400001)(6506007)(9686003)(26005)(53546011)(186003)(82960400001)(122000001)(107886003)(38100700002)(38070700005)(86362001)(71200400001)(41300700001)(8936002)(52536014)(5660300002)(478600001)(66946007)(33656002)(966005)(55016003)(7696005)(76116006)(8676002)(66556008)(66476007)(54906003)(64756008)(110136005)(66446008)(4326008)(19627235002)(316002)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?UfOkjzufM1vj7iXTGwr4ORUB9QuYQKW0MI83yQAvCw8PvlcMFp3qEu5i1YR4?= =?us-ascii?Q?oDq3oLZohEHg5FZDFpwlUsFXqMX98dzoliVSOfycWi8XabmUp5SJ9fhz6RGN?= =?us-ascii?Q?J/zZbzyYBR1f+rzc4AV0dvo7TZLQsSJzTYM6lqFhN8zydb+9sj4LumDFjHZX?= =?us-ascii?Q?PxPFwqyThHfMLgYpik8KX61L3Y1RTgE+GPMRWbkh3JHPYsKaA+U+Mk/bDY6s?= =?us-ascii?Q?3jlA4ayGpIxeTYy7M7LgQVvv0eBGDO93BuZN1OHBVFJN3l1K69nIVzWuNRsQ?= =?us-ascii?Q?54V5vj2+M+MTimBhM4vRRZ5bX76nZtzvTwKSXrN7Ol0tNzwxYaEYR0OIw1nx?= =?us-ascii?Q?A+vo8ziSgEm+avTqXPX4dCLknGdTYUriPI2h/+OuPY2dKo6oxPLuht0c6fej?= =?us-ascii?Q?nRcka9jEyawsu7GpFc0gXrFEtVMfGP8BK9A2nNIRAmRz6mrif96F8vmO3qcT?= =?us-ascii?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EPcMmSsayVL1E3E?= =?us-ascii?Q?4KkSffzGmFMOAHtEv2313JuzKelPhsaBqegqslwoAbFkt4jjLqDntnbOeb7C?= =?us-ascii?Q?79nZIl9m17RyWhZWiL6hRua9zLKkPnPYL/bCYC2Wy1wHDz1iwUKihjfMrhW5?= =?us-ascii?Q?0uP1/qQaOkpAw75N8WIuVM3uNkHjb/pEJK08haFluj7UJRCTzKkAk851nS2j?= =?us-ascii?Q?whlVFCuOK98JhXIOPg0=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b9909d7-beb0-4717-6228-08db303f843a X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2023 10:22:36.1980 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GYuaQx89VGtop8Yuo9+TFOK6qLOhXegq7NlKT5HKhCpYYOZBx+ExQZoBnmCwRuuwT1U3rCMtEdC1nidgcnPEkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7560 Return-Path: gua.guo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Gua Guo -----Original Message----- From: Wu, LinusX =20 Sent: Wednesday, March 29, 2023 6:21 PM To: devel@edk2.groups.io Cc: Wu, LinusX ; Dong, Guo ; Ni, R= ay ; Rhodes, Sean ; Lu, James ; Guo, Gua Subject: [PATCH] UefiPayloadPkg: Support more input parameter From: Linus Wu REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4386 Add additional input parameter support --SpecRevision: user input spec version --Revision: user input revision --ProducerId: producer company name 1. UniversalPayloadBuild.py 2. Downgrade spec revision from 0.9 to 0.7 Cc: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo Signed-off-by: Linus Wu --- UefiPayloadPkg/UniversalPayloadBuild.py | 45 ++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/Unive= rsalPayloadBuild.py index 522855eba4..7cd04fdceb 100644 --- a/UefiPayloadPkg/UniversalPayloadBuild.py +++ b/UefiPayloadPkg/UniversalPayloadBuild.py @@ -31,11 +31,48 @@ class UPLD_INFO_HEADER(LittleEndianStructure): def __init__(self): self.Identifier =3D b'PLDH' self.HeaderLength =3D sizeof(UPLD_INFO_HEADER) - self.SpecRevision =3D 0x0009 + self.SpecRevision =3D 0x0070 self.Revision =3D 0x0000010105 self.ImageId =3D b'UEFI' self.ProducerId =3D b'INTEL' =20 +def GenSpecRevision (Argument): + try: + (MajorStr, MinorStr) =3D Argument.split('.') + except: + raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision = format (Major[8-bits].Minor[8-bits]).'.format (Argument)) + # + # Spec Revision Bits 15 : 8 - Major Version. Bits 7 : 0 - Minor Versio= n. + # + if len(MinorStr) > 0 and len(MinorStr) < 3: + try: + Minor =3D int(MinorStr, 16) if len(MinorStr) =3D=3D 2 else (in= t(MinorStr, 16) << 4) + except: + raise argparse.ArgumentTypeError ('{} Minor version of SpecRev= ision is not a valid integer value.'.format (Argument)) + else: + raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision = format (Major[8-bits].Minor[8-bits]).'.format (Argument)) + + if len(MajorStr) > 0 and len(MajorStr) < 3: + try: + Major =3D int(MajorStr, 16) + except: + raise argparse.ArgumentTypeError ('{} Major version of SpecRev= ision is not a valid integer value.'.format (Argument)) + else: + raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision = format (Major[8-bits].Minor[8-bits]).'.format (Argument)) + + return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0) + +def Validate32BitInteger (Argument): + try: + Value =3D int (Argument, 0) + except: + raise argparse.ArgumentTypeError ('{} is not a valid integer value= .'.format (Argument)) + if Value < 0: + raise argparse.ArgumentTypeError ('{} is a negative value.'.format= (Argument)) + if Value > 0xffffffff: + raise argparse.ArgumentTypeError ('{} is larger than 32-bits.'.for= mat (Argument)) + return Value + def RunCommand(cmd): print(cmd) p =3D subprocess.Popen(cmd, shell=3DTrue, stdout=3Dsubprocess.PIPE, st= derr=3Dsubprocess.STDOUT,cwd=3Dos.environ['WORKSPACE']) @@ -111,6 +148,9 @@ def BuildUniversalPayload(Args, MacroList): # Buid Universal Payload Information Section ".upld_info" # upld_info_hdr =3D UPLD_INFO_HEADER() + upld_info_hdr.SpecRevision =3D Args.SpecRevision + upld_info_hdr.Revision =3D Args.Revision + upld_info_hdr.ProducerId =3D Args.ProducerId.encode()[:16] upld_info_hdr.ImageId =3D Args.ImageId.encode()[:16] upld_info_hdr.Attribute |=3D 1 if BuildTarget =3D=3D "DEBUG" else 0 fp =3D open(UpldInfoFile, 'wb') @@ -156,6 +196,9 @@ def main(): parser.add_argument('-i', '--ImageId', type=3Dstr, help=3D'Specify pay= load ID (16 bytes maximal).', default =3D'UEFI') parser.add_argument('-q', '--Quiet', action=3D'store_true', help=3D'Di= sable all build messages except FATAL ERRORS.') parser.add_argument("-p", "--pcd", action=3D"append") + parser.add_argument("-s", "--SpecRevision", type=3DGenSpecRevision, de= fault =3D'0.7', help=3D'Indicates compliance with a revision of this specif= ication in the BCD format.') + parser.add_argument("-r", "--Revision", type=3DValidate32BitInteger, d= efault =3D'0x0000010105', help=3D'Revision of the Payload binary. Major.Min= or.Revision.Build') + parser.add_argument("-o", "--ProducerId", default =3D'INTEL', help=3D'= A null-terminated OEM-supplied string that identifies the payload producer = (16 bytes maximal).') MacroList =3D {} args =3D parser.parse_args() if args.Macro is not None: --=20 2.39.1.windows.1