error while compiling a module
for a simple module i used this code
#include <linux/module.h> /* Defines the license for this LKM */ MODULE_LICENSE("GPL"); /* Init function called on module entry */ int my_module_init( void ) { printk(KERN_INFO "my_module_init called. Module is now loaded.\n"); return 0; } /* Cleanup function called on module exit */ void my_module_cleanup( void ) { printk(KERN_INFO "my_module_cleanup called. Module is now unloaded.\n"); return; } /* Declare entry and exit functions */ module_init( my_module_init ); module_exit( my_module_cleanup ); then in makefile i had obj-m += simple-lkm.o then i used this $ make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules make: *** /usr/src/linux-2.6.32-46-server: No such file or directory. Stop. $ What is the problem in this? |
you change into src a directory that does not exist but you should go into the module directory
take this makefile Code:
|
I tried this makefile but stil am getting the same error
|
if you call make like this
make -C /usr/src/linux-`uname -r` .... than it is very possible that it will not work make -C tells make to change into the directory given.. and it seems that you do not have /usr/src/linux-2.6.32-46-serve and you do usually not want to run make for a module there. try just make in the directory with your module file and the makefile posted, |
error while compiling a module
could you be more clear how should the make be?
|
your/directory
- Makefile (whith the content I posted) - modulefile.c (with your code) cd your/directory make hth |
thanks it worked.I want to know how to write the code for getting running time of a process and put it into this module?
|
All times are GMT -5. The time now is 06:24 PM. |