summaryrefslogtreecommitdiffstats
path: root/package/system/mtd/src/mtd.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: fix reading of image magic bytes in smaller chunksJohn Crispin2016-03-031-5/+12
| | | | | | | | | | | | | | | The image_check currently fails when it cannot read all magic bytes in a single chunk. But this can happen when the data are read from a pipe. This currently breaks the openmesh.sh upgrade script with musl because it uses dd with a blocksize of 1 to copy the image file to the mtd process. The read can simply be repeated until enough bytes are read for the magic byte check. It only stops when either an error was returned or 0 bytes were read. Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com> SVN-Revision: 48891
* mtd: fix Seama format after replacing EOF with sysupgrade dataRafał Miłecki2016-02-101-2/+13
| | | | | | | | | | Seama header has MD5 similarly to TRX and its CRC32. We need to update it after replacing anything in Seama entity content to make bootloader accept it. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48688
* mtd: detect image format when writingRafał Miłecki2016-02-061-3/+54
| | | | | | | | | | | | | | | Recently TRX checking code was changed to detect Seama format and don't abort whole writing operation because of it. This isn't a good long-term solution. It's a poor idea to teach every format handler recognizing all possible formats. Instead it should be handled in a generic code which should run check depending on the detected format. This will also allow further improvements like fixing formats other than TRX after replacing JFFS2. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48639
* mvebu: add support for the Linksys boot counterImre Kaloz2015-08-191-0/+12
| | | | | | | | | | | | | 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> SVN-Revision: 46690
* mtd: fix md5sum error checkingJohn Crispin2015-03-051-1/+1
| | | | | | | | | | | | | | In mtd_verify(), the return value of md5sum() has been interpreted as error if nonzero, while the function returns number of processed bytes, which caused mtd_verify() to always fail. This patch fixes error checking to interpret only negative values as errors. Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com> SVN-Revision: 44605
* mtd: make the dump commnd honour the -o optionJohn Crispin2014-12-031-6/+5
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43512
* mtd: make the mtd dump call run properly on nand flashJohn Crispin2014-12-021-5/+18
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43503
* mtd: add ability to dump a mtd deviceJohn Crispin2014-12-021-5/+57
| | | | | | | | | this can be used on nand flashes and will skip bad blocks and run ecc on the read data before dumping it. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43500
* mtd: fix 2 compiler warningsJohn Crispin2014-11-261-2/+1
| | | | | | | | | mtd.c:544:7: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘ssize_t’ [-Wformat] mtd.c:602:1: warning: label ‘done’ defined but not used [-Wunused-label] Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43383
* mtd: fix compile error with muslFelix Fietkau2014-05-211-0/+1
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40819
* mtd: improve mtd detectionJohn Crispin2014-03-301-1/+3
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 40301
* mtd: add support for bad blocks in NAND flashFelix Fietkau2014-03-261-5/+46
| | | | | | | | | | | | | NAND flash is very likely to contain bad blocks. Currently, mtd and therefore sysupgrade fails when it encounters a single bad block, potentially leaving an unbootable system. This patch allows the mtd utility to skip bad blocks in NAND flash and complete sysupgrade successfully. Patch by: Matthew Redfearn <matt.redfearn@nxp.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40021
* mtd: add a "mtd verify" callJohn Crispin2013-11-191-1/+69
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 38871
* ar71xx: Unifi AP Pro sysupgrade patchFelix Fietkau2013-11-141-3/+12
| | | | | | | | | | | | | | | | | | The current implementation of mtd will not append the backup file created by sysupgrade to the correct partition, as mtd will append the data to first jffs2 partition it finds. As the kernel is also stored on a jffs2 partition (which resides before the overlay partition), the data will be appended to this partition. To fix this problem, a new option -s <number> skip the first n bytes when appending data to the jffs2 partiton, defaults to "0" is added to mtd. Signed-off-by: Peter Wagner <tripolar@gmx.at> SVN-Revision: 38807
* kernel/base-files: clean up old code related to refreshing mtd partitions, ↵Felix Fietkau2013-07-141-38/+0
| | | | | | | | it is no longer used anywhere Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 37282
* packages: clean up the package folderJohn Crispin2013-06-211-0/+761
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37007