Go to previous topic
Go to next topic
Last Post 11 Jan 2008 11:39 AM by  mattwick
How to create partitions in NAND memory
 3 Replies
Author Messages
dexter.solio@navy.mil
New Member
New Member
Posts:


--
13 Dec 2007 10:20 AM
    I am interested in partitioning my NAND flash memory to store the stage 2 boot loader, the kernel image, and the rootfs.

    When I boot my kernel and examine my MTD devices (cat /proc/mtd), partitions already exist (not sure how they were created).

      dev size erasesize name
      mtd0: 00080000 00010000 "Bootloader"
      mtd1: 00180000 00010000 "Kernel"
      mtd2: 00200000 00004000 "nand.kernel"
      mtd3: 03e00000 00004000 "nand.rootfs"
      mtd4: 04000000 00004000 "<NULL>"
      mtd5: 04000000 00004000 "<NULL>"


    I've replaced mtd3 with my own root fs (rootfs.jffs2) using nandwrite. When the stage 2 bootloader and the kernel image is loaded in RAM and executed, the linux kernel uncompresses and runs without any errors.

    I used the same process above and replaced mtd2 with my own linux kernel image, and loaded the stage 2 bootloader to RAM. I get the following error when the linux kernel uncompresses:

      MXC_NAND: HWECC uncorrectable 2-bit ECC error
      mtd->read (0x400 bytes from 0x1e000000) returned ECC error.


    Has anyone partitioned their NAND memory this way and not get the ECC error? Any comments, ideas?

    Thanks.
    arjun.kv@7lf-tech.com
    New Member
    New Member
    Posts:


    --
    14 Dec 2007 04:24 AM
    Hi,

    I am trying to do the same thing as you. But when i do the nandwrite i get the following error.

    # nandwrite /dev/mtd/3 /mnt/usb/rootfs.jffs2 -p
    [ 54.760000] MTD_open
    [ 54.770000] MTD_ioctl
    [ 54.770000] MTD_ioctl
    Writing data to block 0
    [ 54.770000] MTD_ioctl

    [ 54.790000] MTD_write
    pwrite: Input/output error[ 54.790000] MTD_close

    Data did not fit into device, due to bad blocks
    : Illegal seek

    Please suggest what could be wrong here. I did a flasheraseall of mtd/3 block before writing.

    Thanks
    Arjun
    dexter.solio@navy.mil
    New Member
    New Member
    Posts:


    --
    14 Dec 2007 09:21 AM
    you have to erase the mtd partition first, then use nandwrite. Make sure when you erase, you specify the -j option for jffs2.
    mattwick
    New Member
    New Member
    Posts:


    --
    11 Jan 2008 11:39 AM
    Dexter & crew worked out the answer to the original question in this thread here:
    http://tdg.logicpd.com/viewtopic.php?f=29&t=1222


    ---