kernel module makefile problem
sir i was trying to make a makefile
but i was not able to do that module was simple a hello world program #include<linux/init.h> #include<linux/module.h> MODULE_LISENCE("DUAL bSD/GPL"); static int hello_init(void ) { printk(KERN_ALERT "HELLO WORLD"); return 0; } static int hello_exit(void) { printk( KERN_ALERT "thankyou cruel sworld"); } module_init(hello_init); module_exi(hello_exit); its name was demo.c i made a Makefile obj-m = foo.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 but i ended up on an eror make -C /lib/modules/3.5.0-23-generic/build M=/home/shiv/Desktop/module modules make[1]: Entering directory `/usr/src/linux-headers-3.5.0-23-generic' make[2]: *** No rule to make target `/home/shiv/Desktop/module/foo.c', needed by `/home/shiv/Desktop/module/foo.o'. Stop. make[1]: *** [_module_/home/shiv/Desktop/module] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-23-generic' make: *** [all] Error 2 kindly help |
As far as I see the name of your test is demo.c you would try:
obj-m = demo.o # instead of foo.o |
sir i have tried with demo.o but problem persists
|
please use [code]here comes your code[/code] blocks to keep your formatting and post your new makefile and the complete error message(s)
|
The simple module Makefile looks like this
Code:
obj-m := demo.o |
sir i have succeeded in compiling the make file sucessfully.. and i have loaded the kernal sucessfully ... but pls tell me that where to look for output...
means hello world is not printed on terminal after loading it on the kernal |
see man syslog about how printk handled
|
also, isnt that a typo?
Code:
MODULE_LISENCE("DUAL bSD/GPL"); should be MODULE_LICENSE, right? |
All times are GMT -5. The time now is 01:22 PM. |