@@ -554,6 +554,7 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
554554 if len (sys .argv ) < 5 :
555555 print ("Usage: python3 patch.py encode OLD_FW NEW_FW PATCH [OPTIONS]" )
556556 print ("Options:"
557+ "\n \t -d : use diff with option minimal to reduce the patch size"
557558 "\n \t -v : verify che correctness of the patch"
558559 "\n \t -V : verify che correctness of the txt patch"
559560 "\n \t -t FILENAME: write the patch in txt format"
@@ -570,6 +571,7 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
570571 # default values
571572 verify = False
572573 verify_py = False
574+ minimal = False
573575 path_patch_txt = ""
574576 path_patch_bin_txt = ""
575577 path_report_txt = ""
@@ -593,6 +595,9 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
593595 path_report_txt = sys .argv [i + 1 ]
594596 elif sys .argv [i ] == '-R' :
595597 path_report_csv = sys .argv [i + 1 ]
598+ elif sys .argv [i ] == '-d' :
599+ minimal = True
600+
596601
597602 except IndexError :
598603 print ("Error during parsing arguments" )
@@ -614,7 +619,10 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
614619 if header_custom :
615620 to_remove .extend (["old_fw_header.tmp" , "new_fw_header.tmp" ])
616621 # compute diff
617- os .system ("diff old_fw.tmp new_fw.tmp > diff.tmp" )
622+ if minimal :
623+ os .system ("diff -d old_fw.tmp new_fw.tmp > diff.tmp" )
624+ else :
625+ os .system ("diff old_fw.tmp new_fw.tmp > diff.tmp" )
618626 os .system ("grep -E '^[0-9,]+[acd][0-9,]+$' diff.tmp > diff_c.tmp" )
619627 os .system ("grep '^>' diff.tmp | sed 's/^> //' > diff_a.tmp" )
620628
0 commit comments