4 # Grab all the options for a kernel build. For backwards compat, we need to
5 # do this after bsd.own.mk.
6 .include "kern.opts.mk"
14 # Search for kernel source tree in standard places.
15 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
16 .if exists(${_dir}/kern/)
21 .endif # defined(SYSDIR)
23 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
24 .error "can't find kernel source tree"
27 DTB=${DTS:T:R:S/$/.dtb/}
28 DTBO=${DTSO:T:R:S/$/.dtbo/}
30 .SUFFIXES: .dtb .dts .dtbo .dtso
31 .PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}
32 .PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays
37 @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
38 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
40 .dtso.dtbo: ${OP_META}
41 @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
42 @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
44 # Add dependencies on the source file so that out-of-tree things can be included
45 # without any .PATH additions.
47 ${_dts:R:T}.dtb: ${_dts}
51 ${_dtso:R:T}.dtbo: ${_dtso}
55 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
56 # to make sure the tree is setup properly. We don't recreate it to avoid duplicate
57 # entries in the NO_ROOT case.
58 test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
60 .if ${MACHINE_CPUARCH} == "aarch64"
61 # :H:T here to grab the vendor component of the DTB path in a way that
62 # allows out-of-tree DTS builds, too. We make the assumption that
63 # out-of-tree DTS will have a similar directory structure to in-tree,
64 # with .dts files appearing in a vendor/ directory.
65 test -d ${DESTDIR}${DTBDIR}/${_dtb:H:T} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
66 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
67 ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
69 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
70 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
73 test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR}
75 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
76 ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/