# Applying device tree overlays Debian

**URL:** <https://hub.mender.io/t/applying-device-tree-overlays-debian/4372>\
**Category:** General Discussions\
**Tags:** beaglebone-black, debian, u-boot\
**Created:** [December 3, 2021, 1:59am UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372 "2021-12-03T01:59:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![timbo22](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@timbo22](https://hub.mender.io/u/timbo22)\
**Post date:** [December 3, 2021, 1:59am UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/1 "2021-12-03T01:59:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 3, 2021, 1:46pm UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/2 "2021-12-03T13:46:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![timbo22](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@timbo22](https://hub.mender.io/u/timbo22)\
**Post date:** [December 7, 2021, 7:11pm UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/3 "2021-12-07T19:11:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![azarubkin](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@azarubkin](https://hub.mender.io/u/azarubkin)\
**Post date:** [December 14, 2021, 11:39am UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/4 "2021-12-14T11:39:18Z")

</div>

@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?)

---

<div class="post-metadata">

**Author:** ![timbo22](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@timbo22](https://hub.mender.io/u/timbo22)\
**Post date:** [December 14, 2021, 8:15pm UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/5 "2021-12-14T20:15:20Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![azarubkin](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@azarubkin](https://hub.mender.io/u/azarubkin)\
**Post date:** [December 15, 2021, 12:30pm UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/6 "2021-12-15T12:30:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![timbo22](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@timbo22](https://hub.mender.io/u/timbo22)\
**Post date:** [December 19, 2021, 8:18pm UTC](https://hub.mender.io/t/applying-device-tree-overlays-debian/4372/7 "2021-12-19T20:18:14Z")

</div>

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.
