> 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.
>
Ok. Nice to know the reason. Does this mean that a bad block requires that
all the Tnodes are recalculated? I hope that this doesnt mean that Tnodes
already written are invalidated (hardlinks for example).
> > 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
>
Ok. I fixed it in the bootldr by forcing the values to 0xff (no typos, I
checked).
Just to be sure I added the line and re-ran the tests. Same outcome.
> > 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.
>
Ok.
> > ... 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.
But this was after the setting to 0xff.
> >
> > 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.
Sorry, no typos - unless I force the wrong indexes I suppose. I do
yaffs_data[512+4]=0xff; yaffs_data[512+5]=0xff.
I stupidly used the term "zero" when I meant "erased" to 0xff.
It is curious that *all* the files are listed and unfindable. Feels like a
deeper problem somewhere.
> * Remember to skip over bad blocks (and don't go write anything to them).
>
I really *should* do that I know.. Just too impatient to do it at the first
cut.
> 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.
>
Marginal utility for me actually. I would clear the NAND and write an image
from the bootloader. Once the kernel is up, USB networking and cp does the
rest unless I need to clean a mucky NAND partition.
> Would that be of use?
> Do you feel like doing it?
>
Sounds straightforward enough. If I find a "spare moment" I'll do it, its
just a copy of the bootloader code.
> >
> > 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.
>
You are, of course, entirely correct. The "badness" was reported in the
page-fetch routine, hence my imprecision.
Nick
>
> -- 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.