Re: [Yaffs] Structure of YAFFS2 spare 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] Structure of YAFFS2 spare OOB area
On Friday 04 February 2011 12:22:57 Ketil Froyn wrote:
> On Thu, Feb 3, 2011 at 10:42 PM, Charles Manning
>
> <> wrote:
> > On Thursday 03 February 2011 13:38:48 Eugene Soh wrote:
> >> I've performed a nanddump of a YAFFS2 filesystem and would like to know
> >> the exact byte / hex structure of the spare OOB area.
> >
> > Sorry there is no such thing.
> >
> > The actual layout is controlled by the NAND driver. YAFFS2 just says
> > "store these bytes" and the NAND driver then determines where to store
> > those bytes and the other bytes (ECC, bad block markers, and possibly
> > more).
> >
> > Find the NAND driver for the device you are using. That will help.
>
> How undefined is the layout without knowing the driver? Is it just the
> offset of the data in the OOB that will vary? Or are there drivers
> that change endianness or something like that?


Anything is possible.

Most common would probably be the default layouts defined in
drivers/mtd/nand/nand_base.c

The yaffs tags will be stored in the area defined in .oobfree

eg.
 static struct nand_ecclayout nand_oob_64 = {
    .eccbytes = 24,
    .eccpos = {
           40, 41, 42, 43, 44, 45, 46, 47,
           48, 49, 50, 51, 52, 53, 54, 55,
           56, 57, 58, 59, 60, 61, 62, 63},
    .oobfree = {
        {.offset = 2,
         .length = 38} }
};


Here

bytes 0,1 are the bad block marker (should be 0xff)
bytes 2..39 contain the yaffs tags a struct yaffs_packed_tags2
bytes 40..63 contain ECC bytes.

-- Charles


-- Charles