Debian jessie (4.4.113-ti-r148) boots to rescue mode when cape attached (u-boot 2018.03+rootwait 1?)

I have a custom .conf for image-builder that’s based on the beaglebone ones, except that I have a handful of extra packages and copy some extra files into the image. Periodically, I update this against image-builder:master. I’ve been using jessie with a 4.4 kernel for a while quite successfully, I just updated the other day and now my flashed images won’t boot properly if the cape is attached. If I detach the cape & boot, all is fine.

With the cape attached, it boots into the rescue-service, but journalctl -xb shows no [obvious!] errors. I can actually continue the boot and get to a normal state if I enter systemctl default from the rescue-shell.

After some debugging (hard to attach USB-serial when there’s a cape attached!), I think i have it narrowed down. In comparing the boot output, the u-boot command line seems to be getting an extra “1” after rootwait when the cape is on, but not otherwise. I’m guessing that perhaps this stray “1” causes systemd to fail to load the “target” and so it goes to rescue-mode. I’m guessing this “1” comes from u-boot? The u-boot version is set in the chroot/beagleboard.org-jessie.sh script as follows:

u_boot_release=“v2018.03”

With the cape:

debug: [console=ttyO0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait 1 coherent_pool=1M net.ifnames=0] …
debug: [bootz 0x82000000 0x88080000:5363d1 0x88000000] …

Without the cape:

debug: [console=ttyO0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0] …
debug: [bootz 0x82000000 0x88080000:5363d1 0x88000000] …

This is the only difference in the boot sequence until it gets to the point where the rescue-service starts with the cape attached. The cape is pretty simple, it’s a BTLE module that is connected to ttyO5 with a couple of GPIOs for resetting etc. (and it has worked just fine with previous image-builder incarnations). Oh, I also use --dtb beaglebone-nohdmi when building the image.

FWIW, here’s the full boot sequence with the cape attached (note: in this run I moved the .dtbo file from /lib/firmware while debugging, but it does the same with it in place):

U-Boot SPL 2018.03-00002-g254339602c (Mar 16 2018 - 12:36:44 -0500)
Trying to boot from MMC2
Loading Environment from EXT4… Card did not respond to voltage select!
** Bad device mmc 0 **
Failed (-5)

U-Boot 2018.03-00002-g254339602c (Mar 16 2018 - 12:36:44 -0500), Build: jenkins-github_Bootloader-Builder-42

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.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4… Card did not respond to voltage select!
** Bad device mmc 0 **
Failed (-5)
Board: BeagleBone Black
not set. Validating first E-fuse MAC
BeagleBone Black:
debug: process_cape_part_number:[BB-BLE]
debug: process_cape_part_number:[42422D424C45]
BeagleBone: cape eeprom: i2c_probe: 0x54: /lib/firmware/BB-BLE-00A0.dtbo [0x1a9643f]
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=[00C0] …
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
814 bytes read in 15 ms (52.7 KiB/s)
Loaded environment from /boot/uEnv.txt
debug: [dtb=am335x-boneblack-emmc-overlay.dtb] …
Using: dtb=am335x-boneblack-emmc-overlay.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.4.113-ti-r148 …
9447320 bytes read in 614 ms (14.7 MiB/s)
loading /boot/dtbs/4.4.113-ti-r148/am335x-boneblack-emmc-overlay.dtb …
60416 bytes read in 34 ms (1.7 MiB/s)
uboot_overlays: add [enable_uboot_overlays=1] to /boot/uEnv.txt to enable…
loading /boot/initrd.img-4.4.113-ti-r148 …
5465041 bytes read in 361 ms (14.4 MiB/s)
debug: [console=ttyO0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait 1 coherent_pool=1M net.ifnames=0] …
debug: [bootz 0x82000000 0x88080000:5363d1 0x88000000] …

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fac9000, end 8ffff3d1 … OK
Loading Device Tree to 8fab7000, end 8fac8bff … OK

