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"
28 # DTB for aarch64 needs to preserve the immediate parent of the .dts, because
29 # these DTS are vendored and should be installed into their vendored directory.
30 .if ${MACHINE_ARCH} == "aarch64"
31 DTB+= ${_dts:R:S/$/.dtb/}
33 DTB+= ${_dts:T:R:S/$/.dtb/}
37 DTBO=${DTSO:T:R:S/$/.dtbo/}
39 .SUFFIXES: .dtb .dts .dtbo .dtso
40 .PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}
41 .PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays
46 @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
47 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
49 .dtso.dtbo: ${OP_META}
50 @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
51 @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
53 # Add dependencies on the source file so that out-of-tree things can be included
54 # without any .PATH additions.
55 .for _dts in ${DTS} ${FDT_DTS_FILE}
56 ${_dts:R:T}.dtb: ${_dts}
60 ${_dtso:R:T}.dtbo: ${_dtso}
64 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
65 # to make sure the tree is setup properly. We don't recreate it to avoid duplicate
66 # entries in the NO_ROOT case.
67 test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
69 .if ${MACHINE_CPUARCH} == "aarch64"
70 # :H:T here to grab the vendor component of the DTB path in a way that
71 # allows out-of-tree DTS builds, too. We make the assumption that
72 # out-of-tree DTS will have a similar directory structure to in-tree,
73 # with .dts files appearing in a vendor/ directory.
74 test -d ${DESTDIR}${DTBDIR}/${_dtb:H:T} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
75 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
76 ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
78 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
79 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
82 test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR}
84 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
85 ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/