]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/FMMT/FMMT.py
BaseTools/FMMT: Add Shrink Fv function
[mirror_edk2.git] / BaseTools / Source / Python / FMMT / FMMT.py
index 3590f3340ec3addc132afb83823b6792747a1c25..bf580b3843a81b6e2427a54b4bb87164d312268b 100644 (file)
@@ -41,6 +41,8 @@ parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", nargs='+',
                         FmmtConf file saves the target guidtool used in compress/uncompress process.\\r
                         If do not provide, FMMT tool will search the inputfile folder for FmmtConf.ini firstly, if not found,\\r
                         the FmmtConf.ini saved in FMMT tool's folder will be used as default.")\r
+parser.add_argument("-s", "--ShrinkFv", dest="ShrinkFv", nargs='+',\r
+                    help="Shrink the Fv file: '-s InputFvfile OutputFvfile")\r
 \r
 def print_banner():\r
     print("")\r
@@ -111,6 +113,9 @@ class FMMT():
         else:\r
             ReplaceFfs(inputfile, self.CheckFfsName(Ffs_name), newffsfile, outputfile)\r
 \r
+    def Shrink(self,inputfile: str, outputfile: str) -> None:\r
+        self.SetDestPath(inputfile)\r
+        ShrinkFv(inputfile, outputfile)\r
 \r
 def main():\r
     args=parser.parse_args()\r
@@ -142,6 +147,8 @@ def main():
                 fmmt.Replace(args.Replace[0],args.Replace[2],args.Replace[3],args.Replace[4],args.Replace[1])\r
             else:\r
                 fmmt.Replace(args.Replace[0],args.Replace[1],args.Replace[2],args.Replace[3])\r
+        elif args.ShrinkFv:\r
+            fmmt.Shrink(args.ShrinkFv[0], args.ShrinkFv[1])\r
         else:\r
             parser.print_help()\r
     except Exception as e:\r