2015-01-08 18:28:06 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# The include file <dtb.mk> handles building and installing dtb files.
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
2017-06-17 23:34:53 +00:00
|
|
|
# DTC The Device Tree Compiler to use
|
|
|
|
#
|
2015-01-08 18:28:06 +00:00
|
|
|
# DTS List of the dts files to build and install.
|
|
|
|
#
|
|
|
|
# DTBDIR Base path for dtb modules [/boot/dtb]
|
|
|
|
#
|
|
|
|
# DTBOWN .dtb file owner. [${BINOWN}]
|
|
|
|
#
|
|
|
|
# DTBGRP .dtb file group. [${BINGRP}]
|
|
|
|
#
|
|
|
|
# DTBMODE Module file mode. [${BINMODE}]
|
|
|
|
#
|
|
|
|
# DESTDIR The tree where the module gets installed. [not set]
|
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# install:
|
|
|
|
# install the kernel module; if the Makefile
|
|
|
|
# does not itself define the target install, the targets
|
|
|
|
# beforeinstall and afterinstall may also be used to cause
|
|
|
|
# actions immediately before and after the install target
|
|
|
|
# is executed.
|
|
|
|
#
|
|
|
|
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
# Grab all the options for a kernel build. For backwards compat, we need to
|
|
|
|
# do this after bsd.own.mk.
|
|
|
|
.include "kern.opts.mk"
|
|
|
|
|
2017-06-17 23:34:53 +00:00
|
|
|
DTC?= dtc
|
|
|
|
|
2015-01-08 18:28:06 +00:00
|
|
|
# Search for kernel source tree in standard places.
|
|
|
|
.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
|
|
|
|
.if !defined(SYSDIR) && exists(${_dir}/kern/)
|
2016-05-31 23:12:43 +00:00
|
|
|
SYSDIR= ${_dir:tA}
|
2015-01-08 18:28:06 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
|
|
|
|
.error "can't find kernel source tree"
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.SUFFIXES: .dtb .dts
|
|
|
|
|
2017-11-14 21:03:57 +00:00
|
|
|
.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}
|
2015-01-08 18:28:06 +00:00
|
|
|
|
|
|
|
DTB=${DTS:R:S/$/.dtb/}
|
|
|
|
|
|
|
|
all: ${DTB}
|
|
|
|
|
|
|
|
.if defined(DTS)
|
2017-06-17 23:34:53 +00:00
|
|
|
.export DTC
|
2015-01-08 18:28:06 +00:00
|
|
|
.for _dts in ${DTS}
|
2016-05-31 23:12:43 +00:00
|
|
|
${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META}
|
2015-01-08 18:28:06 +00:00
|
|
|
@echo Generating ${.TARGET} from ${_dts}
|
|
|
|
@${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR}
|
|
|
|
CLEANFILES+=${_dts:R:S/$/.dtb/}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(realinstall)
|
|
|
|
realinstall: _dtbinstall
|
|
|
|
.ORDER: beforeinstall _kmodinstall
|
|
|
|
_dtbinstall:
|
2015-02-09 16:10:30 +00:00
|
|
|
# Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
|
2015-02-09 16:29:44 +00:00
|
|
|
# to make sure the tree is setup properly. We don't recreate it to avoid duplicate
|
|
|
|
# entries in the NO_ROOT case.
|
|
|
|
test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}
|
2015-01-08 18:28:06 +00:00
|
|
|
.for _dtb in ${DTB}
|
|
|
|
${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
|
2015-10-17 05:49:07 +00:00
|
|
|
${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
|
2015-01-08 18:28:06 +00:00
|
|
|
.endfor
|
|
|
|
.endif # !target(realinstall)
|
|
|
|
.endif # !target(install)
|
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|
|
|
|
.include <bsd.obj.mk>
|
2017-01-28 05:07:53 +00:00
|
|
|
.include <bsd.links.mk>
|