OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 83... | Line 83... | |||
83 | |
83 | |
|
84 | static char *buf = NULL; |
84 | static char *buf = NULL; |
|
85 | static char *imagefile = NULL; |
85 | static char *imagefile = NULL; |
|
86 | static enum mtd_image_format imageformat = MTD_IMAGE_FORMAT_UNKNOWN; |
86 | static enum mtd_image_format imageformat = MTD_IMAGE_FORMAT_UNKNOWN; |
|
87 | static char *jffs2file = NULL, *jffs2dir = JFFS2_DEFAULT_DIR; |
- | ||
88 | static char *tpl_uboot_args_part; |
87 | static char *jffs2file = NULL, *jffs2dir = JFFS2_DEFAULT_DIR; |
|
89 | static int buflen = 0; |
88 | static int buflen = 0; |
|
90 | int quiet; |
89 | int quiet; |
|
91 | int no_erase; |
90 | int no_erase; |
|
92 | int mtdsize = 0; |
91 | int mtdsize = 0; |
|
Line 553... | Line 552... | |||
553 | if (part_offset > 0) { |
552 | if (part_offset > 0) { |
|
554 | fprintf(stderr, "Seeking on mtd device '%s' to: %zu\n", mtd, part_offset); |
553 | fprintf(stderr, "Seeking on mtd device '%s' to: %zu\n", mtd, part_offset); |
|
555 | lseek(fd, part_offset, SEEK_SET); |
554 | lseek(fd, part_offset, SEEK_SET); |
|
556 | } |
555 | } |
|
Line 557... | Line -... | |||
557 | |
- | ||
558 | /* Write TP-Link recovery flag */ |
- | ||
559 | if (tpl_uboot_args_part && mtd_tpl_recoverflag_write) { |
- | ||
560 | if (quiet < 2) |
- | ||
561 | fprintf(stderr, "Writing recovery flag to %s\n", tpl_uboot_args_part); |
- | ||
562 | result = mtd_tpl_recoverflag_write(tpl_uboot_args_part, true); |
- | ||
563 | if (result < 0) { |
- | ||
564 | fprintf(stderr, "Could not write TP-Link recovery flag to %s: %i", mtd, result); |
- | ||
565 | exit(1); |
- | ||
566 | } |
- | ||
567 | } |
- | ||
568 | |
556 | |
|
Line 569... | Line 557... | |||
569 | indicate_writing(mtd); |
557 | indicate_writing(mtd); |
|
570 | |
558 | |
|
571 | w = e = 0; |
559 | w = e = 0; |
|
Line 726... | Line 714... | |||
726 | fprintf(stderr, "Failed to update the FIS partition table\n"); |
714 | fprintf(stderr, "Failed to update the FIS partition table\n"); |
|
727 | } |
715 | } |
|
728 | #endif |
716 | #endif |
|
Line 729... | Line 717... | |||
729 | |
717 | |
|
730 | close(fd); |
- | ||
731 | |
- | ||
732 | /* Clear TP-Link recovery flag */ |
- | ||
733 | if (tpl_uboot_args_part && mtd_tpl_recoverflag_write) { |
- | ||
734 | if (quiet < 2) |
- | ||
735 | fprintf(stderr, "Removing recovery flag from %s\n", tpl_uboot_args_part); |
- | ||
736 | result = mtd_tpl_recoverflag_write(tpl_uboot_args_part, false); |
- | ||
737 | if (result < 0) { |
- | ||
738 | fprintf(stderr, "Could not clear TP-Link recovery flag to %s: %i", mtd, result); |
- | ||
739 | exit(1); |
- | ||
740 | } |
- | ||
741 | } |
- | ||
742 | |
718 | close(fd); |
|
743 | return 0; |
719 | return 0; |
|
Line 744... | Line 720... | |||
744 | } |
720 | } |
|
745 | |
721 | |
|
Line 793... | Line 769... | |||
793 | } |
769 | } |
|
794 | if (mtd_fixtrx || mtd_fixseama || mtd_fixwrg || mtd_fixwrgg) { |
770 | if (mtd_fixtrx || mtd_fixseama || mtd_fixwrg || mtd_fixwrgg) { |
|
795 | fprintf(stderr, |
771 | fprintf(stderr, |
|
796 | " -c datasize amount of data to be used for checksum calculation (for fixtrx / fixseama / fixwrg / fixwrgg)\n"); |
772 | " -c datasize amount of data to be used for checksum calculation (for fixtrx / fixseama / fixwrg / fixwrgg)\n"); |
|
797 | } |
773 | } |
|
798 | if (mtd_tpl_recoverflag_write) { |
- | ||
799 | fprintf(stderr, |
- | ||
800 | " -t <partition> write TP-Link recovery-flag to <partition> (for write)\n"); |
- | ||
801 | } |
- | ||
802 | fprintf(stderr, |
774 | fprintf(stderr, |
|
803 | #ifdef FIS_SUPPORT |
775 | #ifdef FIS_SUPPORT |
|
804 | " -F <part>[:<size>[:<entrypoint>]][,<part>...]\n" |
776 | " -F <part>[:<size>[:<entrypoint>]][,<part>...]\n" |
|
805 | " alter the fis partition table to create new partitions replacing\n" |
777 | " alter the fis partition table to create new partitions replacing\n" |
|
806 | " the partitions provided as argument to the write command\n" |
778 | " the partitions provided as argument to the write command\n" |
|
Line 854... | Line 826... | |||
854 | |
826 | |
|
855 | while ((ch = getopt(argc, argv, |
827 | while ((ch = getopt(argc, argv, |
|
856 | #ifdef FIS_SUPPORT |
828 | #ifdef FIS_SUPPORT |
|
857 | "F:" |
829 | "F:" |
|
858 | #endif |
830 | #endif |
|
859 | "frnqe:d:s:j:p:o:c:t:l:")) != -1) |
831 | "frnqe:d:s:j:p:o:c:l:")) != -1) |
|
860 | switch (ch) { |
832 | switch (ch) { |
|
861 | case 'f': |
833 | case 'f': |
|
862 | force = 1; |
834 | force = 1; |
|
863 | break; |
835 | break; |
|
Line 922... | Line 894... | |||
922 | if (errno) { |
894 | if (errno) { |
|
923 | fprintf(stderr, "-c: illegal numeric string\n"); |
895 | fprintf(stderr, "-c: illegal numeric string\n"); |
|
924 | usage(); |
896 | usage(); |
|
925 | } |
897 | } |
|
926 | break; |
898 | break; |
|
927 | case 't': |
- | ||
928 | tpl_uboot_args_part = optarg; |
- | ||
929 | break; |
- | ||
930 | #ifdef FIS_SUPPORT |
899 | #ifdef FIS_SUPPORT |
|
931 | case 'F': |
900 | case 'F': |
|
932 | fis_layout = optarg; |
901 | fis_layout = optarg; |
|
933 | break; |
902 | break; |
|
934 | #endif |
903 | #endif |