Hi,

I'm having an issue with my SD card image. I need to run the same image on three BBB/Bela boards, so I used WinDisk32 to copy the original image and then burn it to another SD card. Both the original card and the new card work in BBB#1, but won't work in any other BBB. I've tried the image in several other boards, but no luck. I can't get another board to run off of that SD card. I've tried using the load-from-SD button on boot, but the boards just load the original beagleboard image. I've connected to the devices over serial after boot, and I can see that both images are present, but I can't the Bela image to load and run.

root@beaglebone:~# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
mmcblk1boot0 179:16   0     1M  1 disk
mmcblk1boot1 179:24   0     1M  1 disk
mmcblk0      179:0    0  14.9G  0 disk
├─mmcblk0p1  179:1    0  67.4M  0 part /media/BELABOOT
└─mmcblk0p2  179:2    0   3.5G  0 part /media/BELAROOTFS
mmcblk1      179:8    0   3.7G  0 disk
├─mmcblk1p1  179:9    0    96M  0 part /boot/uboot
└─mmcblk1p2  179:10   0   3.6G  0 part /

This is what I get with fdisk:


Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeedb4a61

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      140000       68976+   c  W95 FAT32 (LBA)
/dev/mmcblk0p2          141312     7471103     3664896   83  Linux

Disk /dev/mmcblk1: 3925 MB, 3925868544 bytes
4 heads, 16 sectors/track, 119808 cylinders, total 7667712 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk1p1   *        2048      198655       98304    e  W95 FAT16 (LBA)
/dev/mmcblk1p2          198656     7667711     3734528   83  Linux

Disk /dev/mmcblk1boot1: 1 MB, 1048576 bytes
4 heads, 16 sectors/track, 32 cylinders, total 2048 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mmcblk1boot1 doesn't contain a valid partition table

Disk /dev/mmcblk1boot0: 1 MB, 1048576 bytes
4 heads, 16 sectors/track, 32 cylinders, total 2048 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mmcblk1boot0 doesn't contain a valid partition table

I'm tearing my hair out with this, as I need to have this exact image running in three different boards and since it's a very custom image at this point, can't start over with a new one from scratch. Any ideas as to what the problem could be?

