1#! /bin/bash 2# SPDX-License-Identifier: GPL-2.0-or-later 3 4# This script uses the bash <(...) extension. 5# If you want to change this to work with a generic /bin/sh, make sure 6# you fix that. 7 8 9DTC=dtc 10 11source_and_sort () { 12 DT="$1" 13 if [ -d "$DT" ]; then 14 IFORMAT=fs 15 elif [ -f "$DT" ]; then 16 case "$DT" in 17 *.dts) 18 IFORMAT=dts 19 ;; 20 *.dtb) 21 IFORMAT=dtb 22 ;; 23 esac 24 fi 25 26 if [ -z "$IFORMAT" ]; then 27 echo "Unrecognized format for $DT" >&2 28 exit 2 29 fi 30 31 $DTC -I $IFORMAT -O dts -qq -f -s -o - "$DT" 32} 33 34if [ $# != 2 ]; then 35 echo "Usage: dtdiff <device tree> <device tree>" >&2 36 exit 1 37fi 38 39diff -u <(source_and_sort "$1") <(source_and_sort "$2") 40