ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
It helps if you post your message in the right place. Since you want to do Linux kernel programming, your best place to start would be www.kernelnewbies.org which is all about kernel development.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.