LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 04-20-2006, 08:40 AM   #1
andrugene
LQ Newbie
 
Registered: Apr 2006
Distribution: SuSE 10
Posts: 1

Rep: Reputation: 0
Question Compiling kernel modules


Hi!
Now that you guys have this kernel thingy, i was wondering whether you could help me understand the error messages i get when trying to compile a kernel module. It seems like the kernel Header files have errors in them. Are there clean headers i could use or what?

Thanx.
 
Old 04-20-2006, 12:11 PM   #2
rick.2g
Member
 
Registered: Sep 2005
Posts: 41

Rep: Reputation: 15
well... it depends on what kind of errors you're getting. If you're getting warnings, then it's usually nothing to worry about - if you're getting a failed compile, then it might be bad dependencies; do you have the output with the errors?
 
Old 04-20-2006, 12:53 PM   #3
notorp
LQ Newbie
 
Registered: Sep 2005
Distribution: Fedora 10/9/8/6 - FC3 - RH9 + Puppy Dog
Posts: 27

Rep: Reputation: 15
I've noticed that kernel 2.6.16 doesn't like to build modules! Can't get fglrx to build and seen a few threads with the same. What kernel version are you using
 
Old 04-20-2006, 06:48 PM   #4
notorp
LQ Newbie
 
Registered: Sep 2005
Distribution: Fedora 10/9/8/6 - FC3 - RH9 + Puppy Dog
Posts: 27

Rep: Reputation: 15
Scratch that just updated to 2.6.16.2096 (2.6.16-1.2096_FC4smp) from 2.6.16.2069 and now able to compile modules again. Have got fglrx to work even if not using the ati agp.
 
Old 04-26-2006, 01:58 PM   #5
sajjadc
Member
 
Registered: May 2005
Location: kerala,india
Distribution: UBUNTU
Posts: 94

Rep: Reputation: 15
ok
goood reply
thanx
 
Old 04-27-2006, 03:15 AM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 46
Quote:
i was wondering whether you could help me understand the error messages i get when trying to compile a kernel module.
No. We can't help unless you post the error message.
 
Old 05-06-2006, 12:34 AM   #7
akanitkar
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
hi,
i am new to linux. When I try to insert object file into kernel using insmod, I get message like kernel version mismatch. I am using red hat 9, kernel version 2.4.20-8 and gcc 3.2.2. what should i do ?
Regards,
Aditya
 
Old 05-06-2006, 06:47 AM   #8
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Mageia Studio-13.37 Kubuntu.
Posts: 3,325
Blog Entries: 33

Rep: Reputation: 199Reputation: 199
Smile

Akanitkar, To get a faster response, You should post a new thread with your question.

Kind regards, Glenn

btw, That is called hijacking a thread, and when ppl log on to this forum, they won't see your question

Last edited by GlennsPref; 05-06-2006 at 06:48 AM.
 
Old 05-07-2006, 01:46 AM   #9
the_unforgiven
LQ Newbie
 
Registered: Apr 2006
Posts: 12

Rep: Reputation: 0
Quote:
Originally Posted by akanitkar
hi,
i am new to linux. When I try to insert object file into kernel using insmod, I get message like kernel version mismatch. I am using red hat 9, kernel version 2.4.20-8 and gcc 3.2.2. what should i do ?
Regards,
Aditya
Well, since you're compiling something related to kernel, you've gotta compile it with the kernel headers and not glibc headers.
So, your compile command should look like:
gcc -c hello.c -o hello.o -I /usr/src/linux-2.4.20-8/include -D__KERNEL__

Adapt the command to suite your configuration.
HTH
 
Old 06-24-2006, 05:19 AM   #10
m.anju
LQ Newbie
 
Registered: Jun 2006
Posts: 7
Blog Entries: 2

Rep: Reputation: 0
Compiling Kernel Module

