From nobody Sun May 19 16:31:42 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+102981+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+102981+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1681460819; cv=none; d=zohomail.com; s=zohoarc; b=mcgPqCMX325Qns+q+n8uXye+qNXMz32uccdNuxykIvJM32QCoDJx2V6rprDkPeDNuloSNEJuR2AwqlWfTYlQUp77RUUL5jj7Lv/Y8gfRswuw2I2c1mas8C1DrF2iiIuaLG9QrjTmu/e7zunfVe/qMGavrBkNlce/EY8m9sDSkaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681460819; 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=+CR9kkiL/buH101NEphAh+WEpLchujjXIgEdR9/vPFc=; b=TpARp2qTjsRBYn07ADykpJ5U1KQwPl7DPn+3C3hjE92hSvh6Am7QGaVh9wIINVzjWv7ZgFBg79Vi7YB2Ul0oqeR+q2bTRv3HQ2mM0/LuvE9PDTgtSLs2TBtoRRaQM/XiXQ5ADU/z3Osvsdcuz+KyLx9siGMuJjQSG33dHhyRil8= 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+102981+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 1681460819868800.2835281331197; Fri, 14 Apr 2023 01:26:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id sWS2YY1788612xlN90O2OuHa; Fri, 14 Apr 2023 01:26:59 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.4328.1681460818344032235 for ; Fri, 14 Apr 2023 01:26:58 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="328561860" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="328561860" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 01:26:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="667110419" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="667110419" X-Received: from cbduggap-mobl.gar.corp.intel.com ([10.215.183.68]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 01:26:55 -0700 From: "cbduggap" To: devel@edk2.groups.io Cc: Duggapu Chinni B Subject: [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412 Date: Fri, 14 Apr 2023 13:56:41 +0530 Message-Id: <2d02c35832ee95530cc11fad9f69cd9e51165917.1681460264.git.chinni.b.duggapu@intel.com> 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: xopDUSrLPV0ktP8hQfxlRTgox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1681460819; bh=oPbQGEKXIalGGWPz/M2Twckw1oDMycsDxU1GkqmT8js=; h=Cc:Date:From:Reply-To:Subject:To; b=jBZv9Qev8baMGg8ICIFofXD8/++a85Dnv9G8WMkPduPuxvfbr5njDe54F1MrLV8JPRL Cv0l60TJ64IEfgapb6O/oK3Tc0ArCmxS3xPlTe7EnN6NVARort6+Gwfyiel12m7H0Eqyv zh4lBDWyS9gxs7NnjrQgr8P7UnCG7CiNw2k= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1681460821917100003 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 . Signed-off-by: Duggapu Chinni B --- 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 (#102981): https://edk2.groups.io/g/devel/message/102981 Mute This Topic: https://groups.io/mt/98258111/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-