u-boot overlays, what filesystem?

I am configuring a microSD card for BeagleBone Black. It must begin with a FAT filesystem in p1, because this allows the card to be inserted into a Windows PC for configuration chores. It loads MLO/u-boot from FAT, then rootfs is p2 (ext4). This card boots fine, however, I have not managed to get u-boot overlays working. I suspect that I don’t understand which filesystems are in play.

I’d guess that overlays are loaded from the boot filesystem p1, since u-boot has no reason to mount rootfs. So I copied /lib/firmware/PB-I2C1-RTC-6-CLICK.dtb there and added:

uname_r=4.14.51-bone-rt-r16

enable_uboot_overlays=1
uboot_overlay_addr0=/dtbs/${uname_r}/PB-I2C1-RTC-6-CLICK.dtbo

This does not work. I have also tried /boot/dtbs/… (in case /boot is a magic string) and dtbs/… (leading slash) and /lib/firmware/ (in case it knows more about rootfs than I thought).

I have another Beaglebone Black here, running single-partition, in which this works just fine:

uname_r=4.14.8-bone-rt-r11
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/BB-UART2-RS485-00A0.dtbo
uboot_overlay_addr1=/lib/firmware/PB-I2C2-RTC-6-CLICK.dtbo

So, I don’t know what else to try… Help?

First "PB" = PocketBeagle

PB-I2C2-RTC-6-CLICK.dtbo's pin setting isn't going to align with the
BeagleBone Black

Second what version of u-boot?

You can run, but it may not pick up MLO in the FAT partition..

sudo /opt/scripts/tools/version.sh

U-boot Overlays are only enabled if you use /boot/uEnv.txt for
booting, if you are doing a base /uEnv.txt it get's disabled..

Regards,

