[PATCH for next 08/15] ARM: phytec-som-imx6: add boot device emmc and automount

Stefan Christ s.christ at phytec.de
Fri Apr 29 00:25:28 PDT 2016


Hi Sascha,

> > diff --git a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc
> > new file mode 100644
> > index 0000000..e3cc9e3
> > --- /dev/null
> > +++ b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc
> > @@ -0,0 +1,5 @@
> > +#!/bin/sh
> > +
> > +global.bootm.image="/mnt/emmc/linuximage"
> > +global.bootm.oftree="/mnt/emmc/oftree"
> > +global.linux.bootargs.dyn.root="root=/dev/mmcblk3p2 rootwait rw"
> 
> Does this work reliably? Is there finally a patch upstream that creates
> fixed numbers for MMC/SD block devices?

Our kernel tree contains a patch for that. The mmcblk id is derived from the
device tree alias index. It isn't a mainline ready solution, since there are
some unhandled edge cases in the patch and it's implemented currently only for
the driver "sdhci-esdhc-imx".

> When I see patches like this it's probably time to remind how barebox can
> handle bootloader spec ;)
> 
> Put a file like this to /loader/entries/loader.conf:
> 
> title                   Phytec-Monster-Linux
> version                 4.6
> options                 rootwait
> linux-appendroot        true
> linux                   /boot/zImage
> devicetree              /boot/imx6q-phytec-pflaxy.dtb

We already looked at the bootspec and currently evaluating it to use it for MMC
and eMMC boot devices. It nicely decouples the bootloader and kernel/userspace
handling. E.g. maintaining the kernel arguments in the bootloader is not good
thing, because they are product, rootfs, kernel and usecase specific. (Same
argument holds for NAND/NOR partitions in the bootloader device tree ;-)


> The above also works with NAND/UBI. "boot nand0.root.ubi.root" will boot
> from the root volume on the ubi found on the root partition from the
> nand0 device. Again, no further barebox configuration and no manual
> ubiattach required. the root= and ubi.mtd= arguments to the kernel will
> be automatically generated.

Using the bootspec for NAND is not an ideal solution yet. Attaching UBI in the
bootloader to read kernel/devicetree from UBIFS and then reattaching the UBI
again in the kernel, is very time consuming. For a 1GB NAND the UBI attach can
take couple of seconds. Without UBI fastmap it will delay the boot process to
much.  And UBI fastmap has still an experimental touch, but will be the way to
go in the future.

Additionally placing the kernel and device tree on NOR is not handled by the
bootspec, but this will mostly be an embedded special case forever :-)


Mit freundlichen Grüßen / Kind regards,
	Stefan Christ

On Thu, Apr 28, 2016 at 10:34:49AM +0200, Sascha Hauer wrote:
> On Wed, Apr 27, 2016 at 12:04:42PM +0200, Stefan Christ wrote:
> > Add boot file 'emmc' and automount configuration for phyCORE-i.MX6.
> > 
> > Signed-off-by: Stefan Christ <s.christ at phytec.de>
> > ---
> >  .../arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc | 5 +++++
> >  .../phytec-som-imx6/defaultenv-physom-imx6-mira/init/automount       | 3 +++
> >  2 files changed, 8 insertions(+)
> >  create mode 100644 arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc
> > 
> > diff --git a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc
> > new file mode 100644
> > index 0000000..e3cc9e3
> > --- /dev/null
> > +++ b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/boot/emmc
> > @@ -0,0 +1,5 @@
> > +#!/bin/sh
> > +
> > +global.bootm.image="/mnt/emmc/linuximage"
> > +global.bootm.oftree="/mnt/emmc/oftree"
> > +global.linux.bootargs.dyn.root="root=/dev/mmcblk3p2 rootwait rw"
> 
> Does this work reliably? Is there finally a patch upstream that creates
> fixed numbers for MMC/SD block devices?
> 
> When I see patches like this it's probably time to remind how barebox can
> handle bootloader spec ;)
> 
> Put a file like this to /loader/entries/loader.conf:
> 
> title                   Phytec-Monster-Linux
> version                 4.6
> options                 rootwait
> linux-appendroot        true
> linux                   /boot/zImage
> devicetree              /boot/imx6q-phytec-pflaxy.dtb
> 
> Then you can boot the system with "boot mmc3.0", no further barebox
> configuration is needed. Set nv.boot to mmc3.0 if you always want to
> boot from there. The same can be done with nfsroot: Put the rootfs
> somewhere reachable via NFS and do:
> 
> boot nfs://nfshost//path/to/rootfs
> 
> (You'll need a "ip=dhcp" in the options in your loader.conf)
> 
> You can also create multiple loader.conf files with different device
> trees, barebox will then pick the one which is compatible to the current
> board.
> 
> The above also works with NAND/UBI. "boot nand0.root.ubi.root" will boot
> from the root volume on the ubi found on the root partition from the
> nand0 device. Again, no further barebox configuration and no manual
> ubiattach required. the root= and ubi.mtd= arguments to the kernel will
> be automatically generated.
> 
> Configuration files in the environment have become pretty much
> unnecessary for the common case.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list