mtd/util nandwrite.c,1.17,1.18

Artem Bityuckiy dedekind at infradead.org
Thu Dec 2 13:39:43 EST 2004


Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv26402

Modified Files:
	nandwrite.c 
Log Message:
Add additional information when the image doesnt fit the flash
Bugfix: Increase arrays sizes to 2048 and 64 byte to properly with Big-page flashes.


Index: nandwrite.c
===================================================================
RCS file: /home/cvs/mtd/util/nandwrite.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- nandwrite.c	24 Oct 2004 14:57:20 -0000	1.17
+++ nandwrite.c	2 Dec 2004 18:39:41 -0000	1.18
@@ -40,11 +40,14 @@
 #define PROGRAM "nandwrite"
 #define VERSION "1.14"
 
+#define MAX_PAGE_SIZE	2048
+#define MAX_OOB_SIZE	64
+
 /*
  * Buffer array used for writing data
  */
-unsigned char writebuf[512];
-unsigned char oobbuf[16];
+unsigned char writebuf[MAX_PAGE_SIZE];
+unsigned char oobbuf[MAX_OOB_SIZE];
 
 // oob layouts to pass into the kernel as default
 struct nand_oobinfo none_oobinfo = { 
@@ -306,6 +309,8 @@
 	
 	// Check, if length fits into device
 	if ( ((imglen / pagelen) * meminfo.oobblock) > (meminfo.size - mtdoffset)) {
+		fprintf (stderr, "Image %d bytes, NAND page %d bytes, OOB area %u bytes, device size %u bytes\n",
+				imglen, pagelen, meminfo.oobblock, meminfo.size);
 		perror ("Input file does not fit into device");
 		goto closeall;
 	}





More information about the linux-mtd-cvs mailing list