BBGW - Changing boot order ?

Skip to first unread message


Dec 27, 2019, 11:12:12 AM12/27/19
to BeagleBoard

Hello all,
I like to change the boot order on my BBGW device.

At the moment, if I power on it boots from the internal eMMC Card, if a external storage Card in inserted, or not. 
I have to press the the boot button during boot time to force a start with the external Card.

I like to have it the other way: 
If a valid external SD is fund, it will boot from this, other wise it will boot from internal eMMC.
How do I do this?
Is there a documention about the boot process and disk partitions somewhere, so I can find out by myself?

thank you in advance

Robert Nelson

Dec 27, 2019, 12:00:58 PM12/27/19
to Beagle Board,
There is a spec, which is used by default..

but if your using a custom u-boot, then it's probably not enabled..


Robert Nelson

David Cherkus

Jan 6, 2020, 3:27:20 PM1/6/20
to BeagleBoard
Best overall documentation I could find is Derek Malloy's "Exploring Beaglebone" textbook.
It was relatively cheap bought for Amazon Kindle and is an amazing resource for the things I want to do.
Yet it was written a while ago and some (many?) things have changed since it was written. is a good reference on how BBGW is intended to work.
It doesn't tell you much about how it does what it does, or how to change it.

I believe there is no documented way to switch boot order to favor sdcard over u-boot other than the boot button. is a good article on some ways to change u-boot rules but as the title suggests it's more of a "u boot trick" than a standardized way to switch boot order such as a boot manager.

I booted my board using the u-boot on eMMC then used u-boot commands on the serial port to boot my linux from sdcard.
The linux I booted was the yocto build that the textbook above described how to build.
See my notes below.
This may be enough to get you going?

I'd like come up with a way to select an image via the debug serial port.
Some sort of boot manager / image selector like grub is for the x86 world.
But I haven't spent any time investigating that path.   

Here are my notes.

=> ext4ls mmc 0:2 /boot
<DIR>       4096 .
<DIR>       4096 ..
           58296 am335x-boneblack.dtb
           56480 am335x-bone.dtb
         6785592 zImage-5.2.17-yocto-standard
           56736 am335x-bonegreen.dtb
<SYM>         28 zImage

=> setenv loadzimage "load mmc 0:2 ${loadaddr} /boot/zImage"
=> setenv loadftd "load mmc 0:2 ${fdtaddr} /boot/am335x-boneblack.dtb"
=> setenv bootargs "console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fixrtc ${optargs}"
=> run loadzimage
6785592 bytes read in 459 ms (14.1 MiB/s)
=> run loadftd
58296 bytes read in 24 ms (2.3 MiB/s)
=> bootz ${loadaddr} - ${fdtaddr}
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffee000, end 8ffff3b7 ... OK

Starting kernel ...

David Cherkus

Jan 6, 2020, 3:53:07 PM1/6/20
to BeagleBoard
Is there a workable way to "corrupt" the MLO in eMMC so the first level program loader in ROM skips over it and tries sdcard instead?

On a board I used to work on the ROM looked for a magic number at the start of each flash sector and if you overwrote the magic number with 1s (i.e. erased the sector) it would not use the flash and would fail over to trying removable media.

This let us come up with a scheme to store the intentionally corrupted boot sector elsewhere on the flash when we wanted to boot to external media then restore it (with the correct magic number) when we wanted to boot from flash.

Another scheme as above would be to always boot using eMMC's MLO and u-boot.img then use rules in eMMC's /boot/uEnv.txt that establish the default bootcmd and provide alternates you can use to override the default bootcmd as needed to pull linux and device tree from whatever source you prefer (sdcard, tftp, nfs, etc).

On Friday, December 27, 2019 at 12:00:58 PM UTC-5, RobertCNelson wrote:

Hugo van den Brand

Jan 6, 2020, 4:25:38 PM1/6/20
For I workshop we had to use dd to write zeroes to the typical location of uboot.
That would be breaking the uboot partition.

Note that uboot is very flexible. It has some useful predefined variables through which you can easily configure booting. For example, uboot just calls: run bootcmd.
So if you set bootcmd to match your wishes, you will have the booting behavior you want. 
I typically use: run netboot.
That's defined by default and I set all other variables to make the netboot run as I please. 
Don't forget saveenv.

There is are also options to scan for possible bootable partitions, but I don't know the details. 
I have not seen uboot present any menu like grub does. 

Op ma 6 jan. 2020 21:53 schreef David Cherkus <>:
For more options, visit
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

David Cherkus

Jan 6, 2020, 5:34:23 PM1/6/20
to BeagleBoard
Thank you Hugo.   I agree with everything you wrote.   In particular the built in u-boot variables are helpful and aren't too hard to change once you put in the time to understand how they work.  As I said I have not done any research to see if a menu based option is available.  If nothing is available it would probably not be too hard to create u-boot scripts with if/then/else/fi to make a simple text menu option available to select eMMC vs sdcard at boot time.


Matthijs van Duin

Feb 2, 2020, 12:32:57 AM2/2/20
to BeagleBoard
On Monday, 6 January 2020 21:53:07 UTC+1, David Cherkus wrote:
Is there a workable way to "corrupt" the MLO in eMMC so the first level program loader in ROM skips over it and tries sdcard instead?

sudo dd if=/dev/zero of=/dev/mmcblk1 seek=256 count=1

Reply all
Reply to author
0 new messages