nftl_format
Hi,
Attached is a patch to get nftl_format compiling with the latest version of mtd. I managed to get 2 of my DoC chips into a state where DFORMAT would not want to reprogram them. The trigger for this seemed to be loading the grub_firmware into them with doc_loadbios. Anyway with this patch I was able to build nftl_format and reformat both of the chips.
Regards,
Denis.
Index: mtd/include/linux/mtd/nftl.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/nftl.h,v retrieving revision 1.13
include/linux/mtd/nftl.h +3 -0
@@ -8,7 +8,10 @@#define __MTD_NFTL_H__#include <linux/mtd/mtd.h> + +#ifdef __KERNEL__#include <linux/mtd/blktrans.h> +#endif /* __KERNEL__ */ /* Block Control Information */
Index: mtd/util/Makefile
===================================================================
RCS file: /home/cvs/mtd/util/Makefile,v
retrieving revision 1.34
util/Makefile +2 -1
@@ -10,7 +10,8 @@ CFLAGS += -I../include -O2 -Wall -Wstric TARGETS = ftl_format erase eraseall nanddump doc_loadbios \ mkfs.jffs ftl_check mkfs.jffs2 lock unlock \ einfo mtd_debug fcp nandwrite jffs2dump \ - #jffs2reader nftldump nftl_format + nftl_format nftldump +# jffs2reader SYMLINKS = crc32.h crc32.c compr_rtime.c
Index: mtd/util/nftl_format.c
===================================================================
RCS file: /home/cvs/mtd/util/nftl_format.c,v
retrieving revision 1.19
util/nftl_format.c +3 -2
@@ -59,7 +59,8 @@#define le32_to_cpu (x) cpu_to_le32(x)#define le16_to_cpu (x) cpu_to_le16(x) -extern ssize_t pread (),pwrite (); +ssize_t pread (int fd,void *buf,size_t count,off_t offset); +ssize_t pwrite (int fd,const void *buf,size_t count,off_t offset);unsigned char BadUnitTable[MAX_ERASE_ZONES ];unsigned char *readbuf;
@@ -330,7 +331,7 @@ int main(int argc, char **argv)continue ; oob.start = (ezone * meminfo.erasesize) +512 ;if (ioctl (fd,MEMWRITEOOB , &oob)) -printf ("MEMWRITEOOB at %lx: %s\n" , (unsigned long )oob.start, sys_errlist[errno]); +printf ("MEMWRITEOOB at %lx: %s\n" , (unsigned long )oob.start,strerror (errno)); }exit (0 );
Index: mtd/util/nftldump.c
===================================================================
RCS file: /home/cvs/mtd/util/nftldump.c,v
retrieving revision 1.14
util/nftldump.c +5 -5
@@ -37,7 +37,7 @@#include <linux/mtd/mtd.h> #include <linux/mtd/nftl.h> -extern ssize_t pread (); +ssize_t pread (int fd,void *buf,size_t count,off_t offset);static struct NFTLMediaHeader MedHead[2 ];static mtd_info_t meminfo;
@@ -87,7 +87,7 @@ static unsigned short nextEUN(unsigned sreturn UCItable[curEUN][0 ].a.ReplUnitNum; } -static unsigned int find_media_headers () +static unsigned int find_media_headers (void ) {int i;static unsigned long ofs =0 ;
@@ -135,7 +135,7 @@ static unsigned int find_media_headers()return NumMedHeads; } -static void dump_erase_units () +static void dump_erase_units (void ) {int i, j;unsigned long ofs;
@@ -150,7 +150,7 @@ static void dump_erase_units() oob.start = ofs + (j *512 );if (ioctl (fd,MEMREADOOB , &oob))printf ("MEMREADOOB at %lx: %s\n" , - (unsigned long ) oob.start, sys_errlist[errno]); + (unsigned long ) oob.start,strerror (errno));memcpy (&UCItable[i][j], &oobbuf.u,8 ); }if (UCItable[i][1 ].b.EraseMark !=cpu_to_le16 (0x3c69 )) {
@@ -199,7 +199,7 @@ static void dump_erase_units() } } -static void dump_virtual_units () +static void dump_virtual_units (void ) {int i, j;char readbuf[512 ];