Guide needed in device driver / module compilation.
Hi;
i am learning device driver / module coding for linux,
after browsing some web page, i get a test code below;
i faced an error while i try compile it in my
Mandriva 2006 KDE terminal using $ gcc <filename>
#include <linux/module.h>
int init_module(void)
{
printk("test test");
return 0;
}
void cleanup_module(void)
{
printk("------");
}
& i get these messages etc
In file included from /usr/include/linux/sched.h:11,
from /usr/include/linux/module.h:9,
from d.c:2:
/usr/include/linux/jiffies.h:84: error: syntax error before 'jiffies_64'
/usr/include/linux/jiffies.h:88: error: syntax error before 'get_jiffies_64'
/usr/include/linux/jiffies.h: In function 'timespec_to_jiffies':
/usr/include/linux/jiffies.h:320: error: called object 'u64' is not a function
/usr/include/linux/jiffies.h:320: error: called object 'u64' is not a function
/usr/include/linux/jiffies.h:320: error: 'NSEC_PER_SEC' undeclared (first use in
this function)
/usr/include/linux/jiffies.h:320: error: (Each undeclared identifier is reported
only once
blah blah.....
Is it that i have to place a kernel source in /usr/src/linux or the path where the package will auto unpack itself in?
If so, say if i'm using kernel 2.6.10, do i have to unpack a same kernel version or i can use a newer version?
Any Advise is helpful.
thanks
|