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

Sascha Hauer sha at pengutronix.de
Thu May 5 01:25:07 PDT 2022


On Thu, May 05, 2022 at 09:24:48AM +0200, Konstantin Kletschke wrote:
> 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 :-|

Is this a DOS partition table or GPT on this card?
I assume it's a DOS partition table in which case you should have a
variable mmc1.nt_signature. Set this to some arbitrary 32bit value.
Several partitioning tools set this automatically, but not all it seems.

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