SYSBOOT set to MMC1,MMC0 but MMC0 always booted if SD Card present

I’ve got a custom board with SYSBOOT boot order set to always prefer the onboard eMMC (MMC1) over the SD card (MMC0), but after initial flash of the eMMC it always boots from the SD card if it is present.

I’m speculating that SPL is loaded from MMC1 as I expect but then it is using MMC0 as the root device and booting from there. If that is the case, what changes are necessary to u-boot and or uEnv.txt to always boot from eMMC / MMC1 unless the button to boot from SD is held?

Here is output from /dev/ttyO0 during both scenarios:

eMMC only, no SD card present

U-Boot SPL 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500)
Trying to boot from MMC2
Loading Environment from EXT4… Card did not respond to voltage select!

U-Boot 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500), Build: jenkins-github_Bootloader-Builder-144

CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver ‘omap_hsmmc’
No match for driver ‘omap_hsmmc’
Some drivers were not found
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4… Card did not respond to voltage select!
Board: BeagleBone Black
not set. Validating first E-fuse MAC
BeagleBone Black:
BeagleBone Cape EEPROM: no EEPROM at address: 0x54
BeagleBone Cape EEPROM: no EEPROM at address: 0x55
BeagleBone Cape EEPROM: no EEPROM at address: 0x56
BeagleBone Cape EEPROM: no EEPROM at address: 0x57
Net: eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 0 seconds
board_name=[A335BNLT] …
board_rev=[] …
Card did not respond to voltage select!
Card did not respond to voltage select!
Card did not respond to voltage select!
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
Card did not respond to voltage select!
Card did not respond to voltage select!
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1…
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc1(part 0) is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt …
Checking for: /boot.scr …
Checking for: /boot/boot.scr …
Checking for: /boot/uEnv.txt …
gpio: pin 55 (gpio 55) value is 1
1054 bytes read in 45 ms (22.5 KiB/s)
Loaded environment from /boot/uEnv.txt
debug: [dtb=xxxxx.dtb] …
Using: dtb=xxxx.dtb …
Checking if uname_r is set in /boot/uEnv.txt…
gpio: pin 56 (gpio 56) value is 1
Running uname_boot …
loading /boot/vmlinuz-4.19.94-ti-r43 …
10097528 bytes read in 706 ms (13.6 MiB/s)
debug: [enable_uboot_overlays=1] …
debug: [enable_uboot_cape_universal=1] …
debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] …
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] …
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb …
loading /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.dtb …
60334 bytes read in 59 ms (998 KiB/s)
uboot_overlays: [fdt_buffer=0x60000] …
uboot_overlays: loading /lib/firmware/BB-ADC-00A0.dtbo …
867 bytes read in 318 ms (2 KiB/s)
uboot_overlays: loading /lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo …
1584 bytes read in 68 ms (22.5 KiB/s)
uboot_overlays: loading /lib/firmware/BB-HDMI-TDA998x-00A0.dtbo …
4915 bytes read in 191 ms (24.4 KiB/s)
loading /boot/initrd.img-4.19.94-ti-r43 …
3342230 bytes read in 242 ms (13.2 MiB/s)
debug: [console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] …
debug: [bootz 0x82000000 0x88080000:32ff96 88000000] …

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fcd0000, end 8fffff96 … OK
Loading Device Tree to 8fc5d000, end 8fccffff … OK

SD card present

U-Boot SPL 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500)
Trying to boot from MMC2
Loading Environment from EXT4… ** File not found /boot/uboot.env **

** Unable to read “/boot/uboot.env” from mmc0:1 **

U-Boot 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500), Build: jenkins-github_Bootloader-Builder-144

CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver ‘omap_hsmmc’
No match for driver ‘omap_hsmmc’
Some drivers were not found
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4… ** File not found /boot/uboot.env **

** Unable to read “/boot/uboot.env” from mmc0:1 **
Board: BeagleBone Black
not set. Validating first E-fuse MAC
BeagleBone Black:
BeagleBone Cape EEPROM: no EEPROM at address: 0x54
BeagleBone Cape EEPROM: no EEPROM at address: 0x55
BeagleBone Cape EEPROM: no EEPROM at address: 0x56
BeagleBone Cape EEPROM: no EEPROM at address: 0x57
Net: eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 0 seconds
board_name=[A335BNLT] …
board_rev=[] …
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1…
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt …
Checking for: /boot.scr …
Checking for: /boot/boot.scr …
Checking for: /boot/uEnv.txt …
gpio: pin 55 (gpio 55) value is 1
1054 bytes read in 34 ms (30.3 KiB/s)
Loaded environment from /boot/uEnv.txt
debug: [dtb=xxxx.dtb] …
Using: dtb=xxxx.dtb …
Checking if uname_r is set in /boot/uEnv.txt…
gpio: pin 56 (gpio 56) value is 1
Running uname_boot …
loading /boot/vmlinuz-4.19.94-ti-r43 …
10097528 bytes read in 665 ms (14.5 MiB/s)
debug: [enable_uboot_overlays=1] …
debug: [enable_uboot_cape_universal=1] …
debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] …
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] …
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb …
loading /boot/dtbs/4.19.94-ti-r43/am335x-boneblack-uboot-univ.dtb …
60334 bytes read in 55 ms (1 MiB/s)
uboot_overlays: [fdt_buffer=0x60000] …
uboot_overlays: loading /lib/firmware/BB-ADC-00A0.dtbo …
867 bytes read in 310 ms (2 KiB/s)
uboot_overlays: loading /lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo …
1584 bytes read in 210 ms (6.8 KiB/s)
uboot_overlays: loading /lib/firmware/BB-HDMI-TDA998x-00A0.dtbo …
4915 bytes read in 59 ms (81.1 KiB/s)
loading /boot/initrd.img-4.19.94-ti-r43 …
3342230 bytes read in 235 ms (13.6 MiB/s)
debug: [console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] …
debug: [bootz 0x82000000 0x88080000:32ff96 88000000] …

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fcd0000, end 8fffff96 … OK
Loading Device Tree to 8fc5d000, end 8fccffff … OK

Thanks in advance,
Ryan

Have you solved the problem? I had a similar problem when BBAI inserted the SD card and was unable to start the system from eMMC.

在2020年10月13日星期二 UTC+8 上午6:40:08rnid...@gmail.com 写道:

I ended up patching the u-boot source code used by https://github.com/RobertCNelson/Bootloader-Builder to switch the boot target search order from mmc0, legacy_mmc0, mmc1, legacy_mmc1 to mmc1, legacy_mmc1, mmc0, legacy_mmc0. Then I wrote the MLO and SPL images to the image so they get used during install.

Hope that helps.