Starting kernel …

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.113-ti-r148 (root@b1-am57xx-beagle-x15-2gb) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP Wed Mar 7 19:19:19 UTC 2018
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: TI AM335x BeagleBone Black
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon )
[ 0.000000] PERCPU: Embedded 13 pages/cpu @df91e000 s24192 r8192 d20864 u53248
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129408
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait 1 coherent_pool=1M net.ifnames=0
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 442972K/522240K available (12521K kernel code, 1016K rwdata, 4068K rodata, 832K init, 857K bss, 30116K reserved, 49152K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xe0800000 - 0xff800000 ( 496 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc103b734 (16590 kB)
[ 0.000000] .init : 0xc103c000 - 0xc110c000 ( 832 kB)
[ 0.000000] .data : 0xc110c000 - 0xc120a0e8 (1017 kB)
[ 0.000000] .bss : 0xc120d000 - 0xc12e35b4 ( 858 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[ 0.000016] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000041] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000054] OMAP clocksource: timer1 at 24000000 Hz
[ 0.000892] clocksource_probe: no matching clocksources found
[ 0.001099] Console: colour dummy device 80x30
[ 0.001126] WARNING: Your ‘console=ttyO0’ has been replaced by ‘ttyS0’
[ 0.001133] This ensures that you still see kernel messages. Please
[ 0.001140] update your kernel commandline.
[ 0.001161] Calibrating delay loop… 995.32 BogoMIPS (lpj=1990656)
[ 0.046715] pid_max: default: 32768 minimum: 301
[ 0.046868] Security Framework initialized
[ 0.046883] Yama: becoming mindful.
[ 0.046922] AppArmor: AppArmor disabled by boot time parameter
[ 0.047093] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.047106] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.047958] Initializing cgroup subsys io
[ 0.047992] Initializing cgroup subsys memory
[ 0.048038] Initializing cgroup subsys devices
[ 0.048057] Initializing cgroup subsys freezer
[ 0.048074] Initializing cgroup subsys net_cls
[ 0.048090] Initializing cgroup subsys perf_event
[ 0.048105] Initializing cgroup subsys net_prio
[ 0.048129] Initializing cgroup subsys pids
[ 0.048188] CPU: Testing write buffer coherency: ok
[ 0.048250] ftrace: allocating 37709 entries in 111 pages
[ 0.155042] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[ 0.155175] Setting up static identity map for 0x80008280 - 0x800082e0
[ 0.159579] Brought up 1 CPUs
[ 0.159606] SMP: Total of 1 processors activated (995.32 BogoMIPS).
[ 0.159614] CPU: All CPU(s) started in SVC mode.
[ 0.161194] devtmpfs: initialized
[ 0.180084] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.201088] omap_hwmod: debugss: _wait_target_disable failed
[ 0.242384] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.242421] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.246493] xor: measuring software checksum speed
[ 0.282720] arm4regs : 1219.000 MB/sec
[ 0.322718] 8regs : 1091.000 MB/sec
[ 0.362712] 32regs : 1089.000 MB/sec
[ 0.402711] neon : 1739.000 MB/sec
[ 0.402720] xor: using function: neon (1739.000 MB/sec)
[ 0.402850] pinctrl core: initialized pinctrl subsystem
[ 0.404371] NET: Registered protocol family 16
[ 0.408052] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.408984] cpuidle: using governor ladder
[ 0.409004] cpuidle: using governor menu
[ 0.414903] OMAP GPIO hardware version 0.1
[ 0.427022] No ATAGs?
[ 0.427057] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.427608] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[ 0.427622] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[ 0.506739] raid6: neonx2 gen() 1873 MB/s
[ 0.574733] raid6: neonx2 xor() 1160 MB/s
[ 0.574742] raid6: using algorithm neonx2 gen() 1873 MB/s
[ 0.574749] raid6: … xor() 1160 MB/s, rmw enabled
[ 0.574756] raid6: using intx1 recovery algorithm
[ 0.584109] edma 49000000.edma: TI EDMA DMA engine driver
[ 0.587213] vgaarb: loaded
[ 0.587840] SCSI subsystem initialized
[ 0.588603] usbcore: registered new interface driver usbfs
[ 0.588681] usbcore: registered new interface driver hub
[ 0.588794] usbcore: registered new device driver usb
[ 0.589413] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[ 0.590989] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[ 0.591245] media: Linux media interface: v0.10
[ 0.591318] Linux video capture interface: v2.00
[ 0.591438] pps_core: LinuxPPS API ver. 1 registered

Ah, you found a fun bug in the old path.. I'll fix it up for the next
person, but you can go down the new path with your setup...

console=ttyO0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait
1 coherent_pool=1M net.ifnames=0

This was set by:

"args_mmc=run finduuid;setenv bootargs console=${console} " \
"${cape_disable} " \
"${cape_enable} " \
"${cape_uboot} " \
"root=PARTUUID=${uuid} ro " \
"rootfstype=${mmcrootfstype} " \
"${uboot_detected_capes} " \
"${cmdline}\0" \

