Hey it seems I can't get a fresh BeagleBone to boot from the emmc without physically removing the SD card:

What I did:

  • get fresh BBB from box
  • insert 32 GB sandisk SDHC flashed with bela_image_v0.3.8h.img using Balena Etcher on Windows
  • hold BBB boot button and connect 5V 2A power via barrel jack
  • login over ssh, run /opt/Bela/bela_flash_emmc.sh and wait for finish and print Flashing was successful
  • reboot without holding boot button so it should boot from eMMC:
    • by shutdown now, waiting a bit, removing barrel power and then reapplying power after a few seconds.
    • or by running reboot (could this work at all? does calling reboot get the BBB to retry all 4 boot options?)

Now at this point I would expect it to be booted from the eMMC. However if I run mount | grep "on / " I still get /dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered) indicating it is still running from the SD card... If I however completely remove the SD card it boots up fine from the eMMC.

I tried this with two Beaglebones btw.

I'm a bit confused now and I would've hoped to be producing by now, but I have to get the SD+emmc flashing right first.

    Ward by shutdown now, waiting a bit, removing barrel power and then reapplying power after a few seconds.

    This should definitely work. The reboot one wouldn't because the button is sampled only on a hard reboot. Does it successfully boot from emmc if you boot without the sd card?

    Yes if I remove the SD card from the BBB it boots from the eMMC

    Is this with a plain BBB with nothing inserted in its pins? There are 16 pins on P8 that decide boot order alongside the button

    Yes plain BBB and plain image Inmentioned above. Only ethernet connected and 5V 2A supply on the barrel jack, no jumpers or PCBs connected

    I recommend you connect a uart cable to the 5x1 header of the bbb and look at the boot log there

    • Ward replied to this.

      giuliomoro you mean J1? With something like this or this?

      Can the boot logs also be read from the Linux after booting somewhere or does it only log over uart while booting?

      Alright so I used an ESP32 I had laying around to forward uart to serial print and I get this:

      Without holding down boot button

      U-Boot SPL 2019.01-00005-g7fb319437d (Jul 03 2021 - 11:43:29 +0000)
      Trying to boot from MMC2
      Loading Environment from EXT4... 
      ** Unable to use mmc 0:1 for loading the env **
      
      
      U-Boot 2019.01-00005-g7fb319437d (Jul 03 2021 - 11:43:29 +0000)
      
      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... 
      ** Unable to use mmc 0:1 for loading the env **
      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 0 seconds
      1498 bytes read in 2 ms (731.4 KiB/s)
      booting from SD card
      board_name=[A335BNLT] ...
      board_rev=[00C0] ...
      loading am335x-boneblack.dtb
      60607 bytes read in 29 ms (2 MiB/s)
      loading /lib/firmware/BB-BELA-00A1.dtbo
      11248 bytes read in 102 ms (107.4 KiB/s)
      loading /lib/firmware/BB-BELA-CTAG-SPI-00A0.dtbo
      1643 bytes read in 48 ms (33.2 KiB/s)
      8870416 bytes read in 564 ms (15 MiB/s)
      ## Flattened Device Tree blob at 88000000
         Booting using the fdt blob at 0x88000000
         reserving fdt memory region: addr=88000000 size=72000
         Loading Device Tree to 8ff8b000, end 8fffffff ... OK
      
      Starting kernel ...
      
      [    0.002192] timer_probe: no matching timers found
      [    0.433593] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
      [    0.657793] omap_voltage_late_init: Voltage driver support not added
      [    0.664747] PM: Cannot get wkup_m3_ipc handle
      [    0.730941] PM: Cannot get wkup_m3_ipc handle
      
      
      Debian GNU/Linux 9 bela ttyS0
      
      bela login: 

      Holding down boot button

      U-Boot SPL 2019.01-00005-g7fb319437d (Jul 03 2021 - 11:43:29 +0000)
      Trying to boot from MMC1
      Loading Environment from EXT4... 
      ** Unable to use mmc 0:1 for loading the env **
      
      
      U-Boot 2019.01-00005-g7fb319437d (Jul 03 2021 - 11:43:29 +0000)
      
      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... 
      ** Unable to use mmc 0:1 for loading the env **
      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 0 seconds
      1498 bytes read in 1 ms (1.4 MiB/s)
      booting from SD card
      board_name=[A335BNLT] ...
      board_rev=[00C0] ...
      loading am335x-boneblack.dtb
      60607 bytes read in 28 ms (2.1 MiB/s)
      loading /lib/firmware/BB-BELA-00A1.dtbo
      11248 bytes read in 102 ms (107.4 KiB/s)
      loading /lib/firmware/BB-BELA-CTAG-SPI-00A0.dtbo
      1643 bytes read in 49 ms (32.2 KiB/s)
      8870416 bytes read in 564 ms (15 MiB/s)
      ## Flattened Device Tree blob at 88000000
         Booting using the fdt blob at 0x88000000
         reserving fdt memory region: addr=88000000 size=72000
         Loading Device Tree to 8ff8b000, end 8fffffff ... OK
      
      Starting kernel ...
      
      [    0.002187] timer_probe: no matching timers found
      [    0.433177] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
      [    0.657851] omap_voltage_late_init: Voltage driver support not added
      [    0.664830] PM: Cannot get wkup_m3_ipc handle
      [    0.734642] PM: Cannot get wkup_m3_ipc handle
      
      
      Debian GNU/Linux 9 bela ttyS0
      
      bela login: 

      And the diff:

      diff with-sd-no-button.txt with-sd-holding-button.txt
      2c2
      < Trying to boot from MMC2
      ---
      > Trying to boot from MMC1
      30c30
      < 1498 bytes read in 2 ms (731.4 KiB/s)
      ---
      > 1498 bytes read in 1 ms (1.4 MiB/s)
      35c35
      < 60607 bytes read in 29 ms (2 MiB/s)
      ---
      > 60607 bytes read in 28 ms (2.1 MiB/s)
      39c39
      < 1643 bytes read in 48 ms (33.2 KiB/s)
      ---
      > 1643 bytes read in 49 ms (32.2 KiB/s)
      48,52c48,52
      < [    0.002192] timer_probe: no matching timers found
      < [    0.433593] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
      < [    0.657793] omap_voltage_late_init: Voltage driver support not added
      < [    0.664747] PM: Cannot get wkup_m3_ipc handle
      < [    0.730941] PM: Cannot get wkup_m3_ipc handle
      ---
      > [    0.002187] timer_probe: no matching timers found
      > [    0.433177] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
      > [    0.657851] omap_voltage_late_init: Voltage driver support not added
      > [    0.664830] PM: Cannot get wkup_m3_ipc handle
      > [    0.734642] PM: Cannot get wkup_m3_ipc handle

      Only difference seems to be that no button starts with MMC2 (wait there's 3?? or is this off by one?) and that button starts with MMC1. Its weird because MMC2 is not even listed in the boot table

        I am no expert but it may be that the content of uEnv.txt on /dev/mmcblk1p1 (the emmc's first partition) is wrong and tells it to boot from sd card. Can you show the log booting without sd card or button?

        without sd card & not holding button

        U-Boot SPL 2019.01-00005-g7fb319437d (Jul 03 2021 - 11:43:29 +0000)
        Trying to boot from MMC2
        Loading Environment from EXT4... Card did not respond to voltage select!
        
        
        U-Boot 2019.01-00005-g7fb319437d (Jul 03 2021 - 11:43:29 +0000)
        
        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
        <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 0 seconds
        Card did not respond to voltage select!
        Card did not respond to voltage select!
        1498 bytes read in 1 ms (1.4 MiB/s)
        booting from eMMC
        board_name=[A335BNLT] ...
        board_rev=[00C0] ...
        loading am335x-boneblack.dtb
        60607 bytes read in 22 ms (2.6 MiB/s)
        loading /lib/firmware/BB-BELA-00A1.dtbo
        11248 bytes read in 83 ms (131.8 KiB/s)
        loading /lib/firmware/BB-BELA-CTAG-SPI-00A0.dtbo
        1643 bytes read in 34 ms (46.9 KiB/s)
        8870416 bytes read in 561 ms (15.1 MiB/s)
        ## Flattened Device Tree blob at 88000000
           Booting using the fdt blob at 0x88000000
           reserving fdt memory region: addr=88000000 size=72000
           Loading Device Tree to 8ff8b000, end 8fffffff ... OK
        
        Starting kernel ...
        
        [    0.002181] timer_probe: no matching timers found
        [    0.432898] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
        [    0.657036] omap_voltage_late_init: Voltage driver support not added
        [    0.663939] PM: Cannot get wkup_m3_ipc handle
        [    0.730791] PM: Cannot get wkup_m3_ipc handle
        
        
        Debian GNU/Linux 9 bela ttyS0
        
        bela login: 

        edit sorry didn't post the whole thing

          Compare the content of /uEnv.txt on /dev/mmcblk0p1 and /dev/mmcblk1p1

          /dev/mmcblk0p1/uEnv.txt

          uenvcmd=echo loading ${fdtfile}; load mmc ${mmcid}:2 ${fdtaddr} boot/dtbs/${uname_r}/${fdtfile}; if env exists uboot_overlay_addr0; then setenv overlay ${uboot_overlay_addr0}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr1; then setenv overlay ${uboot_overlay_addr1}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr2; then setenv overlay ${uboot_overlay_addr2}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr3; then setenv overlay ${uboot_overlay_addr3}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr4; then setenv overlay ${uboot_overlay_addr4}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr5; then setenv overlay ${uboot_overlay_addr5}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr6; then setenv overlay ${uboot_overlay_addr6}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr7; then setenv overlay ${uboot_overlay_addr7}; run bela_loadoverlay; fi; load mmc ${mmcid}:2 ${loadaddr} /boot/vmlinuz-${uname_r}; setenv bootargs console=${console} root=/dev/mmcblk${mmcid}p2 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet; bootz ${loadaddr} - ${fdtaddr};
          bela_loadoverlay=echo loading ${overlay}; load mmc ${mmcid}:2 ${rdaddr} ${overlay}; fdt addr $fdtaddr; fdt resize 0x60000; fdt apply ${rdaddr}; fdt resize 0x60000;
          
          uboot_overlay_addr2=/lib/firmware/BB-BELA-00A1.dtbo
          uboot_overlay_addr3=/lib/firmware/BB-BELA-CTAG-SPI-00A0.dtbo
          
          console=ttyS0,115200n8
          uname_r=4.14.108-ti-xenomai-r143
          mmcid=0

          /dev/mmcblk1p1/uEnv.txt

          uenvcmd=echo loading ${fdtfile}; load mmc ${mmcid}:2 ${fdtaddr} boot/dtbs/${uname_r}/${fdtfile}; if env exists uboot_overlay_addr0; then setenv overlay ${uboot_overlay_addr0}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr1; then setenv overlay ${uboot_overlay_addr1}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr2; then setenv overlay ${uboot_overlay_addr2}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr3; then setenv overlay ${uboot_overlay_addr3}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr4; then setenv overlay ${uboot_overlay_addr4}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr5; then setenv overlay ${uboot_overlay_addr5}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr6; then setenv overlay ${uboot_overlay_addr6}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr7; then setenv overlay ${uboot_overlay_addr7}; run bela_loadoverlay; fi; load mmc ${mmcid}:2 ${loadaddr} /boot/vmlinuz-${uname_r}; setenv bootargs console=${console} root=/dev/mmcblk${mmcid}p2 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet; bootz ${loadaddr} - ${fdtaddr};
          bela_loadoverlay=echo loading ${overlay}; load mmc ${mmcid}:2 ${rdaddr} ${overlay}; fdt addr $fdtaddr; fdt resize 0x60000; fdt apply ${rdaddr}; fdt resize 0x60000;
          
          uboot_overlay_addr2=/lib/firmware/BB-BELA-00A1.dtbo
          uboot_overlay_addr3=/lib/firmware/BB-BELA-CTAG-SPI-00A0.dtbo
          
          console=ttyS0,115200n8
          uname_r=4.14.108-ti-xenomai-r143
          mmcid=1

          diff mmc0 mmc1

          9c9
          < mmcid=0
          ---
          > mmcid=1

          That looks as expected.
          Now diff this

          Ward Without holding down boot button

          and this

          Ward without sd card & not holding button

          diff with-sd-holding-button.txt without-sd-no-button.txt
          2,4c2,3
          < Trying to boot from MMC1
          < Loading Environment from EXT4...
          < ** Unable to use mmc 0:1 for loading the env **
          ---
          > Trying to boot from MMC2
          > Loading Environment from EXT4... Card did not respond to voltage select!
          18,19c17
          < Loading Environment from EXT4...
          < ** Unable to use mmc 0:1 for loading the env **
          ---
          > Loading Environment from EXT4... Card did not respond to voltage select!
          29a28,29
          > Card did not respond to voltage select!
          > Card did not respond to voltage select!
          31c31
          < booting from SD card
          ---
          > booting from eMMC
          35c35
          < 60607 bytes read in 28 ms (2.1 MiB/s)
          ---
          > 60607 bytes read in 22 ms (2.6 MiB/s)
          37c37
          < 11248 bytes read in 102 ms (107.4 KiB/s)
          ---
          > 11248 bytes read in 83 ms (131.8 KiB/s)
          39,40c39,40
          < 1643 bytes read in 49 ms (32.2 KiB/s)
          < 8870416 bytes read in 564 ms (15 MiB/s)
          ---
          > 1643 bytes read in 34 ms (46.9 KiB/s)
          > 8870416 bytes read in 561 ms (15.1 MiB/s)
          48,52c48,52
          < [    0.002187] timer_probe: no matching timers found
          < [    0.433177] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
          < [    0.657851] omap_voltage_late_init: Voltage driver support not added
          < [    0.664830] PM: Cannot get wkup_m3_ipc handle
          < [    0.734642] PM: Cannot get wkup_m3_ipc handle
          ---
          > [    0.002181] timer_probe: no matching timers found
          > [    0.432898] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
          > [    0.657036] omap_voltage_late_init: Voltage driver support not added
          > [    0.663939] PM: Cannot get wkup_m3_ipc handle
          > [    0.730791] PM: Cannot get wkup_m3_ipc handle

          Diff the ones without button! With sd vs without sd

          Ah my bad

          diff with-sd-no-button.txt without-sd-no-button.txt
          3,4c3
          < Loading Environment from EXT4...
          < ** Unable to use mmc 0:1 for loading the env **
          ---
          > Loading Environment from EXT4... Card did not respond to voltage select!
          18,19c17
          < Loading Environment from EXT4...
          < ** Unable to use mmc 0:1 for loading the env **
          ---
          > Loading Environment from EXT4... Card did not respond to voltage select!
          30,31c28,31
          < 1498 bytes read in 2 ms (731.4 KiB/s)
          < booting from SD card
          ---
          > Card did not respond to voltage select!
          > Card did not respond to voltage select!
          > 1498 bytes read in 1 ms (1.4 MiB/s)
          > booting from eMMC

          OK so maybe I have misinterpreted things earlier and all looks as expected.
          The big picture is that without button:

          • if a valid boot partition is found on the emmc, the am3358 always boots from it.
          • The bootloader from emmc then checks if the sd card is valid for boot and if it is it reads uEnv.txt from it and boots Linux from sd card otherwise it continues booting from emmc
          • if no valid boot partition is found on emmc or when pressing the button, it boots directly from sd card.

          So what you are observing seems expected behaviour.

          Ward . I plan to add a 32 SDHC card with a valid image + extra storage space for samples. Then if the eMMC image breaks the user can hold the SD boot button to boot a valid image, and copy the SD image to the eMMC using /opt/Bela/bela_flash_emmc.sh.

          I think I thought of this the other way around: keep the eMMC as a backup and always boot from SD card. That would be easiest, being things as they are.

          • Ward replied to this.

            giuliomoro So what you are observing seems expected behaviour.

            Ah so then there's also some misunderstanding on my side.

            My assumption (mostly based on the problems Pi users have with SD card corruption) is that SD cards are less durable than eMMC memory. Therefore I thought: boot and run Bela from eMMC and have another valid Bela image on the SD card as backup for if the eMMC image gets messed up somehow. Then the only thing end users would need to do to unbrick their unit is hold the boot button and apply power to fix the eMMC.

            giuliomoro The bootloader from emmc then checks if the sd card is valid for boot and if it is it reads uEnv.txt from it and boots Linux from sd card otherwise it continues booting from emmc

            Could you point me into the right direction to disable this step? Is that in /dev/mmcblk0p1/uEnv.txt ?

            I am unsure where that decision is made. I think the logic for switching to sd card when booting from emmc may be baked into the uboot binary. Not sure how that works, maybe it overrides the content of the mmc variable which is then used by uenvcmd to put together the flattened device tree and boot linux. You may be able to override that by hardcoding partitions in uenvcmd, but you'll have to try it for yourself.

            However, I think you should consider the emmc as the backup storage and the sd card as the "corruptible" one. Then you should be just fine using the default configuration and using the emmc to flash the sd if the latter fails. In that case you may have to use md or gpio (if it works) in uenvcmd to avoid booting from sd card when your button (which should be different from the one you are currently using) is pressed. As a matter of fact you could make the booting from sd your default and upon some button press boot from emmc where you'll hopefully be able to hardcode avoid jumping to sd.

            • Ward replied to this.