Compiling Kernel Modules against the Kernel Source Tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have redhat 9.0 with kernel 2.4.20-8 running and the kernel-source-2.4.20-8.i386.rpm installed. The source tree is under /usr/linux-2.4/

When I compile a module against the source tree and want to insert it thereafter, I get the following message:

root@tuerli dd]# /sbin/insmod ./hello-1.o
./hello-1.o: kernel-module version mismatch
        ./hello-1.o was compiled for kernel version 2.4.20
        while this kernel is version 2.4.20-8.

with /sbin/insmod -f ./hello-1.o it works.

My attempt:
----------
I recompiled the kernel and gave it an custom name. Result: The problem persisted. Only when I recompiled the kernel and gave it the name: 2.4.20 . The /sbin/insmod command worked properly. My conclusion: There must be a silly version check arround about which I dont' know and which only compares strings.


My questions:
------------
-How can I compile the module that this warning doesn't occur


anymore(because source-tree and compiled kernel in my machine are the same, they only have different names.)
-Is there a command arround to determine the source tree's


version?
-How does the gcc-compiler know where to look for the kernel header files? Is there a Environment Variable which determines that? Is there a default location?


Thanks a lot,
Christoph

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux