Re: [Yaffs] How to flash a YAFFS2 image during manufacturing

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] How to flash a YAFFS2 image during manufacturing
On Saturday 28 April 2012 02:33:42 Peter Barada wrote:
> On 04/27/2012 04:15 AM, Sebastian Huber wrote:
> > Hi,
> >
> > lets suppose you have a master YAFFS2 image (without any bad blocks) and
> > want to copy this image to new devices that may have bad blocks in the
> > area dedicated to the YAFFS2 file system. Is it possible to copy this
> > image using a simple bad block skip algorithm? I suppose not. Do you
> > have to copy the image using the YAFFS2 file system itself or is there a
> > simpler solution?
>
> If the "master" image came by reading raw NAND of a yaffs filesystem
> that was properly unmounted this won't work as the checkpoint contained
> in it has chunk ID information (which is the page number from start of
> partitition). If you insert a bad block in the middle then all those
> are off.
>
> If your image does not contain a checkpoint then you can burn it and
> skip over bad blocks, as long as the rest of the partition not burned
> with yaffs data is erased.
>
> Can you use mkyaffs2image to create a YAFFS image that doesn't have
> checkpoint information in it (and then use u-boot "nand write.yaffs" to
> burn it?


As Peter has said, except for the checkpoint data, yaffs does not care which
physical blocks the blocks of data are written to, The tags are there to
sort out the problem.

It does not matter where the bad blocks are or in what order you write them.
You can even use a random number generator to write the blocks if that is
what you want!

The checkpoint data messes this us because that contains a direct dump of the
block information including bad block positions etc.

You can get around the checkpoint problem in one of three ways:

1) When you write the master yaffs2 image, exclude the checkpoint data. For
example, if you created the image on a Linux system by mounting, writing,
then unmounting then use the -no-checkpoint-write (or --no-checkpoint) flags
when mounting. That prevents yaffs2 from writing checkpoint data when
unmounting.

2) If you have used some sort of nand dump to extract the image, then run the
blocks through a filter that deletes the checkpoint blocks. See
yaffs2_checkpt_find_block() to see how to determine what blocks are
checkpoint blocks.

3) Ignore the checkpoint data on the first mount of the image on the new
device. Do this by setting the mount flag --no-checkpoint-read

-- Charles