LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Compiling kernel module for linux kernel 2.4 in 2.6 (http://www.linuxquestions.org/questions/linux-software-2/compiling-kernel-module-for-linux-kernel-2-4-in-2-6-a-277207/)

guam 01-13-2005 02:02 AM

Compiling kernel module for linux kernel 2.4 in 2.6
 
Hello Everyone,

I have a kernel module that perfectly compiles and works with kernel version 2.4.20-18 on Redhat 9.0. This is third party code.

I have upgraded OS to Fedora Core 3 with kernel version 2.6.9. I downloaded the kernel source from the same distribution in rpm form and installed it. The kernel rpm is "kernel-2.6.9-1.667.src.rpm" and followed the steps below:

1. Install kernel-<version>.src.rpm. By default, the files of the package will be written to /usr/src/redhat/.
# rpm -ivh kernel-2.6.9-1.667.src.rpm

2. Change directory to /usr/src/redhat/SPECS/, and issue the command: rpmbuild -bp --target=<arch> kernel.spec
# cd /usr/src/redhat/SPECS/
# rpmbuild -bp --target=i686 kernel-2.6.spec

On a default RPM configuration, the kernel tree will be located in /usr/src/redhat/BUILD/.

Now I have problem compiling the kernel module.

The error message is as follows:
=====================================================
kaodv.c:30:31: linux/modversions.h: No such file or directory
In file included from /lib/modules/2.6.9-1.667/build/include/asm/processor.h:18,
from /lib/modules/2.6.9-1.667/build/include/asm/thread_info.h:16,
from /lib/modules/2.6.9-1.667/build/include/linux/thread_info.h:21,
from /lib/modules/2.6.9-1.667/build/include/linux/spinlock.h:12,
from /lib/modules/2.6.9-1.667/build/include/linux/capability.h:45,
from /lib/modules/2.6.9-1.667/build/include/linux/sched.h:7,
from /lib/modules/2.6.9-1.667/build/include/linux/module.h:10,
from kaodv.c:38:
/lib/modules/2.6.9-1.667/build/include/asm/system.h: In function `__set_64bit_var':
/lib/modules/2.6.9-1.667/build/include/asm/system.h:193: warning: dereferencing type-punned pointer will break strict-aliasing rules
/lib/modules/2.6.9-1.667/build/include/asm/system.h:193: warning: dereferencing type-punned pointer will break strict-aliasing rules
kaodv.c:43:27: linux/wrapper.h: No such file or directory
In file included from /lib/modules/2.6.9-1.667/build/include/linux/irq.h:20,
from /lib/modules/2.6.9-1.667/build/include/asm/hardirq.h:6,
from /lib/modules/2.6.9-1.667/build/include/linux/hardirq.h:6,
from /lib/modules/2.6.9-1.667/build/include/linux/interrupt.h:11,
from /lib/modules/2.6.9-1.667/build/include/asm/highmem.h:24,
from /lib/modules/2.6.9-1.667/build/include/linux/highmem.h:14,
from /lib/modules/2.6.9-1.667/build/include/linux/skbuff.h:27,
from /lib/modules/2.6.9-1.667/build/include/linux/if_ether.h:106,
from kaodv.c:45:
/lib/modules/2.6.9-1.667/build/include/asm/irq.h:16:25: irq_vectors.h: No such file or directory
In file included from /lib/modules/2.6.9-1.667/build/include/asm/hardirq.h:6,
from /lib/modules/2.6.9-1.667/build/include/linux/hardirq.h:6,
from /lib/modules/2.6.9-1.667/build/include/linux/interrupt.h:11,
from /lib/modules/2.6.9-1.667/build/include/asm/highmem.h:24,
from /lib/modules/2.6.9-1.667/build/include/linux/highmem.h:14,
from /lib/modules/2.6.9-1.667/build/include/linux/skbuff.h:27,
from /lib/modules/2.6.9-1.667/build/include/linux/if_ether.h:106,
from kaodv.c:45:
/lib/modules/2.6.9-1.667/build/include/linux/irq.h: At top level:
/lib/modules/2.6.9-1.667/build/include/linux/irq.h:70: error: `NR_IRQS' undeclared here (not in a function)
In file included from /lib/modules/2.6.9-1.667/build/include/linux/irq.h:72,
from /lib/modules/2.6.9-1.667/build/include/asm/hardirq.h:6,
from /lib/modules/2.6.9-1.667/build/include/linux/hardirq.h:6,
from /lib/modules/2.6.9-1.667/build/include/linux/interrupt.h:11,
from /lib/modules/2.6.9-1.667/build/include/asm/highmem.h:24,
from /lib/modules/2.6.9-1.667/build/include/linux/highmem.h:14,
from /lib/modules/2.6.9-1.667/build/include/linux/skbuff.h:27,
from /lib/modules/2.6.9-1.667/build/include/linux/if_ether.h:106,
from kaodv.c:45:
/lib/modules/2.6.9-1.667/build/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS' undeclared here (not in a function)
kaodv.c: In function `init_module':
kaodv.c:188: error: `EXPORT_NO_SYMBOLS' undeclared (first use in this function)
kaodv.c:188: error: (Each undeclared identifier is reported only once
kaodv.c:188: error: for each function it appears in.)
make: *** [kaodv.o] Error 1
=====================================================

I think this is due to some change in the linux kernel source tree. Can someone point me in correct direction for the changes to be made to make the module working?

I mean what are the changes required in source and compilation procedure.

Thanks in advance.

Devel.


All times are GMT -5. The time now is 11:35 AM.