LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-03-2008, 11:07 PM   #1
hoshangi
Member
 
Registered: Nov 2007
Posts: 88

Rep: Reputation: 15
first module programming Error


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
 
Old 08-04-2008, 02:49 AM   #2
storkus
Member
 
Registered: Jun 2008
Location: Phoenix, Arizona, USA
Distribution: Slackware
Posts: 329

Rep: Reputation: 51
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.

Mike
 
Old 08-04-2008, 11:40 PM   #3
hoshangi
Member
 
Registered: Nov 2007
Posts: 88

Original Poster
Rep: Reputation: 15
there is no anyone to help me

i went to the above link and post this topic there but no one answer me;
please help me i getting confuse ;
 
Old 08-05-2008, 02:04 AM   #4
raj.aprilfool
LQ Newbie
 
Registered: Jun 2007
Location: Mumbai, India
Posts: 4

Rep: Reputation: 0
http://tldp.org/LDP/lkmpg/

nice link.... or read Linux Device Drivers, by Alessandro Rubini, O'Reilly Pub. ... go thro' at least 2nd chapter
 
Old 08-05-2008, 04:11 AM   #5
storkus
Member
 
Registered: Jun 2008
Location: Phoenix, Arizona, USA
Distribution: Slackware
Posts: 329

Rep: Reputation: 51
Quote:
Originally Posted by raj.aprilfool View Post
http://tldp.org/LDP/lkmpg/

nice link.... or read Linux Device Drivers, by Alessandro Rubini, O'Reilly Pub. ... go thro' at least 2nd chapter
OOOH, I didn't know there was a whole online book on kernel modules and such! I'm keeping that link around for reference!

Thanks from both of us!

Mike
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error: -1 Invalid module format when using insmod with module cross-compiled for arm AndrewShanks Linux - Embedded & Single-board computer 4 10-15-2007 03:50 AM
insmod: error inserting 'module.o': -1 Invalid module format ksrinivas Linux - Newbie 5 10-11-2006 07:29 AM
Kernel module programming Error : module not found coolguy_iiit Programming 1 07-30-2006 07:23 AM
Programming a module.. need help tantrix Programming 3 04-14-2005 06:15 PM
Module programming linuxanswer Programming 2 12-12-2003 02:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration