BBB boots kernel from SD card but uses distro from EMMC after kernel upgrade

Hi,

I have Gentoo installed on an SD card for my BBB. After a kernel upgrade, for some reason it seems like the board is loading the kernel from the SD card, but booting into Debian on the EMMC.

Here’s the log, I cut off where userspace begins for brevity, but please let me know if it would be helpful and I can reply back with it.

U-Boot SPL 2019.04-dirty (Aug 16 2020 - 22:13:13 -0400)
Trying to boot from MMC1
Loading Environment from EXT4… ** File not found /boot/uboot.env **

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

U-Boot 2019.04-dirty (Aug 16 2020 - 22:13:13 -0400)

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: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net: eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
board_name=[A335BNLT] …
board_rev=[000C] …
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
55 bytes read in 35 ms (1000 Bytes/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt…
gpio: pin 56 (gpio 56) value is 1
Running uname_boot …
loading /boot/vmlinuz-5.9.0-rc7-bone4.1 …
8991232 bytes read in 604 ms (14.2 MiB/s)
debug: [enable_uboot_overlays=] …
loading /boot/dtbs/5.9.0-rc7-bone4.1/am335x-boneblack.dtb …
87799 bytes read in 53 ms (1.6 MiB/s)
uboot_overlays: add [enable_uboot_overlays=1] to /boot/uEnv.txt to enable…
debug: [console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait] …
debug: [bootz 0x82000000 - 0x88000000] …

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Loading Device Tree to 8ffe7000, end 8ffff6f6 … OK

Starting kernel …

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.9.0-rc7-bone4.1 (sleepy@seraph) (arm-none-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 2019100
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=50c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129666
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 450244K/523264K available (9216K kernel code, 1200K rwdata, 3592K rodata, 1024K init, 2896K bss, 23868K reserved, 49152K cma-reserved, 0K highmem)
[ 0.000000] random: get_random_u32 called from __kmem_cache_create+0x1d/0x230 with crng_init=0
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] ftrace: allocating 42810 entries in 84 pages
[ 0.000000] ftrace: allocated 84 pages with 3 groups
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] Trampoline variant of Tasks RCU enabled.
[ 0.000000] Rude variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
[ 0.000000] TI gptimer clocksource: always-on /ocp/interconnect@44c00000/segment@200000/target-module@31000
[ 0.000009] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000026] clocksource: dmtimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000514] TI gptimer clockevent: 24000000 Hz at /ocp/interconnect@48000000/segment@0/target-module@40000
[ 0.001784] Console: colour dummy device 80x30
[ 0.001819] WARNING: Your ‘console=ttyO0’ has been replaced by ‘ttyS0’
[ 0.001825] This ensures that you still see kernel messages. Please
[ 0.001831] update your kernel commandline.
[ 0.001899] Calibrating delay loop… 995.32 BogoMIPS (lpj=1990656)
[ 0.048549] pid_max: default: 32768 minimum: 301
[ 0.049380] LSM: Security Framework initializing
[ 0.049604] Yama: becoming mindful.
[ 0.050285] AppArmor: AppArmor initialized
[ 0.050317] TOMOYO Linux initialized
[ 0.050596] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.050620] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.054380] CPU: Testing write buffer coherency: ok
[ 0.054541] CPU0: Spectre v2: using BPIALL workaround
[ 0.056619] Setting up static identity map for 0x80100000 - 0x80100054
[ 0.056947] rcu: Hierarchical SRCU implementation.
[ 0.060873] EFI services will not be available.
[ 0.062002] devtmpfs: initialized
[ 0.201100] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.203277] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.203319] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.207677] xor: automatically using best checksumming function neon
[ 0.207704] pinctrl core: initialized pinctrl subsystem
[ 0.212946] NET: Registered protocol family 16
[ 0.216235] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.237165] l3-aon-clkctrl:0000:0: failed to disable
[ 0.240530] audit: initializing netlink subsys (disabled)
[ 0.244171] thermal_sys: Registered thermal governor ‘fair_share’
[ 0.244178] thermal_sys: Registered thermal governor ‘bang_bang’
[ 0.244195] thermal_sys: Registered thermal governor ‘step_wise’
[ 0.244704] audit: type=2000 audit(0.232:1): state=initialized audit_enabled=0 res=1
[ 0.244813] cpuidle: using governor menu
[ 1.032582] random: fast init done
[ 1.541322] hw-breakpoint: debug architecture 0x4 unsupported.
[ 1.615692] raid6: skip pq benchmark and using algorithm neonx8
[ 1.615713] raid6: using neon recovery algorithm
[ 1.622614] iommu: Default domain type: Translated
[ 1.627361] SCSI subsystem initialized
[ 1.628905] usbcore: registered new interface driver usbfs
[ 1.629180] usbcore: registered new interface driver hub
[ 1.629425] usbcore: registered new device driver usb
[ 1.631174] pps_core: LinuxPPS API ver. 1 registered

Hi,

I have Gentoo installed on an SD card for my BBB. After a kernel upgrade, for some reason it seems like the board is loading the kernel from the SD card, but booting into Debian on the EMMC.

