[Yaffs] Re: Why does YAFFS skip the first block?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Wookey
Date:  
To: Yaffs
Subject: [Yaffs] Re: Why does YAFFS skip the first block?
+++ Peter Barada [05-06-22 02:27 -0400]:
> > The mkyaffsimage output is fine, so long as you write it into flash starting
> > at startBlock.
>
> Yeah, I figured that out, finally. You can imagine if you loaded the
> YAFFS image at block zero, and ignored the first 256K of data from the
> image, some *really* wierd stuff happens including root directory
> objects that never show up, and a lost+found that contains objects that
> have no contents(due to missing objects located in the first 256K).


> > > Only after its taken a long day of yanking your hair out to understand
> > > the problem. No offense, but yaffs_fs.c, yaffs_mdtif.c and
> > > mkyaffsimage.c don't match as they exist now, and the documentation
> > > doesn't mention that the image created by mkyaffsimage.c should be
> > > offset by a flash block so that it all works. Anyone who's marched down
> > > this path should be able to tell you that.
> >
> >
> > The mkyaffsimage output is completely location independent, but it is
> > expected to be used with mkyaffs (which loads starting at block one). If you
> > take the image and load it into flash at block 1 you'll be OK.
>
> I understand that mkyaffsimage produces a location independent image,
> but it *does* matter where it it is placed such that YAFFS actually
> accesses all of it.
>
> > In what way don't they match?
> >
> > AFAIK,
> > 1) yaffs_fs.c uses startBlock of 1
> > 2) mkyaffs loads from block 1
> > 3) yaffs_guts says block zero is not permitted.
>
> I have a separate bootloader that knows how to erase/burn flash. I'm
> trying to use YAFFS as a *root* filesystem, so it has to be burned from
> a boot-loader, and not from Linux, so mkyaffs doesn't help me here. I'd
> figure if mkyaffsimage is like mkfs.jffs2, it produces an image that can
> be burned *directly* into flash without the need for a support program
> (such as mkyaffs). And if YAFFS is my root FS, then I have a catch-22
> here if I require mkyaffs...
>
> Documentation/yaffs-rootfs-howto.html has:
>
> <H3>Creating a bootable yaffs partition:</H3>
> <P>You can</P>
> <P>1) Create the partition by mounting it from a running linux os and
> copying the data there. The mkyaffs utility in the yaffs source
> simply erases a NAND mtdblock device without removing bad block
> data.</P>
> <P>2) Make and download a filesystem image. The mkyaffsimage utility
> that came with the sources will create a YAFFS block list in a file
> from a root tree. This is a list of 512+16 byte blocks that need to
> be placed (in any order) on a NAND device.</P>
> <P>You will need to write code to copy these data blocks and add in
> the block numbers in the oob areas.</P>
>
> Nowhere does that mention that mkyaffs is *required* to load the image
> created by mkyaffsimage into the NAND device so that it 'shuffles' the
> image past the first block. It describes mkyaffs as 'simply erases a
> NAND mtdblock device'. That can be accomplished by most boot-loaders.


Point taken. Thanx for pointing out that this isn't clear. We are working on
better/newer docs now so this should get fixed fairly soon.

Wookey
-- 
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK  Tel +44 (0) 1223 811679
work: http://www.aleph1.co.uk/     play: http://www.chaos.org.uk/~wookey/