Teen Programmers Unite  
 

 

Return to forum top

linux module issue

Posted by 142857 [send private reply] at February 12, 2003, 01:21:48 PM

I'm trying to compile and link a module. I wrote "hello.c" (the text of which I found from a book) and then: "gcc -c hello.c", then "insmod ./hello.o". But then it says I have the wrong version--this was compiled for version 2.4.9-9 while I have 2.4.18-3.

I found http://lists.debian.org/debian-mentors/2001/debian-mentors-200103/msg00147.html . I've been trying to get it to work with the -I flag.

I eventually came upon "modversions.h" in /usr/bin/include(/linux? i think, right next to module.h), which said to -I/lib/modules/$(uname -r)/build/include. I did that, but it still reported the same error about the version numbers. So I looked through those directories. 2.4.18-3 (my uname -r) is the only directory in /lib/modules. Also, in 2.4.18-3, "build" is something weird. With ls, it has a red background with white text. I couldn't "more" it or "cd" into it. With ls -l, it still has that red background and white text but it has an arrow pointing to ../../../usr/src/linux.2.4.18-3/ (basically /usr/src/linux.2.4.18-3/). But /usr/src/ just contains the "redhat" directory, which doesn't contain much.

This is a pretty long post...if you've gotten this far, thank you for spending time to help me. How can I fix this problem? I don't understand what's going on with that "build" file thing (I tried to uncompress it or at least tar -t it, but it didn't work).

Thank you!

Posted by unknown_lamer [send private reply] at February 13, 2003, 09:04:07 AM

The white on red in the default color ls config means it is a danging sym link. It looks like you removed your kernel source tree, so you no longer have your kernel headers installed.

Grab a new kernel, compile and install it. But do not remove the kernel source directory.

Posted by 142857 [send private reply] at February 13, 2003, 08:40:27 PM

Okay. Thanks a lot.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.