User Tools

Site Tools


This is an old revision of the document!


How to compare (typically in-kernel) device tree source files with dtx_diff.

Preparing for comparison

Given a kernel source tree at, say, ~/k/git/, prepare for comparison with:

$ cd ~/k/git
$ PATH=~/k/git/scripts/dtc:$PATH
$ export ARCH=arm

Note that setting PATH as above will add access to all of the executables (scripts and possible binary executables) under the kernel's scripts/dtc/ directory, which includes not only the dtx_diff script but, if you've compiled the kernel scripts, the dtc device tree compiler program that will exist under there as well.

I mention this so you know that if you already had a /usr/bin/dtc executable installed via some sort of dtc package, the one in that scripts directory will take precedence, unless you add that directory at the end of PATH instead of at the beginning. In any event, you must have a dtc command somewhere for the dtx_diff script.

Comparing two .dts files already in the kernel source tree (Part one)

If you're located at the top of the relevant kernel source tree, and you want to compare two device tree source files already there, say, under arch/arm/boot/dts/ (let's say, imx6q-sabresd.dts and imx6qp-sabresd.dts), you can do this (note the use of shell expansion to save on typing):

$ dtx_diff arch/arm/boot/dts/imx6q{,p}-sabresd.dts
--- arch/arm/boot/dts/imx6q-sabresd.dts
+++ arch/arm/boot/dts/imx6qp-sabresd.dts
@@ -3,8 +3,8 @@
 / {
        #address-cells = <0x1>;
        #size-cells = <0x1>;
-       compatible = "fsl,imx6q-sabresd", "fsl,imx6q";
-       model = "Freescale i.MX6 Quad SABRE Smart Device Board";
+       compatible = "fsl,imx6qp-sabresd", "fsl,imx6qp";
+       model = "Freescale i.MX6 Quad Plus SABRE Smart Device Board";

        aliases {
                can0 = "/soc/aips-bus@02000000/flexcan@02090000";
@@ -44,14 +44,14 @@
                brightness-levels = <0x0 0x4 0x8 0x10 0x20 0x40 0x80 0xff>;
                compatible = "pwm-backlight";
                default-brightness-level = <0x7>;
-               phandle = <0x7a>;
-               pwms = <0x78 0x0 0x4c4b40>;
+               phandle = <0x82>;
+               pwms = <0x80 0x0 0x4c4b40>;
                status = "okay";
        .. etc etc ...
comparing_device_trees_with_dtx_diff.1542470970.txt.gz · Last modified: 2018/11/17 16:09 by rpjday