Re: [Yaffs] definitions of data in oob area ?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] definitions of data in oob area ?
Cal

Read http://users.actrix.co.nz/manningc/yaffs/HowYaffsWorks.pdf

This will give you a good kick-off.

On Thursday 06 November 2008 09:11:57 Cal Page wrote:
> OK, the oob area contains
>
>     chunkId
>     serialNumber
>     byteCount
>     objectId
>     ecc data

>
> for the data in the chunk.
>
> Is chunkId the id of the chunk, ie the chunk index from 0? Does it
> include bad blocks? For example, if the first 10 chunks on my system are
> bad, is the first usable chunkId 10 or 1?


No.

chunkId is the offset of this chunk in the **file**

The file's header chunk is chunkId 0
The first chunk of data in a file is 1
The next chunk of data in a file is 2...

>
> The mkyaffsimage sets serialNumber to 0. It it used for yaffs2? What is
> the serialNumber used for?


The serial number is a 2 bit counter that is used to disambiguate between
twochunks that have matching tags. This is only relevant to yaffs1 mode of
operation.

This is needed because when we overwrite an old chunk in a file with a
replacing chunk we do the following:
* write new chunk with incremented serial number
* delete old chunk.

If power is lost before the delete happens then we end up with 2 chunks
matching the same tags and can tell by looking at the serial number which one
is current

Old Current
00 01
01 10
10 11
11 00


>
> byteCount is the # of bytes in the data part of the chunk.

Yes. The last chunk in a file might not be full.
>
> objectId is incremented from 1 upwards.


From 256 upwards.
Lower numbers are kept for "specials":
1 == rootDir
2 == lost+found
etc

>
> Also, mkyaffsimage writes 512 byte chunks, but my system uses 2048 byte
> chunks. Is this a known bug? Is there a work around?

No. mkyaffsimage is for yaffs1 images with 512 bytes per chunk.

There is also a mkyaffs2image program, but that needs tweakery to march the
way you have done the binary layout in the driver. This is a bit ugly...

The alternative is to write the data to a virgin nand and then extract an
image.

Hope that helps