Changeset View
Changeset View
Standalone View
Standalone View
sys/conf/dtb.mk
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) | .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) | ||||
.error "can't find kernel source tree" | .error "can't find kernel source tree" | ||||
.endif | .endif | ||||
.SUFFIXES: .dtb .dts .dtbo .dtso | .SUFFIXES: .dtb .dts .dtbo .dtso | ||||
.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}/overlays | .PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}/overlays | ||||
DTB=${DTS:R:S/$/.dtb/} | |||||
DTBO=${DTSO:R:S/$/.dtbo/} | |||||
all: ${DTB} ${DTBO} | |||||
.if defined(DTS) | .if defined(DTS) | ||||
.export DTC ECHO | |||||
.for _dts in ${DTS} | .for _dts in ${DTS} | ||||
${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META} | _dtb=${_dts:T:R:S/$/.dtb/} | ||||
@${ECHO} Generating ${.TARGET} from ${_dts} | .if !empty(DTS_${_dtb}) | ||||
@${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR} | .warning "Duplicated DTS ${_dts}" | ||||
CLEANFILES+=${_dts:R:S/$/.dtb/} | .endif | ||||
DTB:=${DTB} ${_dtb} | |||||
DTS_${_dtb}:=${_dts} | |||||
.endfor | .endfor | ||||
.endif | .endif | ||||
.if defined(DTSO) | .if defined(DTSO) | ||||
.export DTC ECHO | |||||
.for _dtso in ${DTSO} | .for _dtso in ${DTSO} | ||||
${_dtso:R:S/$/.dtbo/}: ${_dtso} ${OP_META} | _dtso_path=${_dtso:C/^([^\/])/overlays\/\\1/} | ||||
@${ECHO} Generating ${.TARGET} from ${_dtso} | _dtbo=${_dtso:T:R:S/$/.dtbo/} | ||||
@${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} overlays/${_dtso} ${.OBJDIR} | .if !empty(DTSO_${_dtbo}) | ||||
CLEANFILES+=${_dtso:R:S/$/.dtbo/} | .warning "Duplicated DTSO ${_dtso}" | ||||
.endif | |||||
DTBO:=${DTBO} ${_dtbo} | |||||
DTSO_${_dtbo}:=${_dtso_path} | |||||
.endfor | .endfor | ||||
.endif | .endif | ||||
.if !target(install) | .if defined(DTB) | ||||
.if !target(realinstall) | .export DTC ECHO | ||||
realinstall: _dtbinstall | .for _dtb in ${DTB} | ||||
.ORDER: beforeinstall _kmodinstall | ${_dtb}: ${_dts} ${OP_META} | ||||
@${ECHO} Generating ${.TARGET} from ${DTS_${.TARGET}} | |||||
@${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${DTS_${.TARGET}} ${.OBJDIR} | |||||
CLEANFILES+=${_dtb} | |||||
.endfor | |||||
.endif | |||||
.if defined(DTBO) | |||||
.export DTC ECHO | |||||
.for _dtbo in ${DTBO} | |||||
${_dtbo}: ${DTSO_${.TARGET}} ${OP_META} | |||||
@${ECHO} Generating ${.TARGET} from ${DTSO_${.TARGET}} | |||||
@${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${DTSO_${.TARGET}} ${.OBJDIR} | |||||
CLEANFILES+=${_dtbo} | |||||
.endfor | |||||
.endif | |||||
_dtbinstall: | _dtbinstall: | ||||
# Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree | # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree | ||||
# to make sure the tree is setup properly. We don't recreate it to avoid duplicate | # to make sure the tree is setup properly. We don't recreate it to avoid duplicate | ||||
# entries in the NO_ROOT case. | # entries in the NO_ROOT case. | ||||
test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR} | test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR} | ||||
.for _dtb in ${DTB} | .for _dtb in ${DTB} | ||||
.if ${MACHINE_CPUARCH} == "aarch64" | .if ${MACHINE_CPUARCH} == "aarch64" | ||||
test -d ${DESTDIR}${DTBDIR}/${_dtb:H} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H} | # :H:T here to grab the vendor component of the DTB path in a way that | ||||
# allows out-of-tree DTS builds, too. We make the assumption that | |||||
# out-of-tree DTS will have a similar directory structure to in-tree, | |||||
# with .dts files appearing in a vendor/ directory. | |||||
test -d ${DESTDIR}${DTBDIR}/${_dtb:H:T} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H:T} | |||||
${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ | ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ | ||||
${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H} | ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T} | ||||
.else | .else | ||||
${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ | ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ | ||||
${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ | ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ | ||||
.endif | .endif | ||||
.endfor | .endfor | ||||
test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} | test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} | ||||
.for _dtbo in ${DTBO} | .for _dtbo in ${DTBO} | ||||
${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ | ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ | ||||
${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ | ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ | ||||
.endfor | .endfor | ||||
.endif # !target(realinstall) | |||||
.endif # !target(install) | |||||
.include <bsd.dep.mk> | .if target(kernel-install) | ||||
kernel-all: ${DTB} ${DTBO} | |||||
kernel-install: _dtbinstall | |||||
.ORDER: beforeinstall _dtbinstall | |||||
.elif !target(install) && !target(realinstall) | |||||
all: ${DTB} ${DTBO} | |||||
realinstall: _dtbinstall | |||||
.ORDER: beforeinstall _dtbinstall | |||||
.include <bsd.obj.mk> | .include <bsd.obj.mk> | ||||
.include <bsd.links.mk> | .include <bsd.links.mk> | ||||
.endif # !target(install) && !target(realinstall) |