* [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412
@ 2023-04-14 8:34 cbduggap
2023-04-14 9:08 ` Kuo, Ted
2023-04-14 15:47 ` Chiu, Chasel
0 siblings, 2 replies; 3+ messages in thread
From: cbduggap @ 2023-04-14 8:34 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone, Star Zeng, Ted Kuo, Duggapu Chinni B
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 <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Signed-off-by: Duggapu Chinni B <chinni.b.duggapu@intel.com>
---
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)
+ #
+ # if user provided fd name as a input, skip rest of the flow to
+ # patch fd directly
+ #
+ fdFile = os.path.join(fvDir,fvNames + ".fd")
+ if os.path.exists(fdFile):
+ print("Tool identified Fd file as a input to patch '%s'" %fdFile)
+ self.fdFile = fdFile
+ self.fdSize = os.path.getsize(fdFile)
+ return 0
+
#
# If the Guid.xref is not existing in fvDir, then raise an exception
#
@@ -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:]FdFileBaseNameToPatch \"Offset, Value\"")
+ print ("\tPatchFv FdFileDir FdFileName \"Offset, Value\"")
def main():
#
diff --git a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md b/IntelFsp2Pkg/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**) directly.
#Synopsis
@@ -10,6 +11,12 @@ PatchFv FvBuildDir [FvFileBaseNames:]FdFileBaseNameToPatch ["Offset, Value"]+
| ["Offset, Value, $Command"]+
| ["Offset, Value, $Command, @Comment"]+
```
+```
+PatchFv FdFileDir FdFileName ["Offset, Value"]+
+ | ["Offset, Value, @Comment"]+
+ | ["Offset, Value, $Command"]+
+ | ["Offset, Value, $Command, @Comment"]+
+```
#Description
The **_PatchFv.py_** tool allows the developer to fix up FD images to follow the
@@ -102,6 +109,19 @@ ModuleGuid:Offset
< > Convert absolute address <expr> into an image offset (expr & FSP_SIZE)
```
+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 same
+as explained in the previous sections.
+
+####Example usage:
+Argument 1
+```
+ YouPlatformFspBinPkg\
+```
+Argument 2
+```
+ Fsp_Rebased_T
+```
###Special Commands:
Special commands must use the **$** symbol as a prefix to the command itself.
--
2.39.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412
2023-04-14 8:34 [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412 cbduggap
@ 2023-04-14 9:08 ` Kuo, Ted
2023-04-14 15:47 ` Chiu, Chasel
1 sibling, 0 replies; 3+ messages in thread
From: Kuo, Ted @ 2023-04-14 9:08 UTC (permalink / raw)
To: Duggapu, Chinni B, devel@edk2.groups.io
Cc: Chiu, Chasel, Desimone, Nathaniel L, Zeng, Star
Reviewed-by: Ted Kuo <ted.kuo@intel.com>
Thanks,
Ted
-----Original Message-----
From: Duggapu, Chinni B <chinni.b.duggapu@intel.com>
Sent: Friday, April 14, 2023 4:34 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>; Kuo, Ted <ted.kuo@intel.com>; Duggapu, Chinni B <chinni.b.duggapu@intel.com>
Subject: [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412
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 <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Signed-off-by: Duggapu Chinni B <chinni.b.duggapu@intel.com>
---
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) + #+ # if user provided fd name as a input, skip rest of the flow to+ # patch fd directly+ # + fdFile = os.path.join(fvDir,fvNames + ".fd")+ if os.path.exists(fdFile):+ print("Tool identified Fd file as a input to patch '%s'" %fdFile)+ self.fdFile = fdFile+ self.fdSize = os.path.getsize(fdFile)+ return 0+ # # If the Guid.xref is not existing in fvDir, then raise an exception #@@ -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:]FdFileBaseNameToPatch \"Offset, Value\"")+ print ("\tPatchFv FdFileDir FdFileName \"Offset, Value\"") def main(): #diff --git a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md b/IntelFsp2Pkg/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**) directly. #Synopsis @@ -10,6 +11,12 @@ PatchFv FvBuildDir [FvFileBaseNames:]FdFileBaseNameToPatch ["Offset, Value"]+
| ["Offset, Value, $Command"]+ | ["Offset, Value, $Command, @Comment"]+ ```+```+PatchFv FdFileDir FdFileName ["Offset, Value"]++ | ["Offset, Value, @Comment"]++ | ["Offset, Value, $Command"]++ | ["Offset, Value, $Command, @Comment"]++``` #Description The **_PatchFv.py_** tool allows the developer to fix up FD images to follow the@@ -102,6 +109,19 @@ ModuleGuid:Offset
< > Convert absolute address <expr> into an image offset (expr & FSP_SIZE) ```+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 same+as explained in the previous sections.++####Example usage:+Argument 1+```+ YouPlatformFspBinPkg\+```+Argument 2+```+ Fsp_Rebased_T+``` ###Special Commands: Special commands must use the **$** symbol as a prefix to the command itself.--
2.39.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412
2023-04-14 8:34 [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412 cbduggap
2023-04-14 9:08 ` Kuo, Ted
@ 2023-04-14 15:47 ` Chiu, Chasel
1 sibling, 0 replies; 3+ messages in thread
From: Chiu, Chasel @ 2023-04-14 15:47 UTC (permalink / raw)
To: Duggapu, Chinni B, devel@edk2.groups.io
Cc: Desimone, Nathaniel L, Zeng, Star, Kuo, Ted
Hi Chinni,
Please help to correct patch format and make sure it can pass verification by BaseTools/Scripts/PatchCheck.py
Thanks,
Chasel
> -----Original Message-----
> From: Duggapu, Chinni B <chinni.b.duggapu@intel.com>
> Sent: Friday, April 14, 2023 1:34 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>; Kuo, Ted
> <ted.kuo@intel.com>; Duggapu, Chinni B <chinni.b.duggapu@intel.com>
> Subject: [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file
> directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412
>
> 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 <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Ted Kuo <ted.kuo@intel.com>
> Signed-off-by: Duggapu Chinni B <chinni.b.duggapu@intel.com>
> ---
> 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) + #+ # if user provided fd name as a input, skip rest of
> the flow to+ # patch fd directly+ # + fdFile =
> os.path.join(fvDir,fvNames + ".fd")+ if os.path.exists(fdFile):+
> print("Tool identified Fd file as a input to patch '%s'" %fdFile)+ self.fdFile =
> fdFile+ self.fdSize = os.path.getsize(fdFile)+ return 0+ # # If
> the Guid.xref is not existing in fvDir, then raise an exception #@@ -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:]FdFileBaseNameToPatch \"Offset, Value\"")+ print
> ("\tPatchFv FdFileDir FdFileName \"Offset, Value\"") def main(): #diff --git
> a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
> b/IntelFsp2Pkg/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**) directly.
> #Synopsis @@ -10,6 +11,12 @@ PatchFv FvBuildDir
> [FvFileBaseNames:]FdFileBaseNameToPatch ["Offset, Value"]+
> | ["Offset, Value, $Command"]+ | ["Offset, Value, $Command,
> @Comment"]+ ```+```+PatchFv FdFileDir FdFileName ["Offset, Value"]++ |
> ["Offset, Value, @Comment"]++ | ["Offset, Value, $Command"]++ | ["Offset,
> Value, $Command, @Comment"]++``` #Description The **_PatchFv.py_** tool
> allows the developer to fix up FD images to follow the@@ -102,6 +109,19 @@
> ModuleGuid:Offset
> < > Convert absolute address <expr> into an image offset (expr & FSP_SIZE)
> ```+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
> same+as explained in the previous sections.++####Example usage:+Argument
> 1+```+ YouPlatformFspBinPkg\+```+Argument 2+```+ Fsp_Rebased_T+```
> ###Special Commands: Special commands must use the **$** symbol as a
> prefix to the command itself.--
> 2.39.1.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-14 15:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-14 8:34 [PATCH v2] IntelFsp2Pkg/Tools: Enhance PathFv.py to patch Fd file directly https://bugzilla.tianocore.org/show_bug.cgi?id=4412 cbduggap
2023-04-14 9:08 ` Kuo, Ted
2023-04-14 15:47 ` Chiu, Chasel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox