diff options
author | Ron Yorston <rmy@pobox.com> | 2013-03-19 11:18:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-03-19 11:18:39 +0000 |
commit | 63d2c5fead323df5f4250ed544d0bc03527c8936 (patch) | |
tree | 660979b139a4bc4b143c08843cb7efbc69bdcb4d /miscutils | |
parent | 27fc2d535588728ac3ca69337271471fb6fe3ee9 (diff) | |
parent | a42f530e034b673726a91ea5d8202254e677f066 (diff) | |
download | busybox-w32-63d2c5fead323df5f4250ed544d0bc03527c8936.tar.gz busybox-w32-63d2c5fead323df5f4250ed544d0bc03527c8936.tar.bz2 busybox-w32-63d2c5fead323df5f4250ed544d0bc03527c8936.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/flash_eraseall.c | 15 | ||||
-rw-r--r-- | miscutils/nandwrite.c | 8 |
2 files changed, 12 insertions, 11 deletions
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index 0598371d5..bf9b739a1 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c | |||
@@ -11,10 +11,11 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | //usage:#define flash_eraseall_trivial_usage | 13 | //usage:#define flash_eraseall_trivial_usage |
14 | //usage: "[-jq] MTD_DEVICE" | 14 | //usage: "[-jNq] MTD_DEVICE" |
15 | //usage:#define flash_eraseall_full_usage "\n\n" | 15 | //usage:#define flash_eraseall_full_usage "\n\n" |
16 | //usage: "Erase an MTD device\n" | 16 | //usage: "Erase an MTD device\n" |
17 | //usage: "\n -j Format the device for jffs2" | 17 | //usage: "\n -j Format the device for jffs2" |
18 | //usage: "\n -N Don't skip bad blocks" | ||
18 | //usage: "\n -q Don't display progress messages" | 19 | //usage: "\n -q Don't display progress messages" |
19 | 20 | ||
20 | #include "libbb.h" | 21 | #include "libbb.h" |
@@ -22,9 +23,9 @@ | |||
22 | #include <linux/jffs2.h> | 23 | #include <linux/jffs2.h> |
23 | 24 | ||
24 | #define OPTION_J (1 << 0) | 25 | #define OPTION_J (1 << 0) |
25 | #define OPTION_Q (1 << 1) | 26 | #define OPTION_N (1 << 1) |
26 | #define IS_NAND (1 << 2) | 27 | #define OPTION_Q (1 << 2) |
27 | #define BBTEST (1 << 3) | 28 | #define IS_NAND (1 << 3) |
28 | 29 | ||
29 | /* mtd/jffs2-user.h used to have this atrocity: | 30 | /* mtd/jffs2-user.h used to have this atrocity: |
30 | extern int target_endian; | 31 | extern int target_endian; |
@@ -71,7 +72,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv) | |||
71 | char *mtd_name; | 72 | char *mtd_name; |
72 | 73 | ||
73 | opt_complementary = "=1"; | 74 | opt_complementary = "=1"; |
74 | flags = BBTEST | getopt32(argv, "jq"); | 75 | flags = getopt32(argv, "jNq"); |
75 | 76 | ||
76 | mtd_name = argv[optind]; | 77 | mtd_name = argv[optind]; |
77 | fd = xopen(mtd_name, O_RDWR); | 78 | fd = xopen(mtd_name, O_RDWR); |
@@ -139,7 +140,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv) | |||
139 | 140 | ||
140 | for (erase.start = 0; erase.start < meminfo.size; | 141 | for (erase.start = 0; erase.start < meminfo.size; |
141 | erase.start += meminfo.erasesize) { | 142 | erase.start += meminfo.erasesize) { |
142 | if (flags & BBTEST) { | 143 | if (!(flags & OPTION_N)) { |
143 | int ret; | 144 | int ret; |
144 | loff_t offset = erase.start; | 145 | loff_t offset = erase.start; |
145 | 146 | ||
@@ -154,7 +155,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv) | |||
154 | * types e.g. NOR | 155 | * types e.g. NOR |
155 | */ | 156 | */ |
156 | if (errno == EOPNOTSUPP) { | 157 | if (errno == EOPNOTSUPP) { |
157 | flags &= ~BBTEST; | 158 | flags |= OPTION_N; |
158 | if (flags & IS_NAND) | 159 | if (flags & IS_NAND) |
159 | bb_error_msg_and_die("bad block check not available"); | 160 | bb_error_msg_and_die("bad block check not available"); |
160 | } else { | 161 | } else { |
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index 5908ac773..e3f9b565d 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c | |||
@@ -23,7 +23,7 @@ | |||
23 | //config: Dump the content of raw NAND chip | 23 | //config: Dump the content of raw NAND chip |
24 | 24 | ||
25 | //applet:IF_NANDWRITE(APPLET(nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP)) | 25 | //applet:IF_NANDWRITE(APPLET(nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP)) |
26 | //applet:IF_NANDWRITE(APPLET_ODDNAME(nanddump, nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP, nanddump)) | 26 | //applet:IF_NANDDUMP(APPLET_ODDNAME(nanddump, nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP, nanddump)) |
27 | 27 | ||
28 | //kbuild:lib-$(CONFIG_NANDWRITE) += nandwrite.o | 28 | //kbuild:lib-$(CONFIG_NANDWRITE) += nandwrite.o |
29 | //kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o | 29 | //kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o |
@@ -31,14 +31,14 @@ | |||
31 | //usage:#define nandwrite_trivial_usage | 31 | //usage:#define nandwrite_trivial_usage |
32 | //usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]" | 32 | //usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]" |
33 | //usage:#define nandwrite_full_usage "\n\n" | 33 | //usage:#define nandwrite_full_usage "\n\n" |
34 | //usage: "Write to the specified MTD device\n" | 34 | //usage: "Write to MTD_DEVICE\n" |
35 | //usage: "\n -p Pad to page size" | 35 | //usage: "\n -p Pad to page size" |
36 | //usage: "\n -s ADDR Start address" | 36 | //usage: "\n -s ADDR Start address" |
37 | 37 | ||
38 | //usage:#define nanddump_trivial_usage | 38 | //usage:#define nanddump_trivial_usage |
39 | //usage: "[-o] [-b] [-s ADDR] [-f FILE] MTD_DEVICE" | 39 | //usage: "[-o] [-b] [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" |
40 | //usage:#define nanddump_full_usage "\n\n" | 40 | //usage:#define nanddump_full_usage "\n\n" |
41 | //usage: "Dump the specified MTD device\n" | 41 | //usage: "Dump MTD_DEVICE\n" |
42 | //usage: "\n -o Dump oob data" | 42 | //usage: "\n -o Dump oob data" |
43 | //usage: "\n -b Omit bad block from the dump" | 43 | //usage: "\n -b Omit bad block from the dump" |
44 | //usage: "\n -s ADDR Start address" | 44 | //usage: "\n -s ADDR Start address" |