Thursday, August 07, 2008

insmod, kernel versions, modules and Linux distros

The joy of working with kernel versions and kernel modules.

So after spending a long time finally getting a modpost program running so I could build kernel modules, I was finally able to get them to compile. However, I found that the modules were not loading - insmod and modprobe gave a very unhelpful "-1 Invalid module format" error.

A little bit of searching around for "kernel modules" lead me to the helpful Linux Loadable Kernel Module HOWTO. A page titled Technical details provides the full details about how to find information about the module.

I was able to confirm that the module had compiled properly, and that it was atleast displaying the right meta-information. So what had gone wrong?

A search for the actual error message "invalid module format" led me to a forum discussion on Linuxquestions.org about insmod, where one poster suggesting using 'dmesg' to find out the details of the error.

Excellent information. A line in dmesg shows:
No module found in object
kaodv: version magic '2.6.20.1 preempt mod_unload 486'
should be '2.6.20-486-voyage preempt mod_unload 486'


Perhaps because I used the Debian Voyage kernel instead of the Voyage kernel sources? :( And after all the trouble I went through in finding a corresponding kernel source and building the tree and the toolkit...

Maybe there's a way to just rename just the kernel name, since everything else seems to match ... stay tuned.

No comments: