From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NdpG3MKx; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1681461291; x=1712997291; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Rl2X2k0WwVnoYJl3PSHhM2n/qXr708Xpe8N/rtppRrM=; b=NdpG3MKxvoH+Ccw02EqlXngrNalII5d3iodksLIkYMhUAEKi991jztaw NC1Qhti3TZD7ncGSfOmssXVmfTdFRe+YFoYVfbEk7Cv1pn51Hy+LqRTVa GAgdTfisuUIJ+mfrZnsZ3KYMf0joFZoVr++67LcNzc58lJy0QsuSUVEQf HlNR4VLUc7cCva0SZAfsdfhHREdxWpm14vgKZ4H5VqMoAN/BO6xdXnZRt qbhhB25wsIwI1SgZcOptdNlkfPF1vmUpoLPO8UavU7ydXjnvveZYMvHpP ou7U9vvG95J3PAnNvSWbewUioVdGsmvybTFXg/gux32AugoysaoX5Yrxt A==; 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" 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" 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: [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: 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 . Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ted Kuo 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