Purpose of the mender_dtb_name variable

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

1 Like

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 for an example.

Drew

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?

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.

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

This variable is only used if you have,

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,

MENDER_DTB_NAME=$(mender_get_clean_kernel_devicetree)

and later include it in U-Boot with,

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

If you are using,

MENDER_UBOOT_AUTO_CONFIGURE = "1"

mender_dtb_name is integrated in your bootcmd.

If you are using,

MENDER_UBOOT_AUTO_CONFIGURE = "0"

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

@drewmoseley @mirzak Thank you for your explanations!