Skip to contentSkip to conversation

kernel-devsrc: check for localversion files in the kernel source tree

PATCH Superseded Beniamin Sandu 2 participants 2 messages Apr 10, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-devsrc: check for localversion files in the kernel source tree

The kernel-devsrc rework doesn't take into account localversion files in the kernel source tree. This might result in modules with an incomplete version magic when building out-of-tree using the SDK.

Before:

root@qemux86:~# insmod hello.ko
[   42.000212] hello: version magic '5.0.3-yocto-standard SMP preempt
mod_unload PENTIUMM ' should be '5.0.3-my-custom-release-yocto-standard
SMP preempt mod_unload PENTIUMM '
[   42.008200] hello: version magic '5.0.3-yocto-standard SMP preempt
mod_unload PENTIUMM ' should be '5.0.3-my-custom-release-yocto-standard
SMP preempt mod_unload PENTIUMM '
insmod: can't insert 'hello.ko': invalid module format

After:

root@qemux86:~# insmod hello.ko
[   39.094288] hello: loading out-of-tree module taints kernel.
[   39.108044] Hello World!
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-kernel/linux/kernel-devsrc.bb +5 -0
index 69a8eaef81..ed265f702d 100644
@@ -228,6 +228,11 @@ do_install() {
 
         # required to build scripts/selinux/genheaders/genheaders
         cp -a --parents security/selinux/include/* $kerneldir/build/
+
+	# check for any localversion files
+	if [ -f localversion* ]; then
+	   cp localversion* $kerneldir/build/
+	fi
     )
 
     # Make sure the Makefile and version.h have a matching timestamp so that
Signature · 1 line
2.17.1
#1 lore raw
Quoted 30 lines · Beniamin Sandu

The kernel-devsrc rework doesn't take into account localversion files in the kernel source tree. This might result in modules with an incomplete version magic when building out-of-tree using the SDK.

Before:

root@qemux86:~# insmod hello.ko
[   42.000212] hello: version magic '5.0.3-yocto-standard SMP preempt
mod_unload PENTIUMM ' should be '5.0.3-my-custom-release-yocto-standard
SMP preempt mod_unload PENTIUMM '
[   42.008200] hello: version magic '5.0.3-yocto-standard SMP preempt
mod_unload PENTIUMM ' should be '5.0.3-my-custom-release-yocto-standard
SMP preempt mod_unload PENTIUMM '
insmod: can't insert 'hello.ko': invalid module format

After:

root@qemux86:~# insmod hello.ko
[   39.094288] hello: loading out-of-tree module taints kernel.
[   39.108044] Hello World!
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-kernel/linux/kernel-devsrc.bb +0 -0
index 69a8eaef81..ed265f702d 100644

meta/recipes-kernel/linux/kernel-devsrc.bb do_install() { · line 233

Quoted 6 lines
meta/recipes-kernel/linux/kernel-devsrc.bb +3 -0
@@ -228,6 +228,11 @@ do_install() {
 
         # required to build scripts/selinux/genheaders/genheaders
         cp -a --parents security/selinux/include/* $kerneldir/build/
+
+       # check for any localversion files
+       if [ -f localversion* ]; then

Why not just stay consistent with the rest of the copying and make sure it survives these not
being present via || : ?

Since that is going to potentially have issues when no localversion files are present.

i.e. just use: cp -a localversion* $kerneldir/build/ 2>/dev/null || :

Bruce

Quoted 13 lines
meta/recipes-kernel/linux/kernel-devsrc.bb +2 -1
+          cp localversion* $kerneldir/build/
+       fi
     )
 
     # Make sure the Makefile and version.h have a matching timestamp so that
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II