From nobody Sun May 19 12:45:52 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+103068+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+103068+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1681705394; cv=none; d=zohomail.com; s=zohoarc; b=hbLb8PtnLiwhkOCpovSvsSrIvpTGfhRIoJv2ARDcxOYRFHVv5DUQ+fsx4yiXQuuQkWbxqlxitleMBwJ2f0apCyLA2xLTvAaxQa/ZVpPbY5uO4a5uvyl+VuE1NdVtdnF4fb0IlZbyBA1rCkjyNSDJubGslkVV1ft10u8ceUmKOd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681705394; 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=V+cwHfZVO7riZ2rmPpRoPnXHyLQvJbH84ubltvOjcZM=; b=Pw7LIm3zr8xXcKo7N7yifjk6s5ZLHbMLjaD1WkG3oGXfR51YzCw7WZM/g/m5PS/n0SvffuySQhyDWQ8n9C0q98j1ckdHRs1VgL97VlGY1PEunbe2qbwXi9oNBeBLnWcSW8J+59TU0no5nsLUCIfNAIayu1h3yJG2F2FFjGDQqjk= 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+103068+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 1681705394130379.0496485914041; Sun, 16 Apr 2023 21:23:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id F8E7YY1788612xeolhb3jqON; Sun, 16 Apr 2023 21:23:13 -0700 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.46873.1681705392604592770 for ; Sun, 16 Apr 2023 21:23:13 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="346645458" X-IronPort-AV: E=Sophos;i="5.99,203,1677571200"; d="scan'208";a="346645458" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2023 21:23:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="723122064" X-IronPort-AV: E=Sophos;i="5.99,203,1677571200"; d="scan'208";a="723122064" X-Received: from cbduggap-mobl.gar.corp.intel.com ([10.215.143.47]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2023 21:23:08 -0700 From: "cbduggap" To: devel@edk2.groups.io Cc: "Duggapu, Chinni B" , Chasel Chiu , Nate DeSimone , Star Zeng , Ted Kuo Subject: [edk2-devel] [PATCH v3] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly Date: Mon, 17 Apr 2023 09:52:56 +0530 Message-Id: <57bb69fe722c4e736d0fb9b892380ed2c95bd2b1.1681705360.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: JVTjr8bhuo7guY7pgOEcYvrEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1681705393; bh=4xJWmnd71LLpJ8cvWnuR4bNZZRLUBno9MYu2BkO3pvg=; h=Cc:Date:From:Reply-To:Subject:To; b=ua34y16pkdP+zpw9WvDh1LH46HKKIHzp8pvKmT5ddTzDiIl/zBFKO7ULt4dum3X7Cgi H475IzvSXZoyI1pOohhlG+Zkru8SQhTWAw758ddGXr6XFtU9DUwc2o7mZlyQkzx2CTVxs S+f/UCPKOim017YbZAshHelWUta9OFrex28= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1681705394864100003 Content-Type: text/plain; charset="utf-8" From: "Duggapu, Chinni B" https://bugzilla.tianocore.org/show_bug.cgi?id=3D4412 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: Chasel Chiu --- 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..73ab877c71 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 + # + 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..f28eedf625 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 +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 (#103068): https://edk2.groups.io/g/devel/message/103068 Mute This Topic: https://groups.io/mt/98312628/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-