[QUOT:E=the_unforgiven]Well, since you're compiling something related to kernel, you've gotta compile it with the kernel headers and not glibc headers.
So, your compile command should look like:
gcc -c hello.c -o hello.o -I /usr/src/linux-2.4.20-8/include -D__KERNEL__

Adapt the command to suite your configuration.
HTH [/QUOTE]


hi,

I tried this, but still error

" couldn't find the kernel version the module was compiled for"

thanx
 
Old 06-24-2006, 05:24 AM   #11
m.anju
LQ Newbie
 
Registered: Jun 2006
Posts: 7
Blog Entries: 2

Rep: Reputation: 0
hi,
I m new to linux i am trying kernel programming while insertion of mod error comes when i tried the command

#gcc -c hello.c -o hello.o -isystem /usr/src/linux-2.4.20-8/include -D__KERNEL__ -DLINUX

error: couldn't find the kernel version the module was compiled for

then instead of -isystem i tried -I the problem is not yet solved

Thanx
 
Old 06-24-2006, 07:56 AM   #12
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,401

Rep: Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119
Kernel modules should be rebuilt by using make in the /usr/src/linux directory. I don't see any value in trying to compile them "by hand."

Each kernel module contains a version-identifier designed specifically to prevent them from being loaded by a kernel other than the one they were built for. (Obviously, this would mean instant death. )

If you are running on binary "distros," and are not compiling things for your own kernel, then you simply need to find the right version of "the package or RPM or whatever" that contains the binary module corresponding to the kernel you now have installed.

If you are running on a kernel that you compile yourself, from source, then a simple re-make of the kernel ought to update that module as well, and make install and make modules_install should put it into place.

Remember that you'll have to reboot the system before attempting to install the new module.
 
Old 06-25-2006, 08:56 AM   #13
the_unforgiven
LQ Newbie
 
Registered: Apr 2006
Posts: 12

Rep: Reputation: 0
Quote:
Originally Posted by sundialsvcs
Kernel modules should be rebuilt by using make in the /usr/src/linux directory. I don't see any value in trying to compile them "by hand."

Each kernel module contains a version-identifier designed specifically to prevent them from being loaded by a kernel other than the one they were built for. (Obviously, this would mean instant death. )
This wasn't applicable in the days of 2.4.x kernels.
This is what the new kernel build system for 2.6.x kernels (kbuild) has brought with it.
For 2.4 series kernels, you have to build the modules by hand - unless they've updated the current 2.4 tree to use the kbuild process - I've not tried it in ages now.
 
Old 06-25-2006, 08:58 AM   #14
the_unforgiven
LQ Newbie
 
Registered: Apr 2006
Posts: 12

Rep: Reputation: 0
Quote:
Originally Posted by m.anju
hi,
I m new to linux i am trying kernel programming while insertion of mod error comes when i tried the command

#gcc -c hello.c -o hello.o -isystem /usr/src/linux-2.4.20-8/include -D__KERNEL__ -DLINUX

error: couldn't find the kernel version the module was compiled for

then instead of -isystem i tried -I the problem is not yet solved

Thanx
What's the output of uname -r command?
Are you sure you're building the module for a 2.4.x kernel?
And do you have the configured sources for your current kernel installed?
 
Old 06-26-2006, 01:43 AM   #15
m.anju
LQ Newbie
 
Registered: Jun 2006
Posts: 7
Blog Entries: 2

Rep: Reputation: 0
# uname -r
2.4.20-8

First i installed the current kernel module then only i tried for kernel programming. Still in same problem.
 
  


Reply

Tags
modules


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
compiling modules in kernel 2.6 DrowningFish Programming 4 03-18-2006 05:03 AM
Compiling too many modules into kernel samac Slackware 13 02-27-2006 06:35 PM
Compiling kernel modules NNP Programming 4 12-18-2005 02:08 PM
need some help in Compiling Kernel modules bharat83 Suse/Novell 1 01-07-2005 07:21 AM
Compiling kernel modules? jrjarrett Linux - Software 0 09-09-2003 10:24 AM


All times are GMT -5. The time now is 06:28 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration