hi
i want to start module programming but i don't know how;
i write a module Hello-1.c and compile it with a make file but the following Error has appear :
Code:
make -C /lib/modules/2.6.13-15-default/build M=/root/Desktop modules
make[1]: Entering directory `/usr/src/linux-2.6.13-15-obj/i386/default'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/usr/src/linux-2.6.13-15-obj/i386/default'
make: *** [all] Error 2
the Hello-1.c:
Code:
#include <linux/module.h> /*needed by all modules */
#include <linux/kernel.h> /*needed for Macros like KERN_INFO */
int init_module(void) /* this
function is called as initialization for all modules */
{
printk(KERN_INFO “Hello World1.\n”);
/* if this function returns non
zero means init_module failed and
this module can’t be loaded .
*/
return 0;
}
void cleanup_module(void) /* it is
called when module is terminated and unloaded */
{
printk( KERN_INFO “Goodbye World1.\n”);
}
the Makefile:
Code:
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