How to add a Device Tree Binary to the deploy directory for my yocto build?

I have a custom device tree for my IMX8MP board. I’ve written a recipe that adds these files to the arch/arm64/boot/dts/freescale/ directory. I’m also adding a line to the Makefile in that directory so that my DTB is built. If I do a bitbake -c devshell virtual/kernel and execute make dtbs, my DTB will be successfully built.

However, I’d like the DTB to be built when I do the bitbake tdx-reference-minimal-image and have the resulting DTB file included in the deploy directory along with the other DTBs. How can I accomplish this? In previous (non-toradex) yocto builds I’ve done, this has just happened automatically, so I’m unsure what else I need to do to accomplish this.

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Based on the context provided, it seems you are trying to ensure that your custom device tree binary (DTB) is included in the deploy directory when building your Yocto image for the IMX8MP board. Here are some general steps you can follow to achieve this:

  1. Ensure the Device Tree is Built: Since you’ve already modified the Makefile to include your custom DTB, ensure that your changes are correctly integrated into the kernel build process. This typically involves adding your DTB to the dtb-y variable in the Makefile.

  2. Modify the Kernel Recipe: You may need to modify the kernel recipe to ensure that your custom DTB is included in the deploy directory. This can be done by appending your DTB to the KERNEL_DEVICETREE variable in your kernel recipe or a bbappend file. For example:

    KERNEL_DEVICETREE += "freescale/your-custom-dtb.dtb"
    
  3. Check the Image Recipe: Ensure that the image recipe (e.g., tdx-reference-minimal-image.bb) is set up to include the kernel and its associated DTBs. This is usually handled by default, but it’s good to verify.

  4. Verify the Deployment: After building the image with bitbake tdx-reference-minimal-image, check the deploy directory (usually under tmp/deploy/images/<machine>/) to see if your DTB is present.

If these steps do not resolve the issue, it may be necessary to review the specific Yocto layers and configurations used in your build to ensure that there are no additional customizations or overrides affecting the deployment of DTBs.

Please, also check if these links can help you solve your problem:

How to include Device Tree and Linux kernel in Yocto build?.

KERNEL_DEVICETREE += "freescale/your-custom-dtb.dtb"

That seems to have fixed it. I thought I had tried this, but I think maybe I tried just = and not +=. I’m not sure why that would matter given that I only care about the one device tree, but regardless, it’s working now.