mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Konstantin Kletschke <>
Subject: Re: Boot from SD if SD-Card is present - Beaglebone Black
Date: Tue, 3 May 2022 16:14:37 +0200	[thread overview]
Message-ID: <YnE4zTD4Klact2eQ@Hephaistos> (raw)
In-Reply-To: <>

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? 

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@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? 

> 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?

Since I have bootloader spec not running yet, I have "insidem2m_sd
bootchooser" in /env/nv/boot.default. This works well, if no SD-Card is
inserted and I get a nasty red error with both variants.

Without the detect mechanism in insidem2m_sd I get

Booting entry 'insidem2m_sd'
mount: No such file or directory
could not open /mnt/mmc0.1/boot/zImage: No such file or directory
ERROR: Booting entry 'insidem2m_sd' failed
Booting entry 'bootchooser'

with this detect mechanism I get

Booting entry 'insidem2m_sd'
detect: Connection timed out
ERROR: Running script '/env/boot/insidem2m_sd' failed: error -127
ERROR: Booting entry 'insidem2m_sd' failed
Booting entry 'bootchooser'

Each time it goes to bootchooser which successfully boots internal
MMC... When SD-Card is inserted it chooses it successfully in both ways,
so both variants work well.

> On less recent kernels, the order might change, but at least now it's
> fixed (with aliases).

I spent the whole day to update Kernel, bootloader, rescue SD-Cards,
Install scripts so now internal mmc is mmcblk1, external SD-Card is
mmcblk0 (5.10.12 -> 5.10.63). Like barebox was alaways.

Kind Regards
Konstantin Kletschke

Konstantin Kletschke
Berenbosteler Straße 76 B
30823 Garbsen

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

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

barebox mailing list

  reply	other threads:[~2022-05-03 14:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 16:18 Konstantin Kletschke
2022-05-02  6:35 ` Ahmad Fatoum
2022-05-03 14:14   ` Konstantin Kletschke [this message]
2022-05-05  7:06     ` Sascha Hauer
2022-05-05  7:24       ` Konstantin Kletschke
2022-05-05  8:25         ` Sascha Hauer
2022-05-05  8:58           ` Konstantin Kletschke
2022-05-05  9:38           ` Konstantin Kletschke
2022-05-06 12:20             ` Ahmad Fatoum
2022-05-09  8:04               ` Konstantin Kletschke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YnE4zTD4Klact2eQ@Hephaistos \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox