Applying device tree overlays Debian

Hi,

I have been trying to use Mender for OTA updates of a Beaglebone Black running Debian 10 with mostly success, but I am stuck on one issue. I have been using mender-convert version 6a907c1 to create the artifacts from my “golden” device which runs a customised BBB device tree by applying overlays at boot. I can successfully bootload the artifacts to my devices, however it appears the Mender u-boot does not load the device tree overlays that I have defined in /boot/uEnv.txt.

Is there a way to configure device tree overlays to be used with the Mender u-boot? Or alternatively is there any workaround solution that you may be able to suggest.

Thanks in advance

The mender-convert Beaglebone port uses stock U-Boot, which uses the distro_bootcmd framework. A quick glance at the boot code here suggests that it looks for the uboot.scr script before loading the next boot stage. Maybe you can use that? I did not test it in practice though.

Thank you for your suggestion. I attempted to get it working this way, but could not get my generated uboot.scr to run. I ended up extracting the flattened device tree from a working device, and using this in place of the default am335x_boneblack.dtb device tree blob as a base. This solution seems to be adequate for now, although comes at the cost of less flexibility.

1 Like

@timbo22 could you please outline the steps you’ve taken? Specifically, how did you get the flattened device tree from a working device? I think I can work out the rest (it boils down to replacing the dtb file in the first partition of Mender image, right?)

Hi @azarubkin, you can find the flattened device tree blob here: /sys/firmware/fdt. This is the blob that is passed from the bootloader to the kernel. You can decompile it for inspection with dtc -I dtb -o fdt.dts fdt to check it contains your overlays. Then you’re right, you can just rename it to replace the default device tree blob: boot/efi/dtbs/am335x_boneblack.dtb.

1 Like

Thank you. I tried to get dtb using dtc -I fs -O dtb -o modified.dtb /proc/device-tree command and the resulting file was a little smaller than the one at /sys/firmware/fdt location, and it resulted in hang up during boot. I don’t know why.

Yes I tried the same method initially, and found that although my machine booted with the device tree extracted from /proc/device-tree, it didn’t contain all of my overlays. I’m also unsure why.