This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

mtd4 partition required to be made read/write

Hello,

We are facing problem in making mtd4 – mtd5 partitions on DM365IPNC-OV9715 board.

It has 128MB Nand flash.

We are planning to use mtd4-mtd5 partition for storing information.

So as first step to make mtd4 as writable,

We have changed to platform driver arch/arm/mach-davinci/board-dm365-ipnc.c in kernel source as follows,

 

static struct mtd_partition nand_partitions[] = {

        /* bootloader (UBL, U-Boot, BBT) in sectors:  */

        {

                .name = "bootloader",

                .offset = 0,

                .size = 24 * NAND_BLOCK_SIZE,

                .mask_flags = MTD_WRITEABLE,    /* force read-only */

        },

        /* bootloader params in the next sector  */

        {

                .name = "params",

                .offset = MTDPART_OFS_APPEND,

                .size = 16 * NAND_BLOCK_SIZE,

                .mask_flags = MTD_WRITEABLE,    /* force read-only */

        },

        /* kernel in sectors: */

        {

                .name = "kernel",

                .offset = MTDPART_OFS_APPEND,

                .size = SZ_4M,

                .mask_flags = 0

        },

        {

                .name = "filesystem",

                .offset = MTDPART_OFS_APPEND,

                .size = SZ_16M + SZ_8M,

                .mask_flags = 0

        },

        {

                .name = "data1",

                .offset = MTDPART_OFS_APPEND,

                .size = SZ_2M,

                .mask_flags = MTD_WRITEABLE,    /* force read-only */

        },

        {

                .name = "data2",

                .offset = MTDPART_OFS_APPEND,

                .size = MTDPART_SIZ_FULL,

                .mask_flags =0

        }

};

 

 

After that we built the kernel and flashed it  to nand but,

it seems this change is not being reflected, because we are not able to write to this partition.

Below is output of the mtd_debg write and mtd_debg info for mtd4 partition.

 

 

# ls -l /opt/ffsimg/datastore.jffs2

-rw-r--r-- 1 root root 244 Sep 25 2013 /opt/ffsimg/datastore.jffs2

# /usr/sbin/mtd_debug write /dev/mtd4 0 244 /opt/ffsimg/datastore.jffs2

open(): Permission denied

#

#

# /usr/sbin/mtd_debug info /dev/mtd4

mtd.type = MTD_NANDFLASH

mtd.flags = MTD_CAP_ROM

mtd.size = 2097152 (2M)

mtd.erasesize = 131072 (128K)

mtd.writesize = 2048 (2K)

mtd.oobsize = 64

regions = 0

 

Kernel boot log for your information,

 

[    0.290000] nand_davinci nand_davinci.0: Using 4-bit hardware ECC

[    0.290000] NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)

[    0.300000] Creating 6 MTD partitions on "nand_davinci.0":

[    0.310000] 0x00000000-0x00300000 : "bootloader"

[    0.320000] 0x00300000-0x00500000 : "params"

[    0.320000] 0x00500000-0x00900000 : "kernel"

[    0.330000] 0x00900000-0x02100000 : "filesystem"

[    0.340000] 0x02100000-0x02300000 : "data1"

[    0.340000] 0x02300000-0x08000000 : "data2"

 

Can you please suggest what is missing/wrong in above steps ?

Or how do we make mtd4 partition writable ?

 

Thanks and Regards,

Arpitha

  • Arpitha,

    Run the mount command and see whether this partition is already mounted,.

  • Hi Arpitha,

    Use ".mask_flags    = 0,"  for your data( filesystem) partitions

    You can flash the "jffs2" image by following the commands

    # flash_eraseall -j /dev/mtd4 (-j for jffs2 image (with cleanmarker))

    # nandwrite -pm /dev/mtd4 rootfs.jffs2

    OR

    make your whole filesystem into tar ball

    then boot ur device through NFS

    # flash_eraseall -j /dev/mtd4 (-j for jffs2 image (with cleanmarker))

    # mount -t jffs2 /dev/mtdblock4 /mnt

    # cd /mnt

    # tar -xf /rootfs.tar

    Regards,

    Titus S.