From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NMdxVSG1; spf=pass (domain: intel.com, ip: 134.134.136.24, 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=1681705392; x=1713241392; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wclcZcSkasufb6MK0bpZDl1TdWTjB4K60lL5AziIoKw=; b=NMdxVSG1WilE+OrocAOTcGEfBkm/5hHUoMsttk4rqwC/RjyMHaBrT+cU Vlxhwm1niUszGDP6Nmi67muxPxGpQ8Vm1WcTfGfDuHeGOttbAm1eIWKeD BlHBbTPCudpe1cpi7eFeK0GHzWYx2N5gjlbMyHzGW3v+AfbidS0HojETQ x67og2/MKbx6BJ4YTIdDCo8XVHn52L38uezfKeDi3gZ/w5juNzM65aru6 S8UsaNhjyUJdshVTGrWv61ynY4nOjQBz3agAHs2+oCqZ0JOnV6YJkiGtV HJ7aNnWF3c4TgoaHlIafe93iLeaZBewWX68suYSXPiEDm8P8a7btbIRzX Q==; 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" 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" 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: [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> X-Mailer: git-send-email 2.39.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- 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):=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..f28eedf625 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