Device Tree Overlays in 6.18.1 kernel

I’ve just updated my kernel to 6.18.1 - and something odd is happening - the device tree overlay blobs no longer apply to the device tree that comes in the kernel.

I’ll dig into why this is happening, e.g. what has changed. I suspect its just a case of compiling the device tree blobs against the device tree in the kernel. Anyway just starting a thread here in case anyone else has come across this - and knows the solution, and a place to drop whatever solution I come to.

@RobertCNelson guess this may affect the device tree overlays source code?

Only difference in the dts file, is the that @RobertCNelson have

< 	chosen {
< 		base_dtb = "am335x-boneblack.dts";
< 		base_dtb_timestamp = __TIMESTAMP__;
< 	};

Whereas the linux kernel - that isn’t in the dts, but I guess gets populated by uboot and others. Don’t thing this should stop the overlays being loaded - so its confusing right now …

Its very strange, I check the device tree and everything is in the BBB and PB device tree.

I disassembled the overlay - and it done as alot of fragments that get resolved with:

__fixups__ {
	lcdc = "/fragment@1:target:0";
	mcasp0 = "/fragment@2:target:0";
	am33xx_pinmux = "/fragment@3:target:0";
	epwmss0 = "/fragment@4:target:0";
	ehrpwm0 = "/fragment@5:target:0";
	epwmss1 = "/fragment@6:target:0";
	ehrpwm1 = "/fragment@7:target:0";
	epwmss2 = "/fragment@8:target:0";
	ehrpwm2 = "/fragment@9:target:0";
};

So I guess only question is can those fixips be resolved against the parent device tree.

I’m merging in uboot, so I suspect its not to do with kernel, maybe the device trees (BBB &PB) that are made during kernel building. I’ll check there next …

Doah - the dtb that I got when I compiled my kernel - doesn’t contain symbols!

Now to work out how to cure that!

Check to see if your Kernel compiler remembers the -@ argument!

Question where is that in the a) linux kernel makefile, b) in the kernel config file.

So at the moment dtb are created when I compile the kernel and they don’t have the symbols (so dtc wasn’t run with the -@ symbol), but how to cure that remains to be found.

Here’s an example:

https://openbeagle.org/beaglev-fire/BeagleV-Fire-ubuntu/-/blob/main/04_build_linux.sh?ref_type=heads#L155

OK source is Here its the cryptic line

# Set -@ if the target is a base DTB that overlay is applied onto
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)

Hmmm - wonder if the problem is the vanilla kernel doesn’t have overlays, so the linux kernel doesn’t know the dtb for boards needs to include symbols. My guess is that @RobertCNelson beagle device tree github needs to be merged with the kernel before it is built …

That’s what some of them do; can’t speak to all of them…

Mainline as is, doesn’t enable -@

Here’s where I patch it into the makefile.

1 Like

Just looking into cure the problem, the overlays are got from Overlays which is used in building the arch PKGBUILD. I notice these haven’t been updated in last 5 years, so would I be better using these Overlays. If I do this I could then copy the arm dts file which has symbols in them.

@RobertCNelson what are you thoughts on what would be best used for arch linux?

Use the kernel specific branch for both device tree and overlays, to ensure kernel abi matching..

Which is why the old generic overlay only repo was abandoned.

Oh my.. Arch is using the bb.org-overlays on 6.13.1… that’ll break things..

source=("https://www.kernel.org/pub/linux/kernel/v6.x/${_srcname}.tar.xz"
        "https://www.kernel.org/pub/linux/kernel/v6.x/patch-${pkgver}.xz"
        "https://rcn-ee.com/deb/sid-armhf/v${rcnver}-${rcnrel}/patch-${rcnver%.0}-${rcnrel}.diff.gz"
        "git+https://github.com/RobertCNelson/bb.org-overlays.git"
        '0001-add-lcd-cape-for-chiliboard.patch'
        'config'
        'linux.preset'
        '99-linux.hook')

The ‘patch-${rcnver%.0}-${rcnrel}.diff.gz’ already contains overlays…

Thanks @RobertCNelson Let me make changes here - then I’ll submit to Arch Linux.

Do we know how update the debian corrections to in the diff package?

and this section:

  # install overlays
  cd "${srcdir}/bb.org-overlays"
  mkdir -p "${pkgdir}/usr/lib/firmware"
  cp src/arm/*.dtbo "${pkgdir}/usr/lib/firmware"

So you ‘might’ have to find the “kernel” dtbo’s and copy them directly to usr/lib/firmware too..

We should get them on an lts branch too… (6.18.x and jsut follow it till the next lts..) that’s my goal with am335x now going foward..

Regards,

Ah looking on /arch/arm/boot/dts/ti/omap the only overlays I have are

am571x-idk-touchscreen.dtso  am57xx-idk-lcd-osd101t2045.dtso
am572x-idk-touchscreen.dtso  am57xx-idk-lcd-osd101t2587.dtso
am57xx-evm.dtso

So I wonder what the Debian patches are being apply to …

… oh looks like the patches failed …

Honestly, that’s probally fine… My goal with GitHub - beagleboard/BeagleBoard-DeviceTrees · GitHub is to have matching (branch) for device tree’s and overlay’s that can be installed locally on any of kernel.org’s release..

Since both the main Device-Tree and the Overlays are built with the same device-tree includes, they will have matching structures, so no random overlays not loading because something changed in the device-tree (that’s the main problem we ran into with bb.org-overlays repo)

So on Arch if your running, v6.Y.x, you should be able to run:

git clone -b v6.Y.x https://github.com/beagleboard/BeagleBoard-DeviceTrees.git
cd ./BeagleBoard-DeviceTrees/
make
sudo make install_arm

We might have to patch “install_arm”.. for Arch.. but then you get both the updated Device Tree and Overlays.. (not touching the kernel zImage or modules)..

Regards,

Think you put the overlays in /boot, arm arch puts them in /lib/firmware …

PHONY += install_arch_arm
install_arch_arm: $(ARCH_DTB) $(ARCH_DTBO)
	# install Device Tree
	mkdir -p /boot/dtbs/$(KERNEL_VERSION)/overlays/
	cp src/arm/ti/omap/*.dtb /boot/dtbs/$(KERNEL_VERSION)/ || true
	cp src/arm/overlays/*.dtbo /boot/dtbs/$(KERNEL_VERSION)/overlays || true

Arch:

  mkdir -p "${pkgdir}"/{lib/modules,lib/firmware}
  make INSTALL_MOD_PATH="${pkgdir}" modules_install
  make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
  cp arch/$KARCH/boot/zImage "${pkgdir}/boot/zImage"

Can you please run tree:

tree /boot/dtbs/

i wonder if they added the vendor directory?