linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nandwrite: add --nobad to write bad blocks
@ 2010-09-12  3:51 Mike Frysinger
  2010-09-12 16:27 ` Artem Bityutskiy
  2010-09-23 10:38 ` Artem Bityutskiy
  0 siblings, 2 replies; 22+ messages in thread
From: Mike Frysinger @ 2010-09-12  3:51 UTC (permalink / raw)
  To: linux-mtd

Sometimes dumping bad blocks is useful, like when the block isn't actually
bad but the OOB layout isn't what the kernel is expecting or is otherwise
screwed up.  The --nobad option allows just that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 nandwrite.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/nandwrite.c b/nandwrite.c
index 1b4ca3d..bbe38b9 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -79,6 +79,7 @@ static void display_help (void)
 "                          device\n"
 "  -m, --markbad           Mark blocks bad if write fails\n"
 "  -n, --noecc             Write without ecc\n"
+"  -N, --nobad             Write without bad block skipping\n"
 "  -o, --oob               Image contains oob data\n"
 "  -r, --raw               Image contains the raw oob data dumped by nanddump\n"
 "  -s addr, --start=addr   Set start address (default is 0)\n"
@@ -118,6 +119,7 @@ static bool		forcejffs2 = false;
 static bool		forceyaffs = false;
 static bool		forcelegacy = false;
 static bool		noecc = false;
+static bool		nobad = false;
 static bool		pad = false;
 static int		blockalign = 1; /*default to using 16K block size */
 
@@ -127,7 +129,7 @@ static void process_options (int argc, char * const argv[])
 
 	for (;;) {
 		int option_index = 0;
-		static const char *short_options = "ab:fjmnopqrs:y";
+		static const char *short_options = "ab:fjmnNopqrs:y";
 		static const struct option long_options[] = {
 			{"help", no_argument, 0, 0},
 			{"version", no_argument, 0, 0},
@@ -137,6 +139,7 @@ static void process_options (int argc, char * const argv[])
 			{"jffs2", no_argument, 0, 'j'},
 			{"markbad", no_argument, 0, 'm'},
 			{"noecc", no_argument, 0, 'n'},
+			{"nobad", no_argument, 0, 'N'},
 			{"oob", no_argument, 0, 'o'},
 			{"pad", no_argument, 0, 'p'},
 			{"quiet", no_argument, 0, 'q'},
@@ -181,6 +184,9 @@ static void process_options (int argc, char * const argv[])
 			case 'n':
 				noecc = true;
 				break;
+			case 'N':
+				nobad = true;
+				break;
 			case 'm':
 				markbad = true;
 				break;
@@ -487,6 +493,8 @@ int main(int argc, char * const argv[])
 						 blockstart / meminfo.erasesize, blockstart);
 
 			/* Check all the blocks in an erase block for bad blocks */
+			if (nobad)
+				continue;
 			do {
 				if ((ret = ioctl(fd, MEMGETBADBLOCK, &offs)) < 0) {
 					perror("ioctl(MEMGETBADBLOCK)");
-- 
1.7.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-09-30  3:51 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-12  3:51 [PATCH] nandwrite: add --nobad to write bad blocks Mike Frysinger
2010-09-12 16:27 ` Artem Bityutskiy
2010-09-12 19:05   ` Mike Frysinger
2010-09-13  6:23     ` Artem Bityutskiy
2010-09-14  1:21       ` Mike Frysinger
2010-09-14  5:26         ` Artem Bityutskiy
2010-09-22  4:23           ` Mike Frysinger
2010-09-22  7:12             ` Artem Bityutskiy
2010-09-22  7:34               ` Mike Frysinger
2010-09-29  3:35                 ` Iwo Mergler
2010-09-29  6:56                   ` Jon Povey
2010-09-29 13:25                     ` Mike Frysinger
2010-09-29 23:44                     ` Iwo Mergler
2010-09-30  3:23                       ` Jon Povey
2010-09-29 12:59                   ` Artem Bityutskiy
2010-09-29 13:28                     ` Mike Frysinger
2010-09-30  3:51                       ` Jon Povey
2010-09-23  1:48             ` Jon Povey
2010-09-23 10:38 ` Artem Bityutskiy
2010-09-23 20:04   ` [PATCH v2] " Mike Frysinger
2010-09-24  8:50     ` Artem Bityutskiy
2010-09-24 12:33       ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).