I believe there is a Uboot command that will give you a list. Yup :

DM355 EVM # nand bad

Device 0 bad blocks:
 00520000
 00b60000
 00c20000
 01620000
 01ea0000
 020a0000
 02360000
(plus more)

In general if you are updating an EVM then you shouldn't have to worry about bad blocks in the kernel space. I saw this problem on our own boards when we had a few NAND that had bad blocks in very bad spots.

I use devrocket to create a new filesystem - the platform image "mode" allows you to pick and choose what packages to use. Otherwise you will have to build it manually from either the NFS filesystem or the minimal one (that is in NAND already). This is actually the only thing that I use devrocket for.

Once you have a filesystem, you need to tar it up, and get it on the board. I generally put it on an SD card and mount the card. Then, you need to erase the filesystem that isn't being used - and by this I mean that the NAND flash is partitioned into 5 sections:

root@(none):~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 003c0000 00020000 "bootloader"
mtd1: 00040000 00020000 "params"
mtd2: 00400000 00020000 "kernel"
mtd3: 20000000 00020000 "filesystem1"
mtd4: 1f800000 00020000 "filesystem2"

You will be booting (and running) either filesystem1 or 2. Erase the alternate one with 'flash_eraseall /dev/mtd2'. Then mount it. I use YAFFS2 but JFFS2 works as well.

   mount -t yaffs2 /dev/mtdblock4 /mnt/nand

Then your NAND partition is just like any other mounted storage. Untar your new filesystem to the new mount point (/mnt/nand).

Then when you reboot, update your bootargs like so:

bootargs=root=/dev/mtdblock4 rootfstype=yaffs2 console=ttyS0,115200n8 mem=100M

I usually try to make sure that I always have a good working filesystem in one of the partitions so I can recover the board if the new filesystem is broken.

Good luck!
Steve

Albert Burbea wrote:
Thanks Stephen,
now, how do you get the "bad block list" BEFORE flashing the kernel? Also, how do you build a new filesystem, and flash it on the NAND?
Thanks
Albert

On 8/8/08, *Stephen Berry* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:


    This would seem to be a pretty common thing to do, but for some
    reason it wasn't described anywhere that I could find...

    If you want to be able to update your kernel or uboot image in
    NAND (I'm using a DM355 platform, but this should work for others)
    *while* your system is running and without the use of a JTAG
    device, these are the commands that I use to do this:

    /usr/sbin/flash_eraseall -j /dev/mtd2
    /usr/sbin/nandwrite -p /dev/mtd2 uImage

    This example updates the kernel. It is assumed that /dev/mtd2 is
    your NAND kernel partition. Uboot would be /dev/mtd0.

    Also if you see any bad blocks during the erase operation you'll
    need to make sure they don't occur in the middle of your kernel
    code. It seems that the bootloader doesn't understand bad blocks
    and will NOT skip them. So you need to have a contiguous set of
    good blocks for your kernel.

    I've been able to save some bad boards in the past by moving the
    kernel away from the bad block area and changing the uboot 'nboot'
    command to match that offset.

    Enjoy,

     Steve


    _______________________________________________
    Davinci-linux-open-source mailing list
    [email protected]
    <mailto:[email protected]>
    http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source




--
Albert Burbea
Harishonim 8
Ramat Gan 52502, Israel
Tel/Fax + 972-3-7526016
Mobile: +972-52-3541842
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to