public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Access entire device with mtdblock0
@ 2009-01-10  0:58 Adam Yergovich
  2009-01-10  1:51 ` Jamie Lokier
  2009-01-13 23:10 ` Mike Frysinger
  0 siblings, 2 replies; 13+ messages in thread
From: Adam Yergovich @ 2009-01-10  0:58 UTC (permalink / raw)
  To: linux-mtd

Hello MTD,

There was a grand feature in the 2.4 flavor of MTD that i used wherein 
mtdblock0 was assigned the entirety of the device.  This made updating 
the flash image very easy.

I've since started messing around with 2.6 flavors, and while i have a 
working map that gives the partitions i can no longer access the entire 
device.  I've tried a few things without success to get it to work.

Any recommendations on a simple way to create a partition using the 
entirety of flash?

-Adam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-10  0:58 Access entire device with mtdblock0 Adam Yergovich
@ 2009-01-10  1:51 ` Jamie Lokier
  2009-01-13 23:10 ` Mike Frysinger
  1 sibling, 0 replies; 13+ messages in thread
From: Jamie Lokier @ 2009-01-10  1:51 UTC (permalink / raw)
  To: Adam Yergovich; +Cc: linux-mtd

Adam Yergovich wrote:
> There was a grand feature in the 2.4 flavor of MTD that i used wherein 
> mtdblock0 was assigned the entirety of the device.  This made updating 
> the flash image very easy.
> 
> I've since started messing around with 2.6 flavors, and while i have a 
> working map that gives the partitions i can no longer access the entire 
> device.  I've tried a few things without success to get it to work.
> 
> Any recommendations on a simple way to create a partition using the 
> entirety of flash?

Hey, I use that feature with 2.4 too, and I'm looking at porting a
device to 2.6.  I'll be interested in the answer.

-- Jamie

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-10  0:58 Access entire device with mtdblock0 Adam Yergovich
  2009-01-10  1:51 ` Jamie Lokier
@ 2009-01-13 23:10 ` Mike Frysinger
  2009-01-14  9:00   ` Peter Korsgaard
  1 sibling, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2009-01-13 23:10 UTC (permalink / raw)
  To: Adam Yergovich; +Cc: linux-mtd

On Fri, Jan 9, 2009 at 19:58, Adam Yergovich wrote:
> There was a grand feature in the 2.4 flavor of MTD that i used wherein
> mtdblock0 was assigned the entirety of the device.  This made updating
> the flash image very easy.
>
> I've since started messing around with 2.6 flavors, and while i have a
> working map that gives the partitions i can no longer access the entire
> device.  I've tried a few things without success to get it to work.
>
> 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().
-mike

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-13 23:10 ` Mike Frysinger
@ 2009-01-14  9:00   ` Peter Korsgaard
  2009-01-14 10:58     ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Korsgaard @ 2009-01-14  9:00 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Adam Yergovich

>>>>> "Mike" == Mike Frysinger <vapier.adi@gmail.com> writes:

Hi,

 >> Any recommendations on a simple way to create a partition using the
 >> entirety of flash?

 Mike> looks like no one responded.  i'm pretty sure the answer is to use
 Mike> 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?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-14  9:00   ` Peter Korsgaard
@ 2009-01-14 10:58     ` Mike Frysinger
  2009-01-14 11:09       ` Peter Korsgaard
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Mike Frysinger @ 2009-01-14 10:58 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linux-mtd, Adam Yergovich

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 ...
-mike

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-14 10:58     ` Mike Frysinger
@ 2009-01-14 11:09       ` Peter Korsgaard
  2009-01-14 11:25       ` Ricard Wanderlof
  2009-01-14 11:50       ` Wolfgang Wegner
  2 siblings, 0 replies; 13+ messages in thread
From: Peter Korsgaard @ 2009-01-14 11:09 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Adam Yergovich

>>>>> "Mike" == Mike Frysinger <vapier.adi@gmail.com> writes:

Hi,

 >> Why not just add a partition spanning the entire device in
 >> addition to the other partitions?

 Mike> i was not aware partition tables allowed for overlaps.  if
 Mike> that's true, then the answer is obvious and easy to implement
 Mike> in boards ...

I'm pretty sure it does, and I don't see any checks for it in
mtdpart.c:add_one_partition()

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-14 10:58     ` Mike Frysinger
  2009-01-14 11:09       ` Peter Korsgaard
@ 2009-01-14 11:25       ` Ricard Wanderlof
  2009-01-14 11:50       ` Wolfgang Wegner
  2 siblings, 0 replies; 13+ messages in thread
From: Ricard Wanderlof @ 2009-01-14 11:25 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd@lists.infradead.org, Adam Yergovich


