From 46375c65f6c2a626f1ae75694ca8a3cf446ce5e7 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Sat, 17 Jun 2017 23:34:53 +0000 Subject: [PATCH] make.conf: Add the possibility to use another DTC Add a make.conf DTC variable that control which DTC (Device Tree Compiler) to use. Reviewed by: bdrewery, imp Differential Revision: https://reviews.freebsd.org/D9577 --- share/man/man5/make.conf.5 | 7 ++++++- sys/conf/dtb.mk | 5 +++++ sys/tools/fdt/make_dtb.sh | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5 index 24ebffbbff8..5278c66bd8f 100644 --- a/share/man/man5/make.conf.5 +++ b/share/man/man5/make.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2016 +.Dd February 23, 2017 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -176,6 +176,11 @@ value, use .Dq Li += instead of .Dq Li = . +.It Va DTC +.Pq Vt str +Select the compiler for DTS (Device Tree Syntax) file. +.Va DTC +is initially set to the value of dtc .It Va INSTALL .Pq Vt str the default install command. diff --git a/sys/conf/dtb.mk b/sys/conf/dtb.mk index 81c98ef0ad3..f3e2fa7435e 100644 --- a/sys/conf/dtb.mk +++ b/sys/conf/dtb.mk @@ -4,6 +4,8 @@ # # +++ variables +++ # +# DTC The Device Tree Compiler to use +# # DTS List of the dts files to build and install. # # DTBDIR Base path for dtb modules [/boot/dtb] @@ -31,6 +33,8 @@ # do this after bsd.own.mk. .include "kern.opts.mk" +DTC?= dtc + # Search for kernel source tree in standard places. .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys .if !defined(SYSDIR) && exists(${_dir}/kern/) @@ -50,6 +54,7 @@ DTB=${DTS:R:S/$/.dtb/} all: ${DTB} .if defined(DTS) +.export DTC .for _dts in ${DTS} ${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META} @echo Generating ${.TARGET} from ${_dts} diff --git a/sys/tools/fdt/make_dtb.sh b/sys/tools/fdt/make_dtb.sh index e7138a8790c..f2becbe6218 100755 --- a/sys/tools/fdt/make_dtb.sh +++ b/sys/tools/fdt/make_dtb.sh @@ -16,9 +16,11 @@ if [ -z "${MACHINE}" ]; then MACHINE=$(uname -m) fi +: ${DTC:=dtc} + for d in ${dts}; do dtb=${dtb_path}/`basename $d .dts`.dtb echo "converting $d -> $dtb" cpp -P -x assembler-with-cpp -I $S/gnu/dts/include -I $S/boot/fdt/dts/${MACHINE} -I $S/gnu/dts/${MACHINE} -include $d /dev/null | - dtc -@ -O dtb -o $dtb -b 0 -p 1024 -i $S/boot/fdt/dts/${MACHINE} -i $S/gnu/dts/${MACHINE} + ${DTC} -@ -O dtb -o $dtb -b 0 -p 1024 -i $S/boot/fdt/dts/${MACHINE} -i $S/gnu/dts/${MACHINE} done