platform_external_dtc/dtdiff
Rob Herring 4097bbffcf dtc: Add GPLv2 SPDX tags to files missing license text
A couple of dtc files are missing licenses. Add GPL-2.0-or-later SPDX
tag to them.

Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20190620211944.9378-7-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-06-21 21:06:10 +10:00

39 lines
680 B
Bash

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# 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")