diff mbox

[v2] pkg-kernel-module: Die when kernel module are disabled

Message ID 1439795444-32337-1-git-send-email-nrubinstein@aldebaran.com
State Accepted
Headers show

Commit Message

=?UTF-8?q?No=C3=A9=20Rubinstein?= Aug. 17, 2015, 7:10 a.m. UTC
Test the config of the kernel to see if loadable module support is
enabled, and error out otherwise. This makes the build failure less
confusing.

Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/pkg-kernel-module.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni Aug. 17, 2015, 2:30 p.m. UTC | #1
Dear Noé Rubinstein,

On Mon, 17 Aug 2015 09:10:44 +0200, Noé Rubinstein wrote:
> Test the config of the kernel to see if loadable module support is
> enabled, and error out otherwise. This makes the build failure less
> confusing.
> 
> Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  package/pkg-kernel-module.mk | 4 ++++
>  1 file changed, 4 insertions(+)

Applied after tweaking the commit log, thanks.

Thomas
Peter Korsgaard Aug. 18, 2015, 5:41 a.m. UTC | #2
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Dear Noé Rubinstein,
 > On Mon, 17 Aug 2015 09:10:44 +0200, Noé Rubinstein wrote:
 >> Test the config of the kernel to see if loadable module support is
 >> enabled, and error out otherwise. This makes the build failure less
 >> confusing.
 >> 
 >> Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
 >> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 >> ---
 >> package/pkg-kernel-module.mk | 4 ++++
 >> 1 file changed, 4 insertions(+)

 > Applied after tweaking the commit log, thanks.

Couldn't we instead just force modules support on in the kernel if the
pkg-kernel-module infrastructure is used?
Thomas Petazzoni Aug. 18, 2015, 7:58 a.m. UTC | #3
Hello,

On Tue, 18 Aug 2015 07:41:11 +0200, Peter Korsgaard wrote:
> >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:
> 
>  > Dear Noé Rubinstein,
>  > On Mon, 17 Aug 2015 09:10:44 +0200, Noé Rubinstein wrote:
>  >> Test the config of the kernel to see if loadable module support is
>  >> enabled, and error out otherwise. This makes the build failure less
>  >> confusing.
>  >> 
>  >> Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
>  >> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  >> ---
>  >> package/pkg-kernel-module.mk | 4 ++++
>  >> 1 file changed, 4 insertions(+)
> 
>  > Applied after tweaking the commit log, thanks.
> 
> Couldn't we instead just force modules support on in the kernel if the
> pkg-kernel-module infrastructure is used?

That's another option, yes. Noé?

Thomas
Yann E. MORIN Aug. 18, 2015, 9:47 a.m. UTC | #4
Peter, All,

On 2015-08-18 07:41 +0200, Peter Korsgaard spake thusly:
> >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:
> 
>  > Dear Noé Rubinstein,
>  > On Mon, 17 Aug 2015 09:10:44 +0200, Noé Rubinstein wrote:
>  >> Test the config of the kernel to see if loadable module support is
>  >> enabled, and error out otherwise. This makes the build failure less
>  >> confusing.
>  >> 
>  >> Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
>  >> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  >> ---
>  >> package/pkg-kernel-module.mk | 4 ++++
>  >> 1 file changed, 4 insertions(+)
> 
>  > Applied after tweaking the commit log, thanks.
> 
> Couldn't we instead just force modules support on in the kernel if the
> pkg-kernel-module infrastructure is used?

And how do you suggest we test whether the kernel-module infra is used?

    1) it *is* used already: we do have packages that do call
        $(eval $(kernel-module)) , but I guess that's not what
        you meant. ;-)

    2) so you probably meant: if we actually need to build a kernel
       module.

But that's not so easy:

  - we need to know whether to enable moduls when parsing linux/linux.mk

  - external packages may call kernel-module

  - external packages are parsed after linux.mk

So, too late...

We can't enable kernel modules just from the .mk, we can only check for
them.

Unless we add an hidden kconfig knob BR2)LINUX_NEEDS_MODULES that
packages may select if they want to build modules. Of a visible knob
(user-selectable) that packages can depend on if they need to build
kernel modules...

Needless to say, for 2015.08, Noé's patch is good to go in, while the
alternatives are not; they can however be done post-2015.08.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/pkg-kernel-module.mk b/package/pkg-kernel-module.mk
index 5fb19be..6fb7704 100644
--- a/package/pkg-kernel-module.mk
+++ b/package/pkg-kernel-module.mk
@@ -60,6 +60,10 @@  $(2)_MODULE_SUBDIRS ?= .
 # includes and other support files (Booo!)
 define $(2)_KERNEL_MODULES_BUILD
 	@$$(call MESSAGE,"Building kernel module(s)")
+	@if ! grep -Fqx 'CONFIG_MODULES=y' $(LINUX_DIR)/.config; then \
+		echo "ERROR: Kernel does not support loadable modules"; \
+		exit 1; \
+	fi
 	$$(foreach d,$$($(2)_MODULE_SUBDIRS), \
 		$$(LINUX_MAKE_ENV) $$($$(PKG)_MAKE) \
 			-C $$(LINUX_DIR) \