From owner-svn-src-all@freebsd.org Tue Apr 16 21:09:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1241E157DB08; Tue, 16 Apr 2019 21:09:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8B5680B90; Tue, 16 Apr 2019 21:09:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97EF7252C4; Tue, 16 Apr 2019 21:09:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3GL9w7h052216; Tue, 16 Apr 2019 21:09:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3GL9vQT052213; Tue, 16 Apr 2019 21:09:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201904162109.x3GL9vQT052213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 16 Apr 2019 21:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r346304 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 346304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A8B5680B90 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2019 21:09:59 -0000 Author: kevans Date: Tue Apr 16 21:09:57 2019 New Revision: 346304 URL: https://svnweb.freebsd.org/changeset/base/346304 Log: MFC r345519: DTS/DTSO makeoptions Allow kernel config to specify DTS/DTSO to build, and out-of-tree support This allows for directives such as makeoptions DTS+=/out/of/tree/myboard.dts # in tree! Same rules applied as if this were in a dtb/ module makeoptions DTS+=otherboard.dts to be specified in config(5) and have these built/installed alongside th kernel. The assumption that overlays live in an overlays/ directory is only made for in-tree DTSO, but we still make the assumption that out-of-tree arm64 DTS will be in vendored directories (for now). This lowers the cost to hacking on an overlay or dts by being able to quickly throw it in a custom config, especially if it doesn't fit one of the current dtb/modules quite appropriately or it's not intended for commit there. The build/install targets were split out of dtb.mk to centralize the build logic and leave out the all/realinstall/CLEANFILES additions... it was believed that we didn't want to pollute the kernel build with these. The build rules were converted to suffix rules at the suggestion of Ian to clean things up a little bit in a world where we can have mixed in-tree/out-of-tree DTS/DTSO specified. Added: stable/12/sys/conf/dtb.build.mk - copied unchanged from r345519, head/sys/conf/dtb.build.mk Modified: stable/12/sys/conf/dtb.mk stable/12/sys/conf/kern.post.mk Directory Properties: stable/12/ (props changed) Copied: stable/12/sys/conf/dtb.build.mk (from r345519, head/sys/conf/dtb.build.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/conf/dtb.build.mk Tue Apr 16 21:09:57 2019 (r346304, copy of r345519, head/sys/conf/dtb.build.mk) @@ -0,0 +1,77 @@ +# $FreeBSD$ + +.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" + +DTC?= dtc + +.if !defined(SYSDIR) +.if defined(S) +SYSDIR= ${S} +.else +# Search for kernel source tree in standard places. +.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys +.if exists(${_dir}/kern/) +SYSDIR= ${_dir:tA} +.endif +.endfor +.endif # defined(S) +.endif # defined(SYSDIR) + +.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) +.error "can't find kernel source tree" +.endif + +DTB=${DTS:T:R:S/$/.dtb/} +DTBO=${DTSO:T:R:S/$/.dtbo/} + +.SUFFIXES: .dtb .dts .dtbo .dtso +.PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} +.PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays + +.export DTC ECHO + +.dts.dtb: ${OP_META} + @${ECHO} Generating ${.TARGET} from ${.IMPSRC} + @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR} + +.dtso.dtbo: ${OP_META} + @${ECHO} Generating ${.TARGET} from ${.IMPSRC} + @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR} + +# Add dependencies on the source file so that out-of-tree things can be included +# without any .PATH additions. +.for _dts in ${DTS} +${_dts:R:T}.dtb: ${_dts} +.endfor + +.for _dtso in ${DTSO} +${_dtso:R:T}.dtbo: ${_dtso} +.endfor + +_dtbinstall: +# 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 +# entries in the NO_ROOT case. + test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR} +.for _dtb in ${DTB} +.if ${MACHINE_CPUARCH} == "aarch64" + # :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} \ + ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T} +.else + ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ + ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ +.endif +.endfor + test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} +.for _dtbo in ${DTBO} + ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ + ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ +.endfor Modified: stable/12/sys/conf/dtb.mk ============================================================================== --- stable/12/sys/conf/dtb.mk Tue Apr 16 21:02:41 2019 (r346303) +++ stable/12/sys/conf/dtb.mk Tue Apr 16 21:09:57 2019 (r346304) @@ -8,6 +8,8 @@ # # DTS List of the dts files to build and install. # +# DTSO List of the dts overlay files to build and install. +# # DTBDIR Base path for dtb modules [/boot/dtb] # # DTBOWN .dtb file owner. [${BINOWN}] @@ -20,7 +22,7 @@ # # +++ targets +++ # -# install: +# 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 @@ -28,78 +30,15 @@ # 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" +.include "dtb.build.mk" -DTC?= dtc - -# 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:tA} -.endif -.endfor -.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) -.error "can't find kernel source tree" -.endif - -.SUFFIXES: .dtb .dts .dtbo .dtso - -.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}/overlays - -DTB=${DTS:R:S/$/.dtb/} -DTBO=${DTSO:R:S/$/.dtbo/} - +.if !target(install) && !target(realinstall) all: ${DTB} ${DTBO} - -.if defined(DTS) -.export DTC ECHO -.for _dts in ${DTS} -${_dts:R:S/$/.dtb/}: ${_dts} ${OP_META} - @${ECHO} Generating ${.TARGET} from ${_dts} - @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR} -CLEANFILES+=${_dts:R:S/$/.dtb/} -.endfor -.endif - -.if defined(DTSO) -.export DTC ECHO -.for _dtso in ${DTSO} -${_dtso:R:S/$/.dtbo/}: ${_dtso} ${OP_META} - @${ECHO} Generating ${.TARGET} from ${_dtso} - @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} overlays/${_dtso} ${.OBJDIR} -CLEANFILES+=${_dtso:R:S/$/.dtbo/} -.endfor -.endif - -.if !target(install) -.if !target(realinstall) realinstall: _dtbinstall -.ORDER: beforeinstall _kmodinstall -_dtbinstall: -# 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 -# entries in the NO_ROOT case. - test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR} -.for _dtb in ${DTB} -.if ${MACHINE_CPUARCH} == "aarch64" - test -d ${DESTDIR}${DTBDIR}/${_dtb:H} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H} - ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ - ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H} -.else - ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ - ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ -.endif -.endfor - test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} -.for _dtbo in ${DTBO} - ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ - ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ -.endfor -.endif # !target(realinstall) -.endif # !target(install) +.ORDER: beforeinstall _dtbinstall + +CLEANFILES+=${DTB} ${DTBO} +.endif # !target(install) && !target(realinstall) .include .include Modified: stable/12/sys/conf/kern.post.mk ============================================================================== --- stable/12/sys/conf/kern.post.mk Tue Apr 16 21:02:41 2019 (r346303) +++ stable/12/sys/conf/kern.post.mk Tue Apr 16 21:09:57 2019 (r346304) @@ -8,6 +8,16 @@ # should be defined in the kern.pre.mk so that port makefiles can # override or augment them. +.if defined(DTS) || defined(DTSO) +.include "dtb.build.mk" + +KERNEL_EXTRA+= ${DTB} ${DTBO} +CLEAN+= ${DTB} ${DTBO} + +kernel-install: _dtbinstall +.ORDER: beforeinstall _dtbinstall +.endif + # In case the config had a makeoptions DESTDIR... .if defined(DESTDIR) MKMODULESENV+= DESTDIR="${DESTDIR}"