Openembedded Core Discussions
 help / color / mirror / Atom feed
* How to skip building kernel modules
@ 2020-03-16  9:05 Jacob Kroon
  2020-03-16  9:12 ` Alexander Kanavin
  0 siblings, 1 reply; 3+ messages in thread
From: Jacob Kroon @ 2020-03-16  9:05 UTC (permalink / raw)
  To: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

Hi,

I'm using the linux-yocto kernel recipes together with additional kernel 
config fragments that I append in our custom distro layer. All required 
functionality is built into the kernel, so we don't install any kernel 
modules on target.

What would be the correct way to save compilation time and skip 
building/packaging the kernel modules ? Do I need to provide a custom 
defconfig that explicitly disables all modules ?

I can monkey-patch oe-core with the attached patch in order to achieve 
that goal, but I'm guessing something like this wouldn't be suitable for 
upstreaming ?

Cheers,
Jacob


[-- Attachment #2: 0001-Handle-KERNEL_MODULES.patch --]
[-- Type: text/x-patch, Size: 1285 bytes --]

From: Jacob Kroon <jacob.kroon@gmail.com>
Date: Mon, 16 Mar 2020 09:47:58 +0100
Subject: [PATCH] Handle KERNEL_MODULES

---
 meta/classes/kernel.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index a724645466..538e769f89 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -329,7 +329,12 @@ kernel_do_compile() {
 	fi
 }
 
+KERNEL_MODULES ?= "1"
+
 do_compile_kernelmodules() {
+	if [ "${KERNEL_MODULES}" = "0" ]; then
+		exit 0
+	fi
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
 		cc_extra=$(get_cc_option)
@@ -353,7 +358,7 @@ kernel_do_install() {
 	# First install the modules
 	#
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
-	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
+	if [ "${KERNEL_MODULES}" = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
 		oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
 		rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
 		rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: How to skip building kernel modules
  2020-03-16  9:05 How to skip building kernel modules Jacob Kroon
@ 2020-03-16  9:12 ` Alexander Kanavin
  2020-03-16  9:22   ` Jacob Kroon
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kanavin @ 2020-03-16  9:12 UTC (permalink / raw)
  To: Jacob Kroon; +Cc: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]

The way I read kernel.bbclass, you need to set CONFIG_MODULES=n in your
configuration through some mechanism; then they'll be skipped altogether.

Alex

On Mon, 16 Mar 2020 at 10:06, Jacob Kroon <jacob.kroon@gmail.com> wrote:

> Hi,
>
> I'm using the linux-yocto kernel recipes together with additional kernel
> config fragments that I append in our custom distro layer. All required
> functionality is built into the kernel, so we don't install any kernel
> modules on target.
>
> What would be the correct way to save compilation time and skip
> building/packaging the kernel modules ? Do I need to provide a custom
> defconfig that explicitly disables all modules ?
>
> I can monkey-patch oe-core with the attached patch in order to achieve
> that goal, but I'm guessing something like this wouldn't be suitable for
> upstreaming ?
>
> Cheers,
> Jacob
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 1667 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to skip building kernel modules
  2020-03-16  9:12 ` Alexander Kanavin
@ 2020-03-16  9:22   ` Jacob Kroon
  0 siblings, 0 replies; 3+ messages in thread
From: Jacob Kroon @ 2020-03-16  9:22 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE Core mailing list

On 3/16/20 10:12 AM, Alexander Kanavin wrote:
> The way I read kernel.bbclass, you need to set CONFIG_MODULES=n in your 
> configuration through some mechanism; then they'll be skipped altogether.
> 
> Alex
> 

Yeah, I should have mentioned, setting CONFIG_MODULES=n in a config 
fragment causes all modules to be built into the kernel, which is not 
what I want.

I've also tried setting

do_compile_kernelmodules[noexec] = "1"

but that breaks do_install()

/Jacob

> On Mon, 16 Mar 2020 at 10:06, Jacob Kroon <jacob.kroon@gmail.com 
> <mailto:jacob.kroon@gmail.com>> wrote:
> 
>     Hi,
> 
>     I'm using the linux-yocto kernel recipes together with additional
>     kernel
>     config fragments that I append in our custom distro layer. All required
>     functionality is built into the kernel, so we don't install any kernel
>     modules on target.
> 
>     What would be the correct way to save compilation time and skip
>     building/packaging the kernel modules ? Do I need to provide a custom
>     defconfig that explicitly disables all modules ?
> 
>     I can monkey-patch oe-core with the attached patch in order to achieve
>     that goal, but I'm guessing something like this wouldn't be suitable
>     for
>     upstreaming ?
> 
>     Cheers,
>     Jacob
> 
>     -- 
>     _______________________________________________
>     Openembedded-core mailing list
>     Openembedded-core@lists.openembedded.org
>     <mailto:Openembedded-core@lists.openembedded.org>
>     http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-16  9:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-16  9:05 How to skip building kernel modules Jacob Kroon
2020-03-16  9:12 ` Alexander Kanavin
2020-03-16  9:22   ` Jacob Kroon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox