Overlay on am33xx_pinmux: yocto enable overlays

I’m trying to understand how to overlay the device tree. My understanding of the device tree and it’s syntax are limited but I believe I understand the process of doing through the bootloader using various fdt and load commands.

from this link [Using Device Tree Overlays, example on BeagleBone Cape add-on boards - BeagleBoard](https://Beaglebone overlay instructions) I learned to halt the boot sequence at the bootloader and run these commands:

load mmc 0:1 0x820000000 am335x-boneblack-uboot.dtb
fdt addr 0x82000000
load mmc 0:1 0x83000000 overlays/BBORG_RELAY-00A2.dtbo
fdt resize 8192
fdt apply 0x83000000

So that’s what I attempted to do. Here is my overlay file (pinmux-overlay.dtso)

/*

  • TBD
    */

/dts-v1/;
/plugin/;

&am33xx_pinmux {
pinctrl-names = “default”;
pinctrl-0 = <&testpins>;

 testpins: testpins {
            pinctrl-single,pins = <
                 0x044 0xf  /* P9_41: gpmc_a0.gpio0_20 */
            >;
    };

};

The first thing I did was to create pinmux-overlay.dtsb via the device tree compiler and the command below.

tmp/work/beaglebone_yocto-poky-linux-gnueabi/linux-yocto/5.15.150+gitAUTOINC+567f0adb9d_4fca0c4373-r0/linux-beaglebone_yocto-standard-build/scripts/dtc/dtc -@ -I dts -O dtb -o …/…/pinmux-overlay.dtsb …/…/pinmux-overlay.dtso

The next thing I did was start my bbb and stop in u-boot. Once doing so I ran the following commands:

  1. start usb
    Press SPACE to abort autoboot in 2 seconds

=> usb start
starting USB…
USB0: scanning bus 0 for devices… 1 USB Device(s) found
scanning usb for storage devices… 1 Storage Device(s) found

  1. check what files are in mmc. I see the am335x-boneblack.dtb file… so that’s good

=> fatls mmc 0:1
107932 MLO
63110 am335x-bone.dtb
66576 am335x-boneblack.dtb
63374 am335x-bonegreen.dtb
extlinux/
1224900 u-boot.img
7888336 zImage

6 file(s), 1 dir(s)

  1. check which files are on my usb. I see my pinmux-overlay.dtsb file. so that’s good.

=> fatls usb 0:1
System Volume Information/
510 pinmux-overlay.dtsb
11 TestFile.txt

2 file(s), 1 dir(s)

  1. load the base am335x-boneblack.dtb file to ram address 0x880000000

=> load mmc 0:1 0x880000000 am335x-boneblack.dtb
66576 bytes read in 7 ms (9.1 MiB/s)

  1. Set the device tree base file to ram address 0x80000000

=> fdt addr 0x880000000

  1. load the overlay file pinmux-overlay.dtsb file to ram address 0x890000000

=> load usb 0:1 0x890000000 pinmux-overlay.dtsb
510 bytes read in 50 ms (9.8 KiB/s)

  1. resize fdt. Not really sure of the point of this. I assume to fit the overlay. Mostly I’m following the example.

=> fdt resize 8192

  1. Apply the overlay file to the base device tree file

=> fdt apply 0x890000000
failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND
base fdt does did not have a /symbols node
make sure you’ve compiled with -@
=>

You can see I receive FDT_ERR_NOTFOUND. I believe it’s because of the am33xx_pinmux symbol I have in my device tree overlay file… Assuming I’m correct, I think my question is, how do I overlay am33xx_pinmux symbol. Do I even need to?

see the message about -@ ? make sure with your kernel build you build with that flag: So update arch/arm/boot/dts/ti/omap/Makefile with:

+++ b/arch/arm/boot/dts/ti/omap/Makefile
@@ -1,4 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
+
+ifeq ($(CONFIG_OF_OVERLAY),y)
+DTC_FLAGS += -@
+endif
+

it does not appear that I have that path. I’m looking in my tmp/work-shared directory.

/poky/build/tmp/work-shared$ find -name omap
./beaglebone-yocto/kernel-source/Documentation/arm/omap
./beaglebone-yocto/kernel-source/Documentation/devicetree/bindings/arm/omap
./beaglebone-yocto/kernel-source/drivers/video/fbdev/omap
./beaglebone-yocto/kernel-source/drivers/media/platform/omap
./qemux86-64/kernel-source/Documentation/arm/omap
./qemux86-64/kernel-source/Documentation/devicetree/bindings/arm/omap
./qemux86-64/kernel-source/drivers/video/fbdev/omap
./qemux86-64/kernel-source/drivers/media/platform/omap
/poky/build/tmp/work-shared$

what kernel version? i assumed mainline…

root@beaglebone-yocto:~# uname -r
5.15.150-yocto-standard

then it’s in the old location:

+++ b/arch/arm/boot/dts/Makefile
@@ -1,4 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
+
+ifeq ($(CONFIG_OF_OVERLAY),y)
+DTC_FLAGS += -@
+endif

Regards,

hmmm… still no go. I wonder if I need to add KERNEL_DTB_OVERLAY_SUPPORT to my kernel config. Or something like that.

you enabled? CONFIG_OF_OVERLAY right?

umm… of course :wink:

kidding. Checking now. I did not. So I assume it’s not enabled.

I’m one step closer. I appended my kernel recipe with linux-yocto_5.15.bbappend (shown below)

FILESEXTRAPATHS:prepend := “${THISDIR}/files:”

SRC_URI:append = "
file://kernel_fragment.cfg
"

the kernel_fragment.cfg file looks like this.

# CONFIG_NETFILTER_XT_TARGET_LED is not set
# CONFIG_MAC80211_LEDS is not set
CONFIG_RFKILL_LEDS=y
# CONFIG_LED_TRIGGER_PHY is not set
CONFIG_INPUT_LEDS=y
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
# CONFIG_TOUCHSCREEN_STMFTS is not set
# CONFIG_INPUT_IMS_PCU is not set
# CONFIG_GPIO_CDEV_V1 is not set
CONFIG_GPIO_SYSCON=y
# CONFIG_BACKLIGHT_LED is not set
# CONFIG_HID_ASUS is not set
# CONFIG_HID_BIGBEN_FF is not set
# CONFIG_HID_CORSAIR is not set
# CONFIG_HID_ELAN is not set
# CONFIG_HID_GT683R is not set
# CONFIG_HID_LED is not set
CONFIG_HID_LOGITECH=y
# CONFIG_HID_LOGITECH_HIDPP is not set
# CONFIG_LOGITECH_FF is not set
# CONFIG_LOGIRUMBLEPAD2_FF is not set
# CONFIG_LOGIG940_FF is not set
# CONFIG_LOGIWHEELS_FF is not set
# CONFIG_HID_SONY is not set
# CONFIG_HID_THINGM is not set
# CONFIG_HID_U2FZERO is not set
# CONFIG_HID_WIIMOTE is not set
# CONFIG_USB_LED_TRIG is not set
# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set
CONFIG_LEDS_CLASS=y
# CONFIG_LEDS_CLASS_FLASH is not set
# CONFIG_LEDS_CLASS_MULTICOLOR is not set
CONFIG_LEDS_BRIGHTNESS_HW_CHANGED=y
# CONFIG_LEDS_AN30259A is not set
# CONFIG_LEDS_AW2013 is not set
# CONFIG_LEDS_BCM6328 is not set
# CONFIG_LEDS_BCM6358 is not set
# CONFIG_LEDS_CR0014114 is not set
# CONFIG_LEDS_EL15203000 is not set
# CONFIG_LEDS_LM3530 is not set
# CONFIG_LEDS_LM3532 is not set
# CONFIG_LEDS_LM3642 is not set
# CONFIG_LEDS_LM3692X is not set
# CONFIG_LEDS_PCA9532 is not set
# CONFIG_LEDS_GPIO is not set
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_LP3952 is not set
# CONFIG_LEDS_LP50XX is not set
# CONFIG_LEDS_LP55XX_COMMON is not set
# CONFIG_LEDS_LP8860 is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_PCA963X is not set
# CONFIG_LEDS_DAC124S085 is not set
CONFIG_LEDS_REGULATOR=y
# CONFIG_LEDS_BD2802 is not set
# CONFIG_LEDS_LT3593 is not set
# CONFIG_LEDS_TCA6507 is not set
# CONFIG_LEDS_TLC591XX is not set
# CONFIG_LEDS_LM355x is not set
# CONFIG_LEDS_IS31FL319X is not set
# CONFIG_LEDS_IS31FL32XX is not set
# CONFIG_LEDS_BLINKM is not set
CONFIG_LEDS_SYSCON=y
# CONFIG_LEDS_MLXREG is not set
CONFIG_LEDS_USER=y
# CONFIG_LEDS_SPI_BYTE is not set
# CONFIG_LEDS_TI_LMU_COMMON is not set
CONFIG_LEDS_TRIGGERS=y
# CONFIG_LEDS_TRIGGER_TIMER is not set
# CONFIG_LEDS_TRIGGER_ONESHOT is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
# CONFIG_LEDS_TRIGGER_CPU is not set
# CONFIG_LEDS_TRIGGER_ACTIVITY is not set
# CONFIG_LEDS_TRIGGER_GPIO is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
# CONFIG_LEDS_TRIGGER_CAMERA is not set
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_NETDEV is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set
# CONFIG_LEDS_TRIGGER_AUDIO is not set
# CONFIG_LEDS_TRIGGER_TTY is not set
CONFIG_UIO=y
CONFIG_UIO_PDRV_GENIRQ=y
CONFIG_UIO_DMEM_GENIRQ=y
# CONFIG_UIO_PRUSS is not set
CONFIG_EXPERT=y
CONFIG_GPIO_SYSFS=y
CONFIG_OF_DYNAMIC=y
CONFIG_OF_RESOLVE=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_CONFIGFS=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
CONFIG_SPI_DYNAMIC=y
CONFIG_CONFIGFS_FS=y

just the very end is what I added to allow for overlays. Just this part shown below

CONFIG_OF_DYNAMIC=y
CONFIG_OF_RESOLVE=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_CONFIGFS=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
CONFIG_SPI_DYNAMIC=y
CONFIG_CONFIGFS_FS=y

I also added the code below to tmp/work-shared/beaglebone-yocto/kernel-source/arch/arm/boot/dts/Makefile as you suggested.

ifeq ($(CONFIG_OF_OVERLAY),y)
DTC_FLAGS += -@
endif

The two changes appear to have gotten me to the point where I can overlay my device tree. Shown below.

=> usb start; fatls mmc 0:1; fatls usb 0:1;load mmc 0:1 0x880000000 am335x-boneblack.dtb; fdt addr 0x880000000; load usb 0:1 0x890000000 pinmux-overlay.dtsb; fdt resize 8192; fdt apply 0x890000000
107932 MLO
90469 am335x-bone.dtb
94748 am335x-boneblack.dtb
90832 am335x-bonegreen.dtb
extlinux/
1224900 u-boot.img
7921888 zImage

6 file(s), 1 dir(s)

        System Volume Information/
  510   pinmux-overlay.dtsb
   11   TestFile.txt

2 file(s), 1 dir(s)

94748 bytes read in 9 ms (10 MiB/s)
510 bytes read in 49 ms (9.8 KiB/s)
=>

So this is progress

I appear to be having issues with actually booting the kernel. I’m trying to the bootz command. It appears to hang Starting Kernel line for a long time.

=> load mmc 0:1 0x81000000 zImage
7921888 bytes read in 498 ms (15.2 MiB/s)
=> usb start; fatls mmc 0:1; fatls usb 0:1;load mmc 0:1 0x880000000 am335x-boneblack.dtb; fdt addr 0x880000000; load usb 0:1 0x890000000 pinmux-overlay.dtsb; fdt resize 8192; fdt apply 0x890000000
starting USB...
USB0:   scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
   107932   MLO
    90469   am335x-bone.dtb
    94748   am335x-boneblack.dtb
    90832   am335x-bonegreen.dtb
            extlinux/
  1224900   u-boot.img
  7921888   zImage

6 file(s), 1 dir(s)

            System Volume Information/
      740   pinmux-overlay.dtsb
       11   TestFile.txt

2 file(s), 1 dir(s)

94748 bytes read in 9 ms (10 MiB/s)
740 bytes read in 55 ms (12.7 KiB/s)
=> bootz 0x81000000

Starting kernel ...

It hangs at the above Starting Kernel ... line for a long time. Then eventually it appears to restart as normal. WIth the normal am335x-boneblack.dtb device tree applied. And no overlay.

You forgot the device-tree

=> bootz 0x81000000 - 0x880000000

Regards,

seems to hang here forever

=> bootz 0x81000000 - 0x880000000
## Flattened Device Tree blob at 80000000
   Booting using the fdt blob at 0x80000000
   Loading Device Tree to 8ffdd000, end 8fffffff ... OK

Starting kernel ...

what boot args did you pass? Linux Kernel is running…

linux kernel appears to be hanging. I have not set any bootargs. I’m running the standard kirkstone yocto release.

yocto should have a boot.scr or uEnv.txt or extlinux.conf file in the deploy directory with some sort of text that includes the bootargs…

Regards,

from uboot I can print an environment variable… this our guy?

=> printenv bootcmd
bootcmd=if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd
=> echo ${boot_fit}
0
=>

appears boot_fit is 0 so run findfdt; run init_console; run envboot; run distro_bootcmd should run

envboot reads boot.scr/uEnv.txt… distro_bootcmd will read extlinux.conf

i see you have extlinux/ directory in your fat partition… dump the text of what’s in there, then we can update it to do the overlay.

Regards,

I do not know how to do that within uboot. I allowed the unit to boot without stopping in boot and without attempting to add the overlay from within uboot. below are the contents of boot/extlinux/
extlinux.conf read from within linux
root@beaglebone-yocto:/boot/extlinux# cat extlinux.conf

default Yocto
label Yocto
kernel /zImage
fdtdir /
append root=PARTUUID=7ebf1b30-02 rootwait console=ttyS0,115200

Add pinmux-overlay.dtbo to the same folder that has am335x-boneblack.dtb (your pinmux-overlay.dtsb is named wrong)

Then add this to the end of extlinux.conf:
fdtoverlays pinmux-overlay.dtbo