summaryrefslogtreecommitdiff
path: root/misc-utils/flash_erase.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd-utils: flash_erase: Add flash erase chipLarisa Ileana Grigore2021-05-051-24/+71
| | | | | | | | | Some flash types support full erase chip command which can reduce the flash erase time. Try first to erase the entire flash and fall back to the old method if the operation fails. Signed-off-by: Larisa Ileana Grigore <larisa.grigore@nxp.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
* mtd-utils: Instead of doing preprocessor magic, just output off_t as long longThorsten Glaser2018-10-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Fix warnings abot PRIdoff_t in libmtd.c, in mtd_read (and mtd_write): In file included from ../git/lib/libmtd.c:40:0: ../git/lib/libmtd.c: In function 'mtd_read': ../git/include/common.h:110:18: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'off_t {aka long long int}' [-Wformat=] ../git/include/common.h:120:2: note: in expansion of macro 'errmsg' errmsg(fmt, ##__VA_ARGS__); \ ^~~~~~ ../git/lib/libmtd.c:1082:10: note: in expansion of macro 'sys_errmsg' return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, ^~~~~~~~~~ /usr/lib/klibc/include/inttypes.h:28:17: note: format string is defined here #define PRId32 "d" Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
* misc-utils: flash_erase: Fix Jffs2 type flash erase problemXiaolei Li2018-04-101-4/+5
| | | | | | | | | | | | Currently, Jffs2 clean marker is not written actually, because the oob write length is set to 0 when do mtd_write(). So, get OOB available size at first, and set the correct clean marker length, then program clean marker to free OOB area. Fixes: d7e86124d55b ("mtd-utils: Support jffs2 flash-erase for large OOB (>32b)") Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
* Mark or fix switch cases that fall throughDavid Oberhollenzer2017-11-021-0/+2
| | | | | | | | | | | | | | | | | | | Now that C++17 introduced a special fallthrough keyword for explicitly tagging switch cases that are supposed to fall through, newer gcc versions also implement a feature request from 2002 to warn about maybe unwanted fall-throughs in switch cases in other languages (like C). For C code, we can either add a gcc specific attribute at the end of the switch case, or use a special comment that gcc checks for, indicating that the fall-through behaviour is indeed intended. This patch adds a "/* fall-through */" comment at the end of various case blocks to silence gcc warnings and in some cases a break, where fall-through was probably not intended. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
* mtd-utils: Support jffs2 flash-erase for large OOB (>32b)Manikandan Ramachandran2017-02-211-34/+4
| | | | | | | | | | | | "flash_erase" fails on nand flash with JFFS2 that has OOB size greater than 32 bytes. "flash_erase" uses "MEMGETOOSEL" to determine OOB size. This ioctl call is obsolete and returns error if OOB size is more than 32 bytes. This patch fixes this issue by using "mtd_write" to update clean-marker instead of mtd_oob_write. This fix is based on the discussion: http://lists.infradead.org/pipermail/linux-mtd/2011-September/037958.html. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
* Unify version string printingDavid Oberhollenzer2016-11-171-16/+11
| | | | | | | | | | | | | | | | When a program does sophisticated enough command line processing (i.e. getopt), make sure it responds to -V and --version. When a program prints a version string, make sure it uses the common_print_version macro to print out its name, that it is part of mtd-utils and the mtd-utils version from the build system in a fashion similar to common program packages like the GNU coreutils. When a program responds to -V/--version or -h/--help, make sure it reports success exit status. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
* mtd-utils: Restructure the mtd-utils source.Dongsheng Yang2015-11-111-0/+295
* There is no code modification in this commit, only moving * the files to proper place. The user tools looks a little messy as we place almost the all tools in the root directory of mtd-utils. To make it more clear, I propose to introduce the following structure for our source code. mtd-utils/ |-- lib |-- include |-- misc-utils |-- jffsX-utils |-- nand-utils |-- nor-utils |-- ubi-utils |-- ubifs-utils `-- tests Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>