.. | .. |
---|
1 | 1 | #! /bin/bash |
---|
| 2 | +# SPDX-License-Identifier: GPL-2.0-only |
---|
2 | 3 | |
---|
3 | 4 | # Copyright (C) 2015 Frank Rowand |
---|
4 | 5 | # |
---|
5 | | -# This program is free software; you can redistribute it and/or modify |
---|
6 | | -# it under the terms of the GNU General Public License as published by |
---|
7 | | -# the Free Software Foundation; version 2 of the License. |
---|
8 | 6 | |
---|
9 | 7 | |
---|
10 | 8 | usage() { |
---|
.. | .. |
---|
21 | 19 | diff DTx_1 and DTx_2 |
---|
22 | 20 | |
---|
23 | 21 | |
---|
| 22 | + --annotate synonym for -T |
---|
| 23 | + --color synonym for -c (requires diff with --color support) |
---|
| 24 | + -c enable colored output |
---|
24 | 25 | -f print full dts in diff (--unified=99999) |
---|
25 | 26 | -h synonym for --help |
---|
26 | 27 | -help synonym for --help |
---|
.. | .. |
---|
28 | 29 | -s SRCTREE linux kernel source tree is at path SRCTREE |
---|
29 | 30 | (default is current directory) |
---|
30 | 31 | -S linux kernel source tree is at root of current git repo |
---|
| 32 | + -T annotate output .dts with input source file and line |
---|
| 33 | + (-T -T for more details) |
---|
31 | 34 | -u unsorted, do not sort DTx |
---|
32 | 35 | |
---|
33 | 36 | |
---|
.. | .. |
---|
170 | 173 | |
---|
171 | 174 | # ----- start of script |
---|
172 | 175 | |
---|
| 176 | +annotate="" |
---|
173 | 177 | cmd_diff=0 |
---|
174 | 178 | diff_flags="-u" |
---|
| 179 | +diff_color="" |
---|
175 | 180 | dtx_file_1="" |
---|
176 | 181 | dtx_file_2="" |
---|
177 | 182 | dtc_sort="-s" |
---|
.. | .. |
---|
182 | 187 | while [ $# -gt 0 ] ; do |
---|
183 | 188 | |
---|
184 | 189 | case $1 in |
---|
| 190 | + |
---|
| 191 | + -c | --color ) |
---|
| 192 | + if diff --color /dev/null /dev/null 2>/dev/null ; then |
---|
| 193 | + diff_color="--color=always" |
---|
| 194 | + fi |
---|
| 195 | + shift |
---|
| 196 | + ;; |
---|
185 | 197 | |
---|
186 | 198 | -f ) |
---|
187 | 199 | diff_flags="--unified=999999" |
---|
.. | .. |
---|
204 | 216 | shift |
---|
205 | 217 | ;; |
---|
206 | 218 | |
---|
| 219 | + -T | --annotate ) |
---|
| 220 | + if [ "${annotate}" = "" ] ; then |
---|
| 221 | + annotate="-T" |
---|
| 222 | + elif [ "${annotate}" = "-T" ] ; then |
---|
| 223 | + annotate="-T -T" |
---|
| 224 | + fi |
---|
| 225 | + shift |
---|
| 226 | + ;; |
---|
207 | 227 | -u ) |
---|
208 | 228 | dtc_sort="" |
---|
209 | 229 | shift |
---|
.. | .. |
---|
323 | 343 | DTC="\ |
---|
324 | 344 | ${DTC} \ |
---|
325 | 345 | -i ${srctree}/scripts/dtc/include-prefixes \ |
---|
326 | | - -O dts -qq -f ${dtc_sort} -o -" |
---|
| 346 | + -O dts -qq -f ${dtc_sort} ${annotate} -o -" |
---|
327 | 347 | |
---|
328 | 348 | |
---|
329 | 349 | # ----- do the diff or decompile |
---|
330 | 350 | |
---|
331 | 351 | if (( ${cmd_diff} )) ; then |
---|
332 | 352 | |
---|
333 | | - diff ${diff_flags} --label "${dtx_file_1}" --label "${dtx_file_2}" \ |
---|
| 353 | + diff ${diff_flags} ${diff_color} --label "${dtx_file_1}" --label "${dtx_file_2}" \ |
---|
334 | 354 | <(compile_to_dts "${dtx_file_1}" "${dtx_path_1_dtc_include}") \ |
---|
335 | 355 | <(compile_to_dts "${dtx_file_2}" "${dtx_path_2_dtc_include}") |
---|
336 | 356 | |
---|