Best location for custom dts file

On Toradex KB I can find a document describing how to create a custom device tree file.
The steps are quite clear.
I only would like an advice on where is the best location where saving the custom dts file.
For sure the same folder /arch/arm64/boot/dts/freescale/ of base dts files is an option, but I’m not sure that mixing “toradex” and “custom” dts is a good idea (I think to future updates of “toradex” dts files).
But if I put the file into a custom directory it seems that the useful script find_in_devicetree cannot work anymore.

Can someone (more expert than me) give suggestions on where to save the custom dts files?

1 Like

Hello @vix,

Thanks for reporting this issue!
I could reproduce it. For now, the find_in_devicetree tool supports recursive searching only in the files placed inside the git tree structure - hence in the freescale directory in your case. However, my colleague @henrique.tx should be able to answer it better than me :slight_smile:

Hi @henrique.tx
can you give me a suggestion on this question, please?
Thanks in advance

Hello @vix,
I think it’s interesting to split the issue in two:

  • one is the development environment you’re going to use while you have to create and debug your custom device tree
  • the other is the project structure that you’re going to use to keep all the needed pieces in place for repeatable builds in the future

I consider the advice at create a custom device tree file to be closely related to the development environment. The first thing you’ll do to start your custom device tree is copy an existing device tree and set up the kernel build environment to build it. This way you can start experimenting with changes quickly and iterate fast, also making use of find_in_devicetree.

However, if you wanted to keep the files as they are for your project, you would have to create a branch of the current Toradex kernel branch. To keep this branch, you’ll have to mirror our kernel repository within your infrastructure, which you’ll have to keep updated.

If you keep your custom device tree in another directory within your project, it will be clear that this file is necessary for a successful build. It will not be “lost” within the kernel repository.

Having said that, I would recommend:

  • starting with a custom device tree file inside the kernel repository
  • once you have something that is worth committing, copy it to your project repository
  • from that moment on, I would symlink the file in your project repository back inside the kernel repository, so that you keep your development environment easy to use, and every change you make to the device tree will immediately be visible in your version control system.

If you were using yocto, the device tree could be included with a special recipe for that within your layer. When using Torizon, Torizon Core Builder will build the device tree for you as part of the image generation process.