diff --git a/sys/conf/dtb.build.mk b/sys/conf/dtb.build.mk index 8d106615822f..83ee03943e16 100644 --- a/sys/conf/dtb.build.mk +++ b/sys/conf/dtb.build.mk @@ -1,81 +1,79 @@ # $FreeBSD$ .include # Grab all the options for a kernel build. For backwards compat, we need to # do this after bsd.own.mk. .include "kern.opts.mk" DTC?= dtc .if !defined(SYSDIR) .if defined(S) SYSDIR= ${S} .else .include .endif # defined(S) .endif # defined(SYSDIR) .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) .error "can't find kernel source tree" .endif .for _dts in ${DTS} # DTB for aarch64 needs to preserve the immediate parent of the .dts, because # these DTS are vendored and should be installed into their vendored directory. .if ${MACHINE_CPUARCH} == "aarch64" DTB+= ${_dts:R:S/$/.dtb/} .else DTB+= ${_dts:T:R:S/$/.dtb/} .endif .endfor DTBO=${DTSO:T:R:S/$/.dtbo/} .SUFFIXES: .dtb .dts .dtbo .dtso .PATH.dts: ${SYSDIR}/contrib/device-tree/src/${MACHINE} ${SYSDIR}/dts/${MACHINE} .PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays .export DTC ECHO .dts.dtb: ${OP_META} - @${ECHO} Generating ${.TARGET} from ${.IMPSRC} - @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR} + ${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR} .dtso.dtbo: ${OP_META} - @${ECHO} Generating ${.TARGET} from ${.IMPSRC} - @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR} + ${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR} # Add dependencies on the source file so that out-of-tree things can be included # without any .PATH additions. .for _dts in ${DTS} ${FDT_DTS_FILE} ${_dts:R:T}.dtb: ${_dts} .endfor .for _dtso in ${DTSO} ${_dtso:R:T}.dtbo: ${_dtso} .endfor _dtbinstall: # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree # to make sure the tree is setup properly. We don't recreate it to avoid duplicate # entries in the NO_ROOT case. test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR} .for _dtb in ${DTB} .if ${MACHINE_CPUARCH} == "aarch64" # :H:T here to grab the vendor component of the DTB path in a way that # allows out-of-tree DTS builds, too. We make the assumption that # out-of-tree DTS will have a similar directory structure to in-tree, # with .dts files appearing in a vendor/ directory. test -d ${DESTDIR}${DTBDIR}/${_dtb:H:T} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H:T} ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T} .else ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ .endif .endfor test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} .for _dtbo in ${DTBO} ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ .endfor diff --git a/sys/tools/fdt/make_dtb.sh b/sys/tools/fdt/make_dtb.sh index e1a2fa4b1d8a..728faa02b904 100755 --- a/sys/tools/fdt/make_dtb.sh +++ b/sys/tools/fdt/make_dtb.sh @@ -1,28 +1,27 @@ #!/bin/sh # # $FreeBSD$ # Script generates dtb file ($3) from dts source ($2) in build tree S ($1) S=$1 dts="$2" dtb_path=$3 if [ -z "$dts" ]; then echo "No DTS specified" exit 1 fi if [ -z "${MACHINE}" ]; then MACHINE=$(uname -m) fi : "${DTC:=dtc}" : "${ECHO:=echo}" : "${CPP:=cpp}" for d in ${dts}; do dtb="${dtb_path}/$(basename "$d" .dts).dtb" - ${ECHO} "converting $d -> $dtb" ${CPP} -P -x assembler-with-cpp -I "$S/dts/include" -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -I "$S/contrib/device-tree/src/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null | ${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" -i "$S/contrib/device-tree/src/" done diff --git a/sys/tools/fdt/make_dtbo.sh b/sys/tools/fdt/make_dtbo.sh index 1fcab87a6465..46066019751f 100755 --- a/sys/tools/fdt/make_dtbo.sh +++ b/sys/tools/fdt/make_dtbo.sh @@ -1,28 +1,27 @@ #!/bin/sh # # $FreeBSD$ # Script generates dtbo file ($3) from dtso source ($2) in build tree S ($1) S=$1 dtso="$2" dtbo_path=$3 if [ -z "$dtso" ]; then echo "No DTS overlays specified" exit 1 fi if [ -z "${MACHINE}" ]; then MACHINE=$(uname -m) fi : "${DTC:=dtc}" : "${ECHO:=echo}" : "${CPP:=cpp}" for d in ${dtso}; do dtb="${dtbo_path}/$(basename "$d" .dtso).dtbo" - ${ECHO} "converting $d -> $dtb" ${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -include "$d" /dev/null | ${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" done