From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.35527.1675061134399477948 for ; Sun, 29 Jan 2023 22:45:34 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=JqP++EhP; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1675061134; x=1706597134; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jAAJg4A53dVjW9i2otTgRhwtQ3aTrEvQLCjljazLQrk=; b=JqP++EhPgrDwzWJSqVB3KeJsGsnYnl0ncfOPcltqhNiLujIRqF1sFipE RnBcyhkcMA6vjvWD1j4Oz9Kn6Yn905yYXyxRG5fv1aJm3/qRyj27v3zjQ 9P5KIgFCMhPhnH931HmVWgtKEODW5hdiM4X0e0+ZtgTMLkK937SGl94+C Q9IhVO5rAZw4mV2KZw9FWy2HxA/TgXTHQQ38jVoXvawcdFMmfqeiNrxFs I9kzdmCSSwsNXKwz6Wbdxv1/nWBnznjSMgI3CPwBUaJlyAXYmAtMBGc11 YHYQtOH0jQmUn6Fu3JPRH4gyN3d5PuVjYHuhrZFymYl4Mxl5ad1zOr02p w==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="325184400" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="325184400" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2023 22:45:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="665970074" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="665970074" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga007.fm.intel.com with ESMTP; 29 Jan 2023 22:45:34 -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; Sun, 29 Jan 2023 22:45:33 -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; Sun, 29 Jan 2023 22:45:33 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) 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; Sun, 29 Jan 2023 22:45:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0fhXIXQAF/qeTZnza2qNrOKL/9HcYA5Bh83vK28tzj19KXs06dvmbj8WWsR2px5pntckHrWSIOh2+qx+jYJiBS+z3hy4qJZVoCyOqX2XyrCWiwnZo8lrKhllzd0iH847uo3ixWxhxHv/ZQ9NAZoQ0mCCywARqjJ2hlb+hEro5/bJxNM/uOxuzW+1Ti9Yt4Z4BTeGnoR0XU9rP8vkU+74Tx6ApqZdK79d7fTlTwkF4R14WWaOhw6YgSNjjDzWA5dbhYXwnWrvcwP4KZ4Ai96wR66HiSL9eEuLhzIg35swfEvdXiF4LBaOlr+S2ASeusDPHuJ3e016oifZrRYgoR6kw== 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=gHZjjt74FrtqxzMFkHY/ji6ZOg232IV0otRql86Dssg=; b=gHOtWs70aYcj3scMNlFlnck/9Lb05JotQ/X4g/16GHMDq/tyIZVeZvu40q2XfPwkCc1tiKOCQNesWjCvDdJgqJYAmzEhw+VjXEXvGmv6AhaXNS3jwIL4hM5Gszf+8ACn2mu3zfMXIE4ltcGNr1/C9QmLDsL5/tJUD4JdwP0EaeAuyudPHNNkpru4jCoiEq+zoIEMcyk0YZmpTHQkxcwK4JM61qC96I1T7KCoUll8SpUYHaD+0FwDWW8ROqEQBziz8DU3aWROaJbh7CLBbYyLwjcTIjyk1nJtFrn66FCovwDhjJTgNR26uusl1IQn2NMM9L3VBkKx6r7B+E1Jgc3yJg== 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 PH0PR11MB5594.namprd11.prod.outlook.com (2603:10b6:510:e4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.30; Mon, 30 Jan 2023 06:45:29 +0000 Received: from PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::1736:fe5c:ecff:e73a]) by PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::1736:fe5c:ecff:e73a%4]) with mapi id 15.20.6043.033; Mon, 30 Jan 2023 06:45:29 +0000 From: "Bob Feng" To: "Chen, Christine" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation Thread-Topic: [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation Thread-Index: AQHZNHPZBiz0GUHuzkyJyvuKho4srq62g/QQ Date: Mon, 30 Jan 2023 06:45:29 +0000 Message-ID: References: <20230130062644.1688-1-yuwei.chen@intel.com> In-Reply-To: <20230130062644.1688-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_|PH0PR11MB5594:EE_ x-ms-office365-filtering-correlation-id: a5263b40-2b7b-4ec5-2fc2-08db028d93c8 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: r4kqEinM2qHBY6CjPdBJBvahyz58Fl4Fhv8B01f2NfqcYo/D8kJnPA3i/8HcFHh2QeXxXckCFHsSd/sb8cqdAlNgXIDz0OZpWMadOwyJ3m+dREw3KhckV/x2gqi7Gjq+iaRiGchpOIHnDPxIXdSn3UpRH22iL1jPPXotoKH7zm7GCkKmsMvh+afDIkX9jum2uLB+L+zrSpiP3a2jkaSAoOf2H8r22yrPyQBpQVJnqLmu7N6Eim0ZSdcqAnQ8NxIFqNSApP89ez5oOpAD3GBGOg6O+al0Goc1ZSA9tycCIn6Ujo6klnwAV1vQ7+t00JMsNeocJAEu8sTpqsv/tBqExTody5lSK3CpwaJEBjb/QcfgxxPtagtox7O2eg+pFEUNiwMoaThsPIDzYHia8kalg11KwlSdUnldlg4v8E19epMZC8ASaZXluAfcxSr6AYZbOMspiXv4uye9issWpRaoQ9k6tR++sIIknFlZdvNUevO660FUw98c+Et4MytYo2MZtOn/3tE0lbp6Kjht27T+mW23l35fnIiIk9bhXY/OI0Jzsqy+dUOfKiNKSh5MVZ8DT8qHnK4BGTRAoNFDj1R/4yU8TUcN47BUDXtmGwvnelv3MAPfFew/A1U9vbYTFpff66B8SG8NncHLVqYFcKAvCqReC2/kD1yHApS8KyXgnPq8zSgfGQVGRwB96vJO6jg1fxA0I/Ecmqb4EA47xaCCwQ== 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:(13230025)(396003)(366004)(376002)(346002)(136003)(39860400002)(451199018)(2906002)(83380400001)(7696005)(71200400001)(478600001)(38070700005)(26005)(9686003)(82960400001)(110136005)(122000001)(53546011)(6506007)(66446008)(4326008)(64756008)(66556008)(66476007)(41300700001)(8676002)(66946007)(76116006)(38100700002)(52536014)(33656002)(30864003)(5660300002)(8936002)(186003)(86362001)(316002)(55016003)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?w5h8rYxOZllzd/gz6F7rZ2vCsWGM1X4iOuVx1BdcgU/F+U8AKdlRHKf0tZWH?= =?us-ascii?Q?iIV49WUS3r3gxnqp/88NwP1qrVx5F6DsUSHYNu89blTz739rYAJDNZKOSnaW?= =?us-ascii?Q?kMvZLBVeKgiqEaksh1taWBLaz/wnYZkJevikY9Q3LQwQlXkiL1MBq7cn5ybg?= =?us-ascii?Q?88QlkgFn+0ITNc5Dlj549csZsLvWA9KmiHybbY9A7cXnzsPJLHhHcihBaBTp?= =?us-ascii?Q?+zkolzGy3NRLHIO2U9Qckdm0XVONArxxU5PutTIC4SC0BNFtddmOX5Q0rn9d?= =?us-ascii?Q?cv85ch/UO2JNJfNkZuzKYc/Cqd6VeFrTNQBaOO5lhM5jJnEeLT4cH6K/t2G4?= =?us-ascii?Q?qapL/yTwOg7e8pcDoOCwu5p+KSQKTu6doiR3Vs+wR9EE3EWhpCEZ85SYmjny?= =?us-ascii?Q?C7ulGp2SE95TkGMrFTX2RMT6BCisvoU4nvBzz9XC0yYBDHr952c/9qrkbhlD?= =?us-ascii?Q?3KGwJZrZEs08W1LIrS+Mb2GIwiyOBlnMxgX3kKNI97EFztKDOZtXcQReJvIz?= =?us-ascii?Q?PVujm6oOmd1qshOTWd2gZ8bWKKSiwy0/yQ046wyCaYxqJ6z/UrlIAXTsVjAT?= =?us-ascii?Q?CBwTr/KzyaZsDKt/iK/u1apSsP/C5l2/QJ0FDPVyv4czqV2RrcS/QQH9+9Ig?= =?us-ascii?Q?tz/Uw0DIUbMFkAge8OUfL6rjKZImlhBozhr0PRXafHRp3/0ujeffGXqQ+xQz?= =?us-ascii?Q?G0ox38X8y/voEX3KNKlvHbC1PtZbZzthzLbIWpREW0iAZ/5rqarnNrCJNpVA?= =?us-ascii?Q?eixqjQPGcj3IlhCUz542UEUrW6VtrSQ2GhcBog1d8nWdEKIzzgYd7lZ61JW6?= =?us-ascii?Q?SCtdEuI0rMe53zzurbCWEmgcJxZlLUWlf3JK2+jzGL6k8ZykiGT3chRJFzGr?= =?us-ascii?Q?qlIXhAAPc6VNA69NKTQKeqeRI3eFADCduL74N0Y9g154W8qOziJ5C/qkIV7s?= =?us-ascii?Q?pCLG7gR1ijq/IvZuKAKA25hZ9MTePr5oll3I/Y4eQbUmONj7juX9FUWbB1cF?= =?us-ascii?Q?Nh+dppD6ysAYDA2Z+H8nQvvd0d5snncHiIAMYicSlTd/HFwjlNKa4dZV2Mi8?= =?us-ascii?Q?lWCI1dy7tHuu7puY96CZBCQIvPsKwpbDJgRd+AW0Se/RmvQFRJj6T95AovJk?= =?us-ascii?Q?3g+UL77jzSYjLE7qVOsBV3b+0+x9blKTE5DjYQVfokeTAzs3rkX5E82Sgpww?= =?us-ascii?Q?qGK/JRsmUp85ujZTbdzJPi2uHOgjiFCJPEugDyfqXRTlTDjoMG2HONuw9UFj?= =?us-ascii?Q?kdqTxrIEdyDOv5hI3JN4bp0I5t4KCr6ybeK9+887iZODu9GbuwIVGkOaNESH?= =?us-ascii?Q?RvGf95j+SQs4uHwa7XRWTyw88bYEVpsTFSlwlYZQy/Xo9OjVWwAsfStxIYDe?= =?us-ascii?Q?GtgIGOHfaaKFSN4HTWWWGUBbWrSXpT+0R6wjfN5mwpO2bWqvMGY6tF9AKCUp?= =?us-ascii?Q?pR08gZG8P1ZSDo7b5vrGXLFpU7Ici3Vf21fvr81RJMq9GmtFdkKMRbAkLdXj?= =?us-ascii?Q?xxJk3b+KRaAas9LfkQIDVwUinVIuHSiJ0GEpKfyq4wOhh8KfM+a/6NLC63bq?= =?us-ascii?Q?Ftc32vi18PxyhAHqWd+fsLS/bXCXp8Lkyb/wygHj?= 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: a5263b40-2b7b-4ec5-2fc2-08db028d93c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2023 06:45:29.5759 (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: F6MF3ncDZcdRQ5G1rDyQYpdZkQmCotC9U70Qwn4jyAnoA+K9dLtt628WDBpUKa5WUPyZ9EbAsY+K3ke7t9jVbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5594 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 Reviewed-by: Bob Feng -----Original Message----- From: Chen, Christine =20 Sent: Monday, January 30, 2023 2:27 PM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming Subject: [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for V= ariable 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