diff options
author | Timothy Pearson <tpearson@raptorengineering.com> | 2019-05-11 15:12:49 -0500 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-05-11 15:12:49 -0500 |
commit | 9e80202352dd49bdd9e67b8b906d86f058431505 (patch) | |
tree | 5673c17aad6e3833da8c4ff21b5a11f666ec9fbe /src/dtc/dtdiff | |
download | hqemu-master.zip hqemu-master.tar.gz |
Diffstat (limited to 'src/dtc/dtdiff')
-rw-r--r-- | src/dtc/dtdiff | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/dtc/dtdiff b/src/dtc/dtdiff new file mode 100644 index 0000000..5fa772b --- /dev/null +++ b/src/dtc/dtdiff @@ -0,0 +1,38 @@ +#! /bin/bash + +# This script uses the bash <(...) extension. +# If you want to change this to work with a generic /bin/sh, make sure +# you fix that. + + +DTC=dtc + +source_and_sort () { + DT="$1" + if [ -d "$DT" ]; then + IFORMAT=fs + elif [ -f "$DT" ]; then + case "$DT" in + *.dts) + IFORMAT=dts + ;; + *.dtb) + IFORMAT=dtb + ;; + esac + fi + + if [ -z "$IFORMAT" ]; then + echo "Unrecognized format for $DT" >&2 + exit 2 + fi + + $DTC -I $IFORMAT -O dts -qq -f -s -o - "$DT" +} + +if [ $# != 2 ]; then + echo "Usage: dtdiff <device tree> <device tree>" >&2 + exit 1 +fi + +diff -u <(source_and_sort "$1") <(source_and_sort "$2") |