mtd partitions definition

Mika Korhonen mika.j.korhonen at gmail.com
Sat Oct 17 06:37:32 EDT 2009


2009/10/13 Philipp Boerker <philipp.boerker at gmx.de>:
>
> I'm sorry if this is the wrong place for such questions. I have done a lot of reading on the subject and have browsed through the kernel code for my device but still could not find the desired information (I'm no programming crack, I'm afraid). The situation is this:
>
> I have an embedded device which has some mtd partitions which are controlled by the omap2-nand driver. The exact kernel sources for the device are unavailable at the moment (I expect them to be published by the manufacturer within the next weeks) so I collect most of the info I have from dmesg and grepping through the binaries.
>
> Now I would like to install my own bootloader which in the present case resides in an mtd partition that appears to be read-only (opening the device rw fails). I concluded that I had to change the partition definition to being writable in order to be able to write to the partition holding the bootloader (I assume that making the partition read-only was a kind of security measure on the side of the manufacturer). The remaining mtd partitions can be written using flash_image.
>
> I have learned so far that there are (at least) three ways of defining mtd partitions: kernel command line ("cmdline parsing not available" in dmesg so it shouldn't be this), fixed (i.e. defined somewhere in the sources, however, a grep for the partition names listed in dmesg doesn't show anything) or redboot. The device does not use redboot as a bootloader but as far as I understand this does not mean that it doesn't use the redboot method for defining mtd partitions.
>
> I have looked through the kernel sources for the omap2-nand driver and have come to a function called omap_nand_probe which seems to initialise (at least part of) the device but gets all the interesting information (i.e. partition definition) passed as an argument. So the partition information is set up somewhere else. And I can't find this somewhere else...
>
> I wonder whether there is a user-space tool similar to fdisk for defining mtd partitions provided that the redboot method is used. (btw, the partition holding the bootloader does not use ubi.) I know that mtd partitions can be defined in redboot itself but this is some sort of a chicken-and-egg problem: I need to have the partitions rw in order to have my own bootloader installed and the device uses some other kind of bootloader...
>
> Any help on this? I spend two days learning about mtd (a week ago I didn't know it existed) and I start feeling that pain in my neck... :)
>
>
> Thank you for your work and time!
>
> --

You may also want to have a look at this patch :
http://lists.infradead.org/pipermail/linux-mtd/2009-September/027141.html

That should give you a clue where the partitioning comes from.

Mika



More information about the linux-mtd mailing list