Overlay on am33xx_pinmux: yocto enable overlays

got a bit sidetracked. I did find that I add the inherit kernel-devicetree and KERNEL_DTC_FLAGS += "-@" lines to my kernel bbappend file I no longer need to manually edit tmp/work-shared/beaglebone-yocto/kernel-source/arch/arm/boot/dts/Makefile… so i have that going for me.

my linux-yocto_5.15.bbappend file now looks like this.

inherit kernel-devicetree

KERNEL_DTC_FLAGS += "-@"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI:append = " \
                  file://pinmux-overlay.dts;subdir=git/arch/${ARCH}/boot/dts/overlays \
                  file://kernel_fragment.cfg \
                 "

FILESEXTRAPATHS:prepend := "${THISDIR}/deviceTree:"

PACKAGE_ARCH = "${MACHINE_ARCH}"

KERNEL_DEVICETREE:append = " overlays/pinmux-overlay.dtbo"

it’s odd because I don’t see a extlinux.conf file anywhere in my build environment. So I’m trying to figure out how that is possible. Considering it’s on the unit when I actually boot.

I was able to get the beaglebone to boot. I looked at my uboot environement variables and figure out what commands I needed to get bootz to run. They were setenv oldroot /dev/mmcblk0p2 and run args_mmc_old. Below is the sequence I’m writing at the uboot command prompt.

usb start
fatls mmc 0:1
fatls usb 0:1
load mmc 0:1 0x81000000 zImage
load mmc 0:1 0x880000000 am335x-boneblack.dtb
fdt addr 0x880000000
load usb 0:1 0x890000000 pinmux-overlay2.dtbo
fdt resize 8192
fdt apply 0x890000000
setenv oldroot /dev/mmcblk0p2
run args_mmc_old
bootz 0x81000000 - 0x880000000

Also, here’s the console output of me entering the above values.

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
=>  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
=> fatls mmc 0:1
   107932   MLO
    90469   am335x-bone.dtb
    94748   am335x-boneblack.dtb
    90832   am335x-bonegreen.dtb
            extlinux/
  1224900   u-boot.img
  7919928   zImage

6 file(s), 1 dir(s)

=> fatls usb 0:1
            System Volume Information/
      432   pinmux-overlay2.dtbo
       11   TestFile.txt
      740   pinmux-overlay.dtbo

3 file(s), 1 dir(s)

=> load mmc 0:1 0x81000000 zImage
7919928 bytes read in 499 ms (15.1 MiB/s)
=> load mmc 0:1 0x880000000 am335x-boneblack.dtb
94748 bytes read in 9 ms (10 MiB/s)
=> fdt addr 0x880000000
=> load usb 0:1 0x890000000 pinmux-overlay2.dtbo
432 bytes read in 50 ms (7.8 KiB/s)
=> fdt resize 8192
=> fdt apply 0x890000000
=> setenv oldroot /dev/mmcblk0p2
=> run args_mmc_old
=> 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 ...

Booting Linux on physical CPU 0x0
Linux version 5.15.150-yocto-standard (oe-user@oe-host) (arm-poky-linux-gnueabi-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.38.20220708) #1 PREEMPT Mon Mar 11 14:54:41 UTC 2024
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: TI AM335x BeagleBone Black
Memory policy: Data cache writeback
cma: Reserved 16 MiB at 0x9e800000
Zone ranges:
  Normal   [mem 0x0000000080000000-0x000000009fefffff]

You can also see the pinmux-overlay2.kernel file in

/sys/firmware/devicetree/base/chosen/overlays

root@beaglebone-yocto:/sys/kernel/config/device-tree/overlays# cd /sys/firmware/devicetree/base/chosen/overlays/
root@beaglebone-yocto:/sys/firmware/devicetree/base/chosen/overlays# ls
name  pinmux-overlay2.kernel
root@beaglebone-yocto:/sys/firmware/devicetree/base/chosen/overlays#

finally my overlay file is really simple. It’s not really doing anything yet. but here it is

/*
* TBD
*/

/dts-v1/;
/plugin/;

&{/chosen} {
        overlays {
                pinmux-overlay2.kernel = "Fri Oct 4 12:00:00 2024";
        };
};

&am33xx_pinmux {
};


&{/} {
testsection {
};

};

for posterity sake, here are the values from my uboot of args_mmc_old and all the environment variables that are part of args_mmc_old

=> echo ${args_mmc_old}
setenv bootargs console=${console} ${optargs} ${cape_disable} ${cape_enable} ${cape_uboot} root=${oldroot} ro rootfstype=${mmcrootfstype} ${uboot_detected_capes} ${cmdline}
=> echo ${console}
ttyO0,115200n8
=> echo ${optargs}

=> echo ${cape_disable}

=> echo ${cape_enable}

=> echo ${cape_uboot}

=> echo ${oldroot}

=> echo ${mmcrootfstype}
ext4 rootwait
=> echo ${uboot_detected_capes}

=> echo ${cmdline}

=>

Hi @ TimLewisN,

I followed you post for being able to add a custom dtbo overlay to the standard am335x-boneblack.dtb.

Anyway I am still experiencing troubles on controlling GPIOs at File-System, please have a look to my post here.

Could you help me in resolving this issue ?

Thank you very much.