3 # The include file <dtb.mk> handles building and installing dtb files.
7 # DTS List of the dts files to build and install.
9 # DTBDIR Base path for dtb modules [/boot/dtb]
11 # DTBOWN .dtb file owner. [${BINOWN}]
13 # DTBGRP .dtb file group. [${BINGRP}]
15 # DTBMODE Module file mode. [${BINMODE}]
17 # DESTDIR The tree where the module gets installed. [not set]
22 # install the kernel module; if the Makefile
23 # does not itself define the target install, the targets
24 # beforeinstall and afterinstall may also be used to cause
25 # actions immediately before and after the install target
29 .include <bsd.init.mk>
30 # Grab all the options for a kernel build. For backwards compat, we need to
31 # do this after bsd.own.mk.
32 .include "kern.opts.mk"
34 # Search for kernel source tree in standard places.
35 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
36 .if !defined(SYSDIR) && exists(${_dir}/kern/)
40 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
41 .error "can't find kernel source tree"
46 .PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/boot/fdt/dts/${MACHINE}
48 DTB=${DTS:R:S/$/.dtb/}
54 ${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META}
55 @echo Generating ${.TARGET} from ${_dts}
56 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR}
57 CLEANFILES+=${_dts:R:S/$/.dtb/}
62 .if !target(realinstall)
63 realinstall: _dtbinstall
64 .ORDER: beforeinstall _kmodinstall
66 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
67 # to make sure the tree is setup properly. We don't recreate it to avoid duplicate
68 # entries in the NO_ROOT case.
69 test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
71 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
72 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
74 .endif # !target(realinstall)
75 .endif # !target(install)
79 .include <bsd.links.mk>