How to configure uEnv.txt to enable booting from eMMC?

Hi,

I have problems to understand how to configure uEnv.txt to get BBB to boot from eMMC.

Setup:

  1. u-boot

u-boot is created as described here:
https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-Bootloader:U-Boot

i.e.

git clone https:``//github.com/u-boot/u-boot
cd u-boot/
git checkout v2017.``03``-rc2 -b tmp

with one exception: I have included only the patch 0001

patch -p1 < ``0001``-am335x_evm-uEnv.txt-bootz-n-fixes.patch

MLO and u-boot.img are first copied to SD card.
Then BBB is booted from SD card and above files copied to eMMC :

dd ``if``=./MLO of=/dev/mmcblk1p1 count=``1 seek=``1 bs=128k
dd ``if``=./u-boot.img of=/dev/mmcblk1p1 count=``2 seek=``1 bs=384k

  1. Rootfs

The rootfs is build with Buildroot with kernel version 4.4.52 and custom am335x-boneblack.dtb and am335x-bonegreen.dtb whitch enables two serial ports (O1 & O2). ( I’m having both BBB and BBG HWs).

Rootfs is copied to first to SD card and then extracted to eMMC when BBB is booted from SD card.

  1. uEnv.txt

uEnv.txt content is the following as indicated in the eewiki’s BBB page.
uname_r=4.4.52

  1. zImage

zImage is stored to /boot folder with name vmlinuz-4.4.52 as indicated in the eewiki’s BBB page.

  1. The problem / Questions

Booting starts well but stops at the following point

mm1: new high speed MMC card at address 0001
mmcblkk0: mmc1:0001 MMC04G 3.66 GiB
mmcblk0boot0: mmc:0001 MMC04G partition 1 1.00 MiB
mmcblk0boot1: mmc:0001 MMC04G partition 2 1.00 Mib
mmcblk0: p1
Waiting for root device /dev/mmcblk1p1…

=> so suddenly eMMC has changed it’s identity to mmcblk0 and apparently /dev/mmcblk1p1 doesn’t exist any more preventing booting from eMMC.

Q: why this identity change happens?
Q: what need to added into uEnv.txt to get booting from eMMC working?

  1. Dirty hack / good luck

I’have managed to get BBB to boot from eMMC when having the following configuration

Files:

  • zImage
  • uEnv.txt
  • am335x-boneblack.dtb and am335x-bonegreen.dtb
    are saved into root of eMMC.

The uEnv.txt has the following lines which I copied from the Buildroot Training Lab Book (buildroot-labs.pdf) by Free-Electrons.com.

bootdir=
bootpart=0:1
uenvcmd=run loadimage;run loadramdisk;run findfdt;run loadfdt;run mmcloados

So, I’ve managed to get eMMC booting with a good luck without really knowing what I’m doing.
Now I’d like to understand what is the correct way to configure BBB to boot from eMMC (+ preferable so that uEnv.txt & vmlinuz-4.4.52 are stored to /boot folder).

BR
Timo Välimäki