From nobody Sun May 19 20:47:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+102985+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+102985+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1681461292; cv=none; d=zohomail.com; s=zohoarc; b=iwCv8iUg2XU99nSKQ5MvQwyv4IFsTex284rISlN3RYZOl7ftauUGGAGt/QTAokb5IhtgZLYjsXCP+rfGBHDcb2UZYAkfe4c0iwLrVflps6zJs7wM5/XjRB4QFnj1OV7WlbZo5QU9WRCjSyYpVk0HxFukl+1U4ep3W022kFR78ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681461292; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=A2+yMt8VJoQjRDcgw+QUJsIF1zI6hES08fkUFFsah+U=; b=aD94SgtDxzAnyOu+W+m2vGAmP9JxrLuD24airav+xGiQ6s1YCH1t7ldBnzaqV1O9JmfnNPxjrfbOayqokb5VCdnhmQCylhT73+oVqxQRyxgIuKczL/voqw7Ypd+N5bPQs2DJgHeCXAcpn0TMCe15SX8FCQETa4cRJ4RBLmS8ugw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+102985+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1681461291912718.4758240130288; Fri, 14 Apr 2023 01:34:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xtMKYY1788612xHV73uDwyqF; Fri, 14 Apr 2023 01:34:51 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.4427.1681461291043984349 for ; Fri, 14 Apr 2023 01:34:51 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="341913574" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="341913574" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 01:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="813790427" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="813790427" X-Received: from cbduggap-mobl.gar.corp.intel.com ([10.215.183.68]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 01:34:47 -0700 From: "cbduggap" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Star Zeng , Ted Kuo , Duggapu Chinni B Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412 Date: Fri, 14 Apr 2023 14:04:27 +0530 Message-Id: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,chinni.b.duggapu@intel.com X-Gm-Message-State: T8R5VH62gtzrghlkt3v0MEtXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1681461291; bh=0hDmquUxdxdZ07TEbIMtjGnS5t6IAvNe6NCadU+zuJE=; h=Cc:Date:From:Reply-To:Subject:To; b=XUA2kf3bxRQFC/qBKeVhMtckKUb4Wr1jco+LfrBKUpr88MTbIWezdVuiPcOP7aXrrj5 FvF5k074Cil2F4YpbWxeBB8lvThFiVmbcWt5W/IrJSBrjWEb1YxhZUd4fYjyXcsgHVqIN e+qOfrRK5gu6bAP6qH2xq1kAd7+ocXotNF8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1681461292530100001 Content-Type: text/plain; charset="utf-8" After shrinking the FSP (FV) component using FMMT, Image size in FSP info header is not in sync with the FV length in FV header. This enhancement helps to patch the FSP image size offset with correct length & can be used to patch any offset directly on the FSP Component Fd . Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ted Kuo Signed-off-by: Duggapu Chinni B Reviewed-by: Ted Kuo --- IntelFsp2Pkg/Tools/PatchFv.py | 14 ++++++++++++- .../Tools/UserManuals/PatchFvUserManual.md | 20 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index eb130049b5..156c937abe 100644 --- a/IntelFsp2Pkg/Tools/PatchFv.py +++ b/IntelFsp2Pkg/Tools/PatchFv.py @@ -165,6 +165,17 @@ class Symbols: if not os.path.isdir(fvDir): raise Exception ("'%s' is not a valid directory!" % fvDir) =20 + # + # if user provided fd name as a input, skip rest of the flow to + # patch fd directly + #=20 + fdFile =3D os.path.join(fvDir,fvNames + ".fd") + if os.path.exists(fdFile): + print("Tool identified Fd file as a input to patch '%s'" %fdFi= le) + self.fdFile =3D fdFile + self.fdSize =3D os.path.getsize(fdFile) + return 0 + # # If the Guid.xref is not existing in fvDir, then raise an excepti= on # @@ -848,8 +859,9 @@ class Symbols: # Print out the usage # def Usage(): - print ("PatchFv Version 0.50") + print ("PatchFv Version 0.60") print ("Usage: \n\tPatchFv FvBuildDir [FvFileBaseNames:]FdFileBaseName= ToPatch \"Offset, Value\"") + print ("\tPatchFv FdFileDir FdFileName \"Offset, Value\"") =20 def main(): # diff --git a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md b/IntelFsp= 2Pkg/Tools/UserManuals/PatchFvUserManual.md index 5f1031e729..33bba38a3f 100644 --- a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md +++ b/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md @@ -1,6 +1,7 @@ #Name **_PatchFv.py_** - The python script that patches the firmware volumes (**= FV**) with in the flash device (**FD**) file post FSP build. +From version 0.60, script is capable of patching flash device (**FD**) dir= ectly. =20 #Synopsis =20 @@ -10,6 +11,12 @@ PatchFv FvBuildDir [FvFileBaseNames:]FdFileBaseNameToPat= ch ["Offset, Value"]+ | ["Offset, Value, $Command"]+ | ["Offset, Value, $Command, @Comment"]+ ``` +``` +PatchFv FdFileDir FdFileName ["Offset, Value"]+ + | ["Offset, Value, @Comment"]+ + | ["Offset, Value, $Command"]+ + | ["Offset, Value, $Command, @Comment"]+ +``` =20 #Description The **_PatchFv.py_** tool allows the developer to fix up FD images to foll= ow the @@ -102,6 +109,19 @@ ModuleGuid:Offset < > Convert absolute address into an image offset (expr & FSP_SIZ= E) =20 ``` +From version 0.60 tool allows to pass flash device file path as Argument 1= and=20 +flash device name as Argument 2 and rules for passing offset & value are s= ame +as explained in the previous sections. + +####Example usage: +Argument 1 +``` + YouPlatformFspBinPkg\ +``` +Argument 2 +``` + Fsp_Rebased_T +``` =20 ###Special Commands: Special commands must use the **$** symbol as a prefix to the command itse= lf. --=20 2.39.1.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 (#102985): https://edk2.groups.io/g/devel/message/102985 Mute This Topic: https://groups.io/mt/98258191/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-