-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsoc-dts-diff
executable file
·76 lines (59 loc) · 931 Bytes
/
soc-dts-diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# © Copyright 2018 by Geert Uytterhoeven
#
# This file is subject to the terms and conditions of the GNU General Public
# License.
set -e
function usage()
{
cat <<END
Usage: $(basename $0) [options...] <dts1> <dts2>
END
exit -1
}
function get_soc()
{
local soc
soc=$(basename $1)
# Strip vendor prefix
case $soc in
*,*)
soc=${soc##*,}
;;
esac
case $soc in
pfc-*.c|pinctrl-*.c)
soc=${soc##*-}
soc=${soc%.c}
;;
*)
soc=${soc%%[-.]*}
;;
esac
echo $soc
}
options=-u
for i in $*; do
case $i in
-*)
options="$options $i"
;;
*)
if [ "$dts1" == "" ]; then
dts1=$i
elif [ "$dts2" == "" ]; then
dts2=$i
else
usage
fi
;;
esac
done
if [ "$dts1" == "" -o "$dts2" == "" ]; then
usage
fi
soc1=$(get_soc $dts1)
soc2=$(get_soc $dts2)
colordiff $options \
--label $dts1 <(sed -e "s/$soc1/<SOC>/gi" $dts1) \
--label $dts2 <(sed -e "s/$soc2/<SOC>/gi" $dts2)