Author: imp
Date: Thu Jan  8 18:28:06 2015
New Revision: 276846
URL: https://svnweb.freebsd.org/changeset/base/276846

Log:
  Add infrastructure to build dtb files from dts files.

Added:
  head/share/mk/bsd.dtb.mk   (contents, props changed)
  head/sys/conf/dtb.mk   (contents, props changed)
  head/sys/modules/dtb/
  head/sys/modules/dtb/atmel/
  head/sys/modules/dtb/atmel/Makefile   (contents, props changed)
Modified:
  head/share/mk/Makefile
  head/sys/arm/conf/ATMEL

Modified: head/share/mk/Makefile
==============================================================================
--- head/share/mk/Makefile      Thu Jan  8 18:09:36 2015        (r276845)
+++ head/share/mk/Makefile      Thu Jan  8 18:28:06 2015        (r276846)
@@ -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 \

Added: head/share/mk/bsd.dtb.mk
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/mk/bsd.dtb.mk    Thu Jan  8 18:28:06 2015        (r276846)
@@ -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>

Modified: head/sys/arm/conf/ATMEL
==============================================================================
--- head/sys/arm/conf/ATMEL     Thu Jan  8 18:09:36 2015        (r276845)
+++ head/sys/arm/conf/ATMEL     Thu Jan  8 18:28:06 2015        (r276846)
@@ -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

Added: head/sys/conf/dtb.mk
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/conf/dtb.mk        Thu Jan  8 18:28:06 2015        (r276846)
@@ -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"
+
+# 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>

Added: head/sys/modules/dtb/atmel/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/dtb/atmel/Makefile Thu Jan  8 18:28:06 2015        
(r276846)
@@ -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>
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to