error: linux/module.h: No such file or directory
Beginners question. I'm trying to do a hello.c first compile of a linux driver. I've tried it both on the target platform (Arm BeagleBoard running Ubuntu 10.04) and in a cross-platform environment (Ubuntu 10.10). Basically - the environment isn't set up correctly- and I'm not sure how to fix that?
Can someone please point me in the right direction to get the environment set up correctly?
Thanks!
Steve Wilson
<email address hidden>
---Makefile ----
obj-m += hello.o
all:
make -C /lib/modules/
clean:
make -C /lib/modules/
----- hello.c -------
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_
{
}
------------ Results -------------------
c hello.c -o hello
hello.c:4:54: error: linux/module.h: No such file or directory
hello.c: In function ‘init_module’:
hello.c:9: error: ‘KERN_INFO’ undeclared (first use in this function)
hello.c:9: error: (Each undeclared identifier is reported only once
hello.c:9: error: for each function it appears in.)
hello.c:9: error: expected ‘)’ before string constant
hello.c: In function ‘cleanup_module’:
hello.c:19: error: ‘KERN_INFO’ undeclared (first use in this function)
hello.c:19: error: expected ‘)’ before string constant
make: *** [hello] Error 1
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu linux Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Steven wilson
- Solved:
- Last query:
- Last reply: