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. |
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?
|
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
|
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.
|
ok
goood reply thanx |
Quote:
|
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 |
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 |
Quote:
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 ;) |
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 |
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 |
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. :jawa: ) 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. |
Quote:
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. ;) |
Quote:
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? |
# uname -r
2.4.20-8 First i installed the current kernel module then only i tried for kernel programming. Still in same problem. |
All times are GMT -5. The time now is 02:01 PM. |