I have a mikroBUS cape (https://www.mikroe.com/beaglebone-mikrobus-cape) with an RS485-2 in slot 1, and RTC-6 Click in slot 2.

u-boot version is… hmm, scripts/tools/version.sh doesn’t show it. Odd. I just built it last week.

The same PB-I2C1-RTC-6 is working in another BeagleBone. (I know, PB means PocketBeagle. I read thru the dts and figured it should work, and it does.)

Ah, uEnv.txt in /boot. I’ll try that…

…after moving /uEnv.txt to /boot/uEnv.txt (on the FAT partition) it doesn’t boot at all. Ditto /uboot/uEnv.txt.

Split the file? Just the overlay stuff in /uboot/uEnv.txt… It boots, but, no overlays. In /boot/uEnv.txt… nope.

Sigh.

version.sh grubs u-boot version from u-boot.img and mine is “misplaced”. I see U-Boot 2018.03-dirty.

I have a mikroBUS cape (mikroBUS Cape Board | Extension for BeagleBone Black - MikroE)
with an RS485-2 in slot 1, and RTC-6 Click in slot 2.

u-boot version is... hmm, scripts/tools/version.sh doesn't show it. Odd. I
just built it last week.

Yeah, version.sh doesn't 100% know how to find it when it's a file.
it's only good when MLO/u-boot.img are dd'ed to the MBR...

Okay, what version of u-boot?

Here's the version we recommend with overlay patches:

https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-Bootloader:U-Boot

The same PB-I2C1-RTC-6 is working in another BeagleBone. (I know, PB means
PocketBeagle. I read thru the dts and figured it should work, and it does.)

Ah, cool didn't notice it used the same pin's..

Ah, uEnv.txt in /boot. I'll try that...

..after moving /uEnv.txt to /boot/uEnv.txt (on the FAT partition) it doesn't
boot at all. Ditto /uboot/uEnv.txt.

They aren't really compatible.. /uEnv.txt was the old way, "/boot/uEnv.txt"

Split the file? Just the overlay stuff in /uboot/uEnv.txt... It boots,
but, no overlays. In /boot/uEnv.txt... nope.

So in your /boot/uEnv.txt (on the 2nd partition) just have:

uname_r=4.14.51-bone-rt-r16
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/PB-I2C1-RTC-6-CLICK.dtbo

Regards,

and if you have a usb serial-debug cable plugged into J1, so we can
see what u-boot is doing..

You'll have to remove the cape, but we can then see what u-boot is doing..

Regards,

Your wish is my command:

U-Boot SPL 2018.03-dirty (Jun 29 2018 - 09:25:36 -0400)
Trying to boot from MMC1
Loading Environment from EXT4…
** Unable to use mmc 0:1 for loading the env **
Failed (-5)

U-Boot 2018.03-dirty (Jun 29 2018 - 09:25:36 -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…
** Unable to use mmc 0:1 for loading the env **
Failed (-5)
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=[00C0] …
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Bad device 0:2 0x82000000 **
** Bad device 0:2 0x82000000 **
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 …
828 bytes read in 3 ms (269.5 KiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from /uEnv.txt
Importing environment from mmc …
Checking if uenvcmd is set …
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd …
828 bytes read in 3 ms (269.5 KiB/s)
10134016 bytes read in 635 ms (15.2 MiB/s)
60856 bytes read in 11 ms (5.3 MiB/s)

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Using Device Tree in place at 88000000, end 88011db7

In your first partition, rename /uEnv.txt to /uEnv-old.txt

Then u-boot will scan for /boot/uEnv.txt in partitions 1 -> 7..

Regards,

So now, on the first partition (FAT) I have no /uEnv.txt (nor /boot nor /uboot). I do have:

config-4.14.51-bone-rt-r16
dtbs
initrd.img-4.14.51-bone-rt-r16
MLO
System.map-4.14.51-bone-rt-r16
‘System Volume Information’
u-boot.img
uEnv.txt-old
vmlinuz-4.14.51-bone-rt-r16

On the second partition (EXT4) I have this in /boot/uEnv.txt:

uname_r=4.14.51-bone-rt-r16
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/PB-I2C1-RTC-6-CLICK.dtbo

loadaddr=0x82000000
fdtaddr=0x88000000
rdaddr=0x88080000

initrd_high=0xffffffff
fdt_high=0xffffffff

#boot is first partition
#root is second partition
mmcroot=/dev/mmcblk0p2

loadximage=load mmc 0:1 ${loadaddr} /vmlinuz-${uname_r}
loadxfdt=load mmc 0:1 ${fdtaddr} /dtbs/${uname_r}/${fdtfile}
loadxrd=load mmc 0:1 ${rdaddr} /initrd.img-${uname_r}; setenv rdsize ${filesize}
loaduEnvtxt=load mmc 0:1 ${loadaddr} /uEnv.txt ; env import -t ${loadaddr} ${filesize};
loadall=run loaduEnvtxt; run loadximage; run loadxfdt;

console=/dev/ttyS0
mmcargs=setenv bootargs console=${console} ${optargs} ${cape_disable} ${cape_enable} root=${mmcroot} rootfstype=${mmcrootfstype} ${cmdline}

uenvcmd=run loadall; run mmcargs; bootz ${loadaddr} - ${fdtaddr};

And now, PXE boot.

U-Boot SPL 2018.03-dirty (Jun 29 2018 - 09:25:36 -0400)
Trying to boot from MMC1
Loading Environment from EXT4…
** Unable to use mmc 0:1 for loading the env **
Failed (-5)

U-Boot 2018.03-dirty (Jun 29 2018 - 09:25:36 -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…
** Unable to use mmc 0:1 for loading the env **
Failed (-5)
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=[00C0] …
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Bad device 0:2 0x82000000 **
** Bad device 0:2 0x82000000 **
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
911 bytes read in 28 ms (31.3 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 …
Failed to iterate over directory boot
** Invalid partition 6 **
** Invalid partition 7 **
switch to partitions #0, OK
mmc1(part 0) is current device
** No partition table - mmc 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
** No partition table - mmc 1 **
Checking for: /uEnv.txt …
** No partition table - mmc 1 **
Checking for: /boot.scr …
** No partition table - mmc 1 **
Checking for: /boot/boot.scr …
** No partition table - mmc 1 **
Checking for: /boot/uEnv.txt …
** No partition table - mmc 1 **
** No partition table - mmc 1 **
** No partition table - mmc 1 **
** No partition table - mmc 1 **
** No partition table - mmc 1 **
** No partition table - mmc 1 **
** No partition table - mmc 1 **
starting USB…
USB0: Port not available.
link up on port 0, speed 100, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.17.143 (4 ms)
Using cpsw device
TFTP from server 192.168.1.1; our IP address is 192.168.17.143; sending through gateway 192.168.17.1
Filename ‘vmlinuz-4.14.51-bone-rt-r16’.
Load address: 0x82000000
Loading: T T T

I think I’ll start over with a new flash… I think maybe the ext4 partition is messed up from my fiddling with it.

So now, on the first partition (FAT) I have no /uEnv.txt (nor /boot nor
/uboot). I do have:

config-4.14.51-bone-rt-r16
dtbs
initrd.img-4.14.51-bone-rt-r16
MLO
System.map-4.14.51-bone-rt-r16
'System Volume Information'
u-boot.img
uEnv.txt-old
vmlinuz-4.14.51-bone-rt-r16

OH i see what you did..

So I guess, I have a question.. Do you want Windows to see the kernel
files, or do you just need the "partition" for windows.

In most cases i'd have you move

./config-*
./dtbs/*
./initrd.img-*
./System-*
./vmlinuz-*

to a new /boot/ directory on the second "EXT4" partition.

But, we "can" make it work if you need them in the fat partition...

On the second partition (EXT4) I have this in /boot/uEnv.txt:

uname_r=4.14.51-bone-rt-r16
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/PB-I2C1-RTC-6-CLICK.dtbo

You only need ^ those 3 lines, nuke everything else below this in /boot/uEnv.txt

loadaddr=0x82000000
fdtaddr=0x88000000
rdaddr=0x88080000

initrd_high=0xffffffff
fdt_high=0xffffffff

#boot is first partition
#root is second partition
mmcroot=/dev/mmcblk0p2

loadximage=load mmc 0:1 ${loadaddr} /vmlinuz-${uname_r}
loadxfdt=load mmc 0:1 ${fdtaddr} /dtbs/${uname_r}/${fdtfile}
loadxrd=load mmc 0:1 ${rdaddr} /initrd.img-${uname_r}; setenv rdsize
${filesize}
loaduEnvtxt=load mmc 0:1 ${loadaddr} /uEnv.txt ; env import -t ${loadaddr}
${filesize};
loadall=run loaduEnvtxt; run loadximage; run loadxfdt;

console=/dev/ttyS0
mmcargs=setenv bootargs console=${console} ${optargs} ${cape_disable}
${cape_enable} root=${mmcroot} rootfstype=${mmcrootfstype} ${cmdline}

uenvcmd=run loadall; run mmcargs; bootz ${loadaddr} - ${fdtaddr};

Regards,

Excellent point, I only need to expose the config files, not OS files.

Et Voila! I’m booting and my overlays are loaded!

Thank you sir!

U-Boot 2018.03-dirty (Jun 29 2018 - 09:25:36 -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: Global warm SW reset has occurred.
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 **
Failed (-5)
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=[00C0] …
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Bad device 0:2 0x82000000 **
** Bad device 0:2 0x82000000 **
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
112 bytes read in 28 ms (3.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-4.14.51-bone-rt-r16 …
10134016 bytes read in 670 ms (14.4 MiB/s)
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] …
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot.dtb] …
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot.dtb …
loading /boot/dtbs/4.14.51-bone-rt-r16/am335x-boneblack-uboot.dtb …
58443 bytes read in 54 ms (1 MiB/s)
uboot_overlays: [fdt_buffer=0x60000] …
uboot_overlays: loading /lib/firmware/PB-I2C1-RTC-6-CLICK.dtbo …
535 bytes read in 312 ms (1000 Bytes/s)
uboot_overlays: loading /lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo …
1440 bytes read in 89 ms (15.6 KiB/s)
uboot_overlays: loading /lib/firmware/BB-HDMI-TDA998x-00A0.dtbo …
5127 bytes read in 615 ms (7.8 KiB/s)
uboot_overlays: loading /lib/firmware/BB-ADC-00A0.dtbo …
711 bytes read in 736 ms (0 Bytes/s)
uboot_overlays: add [enable_uboot_cape_universal=1] to /boot/uEnv.txt to enable…
loading /boot/initrd.img-4.14.51-bone-rt-r16 …
4456703 bytes read in 315 ms (13.5 MiB/s)
debug: [console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait] …
debug: [bootz 0x82000000 0x88080000:4400ff 88000000] …

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fbbf000, end 8ffff0ff … OK
reserving fdt memory region: addr=88000000 size=70000
Loading Device Tree to 8fb4c000, end 8fbbefff … OK

Starting kernel …

[ 0.000000] Booting Linux on physical CPU 0x0

Okay, just to collect the resolution into one message:

I have the microSD formatted with partition 1 as FAT, and partition 2 as EXT4.

The FAT partition contains the files /MLO and /u-boot only. The EXT4 partition contains everything else.

On the EXT4 I have /boot/uEnv.txt which contains only this:

uname_r=4.14.51-bone-rt-r16
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/PB-I2C2-RTC-6-CLICK.dtbo

And it’s working.

I am a bit puzzled where it’s getting uenvcmd from now…

If you see your bootlog there is no uenvcmd now uname_boot is executing…