18c2ecf20Sopenharmony_ci#! /bin/bash
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci# Copyright (C) 2015 Frank Rowand
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciusage() {
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci	# use spaces instead of tabs in the usage message
118c2ecf20Sopenharmony_ci	cat >&2 <<eod
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciUsage:
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci   `basename $0` DTx
168c2ecf20Sopenharmony_ci        decompile DTx
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci   `basename $0` DTx_1 DTx_2
198c2ecf20Sopenharmony_ci        diff DTx_1 and DTx_2
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci      --annotate    synonym for -T
238c2ecf20Sopenharmony_ci      --color       synonym for -c (requires diff with --color support)
248c2ecf20Sopenharmony_ci       -c           enable colored output
258c2ecf20Sopenharmony_ci       -f           print full dts in diff (--unified=99999)
268c2ecf20Sopenharmony_ci       -h           synonym for --help
278c2ecf20Sopenharmony_ci       -help        synonym for --help
288c2ecf20Sopenharmony_ci      --help        print this message and exit
298c2ecf20Sopenharmony_ci       -s SRCTREE   linux kernel source tree is at path SRCTREE
308c2ecf20Sopenharmony_ci                        (default is current directory)
318c2ecf20Sopenharmony_ci       -S           linux kernel source tree is at root of current git repo
328c2ecf20Sopenharmony_ci       -T           annotate output .dts with input source file and line
338c2ecf20Sopenharmony_ci                        (-T -T for more details)
348c2ecf20Sopenharmony_ci       -u           unsorted, do not sort DTx
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciEach DTx is processed by the dtc compiler to produce a sorted dts source
388c2ecf20Sopenharmony_cifile.  If DTx is a dts source file then it is pre-processed in the same
398c2ecf20Sopenharmony_cimanner as done for the compile of the dts source file in the Linux kernel
408c2ecf20Sopenharmony_cibuild system ('#include' and '/include/' directives are processed).
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciIf two DTx are provided, the resulting dts source files are diffed.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciIf DTx is a directory, it is treated as a DT subtree, such as
458c2ecf20Sopenharmony_ci  /proc/device-tree.
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciIf DTx contains the binary blob magic value in the first four bytes,
488c2ecf20Sopenharmony_ci  it is treated as a binary blob (aka .dtb or FDT).
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciOtherwise DTx is treated as a dts source file (aka .dts).
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci   If this script is not run from the root of the linux source tree,
538c2ecf20Sopenharmony_ci   and DTx utilizes '#include' or '/include/' then the path of the
548c2ecf20Sopenharmony_ci   linux source tree can be provided by '-s SRCTREE' or '-S' so that
558c2ecf20Sopenharmony_ci   include paths will be set properly.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci   The shell variable \${ARCH} must provide the architecture containing
588c2ecf20Sopenharmony_ci   the dts source file for include paths to be set properly for '#include'
598c2ecf20Sopenharmony_ci   or '/include/' to be processed.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci   If DTx_1 and DTx_2 are in different architectures, then this script
628c2ecf20Sopenharmony_ci   may not work since \${ARCH} is part of the include path.  The following
638c2ecf20Sopenharmony_ci   workaround can be used:
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci      `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts
668c2ecf20Sopenharmony_ci      `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts
678c2ecf20Sopenharmony_ci      `basename $0` tmp_dtx_1.dts tmp_dtx_2.dts
688c2ecf20Sopenharmony_ci      rm tmp_dtx_1.dts tmp_dtx_2.dts
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci   If DTx_1 and DTx_2 are in different directories, then this script will
718c2ecf20Sopenharmony_ci   add the path of DTx_1 and DTx_2 to the include paths.  If DTx_2 includes
728c2ecf20Sopenharmony_ci   a local file that exists in both the path of DTx_1 and DTx_2 then the
738c2ecf20Sopenharmony_ci   file in the path of DTx_1 will incorrectly be included.  Possible
748c2ecf20Sopenharmony_ci   workaround:
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci      `basename $0` DTx_1 >tmp_dtx_1.dts
778c2ecf20Sopenharmony_ci      `basename $0` DTx_2 >tmp_dtx_2.dts
788c2ecf20Sopenharmony_ci      `basename $0` tmp_dtx_1.dts tmp_dtx_2.dts
798c2ecf20Sopenharmony_ci      rm tmp_dtx_1.dts tmp_dtx_2.dts
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cieod
828c2ecf20Sopenharmony_ci}
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cicompile_to_dts() {
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	dtx="$1"
888c2ecf20Sopenharmony_ci	dtc_include="$2"
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	if [ -d "${dtx}" ] ; then
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci		# -----  input is file tree
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci		if ( ! ${DTC} -I fs ${dtx} ) ; then
958c2ecf20Sopenharmony_ci			exit 3
968c2ecf20Sopenharmony_ci		fi
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci	elif [ -f "${dtx}" ] && [ -r "${dtx}" ] ; then
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci		magic=`hexdump -n 4 -e '/1 "%02x"' ${dtx}`
1018c2ecf20Sopenharmony_ci		if [ "${magic}" = "d00dfeed" ] ; then
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci			# -----  input is FDT (binary blob)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci			if ( ! ${DTC} -I dtb ${dtx} ) ; then
1068c2ecf20Sopenharmony_ci				exit 3
1078c2ecf20Sopenharmony_ci			fi
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci			return
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci		fi
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci		# -----  input is DTS (source)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci		if ( cpp ${cpp_flags} -x assembler-with-cpp ${dtx} \
1168c2ecf20Sopenharmony_ci			| ${DTC} ${dtc_include} -I dts ) ; then
1178c2ecf20Sopenharmony_ci			return
1188c2ecf20Sopenharmony_ci		fi
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci		echo ""                                                      >&2
1218c2ecf20Sopenharmony_ci		echo "Possible hints to resolve the above error:"            >&2
1228c2ecf20Sopenharmony_ci		echo "  (hints might not fix the problem)"                   >&2
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci		hint_given=0
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci		if [ "${ARCH}" = "" ] ; then
1278c2ecf20Sopenharmony_ci			hint_given=1
1288c2ecf20Sopenharmony_ci			echo ""                                              >&2
1298c2ecf20Sopenharmony_ci			echo "  shell variable \$ARCH not set"               >&2
1308c2ecf20Sopenharmony_ci		fi
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci		dtx_arch=`echo "/${dtx}" | sed -e 's|.*/arch/||' -e 's|/.*||'`
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci		if [ "${dtx_arch}" != ""  -a "${dtx_arch}" != "${ARCH}" ] ; then
1358c2ecf20Sopenharmony_ci			hint_given=1
1368c2ecf20Sopenharmony_ci			echo ""                                              >&2
1378c2ecf20Sopenharmony_ci			echo "  architecture ${dtx_arch} is in file path,"   >&2
1388c2ecf20Sopenharmony_ci			echo "  but does not match shell variable \$ARCH"    >&2
1398c2ecf20Sopenharmony_ci			echo "  >>\$ARCH<< is: >>${ARCH}<<"                  >&2
1408c2ecf20Sopenharmony_ci		fi
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci		if [ ! -d ${srctree}/arch/${ARCH} ] ; then
1438c2ecf20Sopenharmony_ci			hint_given=1
1448c2ecf20Sopenharmony_ci			echo ""                                              >&2
1458c2ecf20Sopenharmony_ci			echo "  ${srctree}/arch/${ARCH}/ does not exist"     >&2
1468c2ecf20Sopenharmony_ci			echo "  Is \$ARCH='${ARCH}' correct?"                >&2
1478c2ecf20Sopenharmony_ci			echo "  Possible fix: use '-s' option"               >&2
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci			git_root=`git rev-parse --show-toplevel 2>/dev/null`
1508c2ecf20Sopenharmony_ci			if [ -d ${git_root}/arch/ ] ; then
1518c2ecf20Sopenharmony_ci				echo "  Possible fix: use '-S' option"       >&2
1528c2ecf20Sopenharmony_ci			fi
1538c2ecf20Sopenharmony_ci		fi
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci		if [ $hint_given = 0 ] ; then
1568c2ecf20Sopenharmony_ci			echo ""                                              >&2
1578c2ecf20Sopenharmony_ci			echo "  No hints available."                         >&2
1588c2ecf20Sopenharmony_ci		fi
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci		echo ""                                                      >&2
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci		exit 3
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci	else
1658c2ecf20Sopenharmony_ci		echo ""                                                     >&2
1668c2ecf20Sopenharmony_ci		echo "ERROR: ${dtx} does not exist or is not readable"      >&2
1678c2ecf20Sopenharmony_ci		echo ""                                                     >&2
1688c2ecf20Sopenharmony_ci		exit 2
1698c2ecf20Sopenharmony_ci	fi
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci}
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci# -----  start of script
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ciannotate=""
1778c2ecf20Sopenharmony_cicmd_diff=0
1788c2ecf20Sopenharmony_cidiff_flags="-u"
1798c2ecf20Sopenharmony_cidiff_color=""
1808c2ecf20Sopenharmony_cidtx_file_1=""
1818c2ecf20Sopenharmony_cidtx_file_2=""
1828c2ecf20Sopenharmony_cidtc_sort="-s"
1838c2ecf20Sopenharmony_cihelp=0
1848c2ecf20Sopenharmony_cisrctree=""
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ciwhile [ $# -gt 0 ] ; do
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	case $1 in
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci	-c | --color )
1928c2ecf20Sopenharmony_ci		if diff --color /dev/null /dev/null 2>/dev/null ; then
1938c2ecf20Sopenharmony_ci			diff_color="--color=always"
1948c2ecf20Sopenharmony_ci		fi
1958c2ecf20Sopenharmony_ci		shift
1968c2ecf20Sopenharmony_ci		;;
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	-f )
1998c2ecf20Sopenharmony_ci		diff_flags="--unified=999999"
2008c2ecf20Sopenharmony_ci		shift
2018c2ecf20Sopenharmony_ci		;;
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci	-h | -help | --help )
2048c2ecf20Sopenharmony_ci		help=1
2058c2ecf20Sopenharmony_ci		shift
2068c2ecf20Sopenharmony_ci		;;
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci	-s )
2098c2ecf20Sopenharmony_ci		srctree="$2"
2108c2ecf20Sopenharmony_ci		shift 2
2118c2ecf20Sopenharmony_ci		;;
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci	-S )
2148c2ecf20Sopenharmony_ci		git_root=`git rev-parse --show-toplevel 2>/dev/null`
2158c2ecf20Sopenharmony_ci		srctree="${git_root}"
2168c2ecf20Sopenharmony_ci		shift
2178c2ecf20Sopenharmony_ci		;;
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	-T | --annotate )
2208c2ecf20Sopenharmony_ci		if [ "${annotate}"  = "" ] ; then
2218c2ecf20Sopenharmony_ci			annotate="-T"
2228c2ecf20Sopenharmony_ci		elif [ "${annotate}"  = "-T" ] ; then
2238c2ecf20Sopenharmony_ci			annotate="-T -T"
2248c2ecf20Sopenharmony_ci		fi
2258c2ecf20Sopenharmony_ci		shift
2268c2ecf20Sopenharmony_ci		;;
2278c2ecf20Sopenharmony_ci	-u )
2288c2ecf20Sopenharmony_ci		dtc_sort=""
2298c2ecf20Sopenharmony_ci		shift
2308c2ecf20Sopenharmony_ci		;;
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci	*)
2338c2ecf20Sopenharmony_ci		if [ "${dtx_file_1}"  = "" ] ; then
2348c2ecf20Sopenharmony_ci			dtx_file_1="$1"
2358c2ecf20Sopenharmony_ci		elif [ "${dtx_file_2}" = "" ] ; then
2368c2ecf20Sopenharmony_ci			dtx_file_2="$1"
2378c2ecf20Sopenharmony_ci		else
2388c2ecf20Sopenharmony_ci			echo ""                                             >&2
2398c2ecf20Sopenharmony_ci			echo "ERROR: Unexpected parameter: $1"              >&2
2408c2ecf20Sopenharmony_ci			echo ""                                             >&2
2418c2ecf20Sopenharmony_ci			exit 2
2428c2ecf20Sopenharmony_ci		fi
2438c2ecf20Sopenharmony_ci		shift
2448c2ecf20Sopenharmony_ci		;;
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci	esac
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_cidone
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ciif [ "${srctree}" = "" ] ; then
2518c2ecf20Sopenharmony_ci	srctree="."
2528c2ecf20Sopenharmony_cifi
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ciif [ "${dtx_file_2}" != "" ]; then
2558c2ecf20Sopenharmony_ci	cmd_diff=1
2568c2ecf20Sopenharmony_cifi
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ciif (( ${help} )) ; then
2598c2ecf20Sopenharmony_ci	usage
2608c2ecf20Sopenharmony_ci	exit 1
2618c2ecf20Sopenharmony_cifi
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci# this must follow check for ${help}
2648c2ecf20Sopenharmony_ciif [ "${dtx_file_1}" = "" ]; then
2658c2ecf20Sopenharmony_ci	echo ""                                                             >&2
2668c2ecf20Sopenharmony_ci	echo "ERROR: parameter DTx required"                                >&2
2678c2ecf20Sopenharmony_ci	echo ""                                                             >&2
2688c2ecf20Sopenharmony_ci	exit 2
2698c2ecf20Sopenharmony_cifi
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci# -----  prefer dtc from linux kernel, allow fallback to dtc in $PATH
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ciif [ "${KBUILD_OUTPUT:0:2}" = ".." ] ; then
2758c2ecf20Sopenharmony_ci	__KBUILD_OUTPUT="${srctree}/${KBUILD_OUTPUT}"
2768c2ecf20Sopenharmony_cielif [ "${KBUILD_OUTPUT}" = "" ] ; then
2778c2ecf20Sopenharmony_ci	__KBUILD_OUTPUT="."
2788c2ecf20Sopenharmony_cielse
2798c2ecf20Sopenharmony_ci	__KBUILD_OUTPUT="${KBUILD_OUTPUT}"
2808c2ecf20Sopenharmony_cifi
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ciDTC="${__KBUILD_OUTPUT}/scripts/dtc/dtc"
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ciif [ ! -x ${DTC} ] ; then
2858c2ecf20Sopenharmony_ci	__DTC="dtc"
2868c2ecf20Sopenharmony_ci	if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config 2>/dev/null; then
2878c2ecf20Sopenharmony_ci		make_command='
2888c2ecf20Sopenharmony_ci         make scripts'
2898c2ecf20Sopenharmony_ci	else
2908c2ecf20Sopenharmony_ci		make_command='
2918c2ecf20Sopenharmony_ci         Enable CONFIG_DTC in the kernel configuration
2928c2ecf20Sopenharmony_ci         make scripts'
2938c2ecf20Sopenharmony_ci	fi
2948c2ecf20Sopenharmony_ci	if ( ! which ${__DTC} >/dev/null ) ; then
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci		# use spaces instead of tabs in the error message
2978c2ecf20Sopenharmony_ci		cat >&2 <<eod
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ciERROR: unable to find a 'dtc' program
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci   Preferred 'dtc' (built from Linux kernel source tree) was not found or
3028c2ecf20Sopenharmony_ci   is not executable.
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci      'dtc' is: ${DTC}
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci      If it does not exist, create it from the root of the Linux source tree:
3078c2ecf20Sopenharmony_ci${make_command}
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci      If not at the root of the Linux kernel source tree -s SRCTREE or -S
3108c2ecf20Sopenharmony_ci      may need to be specified to find 'dtc'.
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci      If 'O=\${dir}' is specified in your Linux builds, this script requires
3138c2ecf20Sopenharmony_ci      'export KBUILD_OUTPUT=\${dir}' or add \${dir}/scripts/dtc to \$PATH
3148c2ecf20Sopenharmony_ci      before running.
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci      If \${KBUILD_OUTPUT} is a relative path, then '-s SRCDIR', -S, or run
3178c2ecf20Sopenharmony_ci      this script from the root of the Linux kernel source tree is required.
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci   Fallback '${__DTC}' was also not in \${PATH} or is not executable.
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_cieod
3228c2ecf20Sopenharmony_ci		exit 2
3238c2ecf20Sopenharmony_ci	fi
3248c2ecf20Sopenharmony_ci	DTC=${__DTC}
3258c2ecf20Sopenharmony_cifi
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci# -----  cpp and dtc flags same as for linux source tree build of .dtb files,
3298c2ecf20Sopenharmony_ci#        plus directories of the dtx file(s)
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_cidtx_path_1_dtc_include="-i `dirname ${dtx_file_1}`"
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_cidtx_path_2_dtc_include=""
3348c2ecf20Sopenharmony_ciif (( ${cmd_diff} )) ; then
3358c2ecf20Sopenharmony_ci	dtx_path_2_dtc_include="-i `dirname ${dtx_file_2}`"
3368c2ecf20Sopenharmony_cifi
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_cicpp_flags="\
3398c2ecf20Sopenharmony_ci	-nostdinc                                  \
3408c2ecf20Sopenharmony_ci	-I${srctree}/scripts/dtc/include-prefixes  \
3418c2ecf20Sopenharmony_ci	-undef -D__DTS__"
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ciDTC="\
3448c2ecf20Sopenharmony_ci	${DTC}                                     \
3458c2ecf20Sopenharmony_ci	-i ${srctree}/scripts/dtc/include-prefixes \
3468c2ecf20Sopenharmony_ci	-O dts -qq -f ${dtc_sort} ${annotate} -o -"
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci# -----  do the diff or decompile
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ciif (( ${cmd_diff} )) ; then
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci	diff ${diff_flags} ${diff_color} --label "${dtx_file_1}" --label "${dtx_file_2}" \
3548c2ecf20Sopenharmony_ci		<(compile_to_dts "${dtx_file_1}" "${dtx_path_1_dtc_include}") \
3558c2ecf20Sopenharmony_ci		<(compile_to_dts "${dtx_file_2}" "${dtx_path_2_dtc_include}")
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_cielse
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci	compile_to_dts "${dtx_file_1}" "${dtx_path_1_dtc_include}"
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_cifi
362