From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web09.7147.1631268298981829062 for ; Fri, 10 Sep 2021 03:04:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=oWUuF3Lf; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10102"; a="221078198" X-IronPort-AV: E=Sophos;i="5.85,282,1624345200"; d="scan'208";a="221078198" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2021 03:04:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,282,1624345200"; d="scan'208";a="607343070" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga001.fm.intel.com with ESMTP; 10 Sep 2021 03:04:57 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) 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.2242.12; Fri, 10 Sep 2021 03:04:57 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 10 Sep 2021 03:04:56 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 10 Sep 2021 03:04:56 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.175) 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.2242.12; Fri, 10 Sep 2021 03:04:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jdrhXl3L4KeNCXKMSfxHBsKa7DDup8PnD4Gn07VOpVHyxexFmX+goM9WOzur0ol4rcYylB2DGpEBKiEwBmPwcGi2hAlrBL3dXk1K+hEDGW0KByXjNghSJ+bq2kC7r+/rwtT3dBs1FfFyEMn83MRX5/se2VusNMDR0SeymfNlS1McZ6kGcW065+PvOmu+RLweFO83/mmr9ErtUcEardZ9mZ9qHaAmr/wLL11kARhbGMdVbEqXRW/wkTSQXgRPse2ssMacJMVsCTC4HxDEEzMLPhbrVIR0QmlZSNbYR11Cz6r/6aaWZk4kJZxbNE61/ObgunvcUKHbdwqQNBMd0B5KgA== 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; bh=Z1YTemHQavqA38WrggiW1axLbpE85bYEvi9gd0iX4aY=; b=DvfUNtudJnIDyhLcAR8Dv76ZxUSY4ga6cIuQ3qa/uMtHqN2D4/ZXo9m4IGZ6rSJQYmftZGQqv+b3nk9NwzWwzOTFT5L3yyD/gpoqcHXdzuonQ/q6o+dg0QRkp+ZzJnLpsIrfRzPnXCYiuhEydfm9eWLIK7Cys7eXqDXqZAq11hBobM3sOYiE4oZBQKTnG520OIDPq8E+/tdDNZiZ69+oBbjVuTXXWknTmeFPkk/P/R+388rl2kmc+thgnma7rUpsRlhage0kkASugog4ZzZRSBjAa+ocRwv6DU5TRf0FY0oUPjo4fLtT29+BHfVKF+8wuFJjeqg368JHHeGGjNfvHQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z1YTemHQavqA38WrggiW1axLbpE85bYEvi9gd0iX4aY=; b=oWUuF3LfYPE5GHsZEij5EnzQZqHX1uvdcgiH/5XHmk0zVe1XkjclEFW9wReRekw9AuPzXlpSX//2zWWfl/q2ePoTTG6HWO+Ow1B5zzahHJkwp9jO5jr4qRc24TF0Z77Hkz08y7FkpIdKlrYS9DWpZLMaD5ZXRnxm+Z9IFGuPvo8= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by MWHPR11MB2016.namprd11.prod.outlook.com (2603:10b6:300:26::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Fri, 10 Sep 2021 10:04:55 +0000 Received: from CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::50ce:c9a3:ab37:9fac]) by CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::50ce:c9a3:ab37:9fac%9]) with mapi id 15.20.4500.017; Fri, 10 Sep 2021 10:04:54 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" , "Feng, Bob C" , "Chen, Christine" CC: "Dong, Guo" , "Ma, Maurice" , "You, Benjamin" , "Liu, Zhiguang" Subject: Re: [PATCH] UefiPayloadPkg: Add script to build UniversalPayload in UefiPayloadPkg Thread-Topic: [PATCH] UefiPayloadPkg: Add script to build UniversalPayload in UefiPayloadPkg Thread-Index: AQHXphwjR+oGl/GRXUqNWVfB6P/0Y6udBMWQ Date: Fri, 10 Sep 2021 10:04:54 +0000 Message-ID: References: <20210910081548.1816-1-dun.tan@intel.com> In-Reply-To: <20210910081548.1816-1-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.100.41 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3f4058b3-35db-4f8c-eff4-08d974427046 x-ms-traffictypediagnostic: MWHPR11MB2016: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uDY4T+14Kpt/a2HpxttH13NiMJG3LLSb9kzD+rdxK0tdOjYs0+kU8Hi4hTSzgHmWPc0H4Pe5S7qvdp/5uEYTz+PKIGyCUMdD179XdQjCzAjJ6jv7GB+I/iSXu5YeHlLHdpayGycdHCmfJbA7MkONhE54RNxLHogoFuIqXXRhFNMQzb2OjG66F3eKIb8qvYNp2uKvj6po/95/cvyWpgZLiNCfNVwwaTylcZFLNvUc7PbHDRiN2wWn5ksBTm+O9hsx05yfT+8M4WtIgqbHoeJtOtd0x5wcr5ff4ggR2YoUUP/DyUFlLhYZq8PrS7M1w4sM7iYSUEQDv81GMmV6zkK+o4u+rPqSIh/hpjTAmahPZbHEvxBkGwlmvd5MQn7JsOJqj0520626/jtZ+iOoDhLR+JhhEyzZdDJTR5J0myNT9mi45Famse7UdTy5D54ro5jaHKPTq0lm0j0g2Nqfyab65I1H7Cjg6OGdRkUxPxynKX34CGd0mXE4kJwR72M+lNSN+zD1LtzqR0MJlBTe0fRVb9dKRiynO1Wc34Iw/QlIzY6cxpohdu68bl9yaUjT6jp765CCNpT8dLCK/whLAY1uRn+LTWqXeLTG+zxiDdGO7iGLP1OpM4CXLod6xrUbGYyglHACUTTd1knf7ln8Jk7HRUkFjxI5zaYgETXCRHwIf2JMrG0hKk1fJ84JAg8/TEw0GJDWSk8Ko/CTPXTsKLNBag== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4930.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(346002)(366004)(39850400004)(376002)(7696005)(478600001)(33656002)(76116006)(107886003)(6506007)(55016002)(5660300002)(4326008)(38100700002)(38070700005)(122000001)(66946007)(83380400001)(110136005)(186003)(8936002)(9686003)(54906003)(66446008)(8676002)(66556008)(66476007)(316002)(86362001)(64756008)(2906002)(52536014)(6636002)(71200400001)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?3PCTDzV52k86+SXZA3icXjHk8bjQGepKD8Ju05nNrWPztoiuSgdWpI58h4GG?= =?us-ascii?Q?+ywCpL9VfRi9EHfcWArDfiM14d5NU7gLLDO7z3pWMGEztjPT6d9BLnFAYuLZ?= =?us-ascii?Q?B+Ojz8bzthg/WicICmqtuHUj6QFdBUrwervMFfoK+L/WUvPRosLK1hwhY423?= =?us-ascii?Q?cq1BaXmVEiVF45tLj6Dykyf2Th3O03Ze4/zGkuoi4e8yDI3qbHn1BHYY0ymT?= =?us-ascii?Q?Cpe0CCS1SCf+av8nryxRWAEEMU7UB1KwklpJ6vdfJro2LQTVUbXh22H6+GZL?= =?us-ascii?Q?ZXMa4p/eiH679MbcRNvNF9muIK2ThEEoeo3Qc8I9UoIjvH0YIIR+mQ3Rejw5?= =?us-ascii?Q?/iPeO38FnylvAZ1WBMQUsWo1cp3GeoseTFo9rmKUusj9rsnsEvP/q+GZsYFZ?= =?us-ascii?Q?8ZekpM4qZ9bWJRb09jLwwzD+Xb37P/mk33CkeHl08ZAX9cdO6cu7pgQUYMrR?= =?us-ascii?Q?IIcnIh41oHLHLAeI/TMZt6TU0kivr6orCDUg8gui+R2cONz/AReedouEKcQF?= =?us-ascii?Q?Bg0beyOB95E5c9QMJ4I0+5UVy/6aoABvdaFg8vmISsWPvHC/UHmD21xU1WD9?= =?us-ascii?Q?fX99iYbF2rX0mIFbbHnLqNmtAR6TzpamsiHuaU44LxFSI13YlC6cu06OcbOn?= =?us-ascii?Q?XHsZYaQBFZ/q9crP5YykNqe552cOYMhImS4DlbbZsvkdNk+aoc6r+1FScuXO?= =?us-ascii?Q?e9msEjspORU7EHA5gptVhnU/OFkJs7Qon4Eo7me2oRlIfPJfCROAEZx6RrQP?= =?us-ascii?Q?zfIkGB9YAWQhPjf3tUgG2otRsxXi839ZcCNxRbFkO4ePQcgwvzGwWHptr64M?= =?us-ascii?Q?ei0QCKdeUjYvf5D/y+02+UVnCRghEDbG4djMTp8tIyVkH9TBA1R20z6Wbiws?= =?us-ascii?Q?gXMJF/AiP7oeAT1Cxm5p9oN7aub0Vo+AstpmXYhIRIpmNtWywzuhQ2phhnkg?= =?us-ascii?Q?Gn5DOaBu6oYGGp4Nmx1DtRboE5e5jUoLlc1lHYTRx4jBkgPDReRJ2RTzfzJP?= =?us-ascii?Q?9uOJczPmwueWInd5OmJohjlSynxbICPK6e/z9Rf5MCtU/3uC8teqMbLO5aMT?= =?us-ascii?Q?b/IOyiEFqmzJvBeKkmxH3Mv8CmcIxxr6gizQixmiIo5B3F7nZ5EeFmuQpO9I?= =?us-ascii?Q?sTeijZBpWBg99S2mOE0KOKqMGjtrsobbrnkwf301pkeIkgQmy1+U71l/4m9Q?= =?us-ascii?Q?3tz6Ik389xvqYpjV6WT4cZDuwPoDWoLhl0xyVydlF4BIhfiQ8dtORLB8OFk3?= =?us-ascii?Q?YkoOXGksci1gfj6L2XgFiqD9yidELOG0ipyE8Pwjpp2yMqsSWSsYCrTb3jVX?= =?us-ascii?Q?BBtjdHH2qTKN72yB/QD4+C63?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4930.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f4058b3-35db-4f8c-eff4-08d974427046 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Sep 2021 10:04:54.9080 (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: sLYR13Zz0rTk2u48I6bt6tMkfNkgsJAOIaF0yP8GfnZ7yU1GlRLEzpliVF7kEKZi9s3bRSVo6dUq7rNs4wdIag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB2016 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable + Bob for general python language level review. more comments embedded. > +def BuildUniversalPayload(args, MacroList): > + build_target =3D args.Target > + tool_chain_tag =3D args.ToolChain > + elf_tool_chain =3D 'CLANGDWARF' > + entry_module_inf =3D os.path.join("UefiPayloadPkg", "UefiPayloadEntr= y", "UniversalPayloadEntry.inf") 1. Lots of hardcode file/directory names here. Can we write in below way? entry_module_inf =3D "UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry= .inf" entry_module_inf =3D os.path.normpath(entry_module_inf) > + fv =3D os.path.join(os.environ['WORKSPACE'], "Build", "UefiPayloadPk= gX64", "%s_%s"%(build_target, tool_chain_tag), "FV", > "DXEFV.Fv") > + entry =3D os.path.join(os.environ['WORKSPACE'], "Build", "UefiPayloa= dPkgX64", "%s_%s"%(build_target, elf_tool_chain), "X64", > "UefiPayloadPkg", "UefiPayloadEntry", "UniversalPayloadEntry", "DEBUG", "= UniversalPayloadEntry.dll") 2. build_directory =3D os.path.join(os.environ['WORKSPACE'], os.path.normpath = ("Build/UefiPayloadPkgX64") fv =3D os.path.join(build_directory, "%s_%s"%(build_target, tool_chain_tag)= , os.path.normpath("FV/DXEFV.fv")) entry =3D ...... > + dsc_patch =3D os.path.join("UefiPayloadPkg", "UefiPayloadPkg.dsc") 3. Similar change can be applied to dsc_patch (typo? dsc_path?) > + macro_list =3D " " > + for key in MacroList: > + macro_list +=3D"-D {0}=3D{1} ".format(key, MacroList[key]) 4. you can set macro_list =3D "", then insert space before each "-D" in th= e loop. > + > + # > + # Building DXE core and DXE drivers as DXEFV. > + # > + build_payload =3D "build -p %s -b %s -a X64 -t %s -y UplBuildReport.= txt"%(dsc_patch, build_target, tool_chain_tag) > + build_payload +=3D macro_list 5. you could write in following way build_payload =3D f"build -p {dsc_patch} ..." > + RunCommand(build_payload) > + # > + # Building Universal Payload entry. > + # > + build_module =3D "build -p %s -b %s -a X64 -m %s -t %s -y UplBuildRe= portEntry.txt"%(dsc_patch, build_target, > entry_module_inf, elf_tool_chain) 6. can you please make sure that there is no file generated in the workspac= e directory. All files are generated under build directory including the re= port file and the ELF file. > + shutil.copy (entry, os.path.join(os.environ['WORKSPACE'], 'UPL.elf')= ) 7. do you copy out. > + > +def main(): > + print ("Begin to build Universal Payload...") 8. above message is not needed when printing help. maybe just remove the ab= ove message completely. > + parser =3D argparse.ArgumentParser(description=3D'For build Universa= l Payload') > + parser.add_argument('-t', '--ToolChain', help=3D"Using the ToolChain= to build the UniversalPayload") > + parser.add_argument('-b', '--Target', help=3D"Using the TARGET to bu= ild the UniversalPayload") 9. set TARGET to DEBUG as default?