summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/FMMT/FMMT.py
diff options
context:
space:
mode:
authorChen, Christine <Yuwei.Chen@intel.com>2022-09-16 09:51:18 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-10-19 06:32:07 +0000
commit09e74b81ba7178588d4636762ffb852987f18525 (patch)
treef748b73b83394ef5bdf1a5ab4ec4a1d20c1403aa /BaseTools/Source/Python/FMMT/FMMT.py
parent0e6db46b1be173e7207bfadc05221a20f9b0dd02 (diff)
downloadedk2-09e74b81ba7178588d4636762ffb852987f18525.tar.gz
edk2-09e74b81ba7178588d4636762ffb852987f18525.tar.bz2
edk2-09e74b81ba7178588d4636762ffb852987f18525.zip
BaseTools/FMMT: Add Shrink Fv function
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3938 This function is used to remove the useless FV free space. Usage: FMMT -s Inputfile Outputfile Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/FMMT/FMMT.py')
-rw-r--r--BaseTools/Source/Python/FMMT/FMMT.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/FMMT/FMMT.py b/BaseTools/Source/Python/FMMT/FMMT.py
index 3590f3340e..bf580b3843 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -41,6 +41,8 @@ parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", nargs='+',
FmmtConf file saves the target guidtool used in compress/uncompress process.\
If do not provide, FMMT tool will search the inputfile folder for FmmtConf.ini firstly, if not found,\
the FmmtConf.ini saved in FMMT tool's folder will be used as default.")
+parser.add_argument("-s", "--ShrinkFv", dest="ShrinkFv", nargs='+',
+ help="Shrink the Fv file: '-s InputFvfile OutputFvfile")
def print_banner():
print("")
@@ -111,6 +113,9 @@ class FMMT():
else:
ReplaceFfs(inputfile, self.CheckFfsName(Ffs_name), newffsfile, outputfile)
+ def Shrink(self,inputfile: str, outputfile: str) -> None:
+ self.SetDestPath(inputfile)
+ ShrinkFv(inputfile, outputfile)
def main():
args=parser.parse_args()
@@ -142,6 +147,8 @@ def main():
fmmt.Replace(args.Replace[0],args.Replace[2],args.Replace[3],args.Replace[4],args.Replace[1])
else:
fmmt.Replace(args.Replace[0],args.Replace[1],args.Replace[2],args.Replace[3])
+ elif args.ShrinkFv:
+ fmmt.Shrink(args.ShrinkFv[0], args.ShrinkFv[1])
else:
parser.print_help()
except Exception as e: