Hello Konstantin, On 01.05.22 18:18, Konstantin Kletschke wrote: > Hi All, > > I have a Beaglebone Black whith internal MMC and external SD-Card > interface. > > I boot from internal MMC always. The system itself aways boots from > internal MMC. > > Is there a way - may be scriptable in boot entry - to start system from > external SD-Card, if it is present? 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. > > Normally I boot this way, bootchooser select system0 or system1: > > #!/bin/sh > > mount mmc1.1 > > global.bootm.image=/mnt/mmc1.1/boot/zImage > global.bootm.oftree=/mnt/mmc1.1/boot/am335x-boneblack.dtb > global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" "The barebox way" is to keep this configuration confined to the rootfs as it makes it easier to change this parameters without changing the bootloader. We usually do that with bootloader spec file (name it e.g. /loader/entries/boneblack.conf): 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). > If I stop autoboot and want to use external SD-Card I manually select > insidem2m_sd as a boot entry: > > #!/bin/sh > > mount mmc0.1 > > global.bootm.image=/mnt/mmc0.1/boot/zImage > global.bootm.oftree=/mnt/mmc0.1/boot/am335x-boneblack.dtb > global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootfstype=ext4 rootwait" > > Can this be something like: > > IF external SD-CARD IS PRESENT bootentry is insidem2m_sd ELSE > bootchooser boot already accepts multiple boot targets to try in order, so you could do boot mmc0.1 mmc1.1 Or if it yields better error messages: if detect mmc0; then boot mmc0.1 fi boot mmc1.1 > Please obey if you are inspecting the CMDLINE, in more recent Kernels > the mmcblk0 and mmcblk1 numbering is exchanged. On less recent kernels, the order might change, but at least now it's fixed (with aliases). Cheers, Ahmad > > > Kind Regards > Konstantin > > -- 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 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox