Hi, I am facing
problems while I try to compile a simple "Hello World" Kernel module.
I am using RHEL 5 (2.6.12.x kernel). This is the
program that I am trying to compile. /*************************
Hello World Kernel Module *********************/ #define MODULE #define LINUX
#define __KERNEL__ #include
<linux/module.h> /* Needed by all modules */ #include
<linux/kernel.h> /* Needed for KERN_ALERT */ int init_module(void) {
printk("<1>Hello world 1.\n"); // A non 0 return means
init_module failed; module can't be loaded. return 0; } void cleanup_module(void) { printk(KERN_ALERT
"Goodbye world 1.\n"); } MODULE_LICENSE("GPL"); /***************************
End of the Module ***************************/ The make file that I am
using is /*************************
Hello World Makefile *************************/ obj-m += hello-1.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 /***************************
End of the Makefile *******************/ The error that I am getting
is that "/lib/modules/$(shell
uname -r)/build cannot be found" or something like that. I did find the "/lib/modules/$(shell
uname -r)/build”, but there was nothing in it. I am facing this only when
I try this with RHEL 5 or FC 7. Thank
you, Regards,, Aravind. "Dovie'andi
se tovya sagain" -Mat Cauthon (WoT). |