[U-Boot] u-boot support for writing yaffs2 images to NAND

Oliver Mayer-Buschmann omb at opensynergy.com
Wed Sep 24 17:01:54 CEST 2008


Hello all,

I'm searching for a patch that allows me to write yaffs2 images
(generated with mkyaffs2image from Aleph One Ltd.) to NAND flash with
u-boot.

After spending some time with the U-Boot sources I've found out, that
there seems not to exist a command for doing this.

An older patch from Frank Mandarino (2006-09-07)
http://lists.denx.de/pipermail/u-boot/2006-September/016867.html
seems not to be applicable anymore.

My background:
I'm working on an at91sam9263ek target platform (256M of 2k+64 NAND
flash)
and I'm aware of both u-boot branches:
u-boot/u-boot-at91.git (I'm working on that, headrevision) and
u-boot/u-boot-nand-flash.git
which have just incorporated yaffs2 filesystem support.

Thanks to all guys that are working on that!
It helped me to find a bug in my port of yaffs2 to our L4 micro kernel
system :)

I'm now able to use the u-boot yaffs commands to e.g. write files to
yaffs2 in NAND and use them inside L4, but this is a little bit too
pedestrian. In addition I do not want to change the u-boot yaffs
config ..

I've played a little bit with the two following supported commands:
"nand write" and "nand write.oob" and found out that they do not what I
need.
And here is some feedback:

yaffs2 uses 28 Bytes of OOB data, starting at offset 0x2
First thing I found out, that using an offset in "nand write.oob" seems
not to work:

U-Boot> nand dump.oob 0
Page 00000000 dump:
OOB:
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff

my oob data is in RAM at 0x20000800
U-Boot> md 20000800  
20000800: 00001000 00000001 00000000 0000ffff    ................
20000810: bfaaf530 00000005 00000005 00000003    0...............
20000820: bfaaf5b0 bfaaed78 bfaaf588 0804924a    ....x.......J...
20000830: 0000ffff 0804a0e5 000000ff b7f44948    ............HI..
20000840: 00000001 00000001 6674ffff 742e7074    ..........tftp.t
20000850: 00007478 00000000 00000000 00000000    xt..............
20000860: 00000000 00000000 00000000 00000000    ................
20000870: 00000000 00000000 00000000 00000000    ................
20000880: 00000000 00000000 00000000 00000000    ................
20000890: 00000000 00000000 00000000 00000000    ................
200008a0: 00000000 00000000 00000000 00000000    ................
200008b0: 00000000 00000000 00000000 00000000    ................
200008c0: 00000000 00000000 00000000 00000000    ................
200008d0: 00000000 00000000 00000000 00000000    ................
200008e0: 00000000 00000000 00000000 00000000    ................
200008f0: 00000000 00000000 00000000 00000000    ................

U-Boot> nand write.oob 20000800 2 1C

NAND write: device 0 offset 0x2, size 0x1c
 28 bytes written: OK

U-Boot> nand dump.oob 0             
Page 00000000 dump:
OOB:
        00 10 00 00 01 00 00 00
        00 00 00 00 ff ff 00 00
        30 f5 aa bf 05 00 00 00
        05 00 00 00 ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff

oops, no offset!

Next thing is that "nand write" only writes data, no oob information.
Ok, it writes 6 bytes ecc to oob::28h but this is not applicable to
yaffs2

mkyaffs2image creates an image, that just concatenates datapage0+oob0
+datapage1+oob1+ ... + datapagen+oobn
where a page is 2k and oob is just the 28Bytes already mentioned
(==yaffs_PackedTags2 structure, that includes the yaffs2 ecc data)
So as result "nand write" writes oob to data sections which creates a
mess.

I'm not yet aware of using the mtd interface to implement an u-boot
command that is able to bring such an image to NAND, maybe it's an easy
task..

So I hope, that somebody has already implemented that ..?

If not I hope, that my information might be a good starting point for
understanding yaffs2 NAND footprints, which is not such an easy task ;-)

Greetings,

Oliver



More information about the U-Boot mailing list