the 1 comes from uboot_detected_capes, which get's set to 1 when it
detects a cape, then i use it to pass the name of the cape the kernel
via:

"if test -n ${uboot_detected_capes}; then " \
    "echo uboot_overlays:
[uboot_detected_capes=${uboot_detected_capes_addr0}${uboot_detected_capes_addr1}${uboot_detected_capes_addr2}${uboot_detected_capes_addr3}]
... ;" \
   "setenv uboot_detected_capes
uboot_detected_capes=${uboot_detected_capes_addr0}${uboot_detected_capes_addr1}${uboot_detected_capes_addr2}${uboot_detected_capes_addr3};
" \
"fi;" \

But that's hidden behind:

"if test -n ${enable_uboot_overlays}; then " \

So also looking what your doing:

Loaded environment from /boot/uEnv.txt
debug: [dtb=am335x-boneblack-emmc-overlay.dtb] ...
Using: dtb=am335x-boneblack-emmc-overlay.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.4.113-ti-r148 ...
9447320 bytes read in 614 ms (14.7 MiB/s)
loading /boot/dtbs/4.4.113-ti-r148/am335x-boneblack-emmc-overlay.dtb ...
60416 bytes read in 34 ms (1.7 MiB/s)
uboot_overlays: add [enable_uboot_overlays=1] to /boot/uEnv.txt to enable...
loading /boot/initrd.img-4.4.113-ti-r148 ...

in /boot/uEnv.txt

remove your: dtb=am335x-boneblack-emmc-overlay.dtb

Then set:

enable_uboot_overlays=1
disable_uboot_overlay_video=1

Also.. we can whitelist the video based on your cape in u-boot:

debug: process_cape_part_number:[BB-BLE]
debug: process_cape_part_number:[42422D424C45]
BeagleBone: cape eeprom: i2c_probe: 0x54:
/lib/firmware/BB-BLE-00A0.dtbo [0x1a9643f]

Just create a pull request on:

https://github.com/beagleboard/bb.org-overlays

and i'll then add it to the u-boot white list.. (that way video get's
auto disabled)

Regards,

Making this change solved it. I updated my bb_ble_image.sh script to add --enable-uboot-cape-overlays and move from --dtb beaglebone-nohdmi to --dtb beagblebone. However, I couldn’t see a way when invoking setup_sdcard.sh to set disable_uboot_overlay_video=1 in uEnv.txt via the command line. So I made the following change to add a custom --disable-uboot-overlay-video option to setup_sdcard.sh (which temporarily helps me out in this case!):

diff --git a/tools/setup_sdcard.sh b/tools/setup_sdcard.sh
index 9d86f92…b9de76e 100755
— a/tools/setup_sdcard.sh
+++ b/tools/setup_sdcard.sh
@@ -1266,7 +1266,11 @@ populate_rootfs () {
echo “###” >> ${wfile}
echo “###Disable auto loading of virtual capes (emmc/video/wireless/adc)” >> ${wfile}
echo “#disable_uboot_overlay_emmc=1” >> ${wfile}

  • echo “#disable_uboot_overlay_video=1” >> ${wfile}
  • if [ “x${uboot_overlay_video}” = “xdisable” ] ; then
  • echo “disable_uboot_overlay_video=1” >> ${wfile}
  • else
  • echo “#disable_uboot_overlay_video=1” >> ${wfile}
  • fi
    echo “#disable_uboot_overlay_audio=1” >> ${wfile}
    echo “#disable_uboot_overlay_wireless=1” >> ${wfile}
    echo “disable_uboot_overlay_adc=1” >> ${wfile}
    @@ -2041,6 +2045,9 @@ while [ ! -z “$1” ] ; do
    –enable-uboot-pru-rproc-414ti)
    uboot_pru_rproc_414ti=“enable”
    ;;
  • –disable-uboot-overlay-video)
  • uboot_overlay_video=“disable”
  • ;;
    –efi)
    uboot_efi_mode=“enable”
    ;;

With this I now have an eMMC flasher image that creates the correct /boot/uEnv.txt after flashing.

Please let me know if there is a better way to disable video (I just need a cmd line option vs whitelisting), there are other options that you might want to control (e.g. audio, adc etc) so maybe a more generalized version of this would be a nice enhancement.

Many thanks!

-W

Yeah, let's do that, can you share your tree/patch, i'll merge that
and add the adc disable option too..

Regards,