I'm using YOCTO PROJECT to build a linux os for my embedded board.
I have a module named uleds which i want insert to my kernel so i taped this insmod command:
insmod
/lib/modules/4.14.73-linux4sam-6.0-dirty/kernel/drivers/leds/uleds.ko
But an errors comes out :
uleds: version magic '4.14.88-01445-g234c56a01768-dirty mod_unload
ARMv7 p2v8 ' should be '4.14.73-linux4sam-6.0-dirty mod_unload ARMv7
p2v8 '
uleds: version magic '4.14.88-01445-g234c56a01768-dirty mod_unload
ARMv7 p2v8 ' should be '4.14.73-linux4sam-6.0-dirty mod_unload ARMv7
p2v8 '
insmod: can't insert
'/lib/modules/4.14.73-linux4sam-6.0-dirty/kernel/drivers/leds/uleds.ko':
invalid module
What i see that my linux kernel version and the module version are not the same. My question is How can I fix this problem so I can insert the module to the kernel ?
The module is not compiled with the same version as your kernel (on the embedded device).
You need to simply compile the module with the right kernel.
You will need to find your kernel recipe in the meta of Yocto, download it (reset the repository of the downloaded kernel to the SRCREV of the recipe), then build your module.
Related
I am trying to "make" and load the "/drivers/md/raid0.ko" module into my linux kernel but I am getting this error.
# modprobe raid0 --force-vermagic
modprobe: ERROR: could not insert 'raid0': Exec format error
dmesg
[Dec 2 15:10] raid0: version magic '5.0.0 SMP mod_unload ' should be '5.0.0-36-generic SMP mod_unload '
My kernel version is
# uname -a
Linux ubuntu1 5.0.0-36-generic #39-Ubuntu SMP Tue Nov 12 09:46:06 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
and the code from which I am trying to load is taken from the link https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.0.tar.xz
Hence the version in that is 5.0.0, without the EXTRAVERSION -36
I have tried a number of things but failed.
Setting the EXTRAVERSION using command make EXTRAVERSION=-1 modules_prepare, before building the module
Using the --force-vermagic while loading the kernel, but it fails.
Copying the Makefile firectly from /usr/lib/modules/$(uname -r)/build/Makefile before building the kernel.
I have used both make SUBDIRS=drivers/md modules and make M=drivers/md for building, but same result for both.
Need help!
force modprobe to ignore the magic str
use --force-vermagic optin
Every module contains a small string containing important information,
such as the kernel and compiler versions. If a module fails to load
and the kernel complains that the "version magic" doesn't match, you
can use this option to remove it. Naturally, this check is there for
your protection, so this using option is dangerous. This applies to
any modules inserted: both the module (or alias) on the command line
and any modules on which it
in this case modprob ignore magic str
I am trying to build my custom kernel module. it is compling successfully but while inserting module it is giving me error
insmod: init_module 'helloworld.ko' failed (Exec format error)
And dmesg Log shows:
version magic '3.10.0+ mod_unload ARMv7 p2v8 ' should be '3.10.0 SMP preempt mod_unload ARMv7 p2v8 '
How can I add "SMP" & "preempt" in version magic ?
Check whether CONFIG_PREEMPT and CONFIG_SMP is enabled in the kernel config of the kernel which you are using to compile your kernel module. Enable it in your kernel and then recompile your module using this config.
I try to cross compile bluez-utils-3.36 from the sources.
Host machine (machine where i build the code)
Processor: Intel(R) Xeon(R) CPU E5-2420 0 # 1.90GHz
OS Version: Linux 2.6.32-44 generic
Target machine: (the target on which the compiled file should run)
Processor: ARM926EJ-S rev 5 (v5l)
OS Version: Linux 2.6.35.3-571
The target seems to have an ARM processor, so i navigated to bluez-utils-3.36 and executed the following command:
./configure \
--host=arm-linux \
BLUEZ_CFLAGS=-I/home/shortened_the_path/bluetooth/bluez-libs-3.36/include \
BLUEZ_LIBS="-L/home/shortened_the_path/bluetooth/bluez-libs-3.36/src/.libs -lbluetooth"
This run successfully. After this i executed make, and get this error:
/usr/lib/libgmodule-2.0.so: could not read symbols: File in wrong format
Is my libgmodule-2.0.so file corrupt?
Does anyone know how i can possibly solve this?
You are compiling for arm but the libgmodule library which you are trying to link against is built for your PC architecture. So you have to cross compile glib which is a dependency of bluez.
Look at this link which explains in detail how to cross compile bluez
http://wiki.beyondlogic.org/index.php?title=Cross_Compiling_BlueZ_Bluetooth_tools_for_ARM
After compiling a kernel for qemu, I get a lots of errors like listed below:
ipv6: version magic '3.18.11-hypriotos+ mod_unload modversions ARMv6 '
should be '3.18.11-hypriotos+ mod_unload modversions ARMv6 p2v8 '
Obviously my kernel and the Hypriotos kernel are somehow different. What means p2v8? And how can I enable it in my kernel?
Go and check out yourself in arch/arm/include/asm/module.h. It's added when CONFIG_ARM_PATCH_PHYS_VIRT is set. So you obviously need this config to be enabled. You can read the description of this option in arch/arm/Kconfig
Keep in mind, however, that if you're not using the same kernel sources that were used for the main kernel build, you may encounter strange problems even if your module is successfully loaded.
#define VERMAGIC_STRING \
UTS_RELEASE "4.4.76 SMP mod_unload ARMv7 p2v8 " \
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
MODULE_ARCH_VERMAGIC
#endif
I will like to know how do the kernel builder to compile parrot modules while compiling the kernel.
I saw a config file for 2.6.32 that has the CONFIG_PARROT modules to yes. And I know where this modules files are stored on the kernel 2.6.32 source. I want a 2.6.37 kernel builder to make this parrot modules and add them to the kernel so I can use them on a VM.
Beside adding the path to the drivers source on the Makefile and setting the CONFIG_PARROT lines to the .config file of the kernel, is there something else to do?