[U-Boot] [PATCH 2/2] kirkwood: ib62x0: Support flattened devicetree

Luka Perkov uboot at lukaperkov.net
Sat Jul 21 14:54:31 CEST 2012


Hi Simon,

On Sat, Jul 21, 2012 at 11:40:15AM +0200, Simon Baatz wrote:
> On Sat, Jul 21, 2012 at 10:30:48AM +0200, DrEagle wrote:
> > Hi Simon and Luka,
> > 
> > Le 21/07/2012 10:03, Luka Perkov a écrit :
> > > On Fri, Jul 20, 2012 at 09:59:15PM +0200, Simon Baatz wrote:
> > >> -#define CONFIG_MACH_TYPE	MACH_TYPE_NAS6210
> > >> +#define CONFIG_OF_LIBFDT
> > > 
> > > Do we need to change environment variables too? This is how I'm booting OpenWrt
> > > with linux 3.3 now:
> > 
> > Is it not better to have the same mtdparts as in the original stock
> > firmware and in the next linux kernel ?

I dont want to use firmware layout that the manufacturer decided to put
in stock firmware. If manufacturer invested more time making good code
they would make sure to upstream their u-boot and linux code. That is
why I dont see any reason to respect original firmware layout.

> You both raise good points here. The mtd partitions can be and also
> currently are defined in the default FDT.  That's probably where the
> kernel should get the partitions from.  However, this means that we
> have the problem that the partitions may be defined differently in
> U-Boot and the kernel, which is a source of errors.
> 
> In my opinion, U-Boot should be able to get the mtd partitions from
> the FDT.  I just had a short look, but could not find such a
> functionality in U-Boot nor any discussions about it.
> 
> > Then we will just need small specifics distribution patch to customize
> > the upstream uboot for the specifics boot params:
> > In Debian, we need the initrd for raid support system bootup.
> 
> Any of these settings here can be overriden by the U-Boot
> configuration. Thus, there is no need to modify U-Boot itself.

I agree.

> > It is better to have the same partition scheme in next linux kernel and
> > in uboot, whatever it will be.
> > And better to be more closer from the original one, to make end-user
> > upgrade process simpler.
> 
> As said, it would be even better to ensure this by letting U-Boot
> learn the partitions from the FDT.
> 
> > An alternative will be to have parameters, if possible, to put uboot
> > distribution wide compatible.
> > May be a bootstrap call (bootscript call from uboot) or another tweak ?
> > 
> > > diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h
> > > index 85856f2..b1c11fd 100644
> > > --- a/include/configs/ib62x0.h
> > > +++ b/include/configs/ib62x0.h
> > > @@ -87,25 +87,23 @@
> > >   */
> > >  #define CONFIG_BOOTCOMMAND \
> > >         "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; "     \
> > > -       "ubi part root; "                                               \
> > > -       "ubifsmount root; "                                             \
> > > +       "ubi part rootfs; "                                             \
> > > +       "ubifsmount rootfs; "                                           \
> > >         "ubifsload 0x800000 ${kernel}; "                                \
> > > -       "ubifsload 0x1100000 ${initrd}; "                               \
> > > -       "bootm 0x800000 0x1100000"
> > > +       "bootm 0x800000"
> > >  
> > >  #define CONFIG_MTDPARTS                                \
> > >         "mtdparts=orion_nand:"                  \
> > >         "0x80000 at 0x0(uboot),"                   \
> > >         "0x20000 at 0x80000(uboot_env),"           \
> > > -       "- at 0xa0000(root)\0"
> > > +       "- at 0xa0000(rootfs)\0"
> > >  
> > >  #define CONFIG_EXTRA_ENV_SETTINGS                                      \
> > >         "console=console=ttyS0,115200\0"                                \
> > >         "mtdids=nand0=orion_nand\0"                                     \
> > >         "mtdparts="CONFIG_MTDPARTS                                      \
> > >         "kernel=/boot/uImage\0"                                         \
> > > -       "initrd=/boot/uInitrd\0"                                        \
> > > -       "bootargs_root=ubi.mtd=2 root=ubi0:root rootfstype=ubifs\0"
> > > +       "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
> > >  
> > >  /*
> > >   * Ethernet driver configuration
> > > 
> 
> Currently I use the following to boot usind a dtb from the first hard
> drive:
> 
> bootcmd=setenv bootargs $(bootargs_console) $(bootargs_root); \
> 	run bootcmd_ide; \
> 	run fdt_ide; \
> 	bootm 0x00800000 0x01100000 0x01000000;                             
> bootcmd_ide=ide reset; \
> 	ext2load ide 0:1 0x00800000 /boot/uImage; \
> 	ext2load ide 0:1 0x01100000 /boot/uInitrd \                                                      
> fdt_ide=ext2load ide 0:1 0x01000000 /boot/kirkwood-ib62x0.dtb; \
> 	fdt addr 0x1000000; fdt resize; fdt chosen                                                       
> 
> This leaves 8MB for the kernel which is enough for me. But this is in
> "works for me" state, I haven't really invested time to find out how
> other boards do that.  I also like to set the kernel bootargs from
> U-Boot and not from the dtb (using fdt chosen).  The mtd partitions
> are not passed via cmdline, but the values from the dtb are taken.

Thank you for this. As promised I'll try to boot 3.5 next week...

Regards,
Luka


More information about the U-Boot mailing list