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

Konstantin Kletschke konstantin.kletschke at
Thu May 5 00:24:48 PDT 2022

Hey Sascha,

On Thu, May 05, 2022 at 09:06:02AM +0200, Sascha Hauer wrote:

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

Ah okay. Those varables are existing.

If I boot from internal MMC bootsource is mmc and instance is 1.
If I boot from external SD-Card bootsource is mmc and instance is 0.

I hope I did not confuse, my use case is to boot from internal MMC
always, booting from external SD-Card (i.e. use SD-Cards bootloader)
requires pressing a button which is not accessible. Boot from internal
always, if SD-Card is there use its rernel/rootfs.

So it is 100% sufficient (succesfully tested already) doing something like:
* boot.default=insidem2m_sd bootchooser
** /env/boot/insidem2m_sd mounts and boots mmc0.1
** bootchooser targets (system0, system1) mount and boot mmc1.1/mmc1.2 

Haken dran!

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

barebox at TI AM335x BeagleBone black:/ mount mmc1.2
ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64
mounted /dev/mmc1.2 on /mnt/mmc1.2
barebox at TI AM335x BeagleBone black:/ cat /mnt/mmc1.2/loader/entries/boneblack.conf 
title		BeagleBone Black - Inside M2M
version		5.14
options		rootwait
linux		/boot/zImage
devicetree	/boot/am335x-boneblack.dtb
linux-appendroot truebarebox at TI AM335x BeagleBone black:/ devinfo ext40
Driver: ext4
Bus: fs
Parent: mmc1
barebox at TI AM335x BeagleBone black:/ 

So, no bootargs option :-|

> > Where is this scripting stuff going into? It is not boot.default (gives

> It would go to /env/boot/somename

Thanks for pointing this out!

Kind Regards,

Konstantin Kletschke
Berenbosteler Straße 76 B
30823 Garbsen

Telefon: +49 (0) 5137 90950136
Mobil: +49 (0) 151 15256238
Fax: +49 (0) 5137 9095010

konstantin.kletschke at 

Geschäftsführung: Michael Emmert, Ingo Haase, Dr. Fred Könemann, Derek Uhlig
HRB: 111204, AG Hannover

More information about the barebox mailing list