public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Adding new partition in uboot
@ 2010-03-21 22:13 Sagar Heroorkar
  2010-04-01 18:51 ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Sagar Heroorkar @ 2010-03-21 22:13 UTC (permalink / raw)
  To: u-boot

Hi David,

I was exploring the ways to add partition into the blob dynamically.

I followd the following steps.

1) say we have 5 partitions.  Flash size is 128mb

norflash at 0,0{
1----------
2------------------
3
----
    5
      partition at f80000 {
                        label = "u_booot";
                        reg = <0xf80000 0x60000>;
                    };

2) i am trying to add 6th partition dynamically in uboot.

   I used the the nodeoffset of norflash at 0,0 which is parent offset wher i
want to create 6th partiton. I passed  this parent offset to
        ret  =  fdt_add_subnode(blob,nodeoffset, "partition at 6800000");
        nodeoffset = ret;
        ptr[0] = 0x6800000;
        ptr[1] = 0x800000;
        offset = 0x6800000;
        regs[0] += size_delta;
        memcpy(regs, ptr, plen);
        ret = fdt_setprop(blob, nodeoffset, "reg", regs, plen);

I am printing the the blob later. i see that node is created but the last
partition ie u-boot @ f80000  is going away.

the blob size is 8000 byes which we built using the

dtc -S 8000 -R 7 -I dts -O dtb -o file.dtb file.dts


Let me know if we need to increase size of the blob or something which i m
missing.
This is going to help  a lot if you can reply.

-Sagar

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

* [U-Boot] Adding new partition in uboot
  2010-03-21 22:13 [U-Boot] Adding new partition in uboot Sagar Heroorkar
@ 2010-04-01 18:51 ` David Gibson
  2010-04-01 21:56   ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2010-04-01 18:51 UTC (permalink / raw)
  To: u-boot

On Sun, Mar 21, 2010 at 06:13:44PM -0400, Sagar Heroorkar wrote:
> Hi David,
> 
> I was exploring the ways to add partition into the blob dynamically.
> 
> I followd the following steps.
> 
> 1) say we have 5 partitions.  Flash size is 128mb
> 
> norflash at 0,0{
> 1----------
> 2------------------
> 3
> ----
>     5
>       partition at f80000 {
>                         label = "u_booot";
>                         reg = <0xf80000 0x60000>;
>                     };
> 
> 2) i am trying to add 6th partition dynamically in uboot.
> 
>    I used the the nodeoffset of norflash at 0,0 which is parent offset wher i
> want to create 6th partiton. I passed  this parent offset to
>         ret  =  fdt_add_subnode(blob,nodeoffset,
> "partition at 6800000");

You should check ret for errors (< 0) before continuing.

>         nodeoffset = ret;
>         ptr[0] = 0x6800000;
>         ptr[1] = 0x800000;

How is ptr declared?

>         offset = 0x6800000;
>         regs[0] += size_delta;

How is regs[0] initialized?

>         memcpy(regs, ptr, plen);

Where did plen come from?

>         ret = fdt_setprop(blob, nodeoffset, "reg", regs, plen);

You should check for errors here too.

> I am printing the the blob later. i see that node is created but the last
> partition ie u-boot @ f80000  is going away.
> 
> the blob size is 8000 byes which we built using the
> 
> dtc -S 8000 -R 7 -I dts -O dtb -o file.dtb file.dts
> 
> 
> Let me know if we need to increase size of the blob or something which i m
> missing.
> This is going to help  a lot if you can reply.

For this case where there's a flash partition that's sometimes there
and sometimes not, it might be simpler to put all the partitions,
including the not-always-present ones in the dts.  Then you can use
fdt_nop_subnode() to remove the extra one on systems where it's not
present.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* [U-Boot] Adding new partition in uboot
  2010-04-01 18:51 ` David Gibson
@ 2010-04-01 21:56   ` Wolfgang Denk
  2010-04-08 10:06     ` Detlev Zundel
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2010-04-01 21:56 UTC (permalink / raw)
  To: u-boot

Dear David Gibson,

In message <20100401185147.GA17447@yookeroo> you wrote:
>
> > Let me know if we need to increase size of the blob or something which i m
> > missing.
> > This is going to help  a lot if you can reply.
> 
> For this case where there's a flash partition that's sometimes there
> and sometimes not, it might be simpler to put all the partitions,
> including the not-always-present ones in the dts.  Then you can use
> fdt_nop_subnode() to remove the extra one on systems where it's not
> present.

A completely different approach woul dbe NOT to try defining the flash
partitions in the device tree, but use command line partitioning in
combination with the "mtdparts" command support in U-Boot. For
frequently changing configurations this is probably the most flexible
approach.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
But the only way of discovering the limits  of  the  possible  is  to
venture a little way past them into the impossible.
                         - _Profiles of the Future_ (1962; rev. 1973)
                  ``Hazards of Prophecy: The Failure of Imagination''

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

* [U-Boot] Adding new partition in uboot
  2010-04-01 21:56   ` Wolfgang Denk
@ 2010-04-08 10:06     ` Detlev Zundel
  0 siblings, 0 replies; 4+ messages in thread
From: Detlev Zundel @ 2010-04-08 10:06 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

> Dear David Gibson,
>
> In message <20100401185147.GA17447@yookeroo> you wrote:
>>
>> > Let me know if we need to increase size of the blob or something which i m
>> > missing.
>> > This is going to help  a lot if you can reply.
>> 
>> For this case where there's a flash partition that's sometimes there
>> and sometimes not, it might be simpler to put all the partitions,
>> including the not-always-present ones in the dts.  Then you can use
>> fdt_nop_subnode() to remove the extra one on systems where it's not
>> present.
>
> A completely different approach woul dbe NOT to try defining the flash
> partitions in the device tree, but use command line partitioning in
> combination with the "mtdparts" command support in U-Boot. For
> frequently changing configurations this is probably the most flexible
> approach.

Actually we have code to fix up the flat device tree from the mtdparts value:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/76029/match=mtdparts

This is somewhat nicer than the "command line bottleneck" and we should
really start using it broadly.

Cheers
  Detlev

-- 
Of course my password is the same as my pet's name
My macaw's name was Q47pY!3 and I change it every 90 days
                        -- Trevor Linton
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

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

end of thread, other threads:[~2010-04-08 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-21 22:13 [U-Boot] Adding new partition in uboot Sagar Heroorkar
2010-04-01 18:51 ` David Gibson
2010-04-01 21:56   ` Wolfgang Denk
2010-04-08 10:06     ` Detlev Zundel

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