Welcome! Log In Create A New Profile

Advanced

My first Module Programming Error

Posted by Hoshangi 
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 :


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:

#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:

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
Re: My first Module Programming Error
August 23, 2008 06:38AM
Look at your Makefile and make sure the commands for make begin with TAB space.
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 3 plus 18?
Message: