compiling kernel modules
Greetings again friends; thanks for the wonderful help with the
rxvt-xpm. I am once again a happy X user. New problem tonight. I want to
compile kernel modules for kernel version 2.2.18 using my debian
unstable systems. I thought my SMP 2.4.2 system was causing problems[1]
but I think it turns out to be libc6-dev that is causing problems[2].
So, I built a new machine. I took slink discs, installed a base system,
upgraded to potato, and then to unstable. (Damn, I'm impressed it worked
as well as it did. :) Now /usr/include/linux/* contains header files for
kernel version 2.4.2-pre2. So, when I build a module on the machine[3]
and try to load it, I get complaints that the module was built for a
different kernel and won't load it.[4]
Can someone please suggest how to write modules for older kernel
versions? Thanks! :)
[1]: 2.4.2 SMP dual celerons, glibc 2.2.2-1, gcc 2.95.3. I would build
the module in a subdirectory of the 2.2.18 kernel sources with the
#include set to the 2.2.18 headers. Those headers of course #include
<other headers>, so they go to /usr/include and get its 2.4.2-pre2
headers.
[2]: dpkg -S /usr/include/linux/modsetver.h returns libc6-dev
[3]:
/* hello.c -- hello world kernel module
* taken from ori pomerantz, this one by seth arnold
* sarnold@willamette.edu
*/
#include "../include/linux/kernel.h"
#include "../include/linux/module.h"
#if CONFIG_MODVERSION==1
#define MODVERSION
#include "../include/linux/modversions.h"
#endif
int init_module()
{
printk("Hello, world!\n");
/* non-zero returns means we failed to load */
return 0;
}
void cleanup_module()
{
printk("Module unloaded\n");
}
/* end of hello.c */
# MAKEFILE
CC=gcc
MODCFLAGS := -Wall -DMODULE -D__KERNEL__ -DLINUX
hello.o: hello.c ../include/linux/version.h
$(CC) $(MODCFLAGS) -c hello.c
[4]: $ sudo insmod hello.o
hello.o: kernel-module version mismatch
hello.o was compiled for kernel version 2.4.2-pre2
while this kernel is version 2.0.36.
Note that I don't care that this machine is currently running 2.0.36.
The same problems occur with a vmware running 2.2.18. Either way, insmod
is telling me the very dirt simple module is for the version of headers
in /usr/include/linux rather than the more local headers.
--
Earthlink: The #1 provider of unsolicited bulk email to the Internet.
Reply to: