LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-01-2014, 12:36 PM   #1
srinivas.rao1993
LQ Newbie
 
Registered: Jun 2014
Posts: 7

Rep: Reputation: Disabled
module.h file/directory not found


i had a problem while compliling a module.the code is

Code:
#define MODULE
#include <linux/module.h>
int init_module(void) { printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void) { printk("<1>Goodbye cruel world\n"); }
after saving it as hello.c ,
Code:
root# gcc -c hello.c
was run in the terminal,which must produce an object file.but its showing an error that
module.h file/directory not found.
could anyone please help me out with this.thank you
 
Old 07-01-2014, 06:06 PM   #2
gengisdave
Member
 
Registered: Dec 2013
Location: Turin, Italy
Distribution: slackware
Posts: 327

Rep: Reputation: 73
sound like eudyptula task 01...

the file module.h is kernel source tree (./include/linux/module.h), so you must use the Makefile way (it's explained in Linux Device Driver, chapter 2, "Compiling Modules")
 
Old 07-02-2014, 12:42 PM   #3
srinivas.rao1993
LQ Newbie
 
Registered: Jun 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
problem in compiling module

I referred to the linux device drivers chapter 2 for creating a makefile.
But its showing an error in the makefile. the makefile is

Code:
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-23-generic/include/linux'

CC[M] /home/madhan/work/hello.o

Building modules,stage 2.

MODPOST

CC /home/madhan/work/hello.mod.o

LD [M] home/madhan/work/hello.ko

make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-23-generic/include/linux'
By the way the hello.c is in the /home/madhan/work/ directory. In the book they had mentioned the path as /usr/src/linux/.
but in my system i found it as /usr/src/linux-headers-3.5.0-23-generic/include/linux.
the error which is shown for the makefile is

Code:
Makefile:2: *** missing separator.  Stop.
could u please tell me what the problem is .thanks.
 
Old 07-02-2014, 01:16 PM   #4
gengisdave
Member
 
Registered: Dec 2013
Location: Turin, Italy
Distribution: slackware
Posts: 327

Rep: Reputation: 73
it seems you compiled the module sucessfully, please post you makefile
 
Old 07-02-2014, 09:41 PM   #5
srinivas.rao1993
LQ Newbie
 
Registered: Jun 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
the above one is the makefile and im having a prolem in that.
 
Old 07-03-2014, 06:19 AM   #6
gengisdave
Member
 
Registered: Dec 2013
Location: Turin, Italy
Distribution: slackware
Posts: 327

Rep: Reputation: 73
in topic #3 you posted the output of make command;

cat Makefile
 
Old 07-03-2014, 01:08 PM   #7
srinivas.rao1993
LQ Newbie
 
Registered: Jun 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
oh sorry!

could u please explain me how to go about compiling the module .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Building glib-2.40, error (libdir) file or directory not found. joetbergerjr Programming 7 06-06-2014 11:46 AM
kernel configuration file has not found /boot directory madhukumar Linux - Software 5 04-29-2014 04:35 AM
invalid file or directory:#include<linux/module.h> clarkshiraz Linux - Software 3 09-27-2009 07:01 AM
/lib/module/2.6.26.6-49.fc8/build: No such file or directory white_mist Linux - Newbie 10 12-14-2008 08:52 PM
how to execute a script file? Have file/directory not found error sirius57 Linux - Software 2 11-22-2007 12:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:02 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration