From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Iy1ezugl; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: chinni.b.duggapu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681460818; x=1712996818; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wbCljrWoUHlAuzm8+tWdPTs1hS0Pwqq8sG6+Dwvf6j8=; b=Iy1ezuglnd/V8ClDdqpD9lFiXEaCkPUAMVl+sibWkBQF6sPsxO6VN7Nx q/HhnMiwetApz653T4jVdSSU0VfticKNwogDDNE9GOkEEIFZDs7b3EvNj 3qoXMDXU2dsRdTFpalwksoMs3tY9kyS8SryrO+d3Ya0FgDTwhM1EOj2/J gvgvBuMusJFp6yMwgFLNNOe4O2V1wbzAqAxWY7oEsRs+YYRNvTy0yAkCt QqkSqgC9FQOZOWxWpPaFRdUqFTFkHH1udOuKprerq/DLVzUsDwvW6kayf x5/vgXN5F3vFKYDCM2dfVZkgzc+Ojlug3KRJ20IPDRfsRx26Ki/oEjKqx Q==; 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" 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" 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: [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> X-Mailer: git-send-email 2.39.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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):=0D raise Exception ("'%s' is not a valid directory!" % fvDir)=0D =0D + #=0D + # if user provided fd name as a input, skip rest of the flow to=0D + # patch fd directly=0D + # =0D + fdFile =3D os.path.join(fvDir,fvNames + ".fd")=0D + if os.path.exists(fdFile):=0D + print("Tool identified Fd file as a input to patch '%s'" %fdFi= le)=0D + self.fdFile =3D fdFile=0D + self.fdSize =3D os.path.getsize(fdFile)=0D + return 0=0D +=0D #=0D # If the Guid.xref is not existing in fvDir, then raise an excepti= on=0D #=0D @@ -848,8 +859,9 @@ class Symbols: # Print out the usage=0D #=0D def Usage():=0D - print ("PatchFv Version 0.50")=0D + print ("PatchFv Version 0.60")=0D print ("Usage: \n\tPatchFv FvBuildDir [FvFileBaseNames:]FdFileBaseName= ToPatch \"Offset, Value\"")=0D + print ("\tPatchFv FdFileDir FdFileName \"Offset, Value\"")=0D =0D def main():=0D #=0D 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=0D **_PatchFv.py_** - The python script that patches the firmware volumes (**= FV**)=0D with in the flash device (**FD**) file post FSP build.=0D +From version 0.60, script is capable of patching flash device (**FD**) dir= ectly.=0D =0D #Synopsis=0D =0D @@ -10,6 +11,12 @@ PatchFv FvBuildDir [FvFileBaseNames:]FdFileBaseNameToPat= ch ["Offset, Value"]+ | ["Offset, Value, $Command"]+=0D | ["Offset, Value, $Command, @Comment"]+=0D ```=0D +```=0D +PatchFv FdFileDir FdFileName ["Offset, Value"]+=0D + | ["Offset, Value, @Comment"]+=0D + | ["Offset, Value, $Command"]+=0D + | ["Offset, Value, $Command, @Comment"]+=0D +```=0D =0D #Description=0D The **_PatchFv.py_** tool allows the developer to fix up FD images to foll= ow the=0D @@ -102,6 +109,19 @@ ModuleGuid:Offset < > Convert absolute address into an image offset (expr & FSP_SIZ= E)=0D =0D ```=0D +From version 0.60 tool allows to pass flash device file path as Argument 1= and =0D +flash device name as Argument 2 and rules for passing offset & value are s= ame=0D +as explained in the previous sections.=0D +=0D +####Example usage:=0D +Argument 1=0D +```=0D + YouPlatformFspBinPkg\=0D +```=0D +Argument 2=0D +```=0D + Fsp_Rebased_T=0D +```=0D =0D ###Special Commands:=0D Special commands must use the **$** symbol as a prefix to the command itse= lf.=0D --=20 2.39.1.windows.1