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.web09.36508.1629188514482930934 for ; Tue, 17 Aug 2021 01:21:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=OVauBNFU; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: chasel.chiu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="203220281" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="203220281" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 01:21:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="680000188" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 17 Aug 2021 01:21:53 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) 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.2242.10; Tue, 17 Aug 2021 01:21:52 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Tue, 17 Aug 2021 01:21:52 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.46) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Tue, 17 Aug 2021 01:21:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZonzcGKA7BoUkMxcnksg3VPpMvGmBjDmJYZUf1RrYzgDyaOb1E+GRjca2y1NfeyWeKBuP8NOOvzv8tfKJJWh//h+TqNcn1MWOn5Fq0UKV8zUzJ8mGavzK+NQp7ghJ/nA+iHZFgn/AzQhOb+nzNaAAmFmG+1i005YNRaPMV2+Ow64B3nrREcbit4PevgrLVgStJELhd5rWp5b9gnVOH05asxaICcjyBoZv1vmrhm8HX6vkGzeq01dhLtZHWcAlOt+EiHW9RCr/zAv4WfUFJLkSzQ8RH2SD21ddFCuiAeH7ZmweamtsuEj9u8ESmpLlWXeKH//bTOpjp5xsWULysiCQ== 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-SenderADCheck; bh=qYgcUVH0KlcyzWdiegQl+7y5nttzp7HKsFFfN03pEaI=; b=MdDHDgrHCwt8TMPgtAuV2L383tb80rehDX7TWdvRef5v0zVfNzuFvUNweLjyfyLgX/dFqnUQ/qlaXjIML90J2rpUyYLbB56FrstI2KpTKebwMUh7KPGOQMQtNfvGvHP1pc2WCszaQPBObFFyXjlL9mFnvbQH1+cWRADPPj5BNkAjaiV4GD6EfTIFHgwfCtmELTGqAZGEOsUeVd3AoWO8OlCCQmtE0qf7AQBTYZvbk+7J7R5K8MBXtvs6WrsOzg6gfPLWMOn6vWyecu+QlsMJkUBbvLh+am1cc8CU7vbkSyl7BMw8BIMr3p9E3C/ZmGo8lEhwXuxMW7GPn/eQAQ1IdQ== 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=qYgcUVH0KlcyzWdiegQl+7y5nttzp7HKsFFfN03pEaI=; b=OVauBNFUdlqC7lPZ15X4y2bsnVFnueRrUBedBbHDEGWXZovO/KqXKD4tLh7Z1cDM6kHXB7tN/jvCweIvUNSVAk4VAdUahIg1Hjgox79l6IEE1iPA41JT8zYUG+3EyqKqByJfvRqs+CfmY6tyX7Kma9v2GBP6W6MXUDzxq3N3/wE= Received: from CH0PR11MB5475.namprd11.prod.outlook.com (2603:10b6:610:d6::21) by CH2PR11MB4421.namprd11.prod.outlook.com (2603:10b6:610:49::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Tue, 17 Aug 2021 08:21:51 +0000 Received: from CH0PR11MB5475.namprd11.prod.outlook.com ([fe80::202c:3305:3dc6:3b3d]) by CH0PR11MB5475.namprd11.prod.outlook.com ([fe80::202c:3305:3dc6:3b3d%3]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 08:21:51 +0000 From: "Chiu, Chasel" To: "Loo, Tung Lun" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "Desimone, Nathaniel L" , "Zeng, Star" Subject: Re: [PATCH] IntelFsp2Pkg: Support Config File and Binary delta comparison Thread-Topic: [PATCH] IntelFsp2Pkg: Support Config File and Binary delta comparison Thread-Index: AQHXkzuWsfXmAVOSk0mZdLHagBSKr6t3W0gA Date: Tue, 17 Aug 2021 08:21:51 +0000 Message-ID: References: <20210817074312.1313-1-tung.lun.loo@intel.com> In-Reply-To: <20210817074312.1313-1-tung.lun.loo@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 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: 630b7e7e-d035-49db-f44c-08d96158108f x-ms-traffictypediagnostic: CH2PR11MB4421: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:446; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LWQwn6slaJ3cLNUc4W2aIOWpxOnI8iJ5D4ClXsw1RaMs1mIMEzqghfIuNiLMtimhGAo93O1/qh7JNRbS/bUtnaPoPbXMxTXMMVp1sTlAlN30fiIq3todGN1oM7zbHYHWYWpgrD1+HYetLOdc3Eren1Rzlcag7cCuVkT/OuMvSmNzn0V+wlByOIo6VlY0ZdW9rWhnbXu6llxx0VazFgt8vpCH5TUZhei5SLnGnBWF7pGU6a6nOgZ1PgkMPDg2ABQ3MsFhKpOg+kCftUtmLkhE5ZJh/Po84TNZfApXl00ZAcn40S6bJ6kwbwAm/lHxCuIDYuPK+QoOIuNWEo7PSG5/SZP1sWqen6Q7bEAbz+NWF/VheU0cbmbp7kr7tDicresoEbCGkbt1kUEtMgm4YLcGFcr0MWqHfiXFaX1awF+2Ff60BbbeG5qNua/FbuADQGy+zEyu+AmPCslpHqzEuEn1dB2muj1cGdX161O1ZyZoLNGUMeL+Owz9iT3o1vLzAOLjGGtZc6Z3j9eaXhflb0lQSdzOfTfLPdp2hedbmta1EVgg3YP7It5ajw29OpzCp+lB3yWnCqUXkxZdpAkKgLOa9kLocWsOIUEK5VcgnE0njzWgFZ7wMFUY1Guot//6J+vAKZBafKO/+XrN4m1hI9LfcXS0le2CLop2iCJSFxQMAec7i16PSw531dLK+heh9bd/9rjEApPcpp+IGzxiPAkeLnVIkZiIm3s0npwy+SCYS+Hq42dml57XF3IuTrNQNlfrXs41shMgsv5C9JeU3ygc3j5QCpfh39JsLmHHbdDXqic= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR11MB5475.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(64756008)(38070700005)(66556008)(66446008)(66476007)(76116006)(66946007)(9686003)(53546011)(186003)(26005)(7696005)(5660300002)(8936002)(2906002)(4326008)(122000001)(107886003)(8676002)(6506007)(52536014)(966005)(83380400001)(38100700002)(508600001)(55016002)(316002)(71200400001)(110136005)(54906003)(86362001)(33656002)(19627235002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5pEsvlM3piilXHNQT8jq2mDhmtH1pH3H6Jsjv9CgvqF81DyXwF3VXfv3JeZE?= =?us-ascii?Q?IkwBkA3rFuIVzlZTiL5KVq6zSIi+uT8g+dsPLOXQh8XZkQDZklS5fcDHshpw?= =?us-ascii?Q?wqUHs1CO7uN/p4KB2jjipwF75YOU2HmMNcp2RwE/DNz/JVrS6mJswDDmfVi5?= =?us-ascii?Q?pvjIV0JUOlWjqp6sWWLor4W7AAYH/6HHHEmxoaaz48HrdDeZmd20WhgTKEsE?= =?us-ascii?Q?wUMYwNQ30TVNAJQQjrkwsIn+XkegcSpaFZN6PMJ9aSXsx1tkXlH9KIrYtc56?= =?us-ascii?Q?jAKTI8QM+RFgNaVCiPX6KMFV+9sunwwD36i3fWJBKH/HG9pCvFM7APykOca8?= =?us-ascii?Q?y+JzTsWTfa+bMP7Qo5wGrRfek/Odkws2nyltcnvePuadTj7/rEaPtsRwmjyQ?= =?us-ascii?Q?nOGHnC+ZdaEoZvgC8C0MUpRbq1ebE+oV8JmJYWHct8DQnoHuGiXeGWXHY+eN?= =?us-ascii?Q?EzF6ChZSEf6dw3FV3MoUUIUkYS+mk+e/hwO7PifUEtWdKXGzCNIlv/d+VXzG?= =?us-ascii?Q?LWjGySeFeT1VH60YbRDJuBH9SvNdqQuUsh0K9FpNpuH3KlsmWA06QMIDiujc?= =?us-ascii?Q?Ymj1RFPcmfu2H75ebBrq69T0Sj73wvLaCC3eX//5+4RZy+PcGs3df0JzhYfe?= =?us-ascii?Q?a59BOalDvu+3bTFPnoQz/B/M05ElgrMR6XCiCsm9tV1JbHCcBYLuuFmVM5WO?= =?us-ascii?Q?H9Nx17b4LTkwsl8cUYa6C+PG5f11eCn4Nb5ph7u05eDZ1vcn32h7zNBF0Mdv?= =?us-ascii?Q?G9Kgul0DlMgZMh3Q5gGMADcLqMAs1+rIEo0WxcU9SR6/G7DLvA4f7bgvU3v5?= =?us-ascii?Q?9vPcOuuSisJF4XV7HYOzEgGLpincAwX+D7LWcbdYp2ydEwFI1WuIdS7nvL3q?= =?us-ascii?Q?xwaMKWCYUNWE4V4ZvGi9m5TkMR/IvJjEJBvWfUnWxgQsPd5P3ef5Rzst98tO?= =?us-ascii?Q?JNMDGJrh/OBk6wjzjA7hGRuud7jrR1T3fJvnYxTzuBgu512BsyKtgvbjR8Xd?= =?us-ascii?Q?/AJOMjGTMlh7HIiyyK34d471eeeGF/GAxR5p4ikiKdzj+sTPb5lPz2U1m1CZ?= =?us-ascii?Q?rZNLU49J13YQ1hi9liFp1RuwxdCaxGk1WQvi0fHvfQDhbNuTdNLayzyuPe1u?= =?us-ascii?Q?9z5GWysD8A7/mh08mEjb7r/C5022wqH9iJ8yVI2zUlp8ZbJlK6AvHMP0q7mM?= =?us-ascii?Q?Nec1Xg3UQuZJLOIGIeUQsP13mR8zdwfFhIRXRR8JKlwL2aanCyd3LqWPGoM+?= =?us-ascii?Q?w7cBLDewHKglH7MtvzNRxrfD17/Q3ckKGrJBuW0FAGdEbW1ki+17pjuq3Ie6?= =?us-ascii?Q?iGc+DypVcz2gq9z87qMNI6w8?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH0PR11MB5475.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 630b7e7e-d035-49db-f44c-08d96158108f X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2021 08:21:51.1108 (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: F5VRgTRag1tNheWNaVc8lUsrE6CnZ2iZIjtRTwG1NjWNbLycEf+emvdHgwhfPHFsHsXBWFJz5UD/lMoqekIM0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4421 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu > -----Original Message----- > From: Loo, Tung Lun > Sent: Tuesday, August 17, 2021 3:43 PM > To: devel@edk2.groups.io > Cc: Loo, Tung Lun ; Ma, Maurice > ; Desimone, Nathaniel L > ; Zeng, Star ; Chiu, > Chasel > Subject: [PATCH] IntelFsp2Pkg: Support Config File and Binary delta > comparison >=20 > From: "Loo, Tung Lun" >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3567 >=20 > This patch is to enable config editor to have a new feature that can spel= l out > the delta between the default configuration files' > data, such as YAML and BSF, against the data stored in the binary. > This can help users understand and track the difference when modification= s > are made. >=20 > Cc: Maurice Ma > Cc: Nate DeSimone > Cc: Star Zeng > Cc: Chasel Chiu > Signed-off-by: Loo Tung Lun > --- > IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py | 43 > ++++++++++++++++++++++++++++++++++++++----- > IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py | 121 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++------- > -- > 2 files changed, 150 insertions(+), 14 deletions(-) >=20 > diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py > b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py > index 008c7d7a16..680b90e09d 100644 > --- a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py > +++ b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py > @@ -807,12 +807,12 @@ class application(tkinter.Frame): > self.page_id =3D '' self.page_list =3D {} self.c= onf_list =3D {}+ > self.cfg_page_dict =3D {} self.cfg_data_obj =3D None > self.org_cfg_data_bin =3D None self.in_left =3D state() s= elf.in_right =3D > state() self.search_text =3D ''- self.binseg_dict =3D {} = # Check if > current directory contains a file with a .yaml extension # if not= default > self.last_dir to a Platform directory where it is@@ -1009,10 +1009,17 @@ > class application(tkinter.Frame): > return visible if self.cfg_data_obj.binseg_dict: = str_split =3D > item['path'].split('.')- if self.cfg_data_obj.binseg_dict[str_= split[-2]] =3D=3D - > 1:- visible =3D False- widget.grid_remove()= - return > visible+ if str_split[-2] not in CGenYamlCfg.available_fv and = \+ > str_split[-2] not in CGenYamlCfg.missing_fv:+ if > self.cfg_data_obj.binseg_dict[str_split[-3]] =3D=3D -1:+ = visible =3D False+ > widget.grid_remove()+ return visible+ else:= + if > self.cfg_data_obj.binseg_dict[str_split[-2]] =3D=3D -1:+ = visible =3D False+ > widget.grid_remove()+ return visible result = =3D 1 if > item['condition']: result =3D self.evaluate_condition(item)@@= -1371,8 > +1378,34 @@ class application(tkinter.Frame): > self.clear_widgets_inLayout() > self.on_config_page_select_change(None) + def > set_config_data_page(self):+ page_id_list =3D []+ for idx, = page in > enumerate(+ self.cfg_data_obj._cfg_page['root']['child']):= + > page_id_list.append(list(page.keys())[0])+ page_list =3D > self.cfg_data_obj.get_cfg_list(page_id_list[idx])+ > self.cfg_page_dict[page_id_list[idx]] =3D 0+ for item in page_= list:+ > str_split =3D item['path'].split('.')+ if str_split[-2] no= t in > CGenYamlCfg.available_fv and \+ str_split[-2] not = in > CGenYamlCfg.missing_fv:+ if > self.cfg_data_obj.binseg_dict[str_split[-3]] !=3D -1:+ > self.cfg_page_dict[page_id_list[idx]] +=3D 1+ else:+ = if > self.cfg_data_obj.binseg_dict[str_split[-2]] !=3D -1:+ > self.cfg_page_dict[page_id_list[idx]] +=3D 1+ removed_page =3D 0+ = for > idx, id in enumerate(page_id_list):+ if self.cfg_page_dict[id]= =3D=3D 0:+ > del self.cfg_data_obj._cfg_page['root']['child'][idx-removed_page] # noq= a: > E501+ removed_page +=3D 1+ def reload_config_data_from= _bin(self, > bin_dat): self.cfg_data_obj.load_default_from_bin(bin_dat)+ > self.set_config_data_page()+ self.left.delete(*self.left.get_child= ren())+ > self.build_config_page_tree(self.cfg_data_obj.get_cfg_page()['root'],+ > '') self.refresh_config_data_page() def set_config_item_valu= e(self, > item, value_str):diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.= py > b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > index 611a9a9c72..b593885807 100644 > --- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > +++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > @@ -13,6 +13,7 @@ import string > import operator as op import ast import tkinter.messagebox as > messagebox+import tkinter from datetime import date from collections > import OrderedDict@@ -583,7 +584,6 @@ class CGenYamlCfg: > self._mode =3D '' self._debug =3D False self._ma= cro_dict =3D {}- > self.bin_offset =3D [] self.binseg_dict =3D {} self.initi= alize() @@ -1046,6 > +1046,7 @@ option format '%s' !" % option) > try: value =3D self.reformat_value_s= tr(act_cfg['value'], > act_cfg['length'])+ except Exception: = value =3D act_cfg['value'] > length =3D bit_len // 8@@ -1298,18 +1299,85 @@ option format '%s' !" % > option) > self.traverse_cfg_tree(_get_field_value, top) return res= ult + > data_diff =3D ''++ def find_data_difference(self, act_val, act_cfg):+ = # > checks for any difference between BSF and Binary file+ config_val = =3D ''+ > if act_val !=3D act_cfg['value']:++ if 'DEC' in act_cfg['type'= ]:+ > bsf_val =3D '0x%x' % int(act_val)+ if bsf_val !=3D act_cfg= ['value']:+ > config_val =3D bsf_val+ else:+ config_v= al =3D ''+ else:+ > config_val =3D act_val++ available_fv1 =3D 'none'+ = available_fv2 =3D > 'none'++ if self.detect_fsp():+ if len(self.ava= ilable_fv) >=3D 1:+ > if len(self.available_fv) > 1:+ available_fv1 =3D = self.available_fv[1]+ > if self.available_fv[2]:+ available_fv2 =3D se= lf.available_fv[2]+ > else:+ available_fv1 =3D self.available_fv[1]+ = if act_cfg['length'] > =3D=3D 16:+ config_val =3D int(config_val, 16)+ = config_val =3D > '0x%x' % config_val+ act_cfg['value'] =3D int(+ > act_cfg['value'], 16)+ act_cfg['value'] =3D '0x%x' % = \+ > act_cfg['value']++ if config_val:+ string =3D (= '.' + act_cfg['cname'])+ > if (act_cfg['path'].endswith(self.available_fv[0] + string)+ = or > act_cfg['path'].endswith(available_fv1 + string)+ or > act_cfg['path'].endswith(available_fv2 + string)) \+ a= nd 'BsfSkip' not > in act_cfg['cname'] \+ and 'Reserved' not in act_c= fg['name']:+ > if act_cfg['option'] !=3D '':+ if act_cfg['length'= ] =3D=3D 8:+ > config_val =3D int(config_val, 16)+ config_val= =3D '0x%x' % > config_val+ act_cfg['value'] =3D int(+ > act_cfg['value'], 16)+ act_cfg['value'] =3D '0= x%x' % \+ > act_cfg['value']+ option =3D act_cfg['option']++ = cfg_val =3D > ''+ bin_val =3D ''+ for i i= n option.split(','):+ if > act_cfg['value'] in i:+ bin_val =3D i+ = elif config_val > in i:+ cfg_val =3D i+ = if cfg_val !=3D '' and bin_val !=3D '':+ > self.data_diff +=3D '\n\nBinary: ' \+ = + act_cfg['name'] \+ > + ': ' + bin_val.replace(' ', '') \+ + '\n= Config file: ' \+ > + act_cfg['name'] + ': ' \+ + cfg_val.repl= ace(' ', '') + '\n'+ > else:+ self.data_diff +=3D '\n\nBinary: ' \= + + > act_cfg['name'] + ': ' + act_cfg['value'] \+ += '\nConfig file: ' + > act_cfg['name'] \+ + ': ' + config_val + '\n'+= def > set_field_value(self, top, value_bytes, force=3DFalse): def > _set_field_value(name, cfgs, level): if 'indx' not in cfgs: = return > act_cfg =3D self.get_item_by_index(cfgs['indx']) actual_offse= t =3D > act_cfg['offset'] - struct_info['offset']- set_value =3D True-= for each > in self.bin_offset:- if actual_offset in range(each[0], (e= ach[0] + > each[2]) * 8):- if each[1] < 0:- = set_value =3D False- if > set_value and force or act_cfg['value'] =3D=3D '':+ if force o= r act_cfg['value'] > =3D=3D '': value =3D get_bits_from_bytes(full_bytes, > actual_offset, act_cfg['lengt= h'])@@ -1321,6 +1389,7 > @@ option format '%s' !" % option) > act_val) = act_cfg['value'] =3D > self.format_value_to_str( value, act_cfg['length'], a= ct_val)+ > self.find_data_difference(act_val, act_cfg) if 'indx' in top: = # it is > config option@@ -1438,6 +1507,9 @@ for '%s' !" % (act_cfg['value'], > act_cfg['path'])) > return bin_segs + available_fv =3D []+ missing_fv =3D []+= def > extract_cfg_from_bin(self, bin_data): # get cfg bin length = cfg_bins =3D > bytearray()@@ -1445,12 +1517,12 @@ for '%s' !" % (act_cfg['value'], > act_cfg['path'])) > Dummy_offset =3D 0 for each in bin_segs: if = each[1] !=3D -1:- > self.bin_offset.append([Dummy_offset, each[1], each[2]]) > cfg_bins.extend(bin_data[each[1]:each[1] + each[2]])+ > self.available_fv.append(each[0]) else:+ > self.missing_fv.append(each[0]) string =3D each[0] + ' is= not availabe.' > messagebox.showinfo('', string)- > self.bin_offset.append([Dummy_offset, each[1], each[2]]) > cfg_bins.extend(bytearray(each[2])) Dummy_offset +=3D each[2] > return cfg_bins@@ -1476,10 +1548,41 @@ for '%s' !" % (act_cfg['value'], > act_cfg['path'])) > print('Patched the loaded binary successfully !') return= bin_data + > def show_data_difference(self, data_diff):+ # Displays if any data > difference detected in BSF and Binary file+ pop_up_text =3D 'There= are > differences in Config file and binary '\+ 'data detected!\n'+ > pop_up_text +=3D data_diff++ window =3D tkinter.Tk()+ > window.title("Data Difference")+ window.resizable(1, 1)+ # = Window > Size+ window.geometry("800x400")+ frame =3D tkinter.Frame(w= indow, > height=3D800, width=3D700)+ frame.pack(side=3Dtkinter.BOTTOM)+ = # > Vertical (y) Scroll Bar+ scroll =3D tkinter.Scrollbar(window)+ > scroll.pack(side=3Dtkinter.RIGHT, fill=3Dtkinter.Y)++ text =3D > tkinter.Text(window, wrap=3Dtkinter.NONE,+ > yscrollcommand=3Dscroll.set,+ width=3D700, hei= ght=3D400)+ > text.insert(tkinter.INSERT, pop_up_text)+ text.pack()+ # Co= nfigure > the scrollbars+ scroll.config(command=3Dtext.yview)+ exit_b= utton =3D > tkinter.Button(+ window, text=3D"Close", command=3Dwindow.dest= roy)+ > exit_button.pack(in_=3Dframe, side=3Dtkinter.RIGHT, padx=3D20, pady=3D10)= + def > load_default_from_bin(self, bin_data): self._old_bin =3D bin_data > cfg_bins =3D self.extract_cfg_from_bin(bin_data) > self.set_field_value(self._cfg_tree, cfg_bins, True)++ if self.dat= a_diff:+ > self.show_data_difference(self.data_diff) return cfg_bins de= f > generate_binary_array(self, path=3D''):-- > 2.26.2.windows.1