Here's the log, I cut off where userspace begins for brevity, but please let me know if it would be helpful and I can reply back with it.

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
55 bytes read in 35 ms (1000 Bytes/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-5.9.0-rc7-bone4.1 ...
8991232 bytes read in 604 ms (14.2 MiB/s)
debug: [enable_uboot_overlays=] ...
loading /boot/dtbs/5.9.0-rc7-bone4.1/am335x-boneblack.dtb ...
87799 bytes read in 53 ms (1.6 MiB/s)
uboot_overlays: add [enable_uboot_overlays=1] to /boot/uEnv.txt to enable...
debug: [console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait] ...

Okay, so in u-boot, we are reading from mmc0 (which is microSD) and
telling the kenrel we want to use root=/dev/mmcblk0p1 which is also
the microSD..

[ 0.000000] Linux version 5.9.0-rc7-bone4.1 (sleepy@seraph) (arm-none-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 2019100

Yay 5.9 boots. :wink:

[ 5.242340] mmc0: new high speed MMC card at address 0001
[ 5.251694] mmcblk0: mmc0:0001 M62704 3.56 GiB
[ 5.258406] mmcblk0boot0: mmc0:0001 M62704 partition 1 2.00 MiB
[ 5.266465] mmcblk0boot1: mmc0:0001 M62704 partition 2 2.00 MiB

Wait a minute.. that's the eMMC...

[ 6.457532] mmc1: new high speed SDXC card at address aaaa
[ 6.466835] mmcblk1: mmc1:aaaa SN64G 59.5 GiB
[ 6.478915] mmcblk1: p1

There's your microSD card..

Uhoh.. They swapped... That's a regression..

In 5.9 we have a brand new mmc driver..

Revert:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/am33xx.dtsi?h=v5.9-rc7&id=0b4edf111870b83ea77b1d7e16b8ceac29f9f388

and it should work again..

Regards,

Hi Robert,

Sorry for the delay in getting back to you!

I am still having the same issue with reverting that commit. This has happened to me in the past as well, I think my workaround for it at the time was to completely rewrite the rootfs onto the SD card and copy the upgraded kernel over as if I were doing a fresh install (not very efficient or smart, I know :frowning:

I think this might be an issue with my u-boot and not the kernel, I have the following defined in uEnv.txt:

uname_r=5.9.0-rc7-bone4.1
disable_uboot_overlay_emmc=1

I attempted to boot with uEnv.txt changed to uboot.env and got the following error:

U-Boot SPL 2019.04-dirty (Aug 16 2020 - 22:13:13 -0400)
Trying to boot from MMC1
Loading Environment from EXT4... *** Warning - bad CRC, using default environment

U-Boot 2019.04-dirty (Aug 16 2020 - 22:13:13 -0400)

CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
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... *** Warning - bad CRC, using default environment

Board: BeagleBone Black
<ethaddr> not set. Validating first E-fuse MAC
BeagleBone Black:
BeagleBone: cape eeprom: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net: eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
board_name=[A335BNLT] ...
board_rev=[000C] ...
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 ...
** Invalid partition 2 **
** Invalid partition 3 **
** Invalid partition 4 **
** Invalid partition 5 **
** Invalid partition 6 **
** Invalid partition 7 **
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
64 bytes read in 17 ms (2.9 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-5.8.1-bone12 ...
8884736 bytes read in 578 ms (14.7 MiB/s)
debug: [enable_uboot_overlays=] ...

unable to find [dtb=am335x-boneblack.dtb] did you name it correctly? ...

FAILSAFE: U-Boot UMS (USB Mass Storage) enabled, media now available over the usb slave port ...
Unknown command 'ums' - try 'help'
uboot_overlays: add [enable_uboot_overlays=1] to /boot/uEnv.txt to enable...
debug: [console=ttyO0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait] ...
debug: [bootz 0x82000000 - 0x88000000] ...
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
** Invalid partition 2 **
** Invalid partition 3 **
** Invalid partition 4 **
** Invalid partition 5 **
** Invalid partition 6 **
** Invalid partition 7 **
starting USB...
USB0: Port not available.
link up on port 0, speed 100, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
*** Unhandled DHCP Option in OFFER/ACK: 125
DHCP client bound to address 192.168.1.210 (1134 ms)
Using cpsw device
TFTP from server 192.168.1.1; our IP address is 192.168.1.210
Filename 'vmlinuz-5.8.1-bone12'.
Load address: 0x82000000
Loading: T T

As far as the fix I believe I've found some help from some old discussions in the google group so I don't want to waste your time to rewrite all of that out... But if there is something else that looks wrong here I would appreciate any help :slight_smile:

Thank you!

Brooke Basile

[ 0.000000] Linux version 5.9.0-rc7-bone4.1 (sleepy@seraph) (arm-none-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 2019100

Yay 5.9 boots. :wink:

[ 5.242340] mmc0: new high speed MMC card at address 0001
[ 5.251694] mmcblk0: mmc0:0001 M62704 3.56 GiB
[ 5.258406] mmcblk0boot0: mmc0:0001 M62704 partition 1 2.00 MiB
[ 5.266465] mmcblk0boot1: mmc0:0001 M62704 partition 2 2.00 MiB

Wait a minute… that’s the eMMC…

[ 6.457532] mmc1: new high speed SDXC card at address aaaa
[ 6.466835] mmcblk1: mmc1:aaaa SN64G 59.5 GiB
[ 6.478915] mmcblk1: p1

There’s your microSD card…

Uhoh… They swapped… That’s a regression…

Hi Robert,

v5.10.21 still have the eMMC as mmc0. Is this really a regression or going forward they are keeping it?

Thanks

Grab this:

https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git/commit/?h=for-next&id=9bbce32a20d6a72c767a7f85fd6127babd1410ac

Regards,

Thank you!