LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Compiling a kernel module results in "insmod" version (https://www.linuxquestions.org/questions/linux-general-1/compiling-a-kernel-module-results-in-insmod-version-77063/)

mvega 07-29-2003 04:26 PM

Compiling a kernel module results in "insmod" version
 
Hi

While I can compile and create a kernel loadable module
as shown below, I get a kernel version mismatch in the
final result as indicated by the insmod command. Can
someone look at the steps below and tell me where I can
reconcile this difference.

Thank You...

#####################################
# Phase 1: Preparing the kernel source files
# from my installation CD...
#####################################
root# rpm -iv kernel-source-2.4.18-14.i386.rpm
root# rpm -iv glibc-kernheaders-2.4-7.20.i386.rpm
root# cd /usr/src/linux-2.4
root# make menuconfig
(Comparing the Qlogic instructions on what to do
here to what came up, it turns out that
I did not have to modify anything here).
root# make dep
#####################################

#####################################
# Phase 2: Preparing the Qlogic source structure
# (i.e. this is the kernel module Im creating to
# drive a Qlogic qla2200 HBA).
######################################

root# mkdir -p /qla2x00
root# cd /qla2x00 (I then copied the source tarball (qla2x00-v6.04.00-dist.tgz) to this directory)
root# tar -xvzf qla2x00-v6.04.00-dist.tgz
root# cd qlogic (the above tar command created this new directory to cd into).
root# ./drvrsetup (i.e. /qla2200/qlogic/drvrsetup --
all this did was untar more source files into the current
directory, /qla2x00/qlogic)

root# pwd
/qla2x00/qlogic

root# make all SMP=1 OSVER=linux-2.4
cc -D__KERNEL__ -DMODULE -Wall -O -g -DUDEBUG -DLINUX -Dlinux -DINTAPI -DEXPORT_SYMTAB -DMODVERSIONS -include /usr/src/linux-2.4/include/linux/modversions.h -I/usr/src/linux-2.4/include -I/usr/src/linux-2.4/include/../drivers/scsi -falign-functions=2 -falign-jumps=2 -falign-loops=2 -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strength-reduce -pipe -DCONFIG_X86_LOCAL_APIC -fno-strict-aliasing -fno-common -mpreferred-stack-boundary=2 -march=i686 -D__SMP__ -DCONFIG_SMP -c qla2200.c -o qla2200.o
cc -D__KERNEL__ -DMODULE -Wall -O -g -DUDEBUG -DLINUX -Dlinux -DINTAPI -DEXPORT_SYMTAB -DMODVERSIONS -include /usr/src/linux-2.4/include/linux/modversions.h -I/usr/src/linux-2.4/include -I/usr/src/linux-2.4/include/../drivers/scsi -falign-functions=2 -falign-jumps=2 -falign-loops=2 -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strength-reduce -pipe -DCONFIG_X86_LOCAL_APIC -fno-strict-aliasing -fno-common -mpreferred-stack-boundary=2 -march=i686 -D__SMP__ -DCONFIG_SMP -c qla2300.c -o qla2300.o

roo# ls -la *.o
-rw-r--r-- 1 root root 622316 Jul 29 17:08 qla2200.o
-rw-r--r-- 1 root root 640068 Jul 29 17:08 qla2300.o

==================================================
Finally here is the problem (I could use the -f option to insmod,
but am not sure what consequence it will have later):
==================================================

root# insmod /qla2x00/qlogic/qla2200.o
/qla2x00/qlogic/qla2200.o: kernel-module version mismatch
/qla2x00/qlogic/qla2200.o was compiled for kernel version 2.4.18-14custom
while this kernel is version 2.4.18-14smp.

How can I get these versions to match up??? In the end, I guess I
need the qla2200.o version to be version 2.4.18-14smp.

Thanks In Advance,
Milton

finegan 07-29-2003 05:36 PM

If I'm remembering right, its getting its versioning info from the file:

/usr/src/linux/include/linux/version.h or modversion.h

Which you can edit to be what matches uname -r. Lemme guess, Mandrake? They assume if you want the kernel source for your kernel you're going to be compiling a custom kernel and ignore the fact that you may just be needing an out of kernel driver...

btw, you can probably get the kid to load with:

insmod -f qla2000.o

That'll force load over the silly mismatch.

Cheers,

Finegan

mvega 07-30-2003 09:03 AM

Fabu... Finegan. The was exactly what I needed.
And it was "/usr/src/linux-2.4/include/linux/version.h".
BTW... RedHat

Thing are always simple when the right people get
involved.

Best Regards,
Milton


All times are GMT -5. The time now is 12:03 AM.