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 .include <bsd.sysdir.mk>
16 .endif # defined(SYSDIR)
18 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
19 .error "can't find kernel source tree"
23 # DTB for aarch64 needs to preserve the immediate parent of the .dts, because
24 # these DTS are vendored and should be installed into their vendored directory.
25 .if ${MACHINE_CPUARCH} == "aarch64"
26 DTB+= ${_dts:R:S/$/.dtb/}
28 DTB+= ${_dts:T:R:S/$/.dtb/}
32 DTBO=${DTSO:T:R:S/$/.dtbo/}
34 .SUFFIXES: .dtb .dts .dtbo .dtso
35 .PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}
36 .PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays
41 @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
42 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
44 .dtso.dtbo: ${OP_META}
45 @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
46 @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
48 # Add dependencies on the source file so that out-of-tree things can be included
49 # without any .PATH additions.
50 .for _dts in ${DTS} ${FDT_DTS_FILE}
51 ${_dts:R:T}.dtb: ${_dts}
55 ${_dtso:R:T}.dtbo: ${_dtso}
59 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
60 # to make sure the tree is setup properly. We don't recreate it to avoid duplicate
61 # entries in the NO_ROOT case.
62 test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
64 .if ${MACHINE_CPUARCH} == "aarch64"
65 # :H:T here to grab the vendor component of the DTB path in a way that
66 # allows out-of-tree DTS builds, too. We make the assumption that
67 # out-of-tree DTS will have a similar directory structure to in-tree,
68 # with .dts files appearing in a vendor/ directory.
69 test -d ${DESTDIR}${DTBDIR}/${_dtb:H:T} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
70 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
71 ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
73 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
74 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
77 test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR}
79 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
80 ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/