Hello -
I am a bit of a newbie when it comes to Linux and modifying uBoot is something that is very new to me. I remember with the Rev B boards that you needed to hold the S2 switch in order to boot from the SD card. This was “fixed” by the time the Rev C hardware came out - I assume by patching uBoot. Anyway, the current behavior (Debian Wheezy) when there is both a valid eMMC image and valid SD image is to boot off the SD card regardless of the state of the S2 switch. I get that this is because the uBoot on the eMMC and the SD card are the same and both defaul to booting the SD card if it is there.
I’d like to get the old behavior back so that the S2 switch forces a boot from the SD card and the eMMC will ignore the SD card for the purpose of finding the boot image.
The reason for this is that I am making a deeply embedded system and want to be able to update the eMMC by booting from SD card using the scripts provided (set the cmdline in uEnv.txt to make it a flasher) and I won;t have physical access to the uSD slot.
Alternatively, and here is where I am a rank newbie, is there a way (script) that I can boot into the eMMC (no boot image on the SD card) and trigger a reflash of the eMMC?
Thanks in advance,
Ed
Made all of the changes and got a clean build for the MLO and u-boot.img (thanks!!!). What is the best way to flash the eMMC? I figure it is to modify an image of my existing eMMC and use your script to flash the SD to the eMMC. That being the case - where is the u-boot.img file? I poked around the .img file and haven’t been able to find anythign in the /boot directory. Thanks again!
Ed
Made all of the changes and got a clean build for the MLO and u-boot.img (thanks!!!). What is the best way to flash the eMMC? I figure it is to modify an image of my existing eMMC and use your script to flash the SD to the eMMC. That being the case - where is the u-boot.img file? I poked around the .img file and haven’t been able to find anythign in the /boot directory. Thanks again!
Ed
Here if you look closely, you’ll see the bootloaders are in the first 1M of disk space, or MBR if you will.
https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSDcard
I have been pointed in the correct direction. Thank you all!
Ed
I have been pointed in the correct direction. Thank you all!
Ed
The link I have is a bit busted, didnt link to the correct spot, but if you click on the left side where it says “Setup MicroSD card” that’ll take you to the correct spot.
The easiest way, boot the bbb up, copy the MLO/u-boot.img over and do:
sudo dd if=./MLO of=/dev/mmcblk1 count=1 seek=1 bs=128k
sudo dd if=./u-boot.img of=/dev/mmcblk1 count=2 seek=1 bs=384k
This assumes /dev/mmcblk1 is currently the eMMC..
Regards,
OK - status:
- Compile - Good
- flash new MLO and u-boot.img - Good
- to check who booted i changed the hostnames on the eMMC (GEMMX) and SD cards (GEMM3)
- cycle power with SD inserted gives GEMMX (SD card)
- cycle power and remove SD card gives GEMM3 (eMMC)
Here’s a scrape from the am335x_evm.h file"
#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance)
“bootcmd_” #devtypel “=”
“run nandboot\0”
#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance)
#devtypel #instance " "
#define BOOT_TARGET_DEVICES(func)
func(LEGACY_MMC, legacy_mmc, 0)
func(MMC, mmc, 1)
func(LEGACY_MMC, legacy_mmc, 1)
func(NAND, nand, 0)
func(PXE, pxe, na)
func(DHCP, dhcp, na)
#define CONFIG_BOOTCOMMAND
"run findfdt; "
“run distro_bootcmd”
I simply deleted the line 87 - that’s what I assumed you meant by remove “mmc 0”. Do I need to blow away the legacy entry as well?
And now it works!
- SD card in boots to GEMM3 (eMMC)
- SD card in and SW2 pressed gives GEMMX (SD card)
Thanks for all your help (everyone) and especially Robert! Now to write down all of this recipe.
Cheers,
Ed
This is just a summary of the above recipe for posterity (and search engines everywhere):
To make it so that the BBB will ignore the SD card unless SW2 is pressed requires a new u-boot on the eMMC.
the following recipe needs to be followed exactly (otherwise there will be errors in the compile of u-boot.
Steps:
- Make sure that you have a 64-bit Linux with git installed, and a BBB that can boot off the eMMC
- Rebuild u-boot:
2.1) install the appropriate cross-compiler
wget -c https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
tar xf gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
export CC=pwd/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
${CC}gcc --version (** this tests to make sure CC is set correctly **)
2.2) Get u-boot from repository (~/)
git clone https://github.com/u-boot/u-boot
cd u-boot/
git checkout v2016.03 -b tmp
2.3) patch it (~/u-boot)
wget -c https://rcn-ee.com/repos/git/u-boot-patches/v2016.03/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
2.4) modify it
2.4.1) in the directory ~/u-boot/include/configs find the file am335x_evm.h
2.4.2) open it and search for the entry #define BOOT_TARGET_DEVICES
2.4.3) delete (comment out) the lines: (these are the lines that tell the bootloader to look at the SD card for a boot image)
func(MMC, mmc, 0)
func(LEGACY_MMC, legacy_mmc, 0)
2.4.4) save the file
2.5) build it (~/u-boot)
make ARCH=arm CROSS_COMPILE=${CC} distclean
make ARCH=arm CROSS_COMPILE=${CC} am335x_evm_defconfig
make ARCH=arm CROSS_COMPILE=${CC}
- There are two files that you are interested in - MLO and u-boot.img
- Boot the BBB off the uSD card (necessary since we are going to muck with the eMMC)
- Get the files MLO and u-boot.img to the BBB
5.1) Use SmarTTY to SCP these files to the BBB - they will end up in /tmp
- Go to the directory where these files landed
- make sure that the eMMC is mounted as mmcblk1 - this should be the case if you coot off the uSD
lsblk
the eMMC on the Rev C BBB is the 3.6G disk/partition
- sudo dd if=./MLO of=/dev/mmcblk1 count=1 seek=1 bs=128k
- sudo dd if=./u-boot.img of=/dev/mmcblk1 count=2 seek=1 bs=384k
- reboot - will boot off the eMMC unless you hold down SW2 in which case it will boot off the uSD
Troubleshooting:
-
If u-boot compilation kicks errors it is probably because the value of ${CC} is not set properly. This value is not permanent, you’ll need to export it every time unless you want to change your Linux PATH. It could also be a typo in the header you modified
-
If you still boot off the uSD regardless of SW2 - check that you actually updated the MLO and u-boot.img files. Best to just try to flash them again since they are a direct write to the uSD card (not part of the file system). Remember - reflashing the eMMC will probably lose your modified u-boot.
i have booted my bb rev c with my own MLO and u-boot.img via sd card i didnt boot the kernel still but without booting the kernel i can copy my MLO and u-boot.img in my emmc flash right ? im using the following steps but only SPL is getting loaded in the SRAM . but not u-boot.img
=> mmc dev 1
=> mmc erase 0 8000
=> fatload mmc 0:1 0x83000000 MLO
=> mmc write 0x83000000 0x0 0x1B000
=> fatload mmc 0:1 0x82000000 u-boot.img
=> mmc write 0x82000000 0x1B000 3056
here is my observation
U-Boot 2025.10-00515-gecdc3872a767 (Oct 22 2025 - 22:39:19 +0530)
CPU : AM335X-GP rev 2.1 Model: TI AM335x BeagleBone Black
DRAM: 512 MiB Core: 161 devices, 18 uclasses, devicetree: separate
WDT: Started wdt@44e35000 with servicing every 1000ms (60s timeout)
NAND: 0 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT… Unable to read “uboot.env” from mmc0:1… not set.
Validating first E-fuse MAC Net: eth2: ethernet@4a100000using musb-hdrc,
OUT ep1out IN ep1in STATUS ep2in MAC de:ad:be:ef:00:01 HOST MAC de:ad:be:ef:00:00 RNDIS ready , eth3: usb_ether Autoboot in 2 seconds
=> mmc list
OMAP SD/MMC: 0 (SD)
OMAP SD/MMC: 1
could u check where im going wrong i even changed the mmc index but same issue is repeating
What issue, everything looks fine from you log
no it should boot directly from emmc not sd card SD/MMC 1 is sd card not emmc which is SD/MMC 0 wait i will send u another log
=> mmc dev 1 switch to partitions #0, OK mmc1(part 0) is current device
=> mmc write 0x83000000 0x0 216
MMC write: dev # 1, block # 0, count 534 … 534 blocks written: OK
=> fatload mmc 0:1 0x82000000 u-boot.img
1563260 bytes read in 103 ms (14.5 MiB/s)
=> mmc dev 1 switch to partitions #0, OK mmc1(part 0) is current device
=> mmc write 0x82000000 0xD8 3055 MMC write: dev # 1, block # 216, count 12373 … 12373 blocks written: OK
=> C
U-Boot SPL 2025.10-00515-gecdc3872a767 (Oct 13 2025 - 22:49:21 +0530) Trying to boot from MMC2
the indexes are changing when im booting