I have got one of the small raspberry pi computers, and i am having my first play with creating a kernel module. I have downloaded the source, and managed to compile my test module but when i try and load it i get this error:
insmod: error inserting 'hello.ko': -1 Invalid module format
and when i look in dmesg i see this error:
hello: version magic '3.1.9+ mod_unload modversions ARMv6 p2v8 ' should be '3.1.9+ mod_unload modversions ARMv6 '
Can anyone point me in the right direction, i’m not sure what its telling me?
Cheers
Luke
It sounds like the kernel source you downloaded does not match the kernel installed on your Pi.
Where did you download it from?
To get the correct source for your kernel type the following on the command line:
This should download the correct kernel source for you kernel (it is a meta-package). You should now see a directory under
/lib/modules/that matches your kernel version (the version printed out when you typeuname -r)Recompile and link you code – make sure you pick up the correct kernel source by having a line like this in your Makefile:
You newly compiled .ko module should now match you kernel and insert without complaints.
Good luck!