Hello, this is my first time here and i come with a problem i have been trying to figure out for 2 days. I just want to compile a simple "hello_world" kernel module.
Here is my kernel module code (hello_module.c):
Code:
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void){
printk (KERN_ALERT "Hello, I am a little module");
return 0;
}
static void hello_exit(void){
printk (KERN_ALERT "Bye bye, nice to meet you");
}
module_init(hello_init);
module_exit(hello_exit);
This is my Makefile:
Code:
obj-m += hello_module.o
KDIR = /usr/src/linux-headers-3.2.0-26-generic
all:
$(MAKE) -C $(KDIR) SUBDIR=$(PWD)
clean:
rm -rf *.o *.ko *.mod *.symvers *.order
The problem comes when i go to the directory and make, i get the following error:
Code:
make -C /usr/src/linux-headers-3.2.0-26-generic SUBDIR=/home/smfloris/Desktop/Modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-26-generic'
make[2]: *** No rule to make target `arch/x86/tools/relocs.c', needed by `arch/x86/tools/relocs'. Stop.
make[1]: *** [archscripts] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-26-generic'
make: *** [all] Error 2
I couldn't find my problem anywhere, nor the solution. As a note, i've checked the headers and found that i have the latest version; I would also like to add that i installed Ubuntu through the Wubi installer.
Any help is greatly appreciated,
Flo.
P.S. Please keep it simple, as i am still a beginner
Bookmarks