diff options
author | Imre Kaloz <kaloz@openwrt.org> | 2015-08-19 08:35:41 +0000 |
---|---|---|
committer | Imre Kaloz <kaloz@openwrt.org> | 2015-08-19 08:35:41 +0000 |
commit | 9f8042dd1f611cb0226c0e13cc26d6879f137d6a (patch) | |
tree | d50eb70e9fbb78619a069820f3eb8427bcfa4acf /package/system/mtd/src/mtd.c | |
parent | f9ccf89b13ac00aac7d741c62bca19beaa588951 (diff) | |
download | upstream-9f8042dd1f611cb0226c0e13cc26d6879f137d6a.tar.gz upstream-9f8042dd1f611cb0226c0e13cc26d6879f137d6a.tar.bz2 upstream-9f8042dd1f611cb0226c0e13cc26d6879f137d6a.zip |
mvebu: add support for the Linksys boot counter (backport of r46690)
The u-boot boot counter was never reset after a successful boot,
which sometimes could make some variables become out of sync.
This patch adds support for the boot counter and enables
auto_recovery unconditionally.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Rob Mosher <nyt-openwrt@countercultured.net>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@46691 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/system/mtd/src/mtd.c')
-rw-r--r-- | package/system/mtd/src/mtd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index 741b57b480..02476306f6 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -640,6 +640,10 @@ static void usage(void) " verify <imagefile>|- verify <imagefile> (use - for stdin) to device\n" " write <imagefile>|- write <imagefile> (use - for stdin) to device\n" " jffs2write <file> append <file> to the jffs2 partition on the device\n"); + if (mtd_resetbc) { + fprintf(stderr, + " resetbc <device> reset the uboot boot counter\n"); + } if (mtd_fixtrx) { fprintf(stderr, " fixtrx fix the checksum in a trx header on first boot\n"); @@ -706,6 +710,7 @@ int main (int argc, char **argv) CMD_FIXSEAMA, CMD_VERIFY, CMD_DUMP, + CMD_RESETBC, } cmd = -1; erase[0] = NULL; @@ -800,6 +805,9 @@ int main (int argc, char **argv) } else if ((strcmp(argv[0], "erase") == 0) && (argc == 2)) { cmd = CMD_ERASE; device = argv[1]; + } else if (((strcmp(argv[0], "resetbc") == 0) && (argc == 2)) && mtd_resetbc) { + cmd = CMD_RESETBC; + device = argv[1]; } else if (((strcmp(argv[0], "fixtrx") == 0) && (argc == 2)) && mtd_fixtrx) { cmd = CMD_FIXTRX; device = argv[1]; @@ -892,6 +900,10 @@ int main (int argc, char **argv) if (mtd_fixtrx) { mtd_fixtrx(device, offset); } + case CMD_RESETBC: + if (mtd_resetbc) { + mtd_resetbc(device); + } case CMD_FIXSEAMA: if (mtd_fixseama) mtd_fixseama(device, 0); |