3 # The include file <dtb.mk> handles building and installing dtb files.
7 # DTC The Device Tree Compiler to use
9 # DTS List of the dts files to build and install.
11 # DTBDIR Base path for dtb modules [/boot/dtb]
13 # DTBOWN .dtb file owner. [${BINOWN}]
15 # DTBGRP .dtb file group. [${BINGRP}]
17 # DTBMODE Module file mode. [${BINMODE}]
19 # DESTDIR The tree where the module gets installed. [not set]
24 # install the kernel module; if the Makefile
25 # does not itself define the target install, the targets
26 # beforeinstall and afterinstall may also be used to cause
27 # actions immediately before and after the install target
31 .include <bsd.init.mk>
32 # Grab all the options for a kernel build. For backwards compat, we need to
33 # do this after bsd.own.mk.
34 .include "kern.opts.mk"
38 # Search for kernel source tree in standard places.
39 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
40 .if !defined(SYSDIR) && exists(${_dir}/kern/)
44 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
45 .error "can't find kernel source tree"
48 .SUFFIXES: .dtb .dts .dtbo .dtso
50 .PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}/overlays
52 DTB=${DTS:R:S/$/.dtb/}
53 DTBO=${DTSO:R:S/$/.dtbo/}
60 ${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META}
61 @echo Generating ${.TARGET} from ${_dts}
62 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR}
63 CLEANFILES+=${_dts:R:S/$/.dtb/}
70 ${_dtso:R:S/$/.dtbo/}: ${_dtso} ${OP_META}
71 @echo Generating ${.TARGET} from ${_dtso}
72 @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} overlays/${_dtso} ${.OBJDIR}
73 CLEANFILES+=${_dtso:R:S/$/.dtbo/}
78 .if !target(realinstall)
79 realinstall: _dtbinstall
80 .ORDER: beforeinstall _kmodinstall
82 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
83 # to make sure the tree is setup properly. We don't recreate it to avoid duplicate
84 # entries in the NO_ROOT case.
85 test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
87 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
88 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
90 test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR}
92 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
93 ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/
95 .endif # !target(realinstall)
96 .endif # !target(install)
100 .include <bsd.links.mk>