Making a linux module
I'm using 10.04 - 2.6.32-27-generic and I'm trying to figure out my problem to install VirtualBox OSE.
To make things simple, I reproduced the problem in few lines:
Entered the following in file "dummy.c":
<code>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
static int __init hello_start(void)
{
printk(KERN_INFO "Loading dummy module...\n");
return 0;
}
static void __exit hello_end(void)
{
printk(KERN_INFO "Exit dummy module.\n");
}
module_
module_
</code>
And the following in the file "Makefile":
<code>
obj-m = dummy.o
KVERSION = $(shell uname -r)
all:
make -C /lib/modules/
clean:
make -C /lib/modules/
</code>
Entered the command:
<code>
make
</code>
I expected that the build generate the file "dummy.ko" but this is what I got:
<code>
make -C /lib/modules/
make[1]: Entering directory `/usr/src/
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/usr/src/
make: *** [all] Error 2
[2]+ Done gedit dummy.c
</code>
Investigating the directory "/usr/src/
In https:/
In https:/
<code>
make -C /usr/src/
</code>
Results in:
<code>
make: Entering directory `/usr/src/
make: *** No rule to make target `modules'. Stop.
make: Leaving directory `/usr/src/
</code>
So the question is: <b>How to accomplish this in a simple manner? What can be wrong?</b>
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- José Marcos Gomes
- Solved:
- Last query:
- Last reply: