May 5, 2013 at 5:26pm UTC
So I decided to try some kernel module examples and have already ran into some trouble. Unfortunately I am very used to eclipse generating makefiles for me and have very little experience with them. Anyway, here is my kernel mod .c code and the makefile, when i am in the directory and type 'make', it says "nothing to be done for all"
kmod.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
* kmod.c
*
* Created on: May 5, 2013
* Author: michaelaelise
*/
#include </usr/src/linux-headers-3.4.0/include/linux/module.h>
#include </usr/src/linux-headers-3.4.0/include/linux/kernel.h>
#include </usr/src/linux-headers-3.4.0/include/linux/init.h>
//MODULE_LICENSE("GPL");
static int __init hello_i(void )
{
printk(KERN_INFO "Hello World of Goo!\n" );
return 0;
}
static void __exit hello_e(void )
{
printk(KERN_INFO "Goodbye AHHHHHHHHHH... Splat.\n" );
}
module_init(hello_i);
module_exit(hello_e);
makefile
1 2 3 4 5 6 7 8
obj-m += kmod.o
KVERSION = $(shell uname -r)
all:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
I took this directly from an example.
Can someone please tell me what to do with the makefile so that it builds the .ko mod?
Thank you.
Last edited on May 5, 2013 at 11:47pm UTC
May 7, 2013 at 1:56pm UTC
ds huh? can you elaborate?
May 7, 2013 at 6:17pm UTC
makefile had spaces instead of a tab on the newlines...