diff options
-rw-r--r-- | miscutils/nandwrite.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index 247fc72f4..c95cbb21e 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c | |||
@@ -29,16 +29,18 @@ | |||
29 | //kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o | 29 | //kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o |
30 | 30 | ||
31 | //usage:#define nandwrite_trivial_usage | 31 | //usage:#define nandwrite_trivial_usage |
32 | //usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]" | 32 | //usage: "[-np] [-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 MTD_DEVICE\n" | 34 | //usage: "Write to MTD_DEVICE\n" |
35 | //usage: "\n -n Write without ecc" | ||
35 | //usage: "\n -p Pad to page size" | 36 | //usage: "\n -p Pad to page size" |
36 | //usage: "\n -s ADDR Start address" | 37 | //usage: "\n -s ADDR Start address" |
37 | 38 | ||
38 | //usage:#define nanddump_trivial_usage | 39 | //usage:#define nanddump_trivial_usage |
39 | //usage: "[-o]" IF_LONG_OPTS(" [--bb=padbad|skipbad]") " [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" | 40 | //usage: "[-no]" IF_LONG_OPTS(" [--bb=padbad|skipbad]") " [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" |
40 | //usage:#define nanddump_full_usage "\n\n" | 41 | //usage:#define nanddump_full_usage "\n\n" |
41 | //usage: "Dump MTD_DEVICE\n" | 42 | //usage: "Dump MTD_DEVICE\n" |
43 | //usage: "\n -n Read without ecc" | ||
42 | //usage: "\n -o Dump oob data" | 44 | //usage: "\n -o Dump oob data" |
43 | //usage: "\n -s ADDR Start address" | 45 | //usage: "\n -s ADDR Start address" |
44 | //usage: "\n -l LEN Length" | 46 | //usage: "\n -l LEN Length" |
@@ -57,10 +59,11 @@ | |||
57 | 59 | ||
58 | #define OPT_p (1 << 0) /* nandwrite only */ | 60 | #define OPT_p (1 << 0) /* nandwrite only */ |
59 | #define OPT_o (1 << 0) /* nanddump only */ | 61 | #define OPT_o (1 << 0) /* nanddump only */ |
60 | #define OPT_s (1 << 1) | 62 | #define OPT_n (1 << 1) |
61 | #define OPT_f (1 << 2) | 63 | #define OPT_s (1 << 2) |
62 | #define OPT_l (1 << 3) | 64 | #define OPT_f (1 << 3) |
63 | #define OPT_bb (1 << 4) /* must be the last one in the list */ | 65 | #define OPT_l (1 << 4) |
66 | #define OPT_bb (1 << 5) /* must be the last one in the list */ | ||
64 | 67 | ||
65 | #define BB_PADBAD (1 << 0) | 68 | #define BB_PADBAD (1 << 0) |
66 | #define BB_SKIPBAD (1 << 1) | 69 | #define BB_SKIPBAD (1 << 1) |
@@ -125,10 +128,10 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv) | |||
125 | applet_long_options = | 128 | applet_long_options = |
126 | "bb\0" Required_argument "\xff"; /* no short equivalent */ | 129 | "bb\0" Required_argument "\xff"; /* no short equivalent */ |
127 | #endif | 130 | #endif |
128 | opts = getopt32(argv, "os:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb); | 131 | opts = getopt32(argv, "ons:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb); |
129 | } else { /* nandwrite */ | 132 | } else { /* nandwrite */ |
130 | opt_complementary = "-1:?2"; | 133 | opt_complementary = "-1:?2"; |
131 | opts = getopt32(argv, "ps:", &opt_s); | 134 | opts = getopt32(argv, "pns:", &opt_s); |
132 | } | 135 | } |
133 | argv += optind; | 136 | argv += optind; |
134 | 137 | ||
@@ -144,6 +147,9 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv) | |||
144 | fd = xopen(argv[0], IS_NANDWRITE ? O_RDWR : O_RDONLY); | 147 | fd = xopen(argv[0], IS_NANDWRITE ? O_RDWR : O_RDONLY); |
145 | xioctl(fd, MEMGETINFO, &meminfo); | 148 | xioctl(fd, MEMGETINFO, &meminfo); |
146 | 149 | ||
150 | if (opts & OPT_n) | ||
151 | xioctl(fd, MTDFILEMODE, (void *)MTD_FILE_MODE_RAW); | ||
152 | |||
147 | mtdoffset = xstrtou(opt_s, 0); | 153 | mtdoffset = xstrtou(opt_s, 0); |
148 | if (IS_NANDDUMP && (opts & OPT_l)) { | 154 | if (IS_NANDDUMP && (opts & OPT_l)) { |
149 | unsigned length = xstrtou(opt_l, 0); | 155 | unsigned length = xstrtou(opt_l, 0); |