I am using redhat 9.
Below is my program (test.c):
=============================
#define MODULE
#include <linux/module.h>
int init_module(void) {printk("<1>Hello, World\n"); return 0; }
void cleanup_module(void) {printk ("<1>Goodbye cruel world\n"); }
I compiled the above module to get "test.o". When tried to insert it by calling
"insmod test.o"
it is complaining. Below is the error message:
test.o: kerner-module version mismatch
test.o was compiled for kerner version 2.4.20
while this kerner is version 2.4.20-8.
Then I tried with "-f" option. I did not get expected result. When I ran "insmod" I expected to see "Hello, World" and when I ran "rmmod" I expected to see "Goodbye cruel world". I did not see these messages.
Below is what I tried:
=================
[root@localhost devicedrivers]# ls
test1.c test1.o
[root@localhost devicedrivers]# insmod test1.o
test1.o: kernel-module version mismatch
test1.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.20-8.
[root@localhost devicedrivers]# insmod -f test1.o
Warning: kernel-module version mismatch
test1.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.20-8
Warning: loading test1.o will taint the kernel: no license
See
http://www.tux.org/lkml/#export-tainted for information about tainted modules
Warning: loading test1.o will taint the kernel: forced load
Module test1 loaded, with warnings
[root@localhost devicedrivers]#
[root@localhost devicedrivers]# rmmod test1
[root@localhost devicedrivers]#
Could anyone please tell me whats happening there. Why am I not seeing the "Hello, World" when insert and "Goodbye cruel world" when I remove the module?