Re: [Yaffs] How to dump/flash a YAFFS2 image?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bounlith Sirivong
Date:  
To: john.mccash
CC: yaffs
Subject: Re: [Yaffs] How to dump/flash a YAFFS2 image?
On Wed, 29 Sep 2010 11:18:50 -0500
"McCash John-GKJN37" <> wrote:

> Bounlith,
>     You're on the right track. If you can get nanddump compiled with
> an appropriate toolchain, you should be able to dump the flash in such a
> way that you can load it back into an mtd device on your linux system. I
> wasn't able to get it to compile (I didn't really try), but found an
> internally compiled version, which unfortunately, I'm unable to share.
>         John


Hi,

OK, I have succeeded in building nanddump for Android. I have tried it on the device. nanddump returns me the error:

    Unknown flash (not normal NAND)


When looking at the source code of nanddump, I see that it checks the OOB size:

    /* Make sure device page sizes are valid */
    if (!(meminfo.oobsize == 128 && meminfo.writesize == 4096) &&
            !(meminfo.oobsize == 64 && meminfo.writesize == 2048) &&
            !(meminfo.oobsize == 32 && meminfo.writesize == 1024) &&
            !(meminfo.oobsize == 16 && meminfo.writesize == 512) &&
            !(meminfo.oobsize == 8 && meminfo.writesize == 256)) {
        fprintf(stderr, "Unknown flash (not normal NAND): meminfo.oobsize=%d\n",
                meminfo.oobsize);
        close(fd);
        exit(EXIT_FAILURE);
    }


What I get now is :
    Unknown flash (not normal NAND): meminfo.oobsize=56


which is an unsupported OOB size. Does it mean that the device uses a custom and non-standard NAND, or that I could omit this checking in the source code of nanddump? Not sure that nandwrite will accept the dump in that case.

Bounlith.

>
> -----Original Message-----
> From: Bounlith Sirivong [mailto:bounlith.sirivong@atelier.tm]
> Sent: Wednesday, September 29, 2010 11:16 AM
> To: McCash John-GKJN37
> Cc:
> Subject: Re: [Yaffs] How to dump/flash a YAFFS2 image?
>
> On Tue, 28 Sep 2010 07:40:22 -0500
> "McCash John-GKJN37" <> wrote:
>
> > Bounlith,
> >
> >             I worked through this several months ago. Cat won't get
> > everything you need from the mtd device, as YAFFS2 uses the
> > out-of-bounds area. You will need to use the nanddump utility.

> >
> >                         John

> >
>
> Hi John,
>
> Thanks for you answer. After your email, I found dump_image-arm-uclibc
> on the net and tried. But I got no better results. Then, I found your
> discussion about your work and your similar problem in the archive of
> this mailing list.
>
> My work is exactly the same as yours: to dump the mtd blocks of an
> Android device and to mount the images of the dump on a Linux computer.
> Have you finally succeed? Have you rebuilt nanddump for Android ARM?
> Your discussion ended with the comparison of the YAFFS options in the
> kernels of Android and Linux.
>
> I have downloaded the source files of mtd-utils and the mtd driver from
> here:
> http://www.linux-mtd.infradead.org/
> I will try to build this for Android. I hope this will work.
>
> Bye.
>
> >
> >
> > From:
> > [mailto:yaffs-bounces@lists.aleph1.co.uk] On Behalf Of Sirivong
> Bounlith
> > Sent: Tuesday, September 28, 2010 4:48 AM
> > To:
> > Subject: [Yaffs] How to dump/flash a YAFFS2 image?
> >
> >
> >
> > Hello,
> >
> > I need to dump a NAND device (formatted to YAFFS2) in an image, then
> > write this image to the NAND emulated device on a linux computer.
> >
> > To get image, I have done a cat of the device:
> >     cat /dev/mtd/mtd3 > <path>/yaffs2image.img

> >
> > I get a 150 MB file. To write the image to the NAND emulated device, I
> > do this:
> >     modprobe mtdblock 
> >     modprobe mtdchar 
> >     modprobe nandsim first_id_byte=0x20 second_id_byte=0x71
> >     mount -t yaffs /dev/mtdblock0 /media/nand
> >     cat yaffs2image.img > /dev/mtdblock0

> >
> > In result, /media/nand contents only a "lost + found" dir. But making
> a
> > cat on mtdblock0 ouputs something which seems to be the contents of
> > yaffs2image.img. I thought I retrieve the files of the original YAFFS2
> > device, including all its clusters.
> >
> > Is there a way to get a dump of a YAFFS2 device, and to flash the dump
> > to another device (emulated or not)?
> >
> > Thanks.
> >
> >
> >
> >
> > --
> > Bounlith Sirivong.
>