Patchwork [PATCHv2,2/4] kmod: allow to build a host variant

login
register
mail settings
Submitter Thomas Petazzoni
Date Aug. 27, 2013, 5:28 p.m.
Message ID <1377624514-10510-3-git-send-email-thomas.petazzoni@free-electrons.com>
Download mbox | patch
Permalink /patch/270165/
State Accepted
Headers show

Comments

Thomas Petazzoni - Aug. 27, 2013, 5:28 p.m.
Since module-init-tools is deprecated, we now want to use kmod instead
for the installation of modules during the kernel build process. In
order to do this, we need to be able to build a host variant of kmod,
which is want this patch allows to do.

Note that only the depmod tool is installed on the host, since that's
the only one likely to be used on the host in a cross-compilation
context.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/kmod/kmod.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
Peter Korsgaard - Sept. 2, 2013, 8:51 p.m.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 Thomas> Since module-init-tools is deprecated, we now want to use kmod instead
 Thomas> for the installation of modules during the kernel build process. In
 Thomas> order to do this, we need to be able to build a host variant of kmod,
 Thomas> which is want this patch allows to do.

 Thomas> Note that only the depmod tool is installed on the host, since that's
 Thomas> the only one likely to be used on the host in a cross-compilation
 Thomas> context.

Committed, thanks.
Peter Korsgaard - Sept. 2, 2013, 8:58 p.m.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 Thomas> Since module-init-tools is deprecated, we now want to use kmod instead
 Thomas> for the installation of modules during the kernel build process. In
 Thomas> order to do this, we need to be able to build a host variant of kmod,
 Thomas> which is want this patch allows to do.

 Thomas> Note that only the depmod tool is installed on the host, since that's
 Thomas> the only one likely to be used on the host in a cross-compilation
 Thomas> context.

 Thomas> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 Thomas> ---
 Thomas>  package/kmod/kmod.mk | 10 ++++++++++
 Thomas>  1 file changed, 10 insertions(+)

 Thomas> diff --git a/package/kmod/kmod.mk b/package/kmod/kmod.mk
 Thomas> index 71a2632..4445fa8 100644
 Thomas> --- a/package/kmod/kmod.mk
 Thomas> +++ b/package/kmod/kmod.mk
 Thomas> @@ -54,4 +54,14 @@ else
 Thomas>  KMOD_CONF_OPT += --disable-tools
 Thomas>  endif
 
 Thomas> +# We only install depmod, since that's the only tool used for the
 Thomas> +# host.
 Thomas> +define HOST_KMOD_INSTALL_TOOLS
 Thomas> +	mkdir -p $(HOST_DIR)/sbin/
 Thomas> +	ln -sf ../usr/bin/kmod $(HOST_DIR)/sbin/depmod
 Thomas> +endef
 Thomas> +
 Thomas> +HOST_KMOD_POST_INSTALL_HOOKS += HOST_KMOD_INSTALL_TOOLS
 Thomas> +

We also need to set HOST_KMOD_AUTORECONF = YES because of the
configure.ac patch (arguably we should default HOST_<pkg>_AUTORECONF =
<pkg>_AUTORECONF).
Thomas Petazzoni - Sept. 2, 2013, 9:48 p.m.
Dear Peter Korsgaard,

On Mon, 02 Sep 2013 22:58:04 +0200, Peter Korsgaard wrote:

>  Thomas> +# We only install depmod, since that's the only tool used for the
>  Thomas> +# host.
>  Thomas> +define HOST_KMOD_INSTALL_TOOLS
>  Thomas> +	mkdir -p $(HOST_DIR)/sbin/
>  Thomas> +	ln -sf ../usr/bin/kmod $(HOST_DIR)/sbin/depmod
>  Thomas> +endef
>  Thomas> +
>  Thomas> +HOST_KMOD_POST_INSTALL_HOOKS += HOST_KMOD_INSTALL_TOOLS
>  Thomas> +
> 
> We also need to set HOST_KMOD_AUTORECONF = YES because of the
> configure.ac patch (arguably we should default HOST_<pkg>_AUTORECONF =
> <pkg>_AUTORECONF).

Ah, yes, right. I didn't see the problem since the configure.ac patch
is only to support gcc < 4.6.x on the host, which wasn't my case. But
certainly useful in general indeed.

Thanks,

Thomas
Peter Korsgaard - Sept. 2, 2013, 10:46 p.m.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 >> We also need to set HOST_KMOD_AUTORECONF = YES because of the
 >> configure.ac patch (arguably we should default HOST_<pkg>_AUTORECONF =
 >> <pkg>_AUTORECONF).

 Thomas> Ah, yes, right. I didn't see the problem since the configure.ac patch
 Thomas> is only to support gcc < 4.6.x on the host, which wasn't my case. But
 Thomas> certainly useful in general indeed.

Not only that, but if you don't have (the right version of) autotools on
your build host it also fails.

Anyway, fixed.
Thomas Petazzoni - Sept. 3, 2013, 7:02 a.m.
Dear Peter Korsgaard,

On Tue, 03 Sep 2013 00:46:01 +0200, Peter Korsgaard wrote:
> >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:
> 
>  >> We also need to set HOST_KMOD_AUTORECONF = YES because of the
>  >> configure.ac patch (arguably we should default HOST_<pkg>_AUTORECONF =
>  >> <pkg>_AUTORECONF).
> 
>  Thomas> Ah, yes, right. I didn't see the problem since the configure.ac patch
>  Thomas> is only to support gcc < 4.6.x on the host, which wasn't my case. But
>  Thomas> certainly useful in general indeed.
> 
> Not only that, but if you don't have (the right version of) autotools on
> your build host it also fails.

Ah, yes, right: configure.ac is newer than configure, so it tries to
automatically regenerate the configure script from configure.ac. Makes
sense, thanks for fixing it!

Thomas

Patch

diff --git a/package/kmod/kmod.mk b/package/kmod/kmod.mk
index 71a2632..4445fa8 100644
--- a/package/kmod/kmod.mk
+++ b/package/kmod/kmod.mk
@@ -54,4 +54,14 @@  else
 KMOD_CONF_OPT += --disable-tools
 endif
 
+# We only install depmod, since that's the only tool used for the
+# host.
+define HOST_KMOD_INSTALL_TOOLS
+	mkdir -p $(HOST_DIR)/sbin/
+	ln -sf ../usr/bin/kmod $(HOST_DIR)/sbin/depmod
+endef
+
+HOST_KMOD_POST_INSTALL_HOOKS += HOST_KMOD_INSTALL_TOOLS
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))