+++ David Wuertele [04-10-27 15:06 -0700]: > Charles> Have a look at the code for mkyaffs. This should give you a > Charles> good kick-off point for programming YAFFS. > > OK, after perusing mkyaffs.c, I am about to write a program for > extracting data from a yaffs partition. > > Instead of using > > dd if=/dev/mtd/2 of=/yaffs.img > > I will use > > myprog /dev/mtd/2 > /yaffs.img > > I think that "myprog" can be written by copying mkyaffs.c to > readyaffs.c, removing the erase code, and changing the part that > writes the data to this: > > if(addr) { > for(offset = 0; offset lseek(fd,addr+offset,SEEK_SET); > if(read(fd,imgpage,512) == 512) { > oob.start = addr+offset; > oob.length=16; > oob.ptr=&imgpage[512]; > ioctl(fd,MEMREADOOB,&oob); > write (1, imgpage, 528); > } > } > } > > Then, if I did this right, I should be able to run > > /sbin/mkyaffs /dev/mtd/2 /yaffs.img > > ...and everything will run normally. > > Does that look right? That looks about right - but you should be aware that a program to do this already exists, called nanddump.c in the mtd utils dir. (It also has the option to dump the output to Hex). If I were you I'd just use nanddump. Wookey -- Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679 work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/