Thanks,
Colin

    czyskows

    Sorry about this issue. If you have a serial cable, would it be possible for you to capture the first few lines of the boot log before the kernel is loaded when you are trying to boot from the copied SD card, both with and without the load-from-SD button pressed? That should help diagnose the issue.

    When you connect the copied SD card to your PC it should automatically mount the BELABOOT partition. In the uEnv.txt on the partition, the last line should read mmcid = x. What number is x on your image?

    Hi Liam,

    Here are the first few lines without button pressed:

    U-Boot SPL 2014.04-00015-gb4422bd (Apr 22 2014 - 13:24:29)
    reading args
    spl_load_image_fat_os: error reading image args, err - -1
    reading u-boot.img
    reading u-boot.img
    
    
    U-Boot 2014.04-00015-gb4422bd (Apr 22 2014 - 13:24:29)
    
    I2C:   ready
    DRAM:  512 MiB
    NAND:  0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Warning - readenv() failed, using default environment

    With button pressed:

    U-Boot SPL 2017.03-dirty (Nov 08 2017 - 18:25:49)
    Trying to boot from MMC1
    reading u-boot.img
    reading u-boot.img
    
    
    U-Boot 2017.03-dirty (Nov 08 2017 - 18:25:49 +0000)
    
    CPU  : AM335X-GP rev 2.1
    I2C:   ready
    DRAM:  512 MiB
    Reset Source: Global external warm reset has occurred.
    Reset Source: Power-on reset has occurred.
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    Using default environment
    
    <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
    Hit any key to stop autoboot:  0
    reading uEnv.txt
    487 bytes read in 4 ms (118.2 KiB/s)
    booting from SD card
    ## Error: "initrd_file" not defined
     **Bad device specification mmc 0
     **Bad device specification mmc 0
    ' - try 'help'd '
    =>

    And here is the entire uEnv.txt :

    uenvcmd=load mmc ${mmcid}:1 ${fdtaddr} ${dtb};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};
    
    console=ttyS0,115200n8
    
    uname_r=4.4.87-ti-xenomai-r121
    dtb=am335x-bone-bela.dtb
    #dtb=am335x-bone-bela-black-wireless.dtb
    mmcid=0
    enable_uboot_overlays=1
    disable_uboot_overlay_video=1
    disable_uboot_overlay_audio=1

    Thanks for your help with this!
    Colin

    Ok, thanks. Looks like the Beaglebones you are using are from 2014 which is pretty old, in fact they pre-date the whole Bela project, which goes some way to explaining why our image does not boot automatically!

    When you hold the button down our boot loaders run as expected, but the failure at **Bad device specification mmc 0 is odd. It may be that our bootlloaders are accidentally loading the uEnv.txt from the old Beaglebone image on the emmc.

    After the boot has failed with the button held down you should be left with a command prompt in the serial console which you can type commands into - if so could you run these commands and post their outputs?

    print uenvcmd
    ls mmc 0:1
    ls mmc 1:1

    Here are those outputs:

    => print uenvcmd
    uenvcmd=load mmc ${mmcid}:1 ${fdtaddr} ${dtb};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};
    => ls mmc 0:1
          487   uenv.txt
        78840   mlo
       366796   u-boot.img
        57802   am335x-bone-bela-black-wireless.dtb
        55127   am335x-bone-bela.dtb
                drivers/
           28   bela.version
                system volume information/
                .spotlight-v100/
                .fseventsd/
          592   uenv.txt~
    
    7 file(s), 4 dir(s)
    => ls mmc 1:1
        81264   mlo
       401800   u-boot.img
                app/
                docs/
                drivers/
                debug/
                dtbs/
                scripts/
                .spotlight-v100/
           51   id.txt
        41174   license.txt
        16822   readme.htm
          292   readme.md
          313   soc.sh
        16822   start.htm
          223   autorun.inf
      2869994   initrd.img
         1430   uenv.txt
      2870058   uinitrd
      3717760   zimage
                system volume information/
    
    13 file(s), 8 dir(s)

    Thanks again!

    Well, that's strange. The boot fails with uboot complaining about not being able to find mmc 0, but the output of ls mmc 0:1 clearly shows that it can find mmc 0, and that it is indeed the SD card device containing the Bela image.

    What happens if you run run uenvcmd?

    If it fails, try running the following commands one after the other in order, and let me know what happens:

    load mmc 0:1 ${fdtaddr} ${dtb}
    load mmc 0:2 ${loadaddr} /boot/vmlinuz-${uname_r}
    setenv bootargs console=${console} root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet
    bootz ${loadaddr} - ${fdtaddr}

    Still no luck:

    Hit any key to stop autoboot:  0
    reading uEnv.txt
    487 bytes read in 3 ms (158.2 KiB/s)
    booting from SD card
    ## Error: "initrd_file" not defined
     **Bad device specification mmc 0
     **Bad device specification mmc 0
    ' - try 'help'd '
    => uenvcmd
    Unknown command 'uenvcmd' - try 'help'
    => load mmc 0:1 ${fdtaddr} ${dtb}
    reading am335x-bone-bela.dtb
     **Unable to read file am335x-bone-bela.dtb
    => load mmc 0:2 ${loadaddr} /boot/vmlinuz-${uname_r}
     **File not found /boot/vmlinuz-4.4.87-ti-xenomai-r121
    => setenv bootargs console=${console} root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet
    => bootz ${loadaddr} - ${fdtaddr}
    =>

    @LiamDonovan 's suggestion is to type

    run uenvcmd

    while it seems that you only did

    uenvcmd

    Ah. Derp. Sorry.

    booting from SD card
    ## Error: "initrd_file" not defined
     **Bad device specification mmc 0
     **Bad device specification mmc 0
    ' - try 'help'd '
    => run uenvcmd
     **Bad device specification mmc 0
     **Bad device specification mmc 0
    ' - try 'help'd '
    =>

    Hmm, this doesn't make a whole lot of sense. The am335x-bone-bela.dtb file is clearly there and visible when you run ls mmc 0:1, so why does the load command fail?

    Here's a couple of things to try:

    • check that the fdtaddr variable exists by running print fdtaddr
    • try running fatload mmc 0:1 ${fdtaddr} am335x-bone-bela.dtb instead of the first load command
    • when booting, mash the space bar so that the boot log stops after Hit any key to stop autoboot: and does not reach reading uEnv.txt (you might have to try this several times as the window is short) then run these commands one-after-the-other:
      load mmc 0:1 ${loadaddr} uEnv.txt
      env import -t ${loadaddr} ${filesize}
      print uenvcmd
      run uenvcmd

    If those things still don't work, just for peace of mind, try deleting the uEnv.txt~ file on the SD boot partition and see if that changes anything.

    Hi Liam,

    Still no luck:

    => load mmc 0:1 ${loadaddr} uEnv.txt
    reading uEnv.txt
    487 bytes read in 3 ms (158.2 KiB/s)
    => env import -t ${loadaddr} ${filesize}
    => print uenvcmd
    uenvcmd=load mmc ${mmcid}:1 ${fdtaddr} ${dtb};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};
    => run uenvcmd
     **Bad device specification mmc 0
     **Bad device specification mmc 0
    ' - try 'help'd '
    =>

    I also deleted the uEnv.txt~ file and it didn't change anything. I loaded different images (Beaglebone and Bela) onto these boards and they worked fine. I also ordered a couple new Beaglebones in the hope that they for some reason work. It's so completely baffling why this particular image will work on ONLY one board and no others.

    Cheers,
    Colin

    I received two new Beaglebones yesterday, wrote the images to SD cards, put them in the BBB's, and they worked! I guess the issue was some inexplicable conflict between my current Bela image and the old BBB's. Anyway, problem solved and I can now go on with my life.

    Thanks you for all the help!
    Colin