On Wed, 14 Jan 2009, 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?
>>>
>> 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 ...

Sure does. We've used it for quite a while, using /dev/mtd0 to refer to 
the whole flash, with /dev/mtd1,2,3... referring to the individual 
partitions.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-14 10:58     ` Mike Frysinger
  2009-01-14 11:09       ` Peter Korsgaard
  2009-01-14 11:25       ` Ricard Wanderlof
@ 2009-01-14 11:50       ` Wolfgang Wegner
  2009-01-14 17:06         ` Adam Yergovich
  2009-01-31  0:08         ` Adam Yergovich
  2 siblings, 2 replies; 13+ messages in thread
From: Wolfgang Wegner @ 2009-01-14 11:50 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Adam Yergovich

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-14 11:50       ` Wolfgang Wegner
@ 2009-01-14 17:06         ` Adam Yergovich
  2009-01-31  0:08         ` Adam Yergovich
  1 sibling, 0 replies; 13+ messages in thread
From: Adam Yergovich @ 2009-01-14 17:06 UTC (permalink / raw)
  To: linux-mtd

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.

Thanks for the advice all.  I will give these a go in the next day or two.

-Adam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-01-14 11:50       ` Wolfgang Wegner
  2009-01-14 17:06         ` Adam Yergovich
@ 2009-01-31  0:08         ` Adam Yergovich
  2009-02-05 22:56           ` hartleys
  1 sibling, 1 reply; 13+ messages in thread
From: Adam Yergovich @ 2009-01-31  0:08 UTC (permalink / raw)
  To: Wolfgang Wegner; +Cc: linux-mtd, Mike Frysinger

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.

-Adam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: Access entire device with mtdblock0
  2009-01-31  0:08         ` Adam Yergovich
@ 2009-02-05 22:56           ` hartleys
  2009-02-06  0:32             ` Adam Yergovich
  0 siblings, 1 reply; 13+ messages in thread
From: hartleys @ 2009-02-05 22:56 UTC (permalink / raw)
  To: Adam Yergovich, Wolfgang Wegner; +Cc: linux-mtd, Mike Frysinger

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-02-05 22:56           ` hartleys
@ 2009-02-06  0:32             ` Adam Yergovich
  2009-02-09 13:15               ` Peter Korsgaard
  0 siblings, 1 reply; 13+ messages in thread
From: Adam Yergovich @ 2009-02-06  0:32 UTC (permalink / raw)
  To: hartleys; +Cc: Wolfgang Wegner, linux-mtd, Mike Frysinger

hartleys wrote:
> 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?
> 

Could well be, some great sleuthing there.  I think the bigger question 
is "Does calling add_mtd_device() after the partitioning has been done 
work?"

I believe the answer to this is no, though some confirmation would be a 
good idea.

If that assumption is correct, I think it should be changed to either:

1) Call it before partitioning so it does add the device.

-or-

2) Change the function such that it works any time and thus the physmap 
call should work as originally written.

I'm not familiar enough with the intended function to know though.  The 
best i can say is that it seems to behave in this way, and it appears to 
me to have been intended to behave differently.

-Adam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Access entire device with mtdblock0
  2009-02-06  0:32             ` Adam Yergovich
@ 2009-02-09 13:15               ` Peter Korsgaard
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Korsgaard @ 2009-02-09 13:15 UTC (permalink / raw)
  To: Adam Yergovich; +Cc: Wolfgang Wegner, hartleys, linux-mtd, Mike Frysinger

>>>>> "Adam" == Adam Yergovich <ayergo@jkmicro.com> writes:

Hi,

 Adam> If that assumption is correct, I think it should be changed to either:

 Adam> 1) Call it before partitioning so it does add the device.

 Adam> -or-

 Adam> 2) Change the function such that it works any time and thus the physmap 
 Adam> call should work as originally written.

It would be bad to change this now to do it automatically as it would
screw up the mtd numbering.

Why not just create an extra partition with the entire size if you
need it?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-02-09 13:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-10  0:58 Access entire device with mtdblock0 Adam Yergovich
2009-01-10  1:51 ` Jamie Lokier
2009-01-13 23:10 ` Mike Frysinger
2009-01-14  9:00   ` Peter Korsgaard
2009-01-14 10:58     ` Mike Frysinger
2009-01-14 11:09       ` Peter Korsgaard
2009-01-14 11:25       ` Ricard Wanderlof
2009-01-14 11:50       ` Wolfgang Wegner
2009-01-14 17:06         ` Adam Yergovich
2009-01-31  0:08         ` Adam Yergovich
2009-02-05 22:56           ` hartleys
2009-02-06  0:32             ` Adam Yergovich
2009-02-09 13:15               ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox