summaryrefslogtreecommitdiffstats
path: root/IntelFsp2Pkg/Tools/PatchFv.py
diff options
context:
space:
mode:
authorDuggapu, Chinni B <chinni.b.duggapu@intel.com>2023-04-16 21:22:56 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-04-18 06:09:25 +0000
commitb16284e2a0011489f6e16dfcc6af7623c3cbaf0b (patch)
treeaf3567cd948bcbab68efabcf8753f92c1ac5c5a4 /IntelFsp2Pkg/Tools/PatchFv.py
parent6ded9f50c3aa123fe581c42ff6c03789b9b593c1 (diff)
downloadedk2-b16284e2a0011489f6e16dfcc6af7623c3cbaf0b.tar.gz
edk2-b16284e2a0011489f6e16dfcc6af7623c3cbaf0b.tar.bz2
edk2-b16284e2a0011489f6e16dfcc6af7623c3cbaf0b.zip
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> Reviewed-by: Ted Kuo <ted.kuo@intel.com> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Diffstat (limited to 'IntelFsp2Pkg/Tools/PatchFv.py')
-rw-r--r--IntelFsp2Pkg/Tools/PatchFv.py14
1 files changed, 13 insertions, 1 deletions
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
@@ -166,6 +166,17 @@ class Symbols:
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
#
xrefFile = os.path.join(fvDir, "Guid.xref")
@@ -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():
#