i am trying to write a simple device driver
filename:dd.c
#include <module.h>
#include<kernel.h>
#include<mod_devicetable.h>
#include<moduleparam.h>
#include<moduleloader.h>
int init_module (void) /* Loads a module in the kernel */
{
printk("Hello kernel n");
return 0;
}
void cleanup_module(void) /* Removes module from kernel */
{
printk("GoodBye Kerneln");
}
gcc -c dd.c gives me the following errors:
In file included from /usr/include/module.h:10,
from dd.c:2:
/usr/include/linux/cache.h:5:23: error: asm/cache.h: No such file or directory
In file included from dd.c:2:
/usr/include/module.h:41: error: field 'attr' has incomplete type
/usr/include/module.h:42: error: expected specifier-qualifier-list before 'ssize_t'
/usr/include/module.h:49: error: field 'kobj' has incomplete type
/usr/include/module.h: In function 'search_module_extables':
/usr/include/module.h:433: error: 'NULL' undeclared (first use in this function)
/usr/include/module.h:433: error: (Each undeclared identifier is reported only once
/usr/include/module.h:433: error: for each function it appears in.)
/usr/include/module.h: In function 'module_text_address':
/usr/include/module.h:439: error: 'NULL' undeclared (first use in this function)
/usr/include/module.h: In function '__module_text_address':
/usr/include/module.h:445: error: 'NULL' undeclared (first use in this function)
/usr/include/module.h: In function 'module_address_lookup':
/usr/include/module.h:476: error: 'NULL' undeclared (first use in this function)
/usr/include/module.h: In function 'module_get_kallsym':
/usr/include/module.h:484: error: 'NULL' undeclared (first use in this function)
In file included from dd.c:6:
/usr/include/moduleloader.h: At top level:
/usr/include/moduleloader.h:11: error: expected ')' before '*' token
/usr/include/moduleloader.h:25: error: expected ')' before '*' token
/usr/include/moduleloader.h:33: error: expected ')' before '*' token
/usr/include/moduleloader.h:40: error: expected ';', ',' or ')' before '*' token
i am using 2.6.18-8.el5 red hat enterprise linux 5
kindly guide me