From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.202176.1672306251645997398 for ; Thu, 29 Dec 2022 01:30:51 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=BNA77XSJ; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: bob.c.feng@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672306251; x=1703842251; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=BmpP6+gy/WsKnfAuJvzsMMrj6T58TqQzn6VaO7b1hE8=; b=BNA77XSJP1aImajF69Xs20jeBQfiqpft9SIENU2/jtUJZkiYbMZ9H/Sc bCEQgeUAHJDaU56pQhCIXPLe4wJ3rpVEMzDvjuRlHcEotVrTP7ecVZIqd 29EYhX78xmPtriUnL1RjoK6+p/ENNESVQoK0AnTyM95Lc95GgYRfDwpuQ jbq4IzvorOrr4laC/uZjm22V8ZXcrfd221k6bqQQ6BumDJSnu847qDUEv 9wPcwK5JTQ3R+Gw3pzVfcLACViwAcA0eDjIU8UWIAV7YGRyqNZCmjMrhV IAv7FSRXZPMFzMMQPeflRBfrl+wsZgxLNcsZKCjKUfhgFf/kt9Ui/63VE g==; X-IronPort-AV: E=McAfee;i="6500,9779,10574"; a="308771503" X-IronPort-AV: E=Sophos;i="5.96,283,1665471600"; d="scan'208";a="308771503" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Dec 2022 01:30:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10574"; a="898921284" X-IronPort-AV: E=Sophos;i="5.96,283,1665471600"; d="scan'208";a="898921284" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga006.fm.intel.com with ESMTP; 29 Dec 2022 01:30:50 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 29 Dec 2022 01:30:49 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 29 Dec 2022 01:30:49 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 29 Dec 2022 01:30:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GsEjnIXOGN292KXJIKb9UPUu5Kz06IOsUre95/2QpIgzoLSaM68ag5vursCUouwQWVZRxqhnPJkXJuwcLyahV1h4aICRxhfnjyvt4CGaPkfdg9TyRW+IgOfZd222YvYGx9VZN+Y+fFIMt2BfEMIeH+x2wKyGDrkZLoufYSQa12ivB2JO3xXjDkf4YA3pxCbGiJEmXuvy33vd8C1Pf7SmSzqhp7NKA4VNrDcCFrUTeNqJdVM4z/41/9bnFY1o3G7lXzLqyOfjDbjdD5L91kqD1yDxzGwtzKMhuOh8lE6485KdC4cyL/2+lcLz1bjKHyulkkkB57/tOiWvTAFXas/nOg== 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=4mfAgZwrX3VkxQFMmsvJnHsGWeW7FarnPkuHQm7RN9k=; b=JGFexosfvRrVVGYCZFi+bUGMJvc053nlEEFZqjlzwsu5TXR7dRFzi9ukapNoNGzbjZUfUbXr3Zu1Xumm8+e0S2gUY9bHqQEIKN+3uGSqgTZa0SZDzA5Kh1dddOkt1cQjrUXAcTSlnSMnvBJfxvvSZyxvT1RXoqMA2QM1lS5vFeSIxwzXNHcWxwqWC3UJ15jXzol3ugBKLhMwB4Fzwk5uj0lGWQke28vAukVdTK7wzGjKsR5ID1nvTMw2jszK+3Ki0rP+fP+f8QgC5tGRFv/Y4qHe5DzMon/ZVmTM6t/9wPmUfTSBHFKfLAxnHX0xZDpbgA5x1u7mqteZR7h2T9C5PA== 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 PH7PR11MB5863.namprd11.prod.outlook.com (2603:10b6:510:135::11) by SJ2PR11MB7574.namprd11.prod.outlook.com (2603:10b6:a03:4ca::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Thu, 29 Dec 2022 09:30:46 +0000 Received: from PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::1251:f989:b162:4186]) by PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::1251:f989:b162:4186%3]) with mapi id 15.20.5944.012; Thu, 29 Dec 2022 09:30:46 +0000 From: "Bob Feng" To: "devel@edk2.groups.io" , "Chen, Christine" CC: "Gao, Liming" Subject: Re: [edk2-devel] [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation Thread-Topic: [edk2-devel] [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation Thread-Index: AQHY+M7Ztd/HD5R/UU27gMX7dt2ae66E3jGQ Date: Thu, 29 Dec 2022 09:30:46 +0000 Message-ID: References: <20221115084643.568-1-yuwei.chen@intel.com> In-Reply-To: <20221115084643.568-1-yuwei.chen@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: PH7PR11MB5863:EE_|SJ2PR11MB7574:EE_ x-ms-office365-filtering-correlation-id: b05cc675-1444-4752-5db6-08dae97f5d8c 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: eNOxDeYlBOFih6ch7TiQnPj23K9UL1ad8hSK7xje2gdc8SR7ERqoCk7Xqde8du8r0+/KGp0Vkrd23SOjv/4eXM/Re8cBBzheC07i4yoxNbj7ogXZ/lNizr9OiSDPZ9/+WWlpbrM1nQ61fn9gDPwUs0vubBt1WfXNP0jjXbP7JVHccW/94lMzS76xFIgO0AVwKZH/IoeD0wGqj6PegbLZikB0uunZwWNmihod06Ej2jR7BNttuTcoYLgKLXO9ha021d2fJQxBCpOrtH4/t33NzaAiUwlxb8QC3k4HJSTkzR5+XnjWLkpBUSf1O2wPRpVlM4hh9N5lzcdR5b5dYsi3haoLjLH8g+39NllUu8DiJWEMqms84A/jvqKpuseLlU+sOVfnLHPIqYuFsqhpLXp8UmpPZFfm+NaRY6V6MXG3bI1wOkS8CtEv0gVZN1sEpSK4gUjKhgrvyOcHSnbE38rno5ETZvBE708SAFrNeMqt6Pp+ff2d6cjxdjUvPv1a0ihOOBiUO9f940gHhxeUXVx0Gu0wike6Im5HFg1hRmq95Qa47bWTVw9Et3a/RXiR/s50tvonlhDi6a+eMex11KHY5nnCerUiJTw2p4IHET5Q/2DWTV2ijaf1u2xWCr3nO6hYUgd4nThfrAGlnLqWUds6tSJDZtCs4kWp1P0SN/gXeW5FveYm746TEBg2YxBDfxwkSnMnhpS0GQ5FE0i5N85sL6UyazNX+pAE0dabazbdj3jvLjUhCttDs6gsxh6Qkd4mcfuRqmYpm3qqV7q1bHsFMw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB5863.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(366004)(346002)(376002)(39860400002)(396003)(451199015)(122000001)(38100700002)(82960400001)(83380400001)(33656002)(86362001)(38070700005)(8676002)(66446008)(64756008)(4326008)(66556008)(76116006)(66946007)(66476007)(52536014)(41300700001)(6636002)(71200400001)(110136005)(316002)(55016003)(2906002)(8936002)(30864003)(5660300002)(9686003)(26005)(186003)(966005)(478600001)(53546011)(7696005)(6506007)(66899015)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7geY9cOOJg8PqdtyaSO/M0GW23BokpDKH1b/QjoPBQIa5uBt5Wavv6+fnrOF?= =?us-ascii?Q?rXiml0PqrQPXekE00qUiHscDwp8VGF7DeeaZYsbj9R1/P6UnPvgVbaijVOOK?= =?us-ascii?Q?heY6KH0p1C9GGgUbnNs+4DDwWPi4RF/gYNkudzm0LymlCdyEWs3nFXZgm7oj?= =?us-ascii?Q?Cxg8UAz9CghiXP4bwapWMtFkiypNPHvdx/mT10PWFpSCzAEAyitLkKz+3xxw?= =?us-ascii?Q?+UnUEmNccAhMmP1DCWFDtyMMcrVvHRYe5DGXddDBarp6L9L0yBzUfY55D0+E?= =?us-ascii?Q?KUHgx5sim5WM2DUQRbHhPhaRYK4eafhkZUVSvyoaRGgGOHsfVxoKaqFaezFF?= =?us-ascii?Q?b3k7ZUdhG22JJRuamuA7r6ABRLAPaHxaXe0UKHyJjBf+XWmSGPBC3/rfcyea?= =?us-ascii?Q?ERbUsG6Uxi9Ni8kJOe/wuWGpJxmz3y0gxteFG0jendQgjWNB0qbIEJ6g4avx?= =?us-ascii?Q?BmhWVnFwZDwBlGSzeKaaME15xQwuqQcVx/LbLGJUR1MGpF2TbWLKtHCISW4F?= =?us-ascii?Q?q3HVGiC78Y98G99nrvFOIkqPn6oUpJEVICf+1YKWR51WQtjIDSprCedoVyjH?= =?us-ascii?Q?OYr4xCNhOLV3qr+fOFbMghbIHrDjiSV9hbdN/gDZ+2+vPTaFrzrglDzt3hJK?= =?us-ascii?Q?lc1nQS9lDS8rH+MrpJk5swvHroa2uA4oZsnZxVTXil5oGwt7zCsTnweXsx3v?= =?us-ascii?Q?o4NqJisSKVqL5bK5koo0joopMNr29yT8yJgBDFUx+eTTLpo2mvehz7hhACl+?= =?us-ascii?Q?IolEVDpaZafCm4nocEU4jpgfLV+E3SCEYhgRy8O2qlC0RVhOiO4wqt0lwZnd?= =?us-ascii?Q?woDb4F4eO7zrdtx9bwgp/svkbefXn+ulgKSW8fcSMW6atJxyUsRRPkjIqmT2?= =?us-ascii?Q?YjSK+dTK8Zm7qr+meb8B/IQHbr3R1lDP68bW3URQMphnn81ZXrA14K3ndYEO?= =?us-ascii?Q?3ShKzbb3tstEF8yE6CFOAyyUTJ1SWmUmAaNOEouybnhbctnxCzaMqdn9uIEu?= =?us-ascii?Q?LRxVPA7M9OLwdjr12Xw1SKh1M+j0TKl/lndis+QdBE/2JcZDYVWpJSESyvNy?= =?us-ascii?Q?qSNFUyXdP0bXFy5ZGyXsprXOBh/eJnOWnbxFLM2cAg6Z+g64E1WM1dWwiWR1?= =?us-ascii?Q?S0pVpoegEqwj2t9AX/Vp4a36h56tXqi9U9H84/IgCLealVf1IlXzNFUHdVPd?= =?us-ascii?Q?MsheZ1scB/jjXj2sN3aVQ2daD7mFDyGrBOH4yhO1LM2TWOcNdNkdOlB5ag/l?= =?us-ascii?Q?+Vc6AKbmi17Ct42o/Ztu/LM5C2E7YtgO3yHzRAqjkg08c1ARGiqgsWPwkvM/?= =?us-ascii?Q?1jUKruhhewF7/qu4VAfpxY7sCFfVgRpk0S0UMRUp7B0GtVWLAVdYqj8r+CTi?= =?us-ascii?Q?A2yK5RtdxzIaAd7J/OPJWNr2015/x3Bgw77QyI/vtq4ESYscGQ/WFjUBLriP?= =?us-ascii?Q?Trw5bQwCuUdJNYCvwMVxoFRWhDmLJDqTFt23n3/G4Opu3jGsLE3yCkbmkkES?= =?us-ascii?Q?lUCbyDELIMYKiFrSkuxF5svYfbJtjN9kfAG8+YJjAWGTpb7YanaDoUyYTx1r?= =?us-ascii?Q?3oEL3Flv+czSGX7Mk+WUEiaRNtMRuHOJ+A7Ecvlw?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5863.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b05cc675-1444-4752-5db6-08dae97f5d8c X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Dec 2022 09:30:46.5319 (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: iNzoiB+PZBDuQPDZG9qdnzjWoKgKFgjq8ZhbdRzaooDP84+PJoeKm1HiklLRPRLc0WihSO8CMcYBd7VSNPMKnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7574 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Christine, Could you send out the entire patch series together? Thanks, Bob -----Original Message----- From: devel@edk2.groups.io On Behalf Of Yuwei Chen Sent: Tuesday, November 15, 2022 4:47 PM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming Subject: [edk2-devel] [Patch V2 3/3] [edk2-staging]BaseTools: Add new build= option for Variable default value generation Add new build option "--gen-default-variable-bin" for Variable default valu= e generation from Python VFR tool's extended json output file. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yuwei Chen --- BaseTools/Source/Python/AutoGen/DataPipe.py | 2 ++ BaseTools/Source/Python/AutoGen/GenDefaultVar.py | 577 ++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++++ BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 8 ++++++++ BaseTools/Source/Python/Common/GlobalData.py | 5 +++++ BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py | 12 ++++++------ BaseTools/Source/Python/build/build.py | 19 ++++++++++++= ++++++- BaseTools/Source/Python/build/buildoptions.py | 1 + 7 files changed, 617 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Source= /Python/AutoGen/DataPipe.py index c700baf7b7..e45b4a928a 100755 --- a/BaseTools/Source/Python/AutoGen/DataPipe.py +++ b/BaseTools/Source/Python/AutoGen/DataPipe.py @@ -173,3 +173,5 @@ class MemoryDataPipe(DataPipe): self.DataContainer =3D {"gPlatformFinalPcds":GlobalData.gPlatformF= inalPcds} self.DataContainer =3D {"VfrYamlEnable": GlobalData.gVfr= YamlEnable}++ self.DataContainer =3D {"GenDefaultVarBin": GlobalData= .gGenDefaultVarBin}diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultV= ar.py b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py new file mode 100644 index 0000000000..859d4f25eb --- /dev/null +++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py @@ -0,0 +1,577 @@ +import json+from ctypes import *+import re+import copy+from struct import = unpack+import os+import Common.EdkLogger as EdkLogger++class GUID(Structure= ):+ _fields_ =3D [+ ('Guid1', c_uint32),+ ('Gui= d2', c_uint16),+ ('Guid3', c_uint16),+ = ('Guid4', ARRAY(c_uint8, 8)),+ ]++ def from_list(self, lis= tformat):+ self.Guid1 =3D listformat[0]+ self.Guid2 =3D listf= ormat[1]+ self.Guid3 =3D listformat[2]+ for i in range(8):+ = self.Guid4[i] =3D listformat[i+3]++ def __cmp__(self, othergui= d):+ if isinstance(otherguid, GUID):+ return 1+ rt= =3D False+ if self.Guid1 =3D=3D otherguid.Guid1 and self.Guid2 =3D= =3D otherguid.Guid2 and self.Guid3 =3D=3D otherguid.Guid3:+ rt = =3D True+ for i in range(8):+ rt =3D rt & (self.G= uid4[i] =3D=3D otherguid.Guid4[i])+ return rt+++class TIME(Structure= ):+ _fields_ =3D [+ ('Year', c_uint16),+ ('Mon= th', c_uint8),+ ('Day', c_uint8),+ ('= Hour', c_uint8),+ ('Minute', c_uint8),+ = ('Second', c_uint8),+ ('Pad1', c_uint8),+ = ('Nanosecond', c_uint32),+ ('TimeZone', c_uint16),= + ('Daylight', c_uint8),+ ('Pad2', c_uint= 8),+ ]+ def __init__(self):+ self.Year =3D 0x0+ self.Mo= nth =3D 0x0+ self.Day =3D 0x0+ self.Hour =3D 0x0+ self= .Minute =3D 0x0+ self.Second =3D 0x0+ self.Pad1 =3D 0x0+ = self.Nanosecond =3D 0x0+ self.TimeZone =3D 0x0+ self.Dayli= ght =3D 0x0+ self.Pad2 =3D 0x0+++EFI_VARIABLE_GUID =3D [0xddcf3616, = 0x3275, 0x4164,+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0x= fe, 0x7d]+EFI_AUTHENTICATED_VARIABLE_GUID =3D [+ 0xaaf32c78, 0x947b, 0x4= 39a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]++AuthVarGuid =3D GUID(= )+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)+VarGuid =3D GUID()= +VarGuid.from_list(EFI_VARIABLE_GUID)++# Variable Store Header Format.+VARI= ABLE_STORE_FORMATTED =3D 0x5a+# Variable Store Header State.+VARIABLE_STORE= _HEALTHY =3D 0xfe+++class VARIABLE_STORE_HEADER(Structure):+ _fields_ = =3D [+ ('Signature', GUID),+ ('Size', = c_uint32),+ ('Format', c_uint8),+ = ('State', c_uint8),+ ('Reserved', = c_uint16),+ ('Reserved1', c_uint32),+ ]+++# Va= riable data start flag.+VARIABLE_DATA =3D 0x55AA++# Variable State flags.+V= AR_IN_DELETED_TRANSITION =3D 0xfe+VAR_DELETED =3D 0xfd+VAR_HEADER_VALID_ONL= Y =3D 0x7f+VAR_ADDED =3D 0x3f+++class VARIABLE_HEADER(Structure):+ _fiel= ds_ =3D [+ ('StartId', c_uint16),+ ('State',= c_uint8),+ ('Reserved', c_uint8)= ,+ ('Attributes', c_uint32),+ ('NameSize', = c_uint32),+ ('DataSize', c_uint32),+ = ('VendorGuid', GUID),+ ]+++class AUTHENTICATED_VARIABL= E_HEADER(Structure):+ _fields_ =3D [+ ('StartId', = c_uint16),+ ('State', c_uint8),+ ('Reser= ved', c_uint8),+ ('Attributes', c_uint= 32),+ ('MonotonicCount', c_uint64),+ ('TimeStamp', = TIME),+ ('PubKeyIndex', c_uint32),+ = ('NameSize', c_uint32),+ ('DataSize', = c_uint32),+ ('VendorGuid', GUID),+ ]+ _pack= _ =3D 1+++# Alignment of Variable Data Header in Variable Store region.+HEA= DER_ALIGNMENT =3D 4+++class DEFAULT_INFO(Structure):+ _fields_ =3D [+ = ('DefaultId', c_uint16),+ ('BoardId', = c_uint16),+ ]+++class DEFAULT_DATA(Structure):+ _fields_ =3D [= + ('HeaderSize', c_uint16),+ ('DefaultInfo', = DEFAULT_INFO),+ ]++class DELTA_DATA(Structure):+ _fields_ = =3D [+ ('Offset', c_uint16),+ ('Value', c_uint8),+ ]+ _= pack_ =3D 1++array_re =3D re.compile(+ "(?P[a-z_A-Z][a-z_A-Z0-9]*= )\[(?P[1-9][0-9]*)\]")+++class VarField():+ def __init__(self):+ = self.Offset =3D 0+ self.Value =3D 0+ self.Size =3D 0++= @property+ def Type(self):+ if self.Size =3D=3D 1:+ = return "UINT8"+ if self.Size =3D=3D 2:+ return "UINT16"= + if self.Size =3D=3D 4:+ return "UINT32"+ if self= .Size =3D=3D 8:+ return "UINT64"++ return "UINT8"+++BASIC= _TYPE =3D {+ "BOOLEAN": 1,+ "UINT8": 1,+ "UINT16": 2,+ "UINT32"= : 4,+ "UINT64": 8+}++def GetTypeSize(fieldtype, VarAttributes):+ num = =3D 1+ if "[" in fieldtype:+ num =3D int(fieldtype.split("[")[1].= split("]")[0])+ fieldtype =3D fieldtype.split("[")[0]+ if fieldty= pe in VarAttributes:+ return VarAttributes[fieldtype]['TotalSize'] *= num+ elif fieldtype in BASIC_TYPE:+ return BASIC_TYPE[fieldtype]= * num+ else:+ return None++class CStruct():+++ def __init__(s= elf, typedefs):+ self.TypeDefs =3D typedefs+ self.TypeStack = =3D copy.deepcopy(typedefs)+ self.finalDefs =3D {}++ def CalStuct= Size(self, sType):+ rt =3D 0+ if sType in BASIC_TYPE:+ = return BASIC_TYPE[sType]++ ma =3D array_re.match(sType)+ = if ma:+ mType =3D ma.group('mType')+ mSize =3D ma.gr= oup('mSize')+ rt +=3D int(mSize) * self.CalStuctSize(mType)+ = else:+ for subType in self.TypeDefs[sType]:+ = rt +=3D self.CalStuctSize(subType['Type'])++ return rt++ def expe= nd(self, fielditem):+ fieldname =3D fielditem['Name']+ fieldT= ype =3D fielditem['Type']+ fieldOffset =3D fielditem['Offset']++ = ma =3D array_re.match(fieldType)+ if ma:+ mType =3D m= a.group('mType')+ mSize =3D ma.group('mSize')+ return= [{"Name": "%s[%d]" % (fieldname, i), "Type": mType, "Offset": (fieldOffset= + i*self.CalStuctSize(mType))} for i in range(int(mSize))]+ else:+ = return [{"Name": "%s.%s" % (fieldname, item['Name']), "Type":ite= m['Type'], "Offset": (fieldOffset + item['Offset'])} for item in self.TypeD= efs[fielditem['Type']]]++ def ExpandTypes(self):+ if not self.fin= alDefs:+ for datatype in self.TypeStack:+ result = =3D []+ mTypeStack =3D self.TypeStack[datatype]+ = while len(mTypeStack) > 0:+ item =3D mTypeStack.pop(= )+ if item['Type'] in self.BASIC_TYPE:+ = result.append(item)+ elif item['Type'] =3D=3D '(n= ull)':+ continue+ else:+ = for expand_item in self.expend(item):+ = mTypeStack.append(expand_item)+ self.finalDefs[datatyp= e] =3D result+ self.finalDefs+ return self.finalDefs++def= Get_Occupied_Size(FileLength, alignment):+ if FileLength % alignment = =3D=3D 0:+ return FileLength+ return FileLength + (alignment-(Fil= eLength % alignment))++def Occupied_Size(buffer, alignment):+ FileLength= =3D len(buffer)+ if FileLength % alignment !=3D 0:+ buffer +=3D = b'\0' * (alignment-(FileLength % alignment))+ return buffer++def PackStr= uct(cStruct):+ length =3D sizeof(cStruct)+ p =3D cast(pointer(cStruct= ), POINTER(c_char * length))+ return p.contents.raw++def calculate_delta= (default, theother):++ if len(default) - len(theother) !=3D 0:+ r= eturn []++ data_delta =3D []+ for i in range(len(default)):+ i= f default[i] !=3D theother[i]:+ data_delta.append([i, theother[i= ]])+ return data_delta++class Variable():+ def __init__(self):+ = self.mAlign =3D 1+ self.mTotalSize =3D 1+ self.mValue =3D {= } # {defaultstore: value}+ self.mBin =3D {}+ self.fields =3D= {} # {defaultstore: fileds}+ self.delta =3D {}+ self.attrib= utes =3D 0+ self.mType =3D ''+ self.guid =3D ''+ self.= mName =3D ''+ self.cDefs =3D None+ self.Struct =3D None+ = self.TypeList =3D {}++ @property+ def GuidArray(self):++ gu= id_array =3D []+ guid =3D self.guid.strip().strip("{").strip("}")+ = for item in guid.split(","):+ field =3D item.strip().strip= ("{").strip("}")+ guid_array.append(int(field,16))+ retur= n guid_array++ def update_delta_offset(self,base):+ for default_i= d in self.delta:+ for delta_list in self.delta[default_id]:+ = delta_list[0] +=3D base++ def pack(self):++ for defau= ltid in self.mValue:+ var_value =3D self.mValue[defaultid]+ = auth_var =3D AUTHENTICATED_VARIABLE_HEADER()+ auth_var.St= artId =3D VARIABLE_DATA+ auth_var.State =3D VAR_ADDED+ = auth_var.Reserved =3D 0x00+ auth_var.Attributes =3D 0x00000007= + auth_var.MonotonicCount =3D 0x0+ auth_var.TimeStamp= =3D TIME()+ auth_var.PubKeyIndex =3D 0x0+ var_name_b= uffer =3D self.mName.encode('utf-16le') + b'\0\0'+ auth_var.Name= Size =3D len(var_name_buffer)+ auth_var.DataSize =3D len(var_val= ue)+ vendor_guid =3D GUID()+ vendor_guid.from_list(se= lf.GuidArray)+ auth_var.VendorGuid =3D vendor_guid++ = self.mBin[defaultid] =3D PackStruct(auth_var) + Occupied_Size(var_name_buff= er + var_value, 4)++ def TypeCheck(self,data_type, data_size):+ i= f BASIC_TYPE[data_type] =3D=3D data_size:+ return True+ r= eturn False++ def ValueToBytes(self,data_type,data_value,data_size):++ = rt =3D b''+ if not self.TypeCheck(data_type, data_size):+ = print(data_type,data_value,data_size)++ if data_type =3D=3D "= BOOLEAN" or data_type =3D=3D 'UINT8':+ p =3D cast(pointer(c_uint= 8(int(data_value,16))), POINTER(c_char * 1))+ rt =3D p.contents.= raw+ elif data_type =3D=3D 'UINT16':+ p =3D cast(pointer(= c_uint16(int(data_value,16))), POINTER(c_char * 2))+ rt =3D p.co= ntents.raw+ elif data_type =3D=3D 'UINT32':+ p =3D cast(p= ointer(c_uint32(int(data_value,16))), POINTER(c_char * 4))+ rt = =3D p.contents.raw+ elif data_type =3D=3D 'UINT64':+ p = =3D cast(pointer(c_uint64(int(data_value,16))), POINTER(c_char * 8))+ = rt =3D p.contents.raw++ return rt++ def serial(self):+ = for defaultstore in self.fields:+ vValue =3D b''+ = vfields =3D {vf.Offset: vf for vf in self.fields[defaultstore]}+ = i =3D 0+ while i < self.mTotalSize:+ if i in vfi= elds:+ vfield =3D vfields[i]+ if vfie= ld.Size !=3D 0:+ vValue +=3D self.ValueToBytes(vfiel= d.Type, vfield.Value,vfield.Size)+ i +=3D vfield.Siz= e+ else:+ vValue +=3D self.ValueToBytes('= UINT8','0x00',1)+ i +=3D 1++ self.mValue[defa= ultstore] =3D vValue+ standard_default =3D self.mValue[0]++ f= or defaultid in self.mValue:+ if defaultid =3D=3D 0:+ = continue+ others_default =3D self.mValue[defaultid]++ = self.delta.setdefault(defaultid, []).extend(calculate_delta(+ = standard_default, others_default))++class DefaultVariableGenerator(= ):+ def __init__(self):+ self.NvVarInfo =3D []++ def LoadNvVar= iableInfo(self, VarInfoFilelist):++ VarDataDict =3D {}+ DataS= truct =3D {}+ VarDefine =3D {}+ VarAttributes =3D {}+ = for VarInfoFile in VarInfoFilelist:+ with open(VarInfoFile.strip= (), "r") as fd:+ data =3D json.load(fd)++ DataStr= uct.update(data.get("DataStruct", {}))+ Data =3D data.get("Data"= )+ VarDefine.update(data.get("VarDefine"))+ VarAttrib= utes.update(data.get("DataStructAttribute"))++ for vardata in Da= ta:+ if vardata['VendorGuid'] =3D=3D 'NA':+ = continue+ if (vardata['VendorGuid'], vardata["VarName"]) = in VarDataDict and vardata in VarDataDict[(vardata['VendorGuid'], vardata["= VarName"])]:+ continue+ VarDataDict.setde= fault(+ (vardata['VendorGuid'], vardata["VarName"]), [])= .append(vardata)++ cStructDefs =3D CStruct(DataStruct)+ for g= uid, varname in VarDataDict:+ v =3D Variable()+ v.gui= d =3D guid+ vardef =3D VarDefine.get(varname)+ if var= def is None:+ for var in VarDefine:+ if V= arDefine[var]['Type'] =3D=3D varname:+ vardef =3D Va= rDefine[var]+ break+ else:+ = continue+ v.attributes =3D vardef['Attributes']+ = v.mType =3D vardef['Type']+ v.mAlign =3D VarAttributes[v.m= Type]['Alignment']+ v.mTotalSize =3D VarAttributes[v.mType]['Tot= alSize']+ v.Struct =3D DataStruct[v.mType]+ v.mName = =3D varname+ v.cDefs =3D cStructDefs+ v.TypeList =3D = VarAttributes+ for fieldinfo in VarDataDict.get((guid, varname),= []):+ vf =3D VarField()+ vf.Offset =3D field= info['Offset']+ vf.Value =3D fieldinfo['Value']+ = vf.Size =3D fieldinfo['Size']+ v.fields.setdefault(+ = int(fieldinfo['DefaultStore'], 10), []).append(vf)+ = v.serial()+ v.pack()+ self.NvVarInfo.append(v)++ = def PackDeltaData(self):++ default_id_set =3D set()+ for v= in self.NvVarInfo:+ default_id_set |=3D set(v.mBin.keys())++ = if default_id_set:+ default_id_set.remove(0)+ delta_= buff_set =3D {}+ for defaultid in default_id_set:+ delta_= buff =3D b''+ for v in self.NvVarInfo:+ delta_lis= t =3D v.delta.get(defaultid,[])+ for delta in delta_list:+ = delta_data =3D DELTA_DATA()+ delta_dat= a.Offset, delta_data.Value =3D delta+ delta_buff +=3D Pa= ckStruct(delta_data)+ delta_buff_set[defaultid] =3D delta_buff++= return delta_buff_set++ def PackDefaultData(self):++ defa= ult_data_header =3D DEFAULT_DATA()+ default_data_header.HeaderSize = =3D sizeof(DEFAULT_DATA)+ default_data_header.DefaultInfo.DefaultId = =3D 0x0+ default_data_header.DefaultInfo.BoardId =3D 0x0+ def= ault_data_header_buffer =3D PackStruct(default_data_header)+++ varia= ble_store =3D VARIABLE_STORE_HEADER()+ variable_store.Signature =3D = AuthVarGuid++ variable_store_size =3D Get_Occupied_Size(sizeof(DEFAU= LT_DATA) + sizeof(VARIABLE_STORE_HEADER), 4)+ for v in self.NvVarInf= o:+ variable_store_size +=3D Get_Occupied_Size(len(v.mBin[0]), 4= )++ variable_store.Size =3D variable_store_size+ variable_sto= re.Format =3D VARIABLE_STORE_FORMATTED+ variable_store.State =3D VAR= IABLE_STORE_HEALTHY+ variable_store.Reserved =3D 0x0+ variabl= e_store.Reserved2 =3D 0x0++ variable_storage_header_buffer =3D PackS= truct(variable_store)++ variable_data =3D b''+ v_offset =3D 0= + for v in self.NvVarInfo:+ v.update_delta_offset(v_offse= t)+ variable_data +=3D Occupied_Size(v.mBin[0],4)+ v_= offset +=3D Get_Occupied_Size(len(v.mBin[0]),4)+++ final_buff =3D Oc= cupied_Size(default_data_header_buffer + variable_storage_header_buffer,4) = + variable_data++ return final_buff++ def GenVariableInfo(self, b= uild_macro):+ VariableInfo =3D []+ VariableInfo.append('Varia= ble Information Report\n')+ if build_macro:+ VariableInfo= .append('[Platform Definitions]')+ for define_item in build_macr= o:+ if '=3D' in define_item:+ VariableInf= o.append('* %-20s=3D %s'%(define_item.split('=3D')[0], define_item.split('= =3D')[1]))+ else:+ VariableInfo.append('*= ' + define_item)+ VariableInfo.append('\n[Variable List]')+ = VariableInfo.append('# {} variables used in current setting:'.format(len(se= lf.NvVarInfo)))+ for item in self.NvVarInfo:+ VariableInf= o.append('* ' + item.mName)+ VariableInfo.append('\n[Variable Detail= s]')+ for item in self.NvVarInfo:+ VariableInfo.append('#= ###################')+ VariableInfo.append('* Variable Name: ' += item.mName)+ VariableInfo.append('* Variable Type: ' + item.mTy= pe)+ VariableInfo.append('* Variable Guid: ' + item.guid)+ = VariableInfo.append('* Variable Size: ' + hex(item.mTotalSize))++ = ## Field structure Info+ VariableInfo.append('* Variable= Fields: {} fields'.format(len(item.Struct)))+ VariableInfo.appe= nd('{')+ VariableInfo.append('# %-5s | %-30s | %-15s | %-10s | %= s'%('Index', 'Name', 'Type', 'TotalSize', 'Offset'))+ FieldsNum = =3D len(item.Struct)+ Name_Offset =3D {}+ if FieldsNu= m =3D=3D 0:+ Name_Offset[0] =3D field['Name']+ fo= r i in range(FieldsNum):+ field =3D item.Struct[i]+ = Name_Offset[field['Offset']] =3D field['Name']+ if i = !=3D FieldsNum-1:+ nextfield =3D item.Struct[i+1]+ = for cur_offset in range(field['Offset']+1, nextfield['Offset'= ]):+ Name_Offset[cur_offset] =3D field['Name']+ = VariableInfo.append(' %-5s | %-30s | %-15s | %-10s | %s'%(i, fi= eld['Name'], field['Type'], GetTypeSize(field['Type'], item.TypeList), fiel= d['Offset']))+ VariableInfo.append('}')++ ## Field va= lue Info+ VariableInfo.append('* Field value: ')+ Var= iableInfo.append('{')+ VariableInfo.append('# defaultstore %-5s = | %-30s | %-15s | %-15s | %s'%('xxxx', 'FieldName', 'FieldType', 'FieldOffs= et', 'FieldValue'))+ storenum =3D len(item.fields)+ f= or storeid in range(storenum):+ for Var in item.fields[store= id]:+ # print('If Var.Offset in Name_Offset: ', Var.Offs= et in Name_Offset)+ if Var.Offset not in Name_Offset:+ = VariableInfo.append(' defaultstore %-5s | %-30s | %-= 15s | %-15s | %s'%(storeid, Var.Offset, Var.Type, Var.Offset, Var.Value))+ = print('Offset:', Var.Offset)+ els= e:+ VariableInfo.append(' defaultstore %-5s | %-30s= | %-15s | %-15s | %s'%(storeid, Name_Offset[Var.Offset], Var.Type, Var.Off= set, Var.Value))+ VariableInfo.append('}\n')+ return Vari= ableInfo++ def generate(self, jsonlistfile, output_folder, build_macro= =3DNone):+ if not os.path.exists(jsonlistfile):+ return+ = if not os.path.exists(output_folder):+ os.makedirs(output= _folder)+ try:+ with open(jsonlistfile,"r") as fd:+ = filelist =3D fd.readlines()+ genVar =3D DefaultVariabl= eGenerator()+ genVar.LoadNvVariableInfo(filelist)+ wi= th open(os.path.join(output_folder, "default.bin"), "wb") as fd:+ = fd.write(genVar.PackDefaultData())++ delta_set =3D genVar.= PackDeltaData()+ for default_id in delta_set:+ wi= th open(os.path.join(output_folder, "defaultdelta_%s.bin" % default_id), "w= b") as fd:+ fd.write(delta_set[default_id])++ = VariableInfo =3D genVar.GenVariableInfo(build_macro)+ if Variab= leInfo:+ with open(os.path.join(output_folder, "VariableInfo= .txt"), "w") as reportfile:+ for item in VariableInfo:+ = reportfile.write(item + '\n')+ except:+ = EdkLogger.info("generate varbin file failed")diff --git a/BaseTools/S= ource/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/Mod= uleAutoGen.py index eb81c3f3af..8fdca9df5c 100755 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -442,6 +442,14 @@ class ModuleAutoGen(AutoGen): rt.append(os.path.join(self.OutputDir, "{}.i".format(SrcFi= le.BaseName))) return rt + @cached_property+ def VarJsonFiles= (self):+ rt =3D []+ for SrcFile in self.SourceFileList:+ = if SrcFile.Ext.lower() =3D=3D '.vfr':+ rt.append(os.p= ath.join(self.OutputDir, "{}.json".format(SrcFile.BaseName)))+ retur= n rt+ ## Return the path of custom file @cached_property def Cu= stomMakefile(self):diff --git a/BaseTools/Source/Python/Common/GlobalData.p= y b/BaseTools/Source/Python/Common/GlobalData.py index 039a9648aa..951a835f1b 100755 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -127,3 +127,8 @@ file_lock =3D None # Build flag for generate Yaml file from Vfr file # gVfrYamlEnable =3D Fal= se++#+# Build flag for generate default variable binary file+#+gGenDefaultV= arBin =3D Falsediff --git a/BaseTools/Source/Python/VfrCompiler/VfrSyntaxVi= sitor.py b/BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py index 43078f914a..9ae60267f6 100644 --- a/BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py +++ b/BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py @@ -4560,7 +4560,7 @@ class VfrSyntaxVisitor(ParseTreeVisitor): '0x%x'%(pVsNode.Guid.Data4[4]), '0x%x'%(pVsNode.Gu= id.Data4[5]), '0x%x'%(pVsNode.Guid.Data4[6]), '0x%x'%(pVsNode.Guid.Data4[7]= )) + ' }}\",\n') f.write(' \"VarName\": \"{}= \",\n'.format(str(pVsNode.Name))) f.write(' = \"DefaultStore\": \"{}\",\n'.format(str(pVsNode.Id)))- = f.write(' \"Size\": \"{}\",\n'.format(str(pInfoNode.Width)))+ = f.write(' \"Size\": {},\n'.format(str(pInfoNode.= Width))) f.write(' \"Offset\": {},\n'.format= (str(pInfoNode.Offset))) #f.write(' \"Value\= ": \"{}\"\n'.format(str(pInfoNode.Value))) if pInfo= Node.Type =3D=3D EFI_IFR_TYPE_DATE:@@ -4574,15 +4574,15 @@ class VfrSyntaxV= isitor(ParseTreeVisitor): if pInfoNode.Type =3D=3D EFI_IFR_TYPE_STRING: = f.write(' \"Value\": \"{}\"\n'.format(pInfoN= ode.Value.string)) if pInfoNode.Type =3D=3D EFI_IFR= _TYPE_NUM_SIZE_8:- f.write(' \"Value\": \= "{}\"\n'.format(pInfoNode.Value.u8))+ f.write(' = \"Value\": \"{}\"\n'.format(hex(pInfoNode.Value.u8))) = if pInfoNode.Type =3D=3D EFI_IFR_TYPE_NUM_SIZE_16:- = f.write(' \"Value\": \"{}\"\n'.format(pInfoNode.Value.= u16))+ f.write(' \"Value\": \"{}\"\n'.for= mat(hex(pInfoNode.Value.u16))) if pInfoNode.Type = =3D=3D EFI_IFR_TYPE_NUM_SIZE_32:- f.write(' = \"Value\": \"{}\"\n'.format(pInfoNode.Value.u32))+ = f.write(' \"Value\": \"{}\"\n'.format(hex(pInfoNode.Value.u32)= )) if pInfoNode.Type =3D=3D EFI_IFR_TYPE_NUM_SIZE_6= 4:- f.write(' \"Value\": \"{}\"\n'.format= (pInfoNode.Value.u64))+ f.write(' \"Value= \": \"{}\"\n'.format(hex(pInfoNode.Value.u64))) if = pInfoNode.Type =3D=3D EFI_IFR_TYPE_BOOLEAN:- f.w= rite(' \"Value\": \"{}\"\n'.format(pInfoNode.Value.b))+ = f.write(' \"Value\": \"{}\"\n'.format(hex(pInfoNode.V= alue.b))) f.write(' },\n') = pInfoNode =3D pInfoNode.Nextdiff --git a/BaseTools/Source/Python/buil= d/build.py b/BaseTools/Source/Python/build/build.py index 7e2f25686d..69217eb3fd 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -749,6 +749,7 @@ class Build(): GlobalData.gEnableGenfdsMultiThread =3D not BuildOptions.NoGenfdsM= ultiThread GlobalData.gDisableIncludePathCheck =3D BuildOptions.Dis= ableIncludePathCheck GlobalData.gVfrYamlEnable =3D BuildOptions.Vfr= YamlEnable+ GlobalData.gGenDefaultVarBin =3D BuildOptions.GenDefault= VarBin if GlobalData.gBinCacheDest and not GlobalData.gUseHashCach= e: EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData=3D"= --binary-destination must be used together with --hash.")@@ -1472,6 +1473,1= 0 @@ class Build(): yamloutputfile =3D inputfile.split(".")[0] + '= .yaml' jsonoutputfile =3D inputfile.split(".")[= 0] + '.json' VfrParse(inputfile, yamloutputfile= , jsonoutputfile)+ if GlobalData.gGenDefaultVarBin:+ = from AutoGen.GenDefaultVar import DefaultVariableGenerator+ = variable_json_filelist =3D os.path.join(AutoGenObject.BuildDir,"variabl= e_json_filelist.txt")+ DefaultVariableGenerator().generate(v= ariable_json_filelist, AutoGenObject.FvDir, GlobalData.gOptions.Macros) = if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db): = EdkLogger.error("build", COMMAND_FAILURE) Threshold =3D s= elf.GetFreeSizeThreshold()@@ -2259,7 +2264,9 @@ class Build(): fw.write("BuildDir=3D%s\n" % Wa.BuildDir) fw.write= ("PlatformGuid=3D%s\n" % str(Wa.AutoGenObjectList[0].Guid)) variabl= e_i_filelist =3D os.path.join(Wa.BuildDir,"variable_i_filelist.txt")+ = variable_json_filelist =3D os.path.join(Wa.BuildDir,"variable_json_fileli= st.txt") vfr_var_i =3D []+ vfr_var_json =3D [] if Gl= obalData.gVfrYamlEnable: for ma in self.AllModules: = vfr_var_i.extend(ma.VarIFiles)@@ -2267,6 +2274,13 @@ class Build(): else: if os.path.exists(variable_i_filelist): = os.remove(variable_i_filelist)+ if GlobalData.gGenDefaultVar= Bin:+ for ma in self.AllModules:+ vfr_var_json.ex= tend(ma.VarJsonFiles)+ SaveFileOnChange(variable_json_filelist, = "\n".join(vfr_var_json), False)+ else:+ if os.path.exists= (variable_json_filelist):+ os.remove(variable_json_filelist)= if GlobalData.gBinCacheSource: BuildModules.extend(se= lf.MakeCacheMiss)@@ -2389,8 +2403,11 @@ class Build(): inputfile =3D i_file.replace("\n",= "") yamloutputfile =3D inputfile.s= plit(".")[0] + '.yaml' jsonoutputfi= le =3D inputfile.split(".")[0] + '.json'- = print('inputfile ', inputfile) = VfrParse(inputfile, yamloutputfile, jsonoutputfile)+ = if GlobalData.gGenDefaultVarBin:+ from AutoGe= n.GenDefaultVar import DefaultVariableGenerator+ = variable_json_filelist =3D os.path.join(Wa.BuildDir,"variable_json_filelis= t.txt")+ DefaultVariableGenerator().generate(var= iable_json_filelist, Wa.FvDir, GlobalData.gOptions.Macros) = GenFdsStart =3D time.time() if GenFdsApi(Wa= .GenFdsCommandDict, self.Db): EdkLogger.error("= build", COMMAND_FAILURE)diff --git a/BaseTools/Source/Python/build/buildopt= ions.py b/BaseTools/Source/Python/build/buildoptions.py index c0304c2f98..9d69719741 100644 --- a/BaseTools/Source/Python/build/buildoptions.py +++ b/BaseTools/Source/Python/build/buildoptions.py @@ -104,4 +104,5 @@ class MyOptionParser(): Parser.add_option("--no-genfds-multi-thread", action=3D"store_true= ", dest=3D"NoGenfdsMultiThread", default=3DFalse, help=3D"Disable GenFds mu= lti thread to generate ffs file.") Parser.add_option("--disable-inc= lude-path-check", action=3D"store_true", dest=3D"DisableIncludePathCheck", = default=3DFalse, help=3D"Disable the include path check for outside of pack= age.") Parser.add_option("--vfr-yaml-enable", action=3D"store_true"= , dest=3D"VfrYamlEnable", default=3DFalse, help=3D"Enable the Vfr to yaml f= unction.")+ Parser.add_option("--gen-default-variable-bin", action= =3D"store_true", dest=3D"GenDefaultVarBin", default=3DFalse, help=3D"Genera= te default variable binary file.") self.BuildOption, self.BuildTarg= et =3D Parser.parse_args()--=20 2.27.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96392): https://edk2.groups.io/g/devel/message/96392 Mute This Topic: https://groups.io/mt/95039234/1768742 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [bob.c.feng@intel.com] -= =3D-=3D-=3D-=3D-=3D-=3D