Fedora Linux Support Community & Resources Center
  #1  
Old 30th April 2011, 05:51 PM
raj0825 Offline
Registered User
 
Join Date: Apr 2011
Posts: 5
windows_xp_2003ie
Talking Kernel module is not compiling

Hi all... I am new to kernel module programming. When i am trying to compile a kernel module by the below command

gcc -D __KERNEL__ -D__SMP__ -DMODULE -DMODVERSIONS -I /usr/src/kernels/2.6.35 -45.fc14.i686/include/linux/ -Wall -O2 -o mod1.o -c mod1.c

when i typed this i am getting the follwing error:

fatal error:linux/module.h: no such file or directory
compilation terminated

But the aforemetioned directory is there and the header file module.h in that directiory.

please help me.

Last edited by raj0825; 1st May 2011 at 07:23 AM. Reason: Objected by the adminstrator
Reply With Quote
  #2  
Old 30th April 2011, 08:31 PM
leigh123linux Online
Retired Administrator
 
Join Date: Oct 2006
Posts: 22,375
linuxredhatfirefox
Talking Re: Should have started a new thread instead of hijacking someone else's thread

Quote:
Originally Posted by raj0825 View Post
Hi all... I am new to kernel module programming. When i am trying to compile a kernel module by the below command

gcc -D __KERNEL__ -D__SMP__ -DMODULE -DMODVERSIONS -I /usr/src/kernels/2.6.35 -45.fc14.i686/include/linux/ -Wall -O2 -o mod1.o -c mod1.c

when i typed this i am getting the follwing error:

fatal error:linux/module.h: no such file or directory
compilation terminated

But the aforemetioned directory is there and the header file module.h in that directiory.

please help me.

Please don't hijack someone else's thread with your irrelevant issue.
I suggest you read the posting rules and choose a proper title.

Posting Rules
Reply With Quote
  #3  
Old 1st May 2011, 07:21 AM
raj0825 Offline
Registered User
 
Join Date: Apr 2011
Posts: 5
windows_xp_2003ie
Smile Re: Trying To Compile Kernel Module

I didnt understand what you are talking about sir. I am very much new to linux and i never posted anything of this sort before. I am extremely sorry if anything wrong with my posting. Please consider my request and help me.
Reply With Quote
  #4  
Old 1st May 2011, 07:31 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,000
linuxfirefox
Re: Trying To Compile Kernel Module

Try this:

Quote:
gcc -D __KERNEL__ -D__SMP__ -DMODULE -DMODVERSIONS -I /usr/src/kernels/2.6.35-45.fc14.i686/include -Wall -O2 -o mod1.o -c mod1.c
The above is your build command with the "/linux" removed from the -I
I did that because the code is trying to include "linux/module.h" so your I statement should not have also had "/linux" at the end.

I'm also a bit suspicious about there being a space between the "-I" and the "/" before "usr"

Usually you should have no space after the -I like this:
Quote:
-I/usr/src/kernels/2.6.35-45.fc14.i686/include

Last edited by marko; 1st May 2011 at 07:43 AM.
Reply With Quote
  #5  
Old 1st May 2011, 07:42 AM
raj0825 Offline
Registered User
 
Join Date: Apr 2011
Posts: 5
windows_xp_2003ie
Re: Trying To Compile Kernel Module

Quote:
Originally Posted by marko View Post
Try this:



The below is your build command with the "/linux" removed from the -I
I did that because the code is trying to include "linux/module.h" so your I statement should not have also had "/linux" at the end.

I'm also a bit suspicious about there being a space between the "-I" and the "/" before "usr"

Usually you should have no space after the -I like this:
Thankyou Marko.. I removed /linux and i tried Still getting the same error..
Reply With Quote
  #6  
Old 1st May 2011, 07:44 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,000
linuxfirefox
Re: Trying To Compile Kernel Module

What does uname -r say?

My point is that the kernel you're actually booted to should be 2.6.35-45.fc14.i686

Did you also take the space out from after the -I
?
Reply With Quote
  #7  
Old 1st May 2011, 07:49 AM
raj0825 Offline
Registered User
 
Join Date: Apr 2011
Posts: 5
windows_xp_2003ie
Re: Trying To Compile Kernel Module

Quote:
Originally Posted by raj0825 View Post
Thankyou Marko.. I removed /linux and i tried Still getting the same error..
Dear Marko.. I removed the space and i got the same error.

Thank you
Reply With Quote
  #8  
Old 1st May 2011, 07:58 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,000
linuxfirefox
Re: Trying To Compile Kernel Module

Quote:
Originally Posted by raj0825 View Post
Dear Marko.. I removed the space and i got the same error.

Thank you
What about my uname -r question, are you actually booted to the same kernel that the include directory is pointing to?
Reply With Quote
  #9  
Old 1st May 2011, 08:48 AM
JEO Offline
Registered User
 
Join Date: Jan 2006
Posts: 2,787
linuxfedorafirefox
Re: Trying To Compile Kernel Module

In his original post, there seems to also be a space in "2.6.35 -45.fc14.i686" there should be no space between the .35 and -45
Reply With Quote
Reply

Tags
compile, kernel, module

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot compile kernel module dAverk Using Fedora 8 17th June 2010 02:30 PM
Akmods not finding kernel source (& Kernel Module size too large in Custom Compile) jbkt23 Using Fedora 27 18th July 2009 12:05 AM
Compile a New Kernel with a Module siddhx Using Fedora 2 27th March 2008 07:43 AM
x86 kernel module compile on x64 F8 pcgoober Using Fedora 0 24th February 2008 02:47 PM
Compile kernel module mclerand Using Fedora 4 31st March 2006 05:33 PM


Current GMT-time: 14:47 (Tuesday, 29-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat