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"
50 .PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/boot/fdt/dts/${MACHINE}
52 DTB=${DTS:R:S/$/.dtb/}
59 ${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META}
60 @echo Generating ${.TARGET} from ${_dts}
61 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR}
62 CLEANFILES+=${_dts:R:S/$/.dtb/}
67 .if !target(realinstall)
68 realinstall: _dtbinstall
69 .ORDER: beforeinstall _kmodinstall
71 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
72 # to make sure the tree is setup properly. We don't recreate it to avoid duplicate
73 # entries in the NO_ROOT case.
74 test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
76 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
77 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
79 .endif # !target(realinstall)
80 .endif # !target(install)
84 .include <bsd.links.mk>