I need to compile and install a linux module. I can compile a module, but when I use insmod to install it, I get the following error message: root@joshua simple]# insmod hello.o hello.o: kernel-module version mismatch hello.o was compiled for kernel version 2.4.0-0.26 while this kernel is version 2.2.16-22. I see that version.h (there are more) is not the same as the compiled kernel: [root@joshua simple]# uname -a Linux joshua 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown This is not a problem with Redhat 6.2, just with 7.0
This is 100% correct behavior. /usr/include/linux contains the glibc headers, not the kernel headers. You must pass -I/usr/src/linux/include to the kgcc line with witch you compile your module. (-O2 -D__KERNEL__ are also needed of course). That this worked for Red Hat 6.2 is pure coincidence (well, almost :) because the kernel and glibc headers matched there.