I am trying to build my own module for usbhid.ko, but after I compiled, I can't load the module. dmesg says no symbol version for module_layout. I am wondering what is the problem? I have already used the kernel source provided by Ubuntu and I have also make sure the kernel version is the same.
|
|
||||
|
|
|
Specifically what the problem is that when you built your module, the kernel source tree was probably missing the Modules.symvers file. The kbuild system actually warns you about this when you build your module. If Modules.symvers is missing, you'll see:
If your kernel has So there are two ways around this. 1) run a full build of your running kernel to generate Modules.symvers, then rebuild your module. [http://www.mjmwired.net/kernel/Documentation/kbuild/modules.txt][1]
2) The other option is to tell stupid modprobe to just ignore all that crap and just load your module anyways:
I tend to favor option 2 :) |
||||
|
|
|
You must use the precisely identical kernel configuration prior to running |
|||||||||||
|
|
The closest I got to getting a solution is this: Have both the linux-headers and linux-source packages corresponding to your kernel installed (e.g. for kernel 3.2.0-27-generic-pae you need linux-headers-3.2.0-27-generic-pae and linux-source-3.2.0-27-generic-pae). Then do this:
After you've done that, in the kernel source directory, do this:
Unfortunately, I don't know how to build a specific module while keeping Module.symvers untouched. Doing |
|||
|
|