Message ID | 1384896475-8744-1-git-send-email-jason@lakedaemon.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 11/19/2013 02:27 PM, Jason Cooper wrote: > Unlike other build products in the Linux kernel, there is no 'make > *install' mechanism to put devicetree blobs in a standard place. > > This patch is an attempt to fix this problem. Akin to 'make install', > this creates a new make target, dtbs_install. The script that gets > called defers to a distribution or user supplied installdtbs binary, > if found in the system. Otherwise, the default action is to install a > given dtb into > > /lib/modules/${kernel_version}/devicetree/${dts_filename}.dtb I still don't see why you wouldn't install the files in /lib/devicetrees, but I suppose that location is fine. > This is done to keep dtbs from different kernel versions separate until > things have settled down. Once the dtbs are stable, and not so strongly > linked to the kernel version, the devicetree files will most likely move > to their own repo. Users will need to upgrade install scripts at that > time. > > Signed-off-by: Jason Cooper <jason@lakedaemon.net> > --- > Question: should I make a note about the filenames not being considered an ABI, > or just let it be? I still believe they're an ABI. I guess Grant meant that they aren't an ABI to the kernel at run-time, unlike the content which is an ABI. That's fine. However, I believe the files certainly are an ABI to any script that takes them from the "make dtbs_install" output directory. Perhaps the best resolution is to just say nothing and let it be:-) > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > +dtbs_install: dtbs > + $(CONFIG_SHELL) $(srctree)/scripts/installdtbs.sh $(KERNELRELEASE) \ > + "$(MODLIB)/devicetree" "$(srctree)/$(boot)/dts" I still think this rule should be in Makefile not arch/arm/Makefile. Aside from those couple of issues, this version looks OK to me.
On Tue, 19 Nov 2013 14:58:05 -0700, Stephen Warren <swarren@wwwdotorg.org> wrote: > On 11/19/2013 02:27 PM, Jason Cooper wrote: > > Unlike other build products in the Linux kernel, there is no 'make > > *install' mechanism to put devicetree blobs in a standard place. > > > > This patch is an attempt to fix this problem. Akin to 'make install', > > this creates a new make target, dtbs_install. The script that gets > > called defers to a distribution or user supplied installdtbs binary, > > if found in the system. Otherwise, the default action is to install a > > given dtb into > > > > /lib/modules/${kernel_version}/devicetree/${dts_filename}.dtb > > I still don't see why you wouldn't install the files in > /lib/devicetrees, but I suppose that location is fine. /boot/devicetrees/${kernel_version} would be my choice. /boot is more likely to be available to firmware than /lib would be. g.
On Tue, Nov 19, 2013 at 02:58:05PM -0700, Stephen Warren wrote: > On 11/19/2013 02:27 PM, Jason Cooper wrote: > > Unlike other build products in the Linux kernel, there is no 'make > > *install' mechanism to put devicetree blobs in a standard place. > > > > This patch is an attempt to fix this problem. Akin to 'make install', > > this creates a new make target, dtbs_install. The script that gets > > called defers to a distribution or user supplied installdtbs binary, > > if found in the system. Otherwise, the default action is to install a > > given dtb into > > > > /lib/modules/${kernel_version}/devicetree/${dts_filename}.dtb > > I still don't see why you wouldn't install the files in > /lib/devicetrees, but I suppose that location is fine. Hmm, after sleeping on it a night, I've come around. If we install to /lib/devicetree/${kernel_version}/, then when the devicetree moves to it's own repo, it should be able to install to /lib/devicetree. So this: 1) hints at the still strong connection between a dtb and the kernel version 2) doesn't sound odd like installing dtbs into a modules directory 3) allows a future independent repository to install non-kernel-version-dependent dtbs in a sane location. I'm still not in favor of installing to /boot/anything since /boot is often a separate, small partition. I even set mine not to automount. The number and size of dtbs is only going to grow. Better to install them in a location with lots of space, and /lib is used to having the kernel modules installed in it. > > This is done to keep dtbs from different kernel versions separate until > > things have settled down. Once the dtbs are stable, and not so strongly > > linked to the kernel version, the devicetree files will most likely move > > to their own repo. Users will need to upgrade install scripts at that > > time. > > > > Signed-off-by: Jason Cooper <jason@lakedaemon.net> > > --- > > Question: should I make a note about the filenames not being considered an ABI, > > or just let it be? > > I still believe they're an ABI. > > I guess Grant meant that they aren't an ABI to the kernel at run-time, > unlike the content which is an ABI. That's fine. > > However, I believe the files certainly are an ABI to any script that > takes them from the "make dtbs_install" output directory. > > Perhaps the best resolution is to just say nothing and let it be:-) Fine by me. > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > > > +dtbs_install: dtbs > > + $(CONFIG_SHELL) $(srctree)/scripts/installdtbs.sh $(KERNELRELEASE) \ > > + "$(MODLIB)/devicetree" "$(srctree)/$(boot)/dts" > > I still think this rule should be in Makefile not arch/arm/Makefile. d*mn. I sent this version too quick. Thanks for catching that. I didn't expand my test coverage after moving installdtbs.sh. > Aside from those couple of issues, this version looks OK to me. Great! Hopefully Linus won't have any concerns when it passes through him. thx, Jason.
On 11/20/2013 10:08 AM, Jason Cooper wrote: > On Tue, Nov 19, 2013 at 02:58:05PM -0700, Stephen Warren wrote: >> On 11/19/2013 02:27 PM, Jason Cooper wrote: >>> Unlike other build products in the Linux kernel, there is no 'make >>> *install' mechanism to put devicetree blobs in a standard place. >>> >>> This patch is an attempt to fix this problem. Akin to 'make install', >>> this creates a new make target, dtbs_install. The script that gets >>> called defers to a distribution or user supplied installdtbs binary, >>> if found in the system. Otherwise, the default action is to install a >>> given dtb into >>> >>> /lib/modules/${kernel_version}/devicetree/${dts_filename}.dtb >> >> I still don't see why you wouldn't install the files in >> /lib/devicetrees, but I suppose that location is fine. > > Hmm, after sleeping on it a night, I've come around. If we install to > /lib/devicetree/${kernel_version}/, then when the devicetree moves to > it's own repo, it should be able to install to /lib/devicetree. > > So this: > 1) hints at the still strong connection between a dtb and the kernel > version > 2) doesn't sound odd like installing dtbs into a modules directory > 3) allows a future independent repository to install > non-kernel-version-dependent dtbs in a sane location. > > I'm still not in favor of installing to /boot/anything since /boot is > often a separate, small partition. I even set mine not to automount. > The number and size of dtbs is only going to grow. Better to install > them in a location with lots of space, and /lib is used to having the > kernel modules installed in it. Isn't installdtbs (the in-kernel version) typically installing to a temporary staging directory, which is then packaged up by some process? If you point DESTDIR/INSTALL_MOD_PATH/... at / when running it, or install a custom /sbin/installdtbs that ignores the path and always copies the files to /, then haven't you specifically opted in to /boot being an available and appropriate location? As such, I'm tending to agree with Grant that /boot/devicetrees/... makes more sense that /lib/devicetrees/...; my use of "/lib" above was simply me writing to fast and typing the wrong thing!
On Wed, Nov 20, 2013 at 01:21:58PM +0000, Grant Likely wrote: > On Tue, 19 Nov 2013 14:58:05 -0700, Stephen Warren <swarren@wwwdotorg.org> wrote: > > On 11/19/2013 02:27 PM, Jason Cooper wrote: > > > Unlike other build products in the Linux kernel, there is no 'make > > > *install' mechanism to put devicetree blobs in a standard place. > > > > > > This patch is an attempt to fix this problem. Akin to 'make install', > > > this creates a new make target, dtbs_install. The script that gets > > > called defers to a distribution or user supplied installdtbs binary, > > > if found in the system. Otherwise, the default action is to install a > > > given dtb into > > > > > > /lib/modules/${kernel_version}/devicetree/${dts_filename}.dtb > > > > I still don't see why you wouldn't install the files in > > /lib/devicetrees, but I suppose that location is fine. > > /boot/devicetrees/${kernel_version} would be my choice. /boot is more > likely to be available to firmware than /lib would be. True, but a lot of systems make /boot a small, non-automounted separate partition. It's not that all of the dtbs take up a lot of space, but that only one of them is needed to boot, which is what /boot is intended to hold. I think it's a distribution issue to determine whether to put one, some or all of the dtbs in /boot. I'd prefer not to make that decision for them. Is /lib/devicetrees/${kernelversion}/ an acceptable middle ground? thx, Jason.
On Wed, 20 Nov 2013 12:08:45 -0500, Jason Cooper <jason@lakedaemon.net> wrote: > I'm still not in favor of installing to /boot/anything since /boot is > often a separate, small partition. I even set mine not to automount. > The number and size of dtbs is only going to grow. Better to install > them in a location with lots of space, and /lib is used to having the > kernel modules installed in it. This is just the kernel default action. It can be overridden with a local script or an environment variable. /boot definitely makes more sense that /lib. g.
diff --git a/Makefile b/Makefile index 920ad07180c9..29d609e972d6 100644 --- a/Makefile +++ b/Makefile @@ -339,6 +339,7 @@ OBJDUMP = $(CROSS_COMPILE)objdump AWK = awk GENKSYMS = scripts/genksyms/genksyms INSTALLKERNEL := installkernel +INSTALLDTBS := installdtbs DEPMOD = /sbin/depmod PERL = perl CHECK = sparse @@ -391,7 +392,7 @@ KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(S export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP -export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE +export MAKE AWK GENKSYMS INSTALLKERNEL INSTALLDTBS PERL UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c99b1086d83d..6c7abfc5eb5e 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -314,6 +314,10 @@ PHONY += dtbs dtbs: scripts $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs +dtbs_install: dtbs + $(CONFIG_SHELL) $(srctree)/scripts/installdtbs.sh $(KERNELRELEASE) \ + "$(MODLIB)/devicetree" "$(srctree)/$(boot)/dts" + # We use MRPROPER_FILES and CLEAN_FILES now archclean: $(Q)$(MAKE) $(clean)=$(boot) diff --git a/scripts/installdtbs.sh b/scripts/installdtbs.sh new file mode 100644 index 000000000000..11027f00c3a4 --- /dev/null +++ b/scripts/installdtbs.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1995 by Linus Torvalds +# +# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin +# +# Further adapted from arch/x86/boot/install.sh by Jason Cooper +# +# "make dtbs_install" script +# +# Arguments: +# $1 - kernel version +# $2 - default install path (blank if root directory) +# $3 - directory containing dtbs +# + +# User may have a custom install script + +if [ -x ~/bin/${INSTALLDTBS} ]; then exec ~/bin/${INSTALLDTBS} "$@"; fi +if [ -x /sbin/${INSTALLDTBS} ]; then exec /sbin/${INSTALLDTBS} "$@"; fi + +# Default install +[ -d "$2" ] && rm -rf "$2" + +mkdir -p "$2" + +for dtb in `find "$3" -name "*.dtb"`; do + cp "$dtb" "$2/${dtb##*/}" +done
Unlike other build products in the Linux kernel, there is no 'make *install' mechanism to put devicetree blobs in a standard place. This patch is an attempt to fix this problem. Akin to 'make install', this creates a new make target, dtbs_install. The script that gets called defers to a distribution or user supplied installdtbs binary, if found in the system. Otherwise, the default action is to install a given dtb into /lib/modules/${kernel_version}/devicetree/${dts_filename}.dtb This is done to keep dtbs from different kernel versions separate until things have settled down. Once the dtbs are stable, and not so strongly linked to the kernel version, the devicetree files will most likely move to their own repo. Users will need to upgrade install scripts at that time. Signed-off-by: Jason Cooper <jason@lakedaemon.net> --- Question: should I make a note about the filenames not being considered an ABI, or just let it be? changes since v3: - drop renaming files to ${compat}.dtb (rmk/swarren) - move installdtbs.sh to ./scripts/ (gcl) changes since v2: - use fdtget instead of a modified dtc to get the board compat string changes since v1: - added this patch Makefile | 3 ++- arch/arm/Makefile | 4 ++++ scripts/installdtbs.sh | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 scripts/installdtbs.sh