# Purpose of the mender\_dtb\_name variable

**URL:** <https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030>\
**Category:** General Discussions\
**Tags:** raspberry-pi-zero, warrior\
**Created:** [June 9, 2020, 3:58pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030 "2020-06-09T15:58:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmbedded](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@rmbedded](https://hub.mender.io/u/rmbedded)\
**Post date:** [June 9, 2020, 3:58pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/1 "2020-06-09T15:58:49Z")

</div>

Hello,

I have a question about a role of the `mender_dtb_name` which occurs among the u-boot environmental variables. Does it determine which dtb file will be loaded? If that is the case, I have got a little bit of an amibguity because now I see that it has following value : `mender_dtb_name=bcm2710-rpi-cm3.dtb`, whereas for my board (RaspberryPi Zero) the dedicated dtb file is `bcm2708-rpi-b-plus.dtb` [(with reference to)](https://www.raspberrypi.org/forums/viewtopic.php?t=238262).  
Additionally, the value of this variable was assigned as the last one in the `KERNEL_DEVICETREE` variable string with warning:  
`WARNING: u-boot-1_2019.01-r0 do_provide_mender_defines: Found more than one dtb specified in KERNEL_DEVICETREE ( bcm2708-rpi-zero-w.dtb bcm2708-rpi-b.dtb bcm2708-rpi-b-plus.dtb bcm2709-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2711-rpi-4-b.dtb bcm2708-rpi-cm.dtb bcm2710-rpi-cm3.dtb overlays/at86rf233.dtbo overlays/dwc2.dtbo overlays/gpio-key.dtbo overlays/hifiberry-amp.dtbo overlays/hifiberry-dac.dtbo overlays/hifiberry-dacplus.dtbo overlays/hifiberry-digi.dtbo overlays/i2c-rtc.dtbo overlays/iqaudio-dac.dtbo overlays/iqaudio-dacplus.dtbo overlays/mcp2515-can0.dtbo overlays/pi3-disable-bt.dtbo overlays/pi3-miniuart-bt.dtbo overlays/pitft22.dtbo overlays/pitft28-resistive.dtbo overlays/pitft35-resistive.dtbo overlays/pps-gpio.dtbo overlays/rpi-ft5406.dtbo overlays/rpi-poe.dtbo overlays/vc4-kms-v3d.dtbo overlays/vc4-fkms-v3d.dtbo overlays/w1-gpio-pullup.dtbo overlays/w1-gpio.dtbo ). Only one should be specified. Choosing the last one: bcm2710-rpi-cm3.dtb. Set KERNEL_DEVICETREE to the desired dtb file to silence this warning`.

I will be grateful for any explanation or references to documentation.

Thank you.

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 9, 2020, 4:49pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/2 "2020-06-09T16:49:07Z")

</div>

Hi @rmbedded, the default for this variable is the last on in the list specified by KERNEL\_DEVICETREE which is usually set by the upstream BSP. There are certainly reasons you may want to customize this such as your case with the Zero vs Pi3. Some systems actually dynamically determine this in U-Boot and in those cases it is usually best to add some U-Boot logic into MENDER\_PRE\_UBOOT\_SETUP\_COMMANDS to do it dynamically. See [this link](https://github.com/mendersoftware/meta-mender-community/blob/34993b2a8e337d6d1cf33ffb5ef5e87da06c00d4/meta-mender-variscite/recipes-bsp/u-boot/u-boot-variscite-mender-common.inc#L48) for an example.

Drew

---

<div class="post-metadata">

**Author:** ![rmbedded](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@rmbedded](https://hub.mender.io/u/rmbedded)\
**Post date:** [June 9, 2020, 7:18pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/3 "2020-06-09T19:18:39Z")

</div>

Hi @drewmoseley, thank you for the answer. But what exactly is this variable responsible for? Does this variable determine which dtb file should be loaded?

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 10, 2020, 5:10pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/4 "2020-06-10T17:10:06Z")

</div>

Yes. It eventually be comes the mender\_dtb\_name U-Boot variable which is loaded by the Mender bootcmd. If you want to make that selection dynamic, you need to ensure that the mender\_dtb\_name variable is updated at boot time.

---

<div class="post-metadata">

**Author:** ![rmbedded](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@rmbedded](https://hub.mender.io/u/rmbedded)\
**Post date:** [June 10, 2020, 9:41pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/5 "2020-06-10T21:41:33Z")

</div>

Ok, so why if now in my system this variable points to incorrect dtb file (dedicated for another board) and the system works properly? I have also tried to delete this file from rootfs and vfat partition, and it didn’t affect system operation either.

Thank you

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 11, 2020, 9:03am UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/6 "2020-06-11T09:03:52Z")

</div>

This variable is only used if you have,

```auto
MENDER_UBOOT_AUTO_CONFIGURE = "1"

```

I assume that you do not have above, and hence it does not have any effect.

Edit:

To further clarify, it will set the following regardless,

```auto
MENDER_DTB_NAME=$(mender_get_clean_kernel_devicetree)

```

and later include it in U-Boot with,

```auto
#define MENDER_DTB_NAME "$MENDER_DTB_NAME"

```

and set it here,

[https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/recipes-bsp/u-boot/patches/0002-Generic-boot-code-for-Mender.patch#L187](https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/recipes-bsp/u-boot/patches/0002-Generic-boot-code-for-Mender.patch#L187).

If you are using,

```auto
MENDER_UBOOT_AUTO_CONFIGURE = "1"

```

`mender_dtb_name` is integrated in your `bootcmd`.

If you are using,

```auto
MENDER_UBOOT_AUTO_CONFIGURE = "0"

```

`mender_dtb_name` is only defined, but not used, unless you explicitly have added logic that uses this variable

---

<div class="post-metadata">

**Author:** ![rmbedded](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@rmbedded](https://hub.mender.io/u/rmbedded)\
**Post date:** [June 11, 2020, 6:01pm UTC](https://hub.mender.io/t/purpose-of-the-mender-dtb-name-variable/2030/7 "2020-06-11T18:01:28Z")

</div>

@drewmoseley @mirzak Thank you for your explanations!
