User Tools

Site Tools


comparing_device_trees_with_dtx_diff

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
comparing_device_trees_with_dtx_diff [2018/11/17 16:08]
rpjday [Preparing for comparison]
comparing_device_trees_with_dtx_diff [2018/11/17 16:13]
rpjday [Comparing two .dts files already in the kernel source tree (Part one)]
Line 17: Line 17:
  
 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. 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):
 +
 +<​code>​
 +$ 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 ...
 +</​code>​
 +
 +===== Comparing two .dts files already in the kernel source tree (Part deux) =====
 +
 +In the above example, you were located in the root directory of the relevant kernel source tree, which is the default for the ''​dtx_diff''​ script, where it knows how to process device tree source file includes. If, however, you're in the actual underlying ''​dts''​ directory (or somewhere else in the kernel source tree), you can't just run the script as is since it won't know the kernel source tree to use to process ''​include''​ directives:
 +
 +<​code>​
 +$ cd arch/​arm/​boot/​dts
 +$ dtx_diff imx6q{,​p}-sabresd.dts
 +
 +... snip ...
 +
 +In file included from imx6qp.dtsi:​43:​0,​
 +                 from imx6qp-sabresd.dts:​45:​
 +imx6q.dtsi:​11:​50:​ error: no include path in which to search for dt-bindings/​interrupt-controller/​irq.h
 + #​include <​dt-bindings/​interrupt-controller/​irq.h>​
 +
 +... snip ...
 +
 +  ./arch/arm/ does not exist
 +  Is $ARCH='​arm'​ correct?
 +  Possible fix: use '​-s'​ option
 +
 +  ./arch/arm/ does not exist
 +  Is $ARCH='​arm'​ correct?
 +  Possible fix: use '​-s'​ option
 +  Possible fix: use '​-S'​ option
 +
 +  Possible fix: use '​-S'​ option
 +$
 +</​code>​
 +
 +Instead, you need to use one of these two variations, depending on whether you're in a Git repository, or just a regular source tree:
 +
 +<​code>​
 +$ dtx_diff -s ~/k/git imx6q{,​p}-sabresd.dts ​   (specify source tree with ''​-s''​)
 +$ dtx_diff -S imx6q{,​p}-sabresd.dts ​           (''​-S''​ means this is a Git repo)
 +</​code>​
 +
 +In short, as long as you're still inside the relevant kernel source tree, comparisons will work -- you just need to make sure the ''​dtx_diff''​ script is told where the top of the kernel source tree is.
comparing_device_trees_with_dtx_diff.txt ยท Last modified: 2018/11/17 18:33 by rpjday