Error during device driver programming...Help

Status
Not open for further replies.

sajeev

Advanced Member level 4
Joined
Apr 29, 2005
Messages
112
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
Kerala-India
Activity points
2,197
I am using fedora core 6(2.6.18.1).I have compiled kernel 2.6.18.2.So I wnt to do a simple device driver programe.I wrote the program below...

/* hello-1.c - The simplest kernel module.
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */


int init_module(void)
{
printk("<1>Hello world 1.\n");

// A non 0 return means init_module failed; module can't be loaded.
return 0;
}


void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world 1.\n");
}


I used the command gcc -c hello.c
But Im getting error message as file <linux/module.h> not found.SAme error for kernel.h also.

For kernel compilation I used the area /usr/src.
I extracted the bzip file of kernel to /usr/src.
And so I got a folder as linux-2.6.18.2
Then i followd the instructions for compilation...and it was success...no error at al.

When i tried to compile the file I am getting this error.Is there any problem with the path of include file?
I could find the .h files in /usr/src/include/linux
and in /usr/src/include/asm-x86.

pls help me to make this program to work..
 

if we write #include<linux/modeule.h> ,then whats the actual path reffered by it?
 

Simple compilation will not work with kernel module. Please read this mini howto:

**broken link removed**
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…