0
ashthespy

Sorting device tree source (dts) files

Recommended Posts

A little bit OT, but what is the recommended way to sort a dts file?
I commonly see patches, where maintainers keep requesting for nodes in a dts file to be sorted alphabetically, but didn't find any way to achieve this? I tired a simple `dtc -I dts -O dts -s xxx.dts` but the output contains symbols that I don't really need.

Share this post


Link to post
Share on other sites

When you decompile a dtb file, you will normally not get the same dts that was used for compiling. It will be a dts that will work the same as the original, but it will not keep the ordering, spacing and indentation, and not even the same identical syntax as the original one.

 

You should instead look for your dts in the kernel source tree. Look in /arch/arm(64)/boot/dts. For example, for Tinker Board in the Mainline kernel, it's this one: https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/rk3288-tinker.dts . Which, in turn, includes another source file, namely this one: https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/rk3288-tinker.dtsi

Share this post


Link to post
Share on other sites

Hmm, so while reading through a few kernel mailing lists, maintainers seem to stress that patches for device tree sources (say my_new_board.dts) should have its nodes sorted alphabetically. I was just wondering if there was a tool that does this, or is it normally done manually?

Share this post


Link to post
Share on other sites
10 hours ago, spy king said:

or is it normally done manually?

Since patches submitters are only sending patches and not the whole DTS, it is up to them to manually locate the changes correctly in the proper location to have those changes sorted in alphabetic order.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0