From nobody Sat Apr 27 11:39:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42750+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42750+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1561387046; cv=none; d=zoho.com; s=zohoarc; b=YeFOz9e65l8++Z0rbw6CXHfQz99k/hirlJdZo5hDXzyKpCpYhUPKsTYCiIQxVluU5xrcncje8BA/pPQ/NrKVEZt1Uu/GeGWGK/CUAAsvk9cUic/fDDWlJ8zDHOuRFHa5Q8KzvpILTllV4ixUJf/gp+yblIVI+GuxqJt3FNISDho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561387046; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=PCQ5NRSya7rXQUlkYH7/1enyE/7Vg3mQSL+nS+AHoYw=; b=Cwv2xnMBneSNQKdHbaqm9rRHRnSGl51RbMzzY+DGpyJ/hoA3j9NarqQ3g+KvT4hAxzIFfkbEG/t0yT33s1NPKIUDGWSI0YAWujEdfnDsYVZfLRVyYekHVx1ins3uxR1lQvPYljV6PIPr7gEmbdIIVwN5V87984Ppb2opuXa8qMk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42750+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1561387046788279.57287494027105; Mon, 24 Jun 2019 07:37:26 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Mon, 24 Jun 2019 07:36:35 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jun 2019 07:36:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,412,1557212400"; d="scan'208";a="161632138" X-Received: from elinachx-mobl.gar.corp.intel.com (HELO cchiu4-MOBL1.gar.corp.intel.com) ([10.252.191.119]) by fmsmga008.fm.intel.com with ESMTP; 24 Jun 2019 07:36:33 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Michael Kubacki , Nate DeSimone , Liming Gao Subject: [edk2-devel] [PATCH] MinPlatformPkg: FSP Python script to python 3.x. Date: Mon, 24 Jun 2019 22:36:17 +0800 Message-Id: <20190624143617.16164-1-chasel.chiu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1561387046; bh=RBxxsfS2qcrZaCqUMfrMZje8FEItFQcF5yjn1P54538=; h=Cc:Date:From:Reply-To:Subject:To; b=XlNO5heUkfFnbpD9G3tnEjtBLdKwtUemzndirzjciC3joNS7lmYvuO7ZP3lsFbZN3lQ fTe24CVX+c2tUnexwq3FVjkl70+vpYO1nqSzy3PyQIfCyJyF8+UyKxTC9RzzWT99XEgUe DGgp6eeH7D9GCrQo+3M9OGVGN94luxQt0Oc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D1930 Updated FSP Python script to support both 2.x and 3.x. Test: . Verified with Python 2.7.12 and 3.6.6. . Verified tool result is the same before the change. . Both py -2 and py -3 built binary can boot. Cc: Michael Kubacki Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Chasel Chiu Reviewed-by: Bob Feng Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py= | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBa= seAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBin= BaseAddress.py index 167a0e0a4c..406e5ec130 100644 --- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddre= ss.py +++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddre= ss.py @@ -10,16 +10,16 @@ import re import subprocess =20 if len(sys.argv) not in [6,7]: - print "RebaseAndPatchFspBinBaseAddress.py - Error in number of arguments= received" - print "Usage - RebaseAndPatchFspBinBaseAddress.py <= FspBinPkg Folder> \ - " + print ("RebaseAndPatchFspBinBaseAddress.py - Error in number of argument= s received") + print ("Usage - RebaseAndPatchFspBinBaseAddress.py = \ + ") exit(1) =20 flashMapName =3D sys.argv[1] fspBinPath =3D sys.argv[2] fspBinFile =3D sys.argv[3] targetDscFile =3D sys.argv[4] -fvOffset =3D long(sys.argv[5], 16) +fvOffset =3D int(sys.argv[5], 16) fspBinFileRebased =3D "Fsp_Rebased.fd" splitFspBinPath =3D os.path.join("edk2","IntelFsp2Pkg","Tools","SplitFsp= Bin.py") =20 @@ -30,21 +30,21 @@ if len(sys.argv) =3D=3D 7: # Make sure argument passed or valid # if not os.path.exists(flashMapName): - print "WARNING! " + str(flashMapName) + " is not found." + print ("WARNING! " + str(flashMapName) + " is not found.") exit(1) fspBinFilePath =3D fspBinPath + os.sep + fspBinFile if not os.path.exists(fspBinFilePath): - print "WARNING! " + str(fspBinFilePath) + " is not found." + print ("WARNING! " + str(fspBinFilePath) + " is not found.") exit(1) if not os.path.exists(targetDscFile): - print "WARNING! " + str(targetDscFile) + " is not found." + print ("WARNING! " + str(targetDscFile) + " is not found.") exit(1) ext_file =3D str(os.path.splitext(targetDscFile)[-1]).lower() if ext_file !=3D ".dsc": - print "WARNING! " + str(targetDscFile) + " is not a dsc file" + print ("WARNING! " + str(targetDscFile) + " is not a dsc file") exit(1) if not os.path.exists(splitFspBinPath): - print "WARNING! " + str(splitFspBinPath) + " is not found." + print ("WARNING! " + str(splitFspBinPath) + " is not found.") exit(1) =20 # @@ -54,7 +54,7 @@ file =3D open (flashMapName, "r") data =3D file.read () =20 # Get the Flash Base Address -flashBase =3D long(data.split("FLASH_BASE")[1].split("=3D")[1].split()[0],= 16) +flashBase =3D int(data.split("FLASH_BASE")[1].split("=3D")[1].split()[0], = 16) =20 # Based on Build Target, select the section in the FlashMap file flashmap =3D data @@ -62,11 +62,11 @@ flashmap =3D data # Get FSP-S & FSP-M & FSP-T offset & calculate the base for line in flashmap.split("\n"): if "PcdFlashFvFspSOffset" in line: - fspSBaseOffset =3D long(line.split("=3D")[1].split()[0], 16) + fspSBaseOffset =3D int(line.split("=3D")[1].split()[0], 16) if "PcdFlashFvFspMOffset" in line: - fspMBaseOffset =3D long(line.split("=3D")[1].split()[0], 16) + fspMBaseOffset =3D int(line.split("=3D")[1].split()[0], 16) if "PcdFlashFvFspTOffset" in line: - fspTBaseOffset =3D long(line.split("=3D")[1].split()[0], 16) + fspTBaseOffset =3D int(line.split("=3D")[1].split()[0], 16) file.close() =20 # @@ -78,10 +78,10 @@ if 'PYTHON_HOME' in os.environ: pythontool =3D os.environ['PYTHON_HOME'] + os.sep + 'python' Process =3D subprocess.Popen([pythontool, splitFspBinPath, "info","-f",fsp= BinFilePath], stdout=3Dsubprocess.PIPE) Output =3D Process.communicate()[0] -FsptInfo =3D Output.rsplit("FSP_M", 1); -for line in FsptInfo[1].split("\n"): - if "ImageSize" in line: - fspMSize =3D long(line.split("=3D")[1], 16) +FsptInfo =3D Output.rsplit(b"FSP_M", 1); +for line in FsptInfo[1].split(b"\n"): + if b"ImageSize" in line: + fspMSize =3D int(line.split(b"=3D")[1], 16) break =20 # Calculate FSP-S/M/T base address, to which re-base has to be done --=20 2.13.3.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42750): https://edk2.groups.io/g/devel/message/42750 Mute This Topic: https://groups.io/mt/32192703/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-