This is almost certainly caused by problems with the way you're using the mtd
layer.
The most typical problem is the spare area storage conflicting with the bad
block markers and ECC bytes.
What I suggest you do is add some tracing in the mtd layer to find if this is
happening, then fix the problem.
-- CHarles
On Thursday 16 July 2009 16:38:36 Rupesh Kumar wrote:
> Hi
> Thanks for the reply.
> After bit more trying, I am able to use yaffs2 partition as RFS(Not with
> the image created by mkyaffs2image,mkyaffs2image is still a concern ).
> I am able to use it, but it gives hell lot of warning messgaes and marks
> block as bad whenever i try to write anything.
>
> I followed following steps:
>
> 1) Booted with RAMDISK image
> 2) erased One partition of flash
> # flash_eraseall /dev/mtd12
> 3) mounted this partition as yaffs2
> # mount -t yaffs2 /dev/mtdblock12 /tmp
> 4) Manually copied RFS contents to the flash partition
> # cp -drf bin /tmp
> # cp -drf bin /tmp
> # cp -drf dev /tmp
> # cp -drf etc /tmp
> # cp -drf home /tmp
> # cp -drf lib /tmp
> # cp -drf linuxrc /tmp
> # cp -drf lost\+found/ /tmp
> # cp -drf mnt /tmp
> # cp -drf opt /tmp
> # cp -drf root /tmp
> # cp -drf sbin /tmp
> # cp -drf sys /tmp
> # cp -drf usr /tmp
> # cp -drf var /tmp
> 5) Rebooted system with yaffs2 RFS.(Bootargs set as:- root=/dev/mtdblock12
> rootfstype=yaffs2 rw console=ttyS0,115200)
>
> System boots up with yaffs2 image. but it complains for bad blocks and
> when i write/create some files in RFS it says "**>> yaffs chunk 11078 was
> not erased".
>
> Complete bootup message is in attached text file.
>
> I have copied RFS contents in "mtdblock12" which starts at offset
> 0x084c0000 in nand. And these are the bad blocks marked(please look ino
> the attached boot log)
> I am not able to understand why writing to yaffs2 partition marks nand
> blocks as bad. :(
>
>
>
>
> Regards
> Rupesh
>
>
>
>
> Kieran Cox <kieran@touchrev.com>
> 07/15/2009 11:32 PM
>
> To
> Rupesh Kumar <Rupesh.Kumar@lntemsys.com>
> cc
> yaffs@lists.aleph1.co.uk, Virupax SS <Virupax.SS@lntemsys.com>
> Subject
> Re: [Yaffs] yaffs2 support for linux 2.6.23
>
>
>
>
>
>
> Hello Rupesh,
>
> I've had this same issue for a quite a while now. In the short term the
> work around is annoying, but is the following.
>
> 1. You will need to boot into another rootfs via another mtd, sd card or
> whatever.
> 2. From there you will flash_erase the partition you wish to have the
> yaffs2 rootfs on.
> 3. Then mount your freshly erased mtd partition.
> 4. Now (if you're not annoyed enough already), untar your rootfs to the
> yaffs2 partition.
> 5. Unmount, reboot, etc.
>
> You're kernel should now successfully boot the yaffs2 rootfs.
>
>
> mkyaffs2image and writing resulting image has never worked for me. I
> suspect this is a bug in either how the image is made or in how the driver
> mounts the partition. I'm sure someone on the list can correct me here,
> and PLEASE do. I'd much rather go the mkyaffs2image route than the above.
>
> Or it's a result of the particulars of your MTD device/ system. For
> example I'm using a Marvell system, which insists on using bad block
> relocation rather than just skipping the bad blocks as the typical linux
> driver does. This is all kinds of headache for writing to NAND. Especially
> if you happen to selfupdate your kernel and there are badblocks within. I
> had to modify mtdwrite to not skip blocks at all. (long story there)
>
> I'm pretty sure yaffs2 has it's own way of handling bad blocks, and part
> of doing so is initialized when you mount a freshly erased partition as a
> yaffs2 FS. In mounting a partition that wasn't initialized by being blank
> first then mounted, yaffs2 just assumes it never was and creates and emtpy
> space that is initialized. I think this is the reason for only having the
> "lost-found" directory after writing the image.
>
> All: please add info and correct here.
>
>
> Good luck.
>
>
>
> Regards,
> Kieran Cox
>
> On Wed, Jul 15, 2009 at 7:46 AM, Rupesh Kumar <Rupesh.Kumar@lntemsys.com>
> wrote:
> Hi
> I am using custom board based on MPC8313 processor. I have 2.6.23 kernel
> running on it . I tried for YAFFS2 support on this kernel.
> For this i downloaded "yaffs2.tar.gz" for this kernel and compiled kernel
> with yaffs2 support.
> I used "mkyaffs2image" utility to generate rootfs image and then i wrote
> this rootfs image to one of nand partition.
> When i tried to boot using yaffs2 rfs it failed saying unable to open init
> console. Exact message is shown below.
>
> rtc-ds1307 0-0068: setting the system clock to 2009-07-09 19:06:16
> (1247166376)
> yaffs: dev is 32505867 name is "mtdblock11"
> yaffs: passed flags ""
> yaffs: Attempting MTD mount on 31.11, "mtdblock11"
> yaffs: restored from checkpoint
> VFS: Mounted root (yaffs2 filesystem).
> Freeing unused kernel memory: 152k init
> Warning: unable to open an initial console.
> Kernel panic - not syncing: No init found. Try passing init= option to
> kernel.
> Rebooting in 180 seconds..
>
> Then, i rebooted system with ramdisk image and peeked in to the flash
> partition, it had only "Lost+Found" folder :(
>
> ~ # mount -t yaffs2 /dev/mtdblock11 /tmp/
> yaffs: dev is 32505867 name is "mtdblock11"
> yaffs: passed flags ""
> yaffs: Attempting MTD mount on 31.11, "mtdblock11"
> yaffs: restored from checkpoint
> ~ # cd /tmp/
> /tmp # ls
> lost+found
> /tmp #
>
> Then, i manually copied rfs folders in flash drive. it complained fornot
> erased chunls and wrote.
>
> **>> yaffs chunk 20983 was not erased
> **>> yaffs chunk 20984 was not erased
> **>> yaffs chunk 20985 was not erased
> **>> yaffs chunk 20986 was not erased
> **>> yaffs chunk 20987 was not erased
> **>> yaffs chunk 20988 was not erased
> **>> yaffs chunk 20989 was not erased
> **>> yaffs chunk 20990 was not erased
> **>> yaffs chunk 20991 was not erased
> **>> yaffs write required 260 attempts
> ~ # ls /tmp/
> bin etc mnt proc sbin usr
> dev lost+found opt root sys var
> ~ #
>
> Now, Just to verify everything in rfs, i just unmounted and again mounted
> that flash drive.
>
> ~ # umount /tmp
> save exit: isCheckpointed 1
> ~ # mount -t yaffs2 /dev/mtdblock11 /tmp/
> yaffs: dev is 32505868 name is "mtdblock11"
> yaffs: passed flags ""
> yaffs: Attempting MTD mount on 31.11, "mtdblock11"
> yaffs: restored from checkpoint
> ~ # ls /tmp/
> lost+found
> ~ #
>
> Could somebody out there please explain what is going worng ?
>
>
> Thanks
> Rupesh
>
>
> _______________________________________________
> yaffs mailing list
> yaffs@lists.aleph1.co.uk
> http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs