Given the following module (like that for hello.c in Rubini's book) --------------------------------------------------------------------- #define MODULE #include <linux/module.h> int init_module(void) { printk("<1>Hello from the Kernel world!"); return 0;} void cleanup_module (void) { printk ("<1>Goodbye.\n"); } ----------------------------------------------------------------------- Trying to compile/install it in RedHat 7.0 gives the following errors: $ kgcc -c hello.c /tmp/ccWSbrbm.s: Assembler messages: /tmp/ccWSbrbm.s:9: Warning: Ignoring changed section attributes for .modinfo # 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. These commands worked fine using RedHat 6.2. Also, I get similar compiler warnings when doing a "make modules" when rebuilding the 2.2.16-22 kernel. Any assistance provided will be much appreciated.
You're using a) the wrong compiler. To build 2.2 kernel modules, use kgcc, not gcc. b) the wrong include path You need to use -I/usr/src/linux-2.2.16/include/linux, not -I/usr/include/linux The headers in /usr/include/linux are for glibc and userland use, not kernel module use.
Thanks for the answer, but I still get the same warning and error as shown by the attached. Please note that I already was using kgcc, not gcc.
Created attachment 5400 [details] kgcc compiler warning/insmod don't recognize kernel version
Use -I/usr/src/linux-2.2.16/include not -I/usr/src/linux-2.2.16/include/linux
let me know if that works
Thank you very much. Using -I/usr/src/linux-2.2.16/include not - I/usr/src/linux-2.2.16/include/linux works. However, I still get the warning message: Ignoring changed section attributes for .modinfo.