From a5587d67f9f8ac5971f073fdfbf4cb0e69fc2bd7 Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 2 Jun 2015 21:24:47 +0000 Subject: [PATCH] MFC: Merge r276846: Add infrastructure to build dtb files from dts files. --- share/mk/Makefile | 1 + share/mk/bsd.dtb.mk | 17 ++++++++ sys/arm/conf/ATMEL | 2 +- sys/conf/dtb.mk | 75 ++++++++++++++++++++++++++++++++++ sys/modules/dtb/atmel/Makefile | 9 ++++ 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 share/mk/bsd.dtb.mk create mode 100644 sys/conf/dtb.mk create mode 100644 sys/modules/dtb/atmel/Makefile diff --git a/share/mk/Makefile b/share/mk/Makefile index 75b45e8d36b..d0234d8c1d4 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 00000000000..24e6930f8fe --- /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 diff --git a/sys/arm/conf/ATMEL b/sys/arm/conf/ATMEL index 59ef417e36c..04b8367402b 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 00000000000..9822f46c2ab --- /dev/null +++ b/sys/conf/dtb.mk @@ -0,0 +1,75 @@ +# $FreeBSD$ +# +# The include file 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 +# 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 +.include diff --git a/sys/modules/dtb/atmel/Makefile b/sys/modules/dtb/atmel/Makefile new file mode 100644 index 00000000000..99ae4cb1f98 --- /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 -- 2.45.2