I have written a simple program to access kernel as follows.
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void) {
printk("<1> Hello world!\n");
return 0;
}
static void hello_exit(void) {
printk("<1> Bye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
When I compile it using
gcc -c kernel_module.c (I am doubtful about this compilation method. I think it needs some more words for compiling the program properly)
Then I use
insmod kernel_module.o
It shows me error the program is compiler for kernel version 2.4.20 and your kernel version is 2.4.29-8.
Can you tell me solution for this problem and may be some proper way of compiling it