@@ -554,6 +554,7 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
554
554
if len (sys .argv ) < 5 :
555
555
print ("Usage: python3 patch.py encode OLD_FW NEW_FW PATCH [OPTIONS]" )
556
556
print ("Options:"
557
+ "\n \t -d : use diff with option minimal to reduce the patch size"
557
558
"\n \t -v : verify che correctness of the patch"
558
559
"\n \t -V : verify che correctness of the txt patch"
559
560
"\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):
570
571
# default values
571
572
verify = False
572
573
verify_py = False
574
+ minimal = False
573
575
path_patch_txt = ""
574
576
path_patch_bin_txt = ""
575
577
path_report_txt = ""
@@ -593,6 +595,9 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
593
595
path_report_txt = sys .argv [i + 1 ]
594
596
elif sys .argv [i ] == '-R' :
595
597
path_report_csv = sys .argv [i + 1 ]
598
+ elif sys .argv [i ] == '-d' :
599
+ minimal = True
600
+
596
601
597
602
except IndexError :
598
603
print ("Error during parsing arguments" )
@@ -614,7 +619,10 @@ def generate_hex_fw(filename, fw_path, fw_header_path, header_fw_size):
614
619
if header_custom :
615
620
to_remove .extend (["old_fw_header.tmp" , "new_fw_header.tmp" ])
616
621
# 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" )
618
626
os .system ("grep -E '^[0-9,]+[acd][0-9,]+$' diff.tmp > diff_c.tmp" )
619
627
os .system ("grep '^>' diff.tmp | sed 's/^> //' > diff_a.tmp" )
620
628
0 commit comments