Access entire device with mtdblock0

hartleys hartleys at visionengravers.com
Thu Feb 5 17:56:30 EST 2009


On Friday, January 30, 2009 5:08 PM, Adam Yergovich wrote:
> Wolfgang Wegner wrote:
>> On Wed, Jan 14, 2009 at 05:58:43AM -0500, Mike Frysinger wrote:
>>> On Wed, Jan 14, 2009 at 04:00, Peter Korsgaard wrote:
>>>> "Mike" == Mike Frysinger <writes:
>>>>>> Any recommendations on a simple way to create a partition using 
>>>>>> the entirety of flash?
>>>>> looks like no one responded.  i'm pretty sure the answer is to use
>>>>> add_mtd_device() even in face of add_mtd_partitions().
>>>> Why not just add a partition spanning the entire device in addition

>>>> to the other partitions?
>>> i was not aware partition tables allowed for overlaps.  if that's 
>>> true, then the answer is obvious and easy to implement in boards ...
>> 
>> They are allowed, but I have not been able yet to do a correct query 
>> for erase_size in case of a partition covering a whole device having 
>> multiple different-sized erase regions.
>> 
>> Regards,
>> Wolfgang
>
> Hello All,
> 
> Sorry for the delay in trying this out, I have been exceptionally
busy.
> 
> The short story is: i got it all to work.
> 
> The long story is:
> 
> In reviewing the code i found that add_mtd_device was already being
> called after the partitioning.  As it wasn't giving mtdblock0 as the
> entire region it didn't seem to be the solution.
> 
> I played around some more, and found disabling the mtd partitioning
> would give me one partition including all of flash.  If you'll note
> in the code (which has been present in physmap.c for some time I
> believe) it was getting to the add_mtd_device and adding it if and
> only if the redboot section was not called.
> 
> I moved the add_mtd_device() call to before the redboot partitioning
> and it all worked brilliantly.
> 
> I would like to suggest that this is perhaps a better construct
> overall as it adds a nice feature.
> 
> Hopefully this is at very least useful to someone who looks at this
> in the future.  I thank you all for your help in this.

It appears this was originally thought about for mtd partitions.

In mdtpart.c, add_mtd_partitions() has a comment above it:

/*
 * This function, given a master MTD object and a partition table,
creates
 * and registers slave MTD objects which are bound to the master
according to
 * the partition definitions.
 * (Q: should we register the master MTD object as well?)
 */

Maybe it was just never revisited?

Hartley



More information about the linux-mtd mailing list