Nick Thanx for raising this points. On Tue, 03 Sep 2002 02:08, Nick Bane wrote: > Charles > > I have added yaffs image writing to bootldr in a rudimentary fashion. > > After noticing three little gotchas: > 1) yaffs_Scan seems to start from the second block not the first (page 32 > not 0). Correct. yaffs does not use block 0. The reason for this is that the Tnode values (used to find the chunks in the file) are only 16 bits and 0 is used to indicate an empty Tnode. Thus, there is no way to access a chunkId of value 0 (ie the first page). Allowing partial use of block zero would complicate the allocation logic. Hence the weasel way out: yaffs does not use block 0. > 2) mkyaffsimage does not initialise either blockStatus or pageStatus. These should both be set to 0xff. I was not initialising the Spare. I have fixed it but not yet checked it in. You might try this: (plz excuse non-patch format) memset(&t,0xff,sizeof (yaffs_Tags)); // <-- after this line memset(&s,0xff,sizeof (yaffs_Spare)); //<-- add this line > 3) pageStatus is declared as unused in yaffs_guts.h but yaffs_Scan discards > it if less than 6 bits are set. Comment bug. Thanx I have fixed this but not yet checked it in. > ... it seemed superficially to work in that mount produced more than > lost+found with the expected names. Yes, that would result from random spare values. > > However, mounting it does fails in an interesting way rather reminiscent of > the copying symlinks bug. > An ls of the mounted directory lists the expected names. > An ls -al lists the same names but as "no such file or directory" other > than lost+found. > > I am using the current cvs version of yaffs but with the previous > yaffs_fs.c compiled into the kernel. > > Clearing the nand, booting the same kernel, mounting the yaffs directory > and copying the sames files (via NFS/usbf) to it and all seems well. > > To write the fs image from bootldr, I just write sequential 512+16 bute > chunks into nand starting at page 32 and zero the 4th and 5th bytes in the > spare as I go. Is there anything else I should be doing? Almost, but not quite.... *These bytes (block status and page status) should be 0xff. I hunch that is what you did and you typo'ed otherwise you'd see no files. * Remember to skip over bad blocks (and don't go write anything to them). I am thinking of adding an option to the mkyaffs utility which formats for yaffs. The option would be the image file you want to load. ie # mkyaffs mtddev <-- just formats # mkyaffs mtddev my.image <-- formats and loads image. Would that be of use? Do you feel like doing it? > > I have added bad page reporting and none is found now I have intialised the > blockStatus bytes. I assume by "bad page" you mean "bad block". Sorry to be pedantic, but one's head spins if these terms get confused. -- CHarles --------------------------------------------------------------------------------------- This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org). If mailing list membership is no longer wanted you can remove yourself from the list by sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" (without the quotes) as the subject.