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.

Make kernel get MTD partitions from command line

Hi,

 

I am using BeagleBoard.

I set the bootargs from U-Boot prompt and they look like this:

OMAP3 beagleboard.org # printenv bootargs
bootargs=console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 rootfstype=squashfs rootwait nohz=off
mtdparts=nand:6656k(all),1m(squash),-(jffs2)

 

The kernel command line specified in the kernel config looks like this:

root=/dev/mmcblk0p2 rootwait console=ttyS2,115200 mtdparts=nand:6656k(all),1m(squash),-(jffs2)

In both cases I specify the same custom partitioning.

The partitions specified in board-omap3beagle.c look like this (different than the above ones):

static struct mtd_partition omap3beagle_nand_partitions[] = {
/* All the partition sizes are listed in terms of NAND block size */
{
.name = "X-Loader",
.offset = 0,
.size = 4 * NAND_BLOCK_SIZE,
.mask_flags = MTD_WRITEABLE, /* force read-only */
},
{
.name = "U-Boot",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
.size = 15 * NAND_BLOCK_SIZE,
.mask_flags = MTD_WRITEABLE, /* force read-only */
},
{
.name = "U-Boot Env",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
.size = 1 * NAND_BLOCK_SIZE,
},
{
.name = "Kernel",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
.size = 32 * NAND_BLOCK_SIZE,
},
{
.name = "File System",
.offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
.size = MTDPART_SIZ_FULL,
},
};

Now I want to partition the NAND as per command line options.

The problem is that the NAND gets partitioned as per the source file (the mapping driver) not as per the command line options. How can I make the kernel get its partitions from the command line?

I tried to find if any relevant config that tells the kernel to get MTD partitions from a driver is checked but I found nothing.

 

Thanks,

donescamillo

 

 

 

  • Hi Donescamillo,

    First off all I haven't tried it on my board, but it should work. You may want to take a look at top header of file "<kernel home>/drivers/mtd/cmdlinepart.c", where it is clearly mentioned on how to use command line option -

     

     * The format for the command line is as follows:
     *
     * mtdparts=<mtddef>[;<mtddef]
     * <mtddef>  := <mtd-id>:<partdef>[,<partdef>]
     *              where <mtd-id> is the name from the "cat /proc/mtd" command
     * <partdef> := <size>[@offset][<name>][ro][lk]
     * <mtd-id>  := unique name used in mapping driver/device (mtd->name)
     * <size>    := standard linux memsize OR "-" to denote all remaining space
     * <name>    := '(' NAME ')'
     *
     * Examples:
     *
     * 1 NOR Flash, with 1 single writable partition:
     * edb7312-nor:-
     *
     * 1 NOR Flash with 2 partitions, 1 NAND with one
     * edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)

    Hope it helps.

    Thanks,

    Vaibhav