gkaindl / rfm12b-linux

A Linux kernel SPI-driver for the RFM12B and RFM69CW RF modules by HopeRF
113 stars 46 forks source link

[Raspberry Pi] Kernel 3.10.19 unable to install module : invalid module format #5

Closed hallard closed 9 years ago

hallard commented 10 years ago

Hello,

Updated my pi (and kernel source of course), I am able to compile the module but I can't install it, got a invalid module format.

root@pi02:~/rfm12b-linux# uname -a Linux pi02 3.10.19+ #600 PREEMPT Sat Nov 16 20:34:43 GMT 2013 armv6l GNU/Linux root@pi02:~/rfm12b-linux# make make -C /lib/modules/3.10.19+/build M=/root/rfm12b-linux modules make[1]: Entering directory /usr/src/linux-source-3.10.19+' CC [M] /root/rfm12b-linux/rfm12b.o Building modules, stage 2. MODPOST 1 modules CC /root/rfm12b-linux/rfm12b.mod.o LD [M] /root/rfm12b-linux/rfm12b.ko make[1]: Leaving directory/usr/src/linux-source-3.10.19+' root@pi02:~/rfm12b-linux# insmod ./rfm12b.ko Error: could not insert module ./rfm12b.ko: Invalid module format

Any hints ? dmesg show me rfm12b: disagrees about version of symbol module_layout

fifthguy commented 10 years ago

I've experienced exactly the same problem today, have you found any solutions to it yet (asking all watchers)? (Asking the authors) Which model of RPi did you test it on? Is it posiblle that A -> B model transition could have contributed to this issue? (spatial pin configuration perhaps of the RPi?)

rosterloh commented 10 years ago

I built this module against the rpi-3.12.y kernel without any issues. Tested on a Model B

jdr0berts commented 10 years ago

I'm having a similar problem, I've followed the steps on 3.10.25+, but get the same error. I tried adding the 3.6 trunk as linked to from these: http://l0l.org.uk/2013/11/rfm12b-linking-jeenode-micro-raspberry-pi/ - but it only installed another 3.10 kernel, and made no difference....

fifthguy commented 10 years ago

ok, I've also had no success whatsoever. according to rosterloh's response i tried to get the 3.12.y kernel, (cloned this: https://github.com/raspberrypi/linux/tree/rpi-3.12.y; and still all i got was a 3.10 kernel- hence my problem stayed remained). Then i tried following the steps jdr0berts points to - still no difference (just another 3.10- again)

jdr0berts commented 10 years ago

Hi fifthguy, I appear to have this working. I'd just gone through a complete rpi-update and update/upgrade which means I'm now running at 3.10.27+. I'd noticed that on building the module, Module.symvers in the build dir was of zero length.... I made some tenuous links, found this page - http://paulspiblog.wordpress.com/ - then did these steps: 1) check that /lib/modules only has the sources according to your kernel (3.10.27+ in my case) - deleted the 3.10.25+ and 3.10-3-rpi directories there. 2) cd /lib/modules/3.10.27+/build 3) mv Modules.symvers Modules.symvers.bak 4) wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers 5) cd rfm12b-linux 6) delete all built files - .o, .mod.*, .ko 7) make 8) sudo modprobe spi-bcm2708 9) sudo insmod rfm12b.ko

and it worked... module loaded, appears /dev/rfm12b.0.1

fifthguy commented 10 years ago

wow! this works, thanks. just a few modifications to your procedure for a fresh raspbian wheezy (3.10.27+)install: 1.) sudo apt-get update 2.) sudo apt-get upgrade 3.) sudo apt-get dist-upgrade (these 3 steps are only necessary to make sure, if you have the 14-01-2014 image it should be already up-to-date) 4.) sudo rpi-update (othewise it will still say invalid tadada, apparently some other firmware drivers are found there) 5.) step 1 from https://github.com/gkaindl/rfm12b-linux 6.) jdr0berts steps(couldn't get it to work without these) (after step 5, same as in the repo readme)

layerzerolabs commented 10 years ago

I've updated the page at http://l0l.org.uk/2013/11/rfm12b-linking-jeenode-micro-raspberry-pi/ to make it more explicit how I got a recent kernel complete with headers, however it is also useful to be able to build against the current kernel as well.

I've just retested the procedure and it worked fine for me, no need to get symvers files or manually extract files from git, just two lines of bash code from a fresh install of raspian to a kernel with headers:

sudo aptitude update && sudo aptitude install -y linux-image-rpi-rpfv linux-headers-rpi-rpfv echo -e "kernel=vmlinuz-3.10-3-rpi\ninitramfs initrd.img-3.10-3-rpi followkernel" | sudo tee -a /boot/config.txt