summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2015-06-02 21:24:47 +0000
committerimp <imp@FreeBSD.org>2015-06-02 21:24:47 +0000
commita5587d67f9f8ac5971f073fdfbf4cb0e69fc2bd7 (patch)
tree1d9287cb9f894447d1dbc943113e39d71883a6a1
parentfb6b5e38d8a14968b7b55572d99d953342d1a42d (diff)
downloadFreeBSD-src-a5587d67f9f8ac5971f073fdfbf4cb0e69fc2bd7.zip
FreeBSD-src-a5587d67f9f8ac5971f073fdfbf4cb0e69fc2bd7.tar.gz
MFC:
Merge r276846: Add infrastructure to build dtb files from dts files.
-rw-r--r--share/mk/Makefile1
-rw-r--r--share/mk/bsd.dtb.mk17
-rw-r--r--sys/arm/conf/ATMEL2
-rw-r--r--sys/conf/dtb.mk75
-rw-r--r--sys/modules/dtb/atmel/Makefile9
5 files changed, 103 insertions, 1 deletions
diff --git a/share/mk/Makefile b/share/mk/Makefile
index 75b45e8..d0234d8 100644
--- a/share/mk/Makefile
+++ b/share/mk/Makefile
@@ -11,6 +11,7 @@ FILES= \
bsd.crunchgen.mk \
bsd.dep.mk \
bsd.doc.mk \
+ bsd.dtb.mk \
bsd.endian.mk \
bsd.files.mk \
bsd.incs.mk \
diff --git a/share/mk/bsd.dtb.mk b/share/mk/bsd.dtb.mk
new file mode 100644
index 0000000..24e6930
--- /dev/null
+++ b/share/mk/bsd.dtb.mk
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+# Search for kernel source tree in standard places.
+.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \
+ ${.CURDIR}/../../../../.. /sys /usr/src/sys
+.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk)
+SYSDIR= ${_dir}
+.endif
+.endfor
+.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || \
+ !exists(${SYSDIR}/conf/kmod.mk)
+.error Unable to locate the kernel source tree. Set SYSDIR to override.
+.endif
+
+.include "${SYSDIR}/conf/dtb.mk"
+
+.include <bsd.sys.mk>
diff --git a/sys/arm/conf/ATMEL b/sys/arm/conf/ATMEL
index 59ef417..04b8367 100644
--- a/sys/arm/conf/ATMEL
+++ b/sys/arm/conf/ATMEL
@@ -15,7 +15,7 @@ makeoptions KERNVIRTADDR=0xc0000000
options KERNPHYSADDR=0x20000000
options KERNVIRTADDR=0xc0000000
-makeoptions MODULES_OVERRIDE=""
+makeoptions MODULES_OVERRIDE="dtb/atmel"
# list all boards here, but not just yet (no multiboard in mainline).
options ARM_MANY_BOARD
diff --git a/sys/conf/dtb.mk b/sys/conf/dtb.mk
new file mode 100644
index 0000000..9822f46
--- /dev/null
+++ b/sys/conf/dtb.mk
@@ -0,0 +1,75 @@
+# $FreeBSD$
+#
+# The include file <dtb.mk> handles building and installing dtb files.
+#
+# +++ variables +++
+#
+# 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" # commented out to minize difference with 11.x and newer
+
+# Search for kernel source tree in standard places.
+.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
+.if !defined(SYSDIR) && exists(${_dir}/kern/)
+SYSDIR= ${_dir}
+.endif
+.endfor
+.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
+.error "can't find kernel source tree"
+.endif
+
+.SUFFIXES: .dtb .dts
+
+.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/boot/fdt/dts/${MACHINE}
+
+DTBDIR?=/boot/dtb
+DTB=${DTS:R:S/$/.dtb/}
+
+all: ${DTB}
+
+.if defined(DTS)
+.for _dts in ${DTS}
+${_dts:R:S/$/.dtb/}: ${_dts}
+ @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:
+.for _dtb in ${DTB}
+ ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
+ ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}
+.endfor
+.endif # !target(realinstall)
+.endif # !target(install)
+
+.include <bsd.dep.mk>
+.include <bsd.obj.mk>
diff --git a/sys/modules/dtb/atmel/Makefile b/sys/modules/dtb/atmel/Makefile
new file mode 100644
index 0000000..99ae4cb
--- /dev/null
+++ b/sys/modules/dtb/atmel/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# All the dts files for the boards we might likely support made by Atmel,
+# plus the SAMA5 offerings.
+DTS=at91-sama5d3_xplained.dts at91sam9g20ek.dts ethernut5.dts \
+ at91-qil_a9260.dts sama5d31ek.dts sama5d33ek.dts sama5d34ek.dts \
+ sama5d35ek.dts sama5d36ek.dts tny_a9260.dts tny_a9g20.dts \
+ usb_a9260.dts usb_a9g20.dts
+
+.include <bsd.dtb.mk>
OpenPOWER on IntegriCloud