I am trying the following, but am unable to build my helloworld.ko file so that I can insmod it into my Kernel. I am using Suse 9.3, and tried logged on as 'root' and as myself. I am running Linux 2.6 (so trying 2.6 Makefile format:
1) I have source file helloworld.c as:
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk(KERN_INFO "hello - I've just loaded myself into the kernel\n");
return 0;
}
void __exit cleanup_module(void)
{
printk(KERN_INFO "goodbye
\n");
}
MODULE_AUTHOR("(c) Me");
MODULE_DESCRIPTION("Hello
");
MODULE_LICENSE("GPL");
2) I am running linux 2.6, so have Makefile as:
obj-m += helloworld.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
3) I run 'make' and get the following error:
psullivan@linux:~> make
make: Nothing to be done for `all'.
psullivan@linux:~>
---
Can someone please tell me:
- Why am I getting the above error "Nothing to be done for all"?
- Which subdirectory do I try to build the *.ko file from?
- Which subdirectory should the above Makefile go into?
- Do I need to be logged on as 'root' (I am, but it doesn't seem to help above)?
Thanks, Patrick//