Hi All
I have a simple kernel module
Code:
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/module.h>
int
DevModInit (void)
{
printk ("hello\n");
return 0;
}
void
DevModDeInit (void)
{
printk ("world\n");
return;
}
module_init (DevModInit);
module_exit (DevModDeInit);
Which I am able to compile properly using
cc test.c -c -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4.20-8smp/include/
But When I try to compile the same code using the 2.6 kernel using the above step, I am getting a lot of errors in the kernel header files like
/usr/src/linux-2.6.18/include/linux/jiffies.h: In function `jiffies_to_msecs':
/usr/src/linux-2.6.18/include/linux/jiffies.h:259: `CONFIG_HZ' undeclared (first use in this function)
/usr/src/linux-2.6.18/include/linux/jiffies.h:265:46: division by zero in #if
I have to write a Makefile which should be common for 2.4 and 2.6 kernel. My aim is to create a "module.o" in both the cases and convert it to "module.ko" in the case of 2.6. Is it possibe to do so?. Also please provide any pointers for the implementation(I am planning to use the kbuild functionality of 2.6 to convert "module.o" to "module.ko
Thanks for your help
Regards
Vijeesh