Linux Kernel Module Programming
Hello,
I've spend countless hours trying to create a simple hello.c module in linux 2.6.11-1.1369_FC4. I read the tldp.org manual for it and it still doesn't work. this is my hello.c: #include <linux/module.h> #include <linux/kernel.h> int init_module(void) { printk(KERN_INFO "Hello World\n"); return 0; } void cleanup_module(void) { printk(KERN_INFO "Goodbye\n"); } my makefile is: obj-m += hello.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules and when i try to 'make' it tells me this.: [root@localhost code]# make make -C ../../../lib/modules/2.6.11-1.1369_FC4/build M=/home/user1/code modulesmake: *** ../../../lib/modules/2.6.11-1.1369_FC4/build: No such file or directory. Stop. make: *** [all] Error 2 [root@localhost code]# i check that directory with ls -al and it shows me [root@localhost 2.6.11-1.1369_FC4]# ls -al total 100 drwxr-xr-x 3 root root 4096 Sep 22 20:09 . drwxr-xr-x 5 root root 4096 Sep 22 22:41 .. lrwxrwxrwx 1 root root 47 Jul 18 19:59 build -> ../../../usr/src/kernels/2.6.11-1.1369_FC4-i686 drwxr-xr-x 9 root root 4096 Jul 18 19:59 kernel -rw-r--r-- 1 root root 45 Sep 22 20:09 modules.alias -rw-r--r-- 1 root root 69 Sep 22 20:09 modules.ccwmap -rw-r--r-- 1 root root 0 Sep 22 20:09 modules.dep -rw-r--r-- 1 root root 73 Sep 22 20:09 modules.ieee1394map -rw-r--r-- 1 root root 132 Sep 22 20:09 modules.inputmap -rw-r--r-- 1 root root 81 Sep 22 20:09 modules.isapnpmap -rw-r--r-- 1 root root 99 Sep 22 20:09 modules.pcimap -rw-r--r-- 1 root root 49 Sep 22 20:09 modules.symbols -rw-r--r-- 1 root root 189 Sep 22 20:09 modules.usbmap lrwxrwxrwx 1 root root 5 Jul 18 19:59 source -> build whats the problem here? I'm completely confused Thanks. |
You should also include the ouput of pwd when inside that directory.
|
All times are GMT -5. The time now is 12:28 AM. |