--- mtd/util/nandwrite.c.orig 2004-07-01 17:09:12.124117544 -0500 +++ mtd/util/nandwrite.c 2004-07-01 17:16:44.497346360 -0500 @@ -42,8 +42,8 @@ /* * Buffer array used for writing data */ -unsigned char writebuf[512]; -unsigned char oobbuf[16]; +unsigned char *writebuf; +unsigned char *oobbuf; // oob layouts to pass into the kernel as default struct nand_oobinfo none_oobinfo = { @@ -223,6 +223,19 @@ close(fd); exit(1); } + + /* NOW! allocate writebuf and oobbuf.. */ + writebuf = malloc (meminfo.oobblock); + oobbuf = malloc (meminfo.oobsize); + if (!writebuf || !oobbuf) + perror ("cannot allocate buffers\n"); + if ((forcejffs2 || forceyaffs || autoplace) && (meminfo.oobsize > 16)) + { + fprintf (stderr, "\nDanger!Danger! Will Robinson, Overriding driver's AUTO_ECC layout for \nlarge-block chips will almost certainly trash OOB!\n Continue? (y/N)\n"); + if (getchar () != 'y') { + exit(1); + } + } // write without ecc ? if (noecc) {