Boot from SD if SD-Card is present - Beaglebone Black

Sascha Hauer sha at pengutronix.de
Thu May 5 00:06:02 PDT 2022


Hey Konsti,

On Tue, May 03, 2022 at 04:14:37PM +0200, Konstantin Kletschke wrote:
> On Mon, May 02, 2022 at 08:35:55AM +0200, Ahmad Fatoum wrote:
> 
> > There is, but I'd check first if it's possible to boot from eMMC only
> > as a fallback if SD boot failed. On some bootroms, this is possible
> > and can easily be scripted in barebox with $global.bootsource
> > and $global.bootsource_instance variables.
> 
> When I type "magicvars" I have no global.boosource. Is that a "no
> bootsource in your bootrom" or has this a fetaure to be enabled as
> a CONFIG_ at compile time?

It's only "bootsource" and "bootsource_instance", without the global.
prefix for historic reasons.

> 
> However, booting from internal MMC is normal use case, SD-Cards are only
> inserted for updates and if some invalid SD-Card is inserted and system
> does not boot because of that I can live with that.
> 
> > title		BeagleBone Black - M2M
> > version		5.17
> > options		rootwait
> > linux		/boot/zImage
> > devicetree	/boot/am335x-boneblack.dtb
> > linux-appendroot true
> > 
> > This way, you can just type boot mmc1.1 to boot. linux-appendroot
> > will have barebox add a root= option pointing at the device it read
> > the bootloader spec file from. You'll want to set CONFIG_MMCBLKDEV_ROOTARG=y
> > to get root=/dev/mmcblk* fixups instead of partuuid (which might be the
> > same if you have the exact same image on SD and eMMC).
> 
> I already investigated bootloader spec but have it much more complicated
> in memory. This is darn simple and allows me to boot from different
> partitions with this same identical setup, right? I will go for it.
> 
> I have no CONFIG_MMCBLKDEV_ROOTARG=y, UUID is fine since all roots are
> individually formatted, no same image.
> 
> But alas, the rootfs is not appended. I created an entry just like you
> proposed and this happens:
> 
> 
> barebox at TI AM335x BeagleBone black:/ boot mmc1.2
> ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64
> Booting entry 'BeagleBone Black - M2M (/mnt/mmc1.2/loader/entries/boneblack.conf)'
> blspec: booting BeagleBone Black - M2M from mmc1
> 
> Loading ARM Linux zImage '/mnt/mmc1.2//boot/zImage'
> Loading devicetree from '/mnt/mmc1.2//boot/am335x-boneblack.dtb'
> commandline: console=ttyS0,115200n8 rootwait
> [...]
> Waiting for root device ...
> 
> What could I do about this? 

Try mounting manually with "mount mmc1.2". What does "devinfo ext40" say
then? It should contain a linux.bootargs option.

> 
> > boot already accepts multiple boot targets to try in order,
> 
> Okay, I was just not aware somehow. To use it for that.
> 
> So /env/nv/boot.default will take "mmc0.1 bootchooser" with bootchooser
> deciding between internal mmc1.1 and mmc1.2.
> If i get bootloader spec booting to fly.
> 
> 
> >   if detect mmc0; then
> >     boot mmc0.1
> >   fi
> > 
> >   boot mmc1.1
> 
> Where is this scripting stuff going into? It is not boot.default (gives
> me errors like "no entry if ... found"), is this going into entry
> boot.default points to?

It would go to /env/boot/somename

Regards,
 Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list