You are not logged in.

#1 2006-07-08 19:48:18

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Kernel hacking

Hey guys,

I'm at a bit of a standstill here on a project I really don't feel like doing. I could ask this question in a more appropriate area, but I'd rather get a quicky from someone who knows me if that's possible...

The overall goal is to port a kernel module written for 2.4 a couple years ago to the 2.6 kernel. In order to test it, I wanted to get the original module working, so I've set up qemu with a warty ubuntu install that uses a 2.6 kernel by default; I installed a 2.4 kernel to work with. I tried compiling the module and got some errors described below, and I have tried writing a simple module as described here: http://bama.ua.edu/~dunna001/journeyman/html/c241.htm and got the same errors.

I'm pretty sure the errors are because the system is set up for a 2.6 kernel and either it is looking for the wrong include files or I have some other wrong headers or something. It is including the 2.4 source headers just fine, but those headers are trying to include stuff from /usr/include that are probably quite different for the 2.6 kernel.

Check out the errors:

gcc -Wall -O2 -I/home/user/linux-2.4.24/include -D__KERNEL__ -DMODULE -D__USER__ -c xyzzy.c -o xyzzy.o
In file included from /home/user/linux-2.4.24/include/linux/kernel.h:13,
                 from xyzzy.c:1:
/home/user/linux-2.4.24/include/linux/types.h:21: error: syntax error before "dev_t"
/home/user/linux-2.4.24/include/linux/types.h:21: warning: type defaults to `int' in declaration of `dev_t'
/home/user/linux-2.4.24/include/linux/types.h:21: warning: data definition has no type or storage class
In file included from /usr/include/asm/math_emu.h:4,
                 from /usr/include/asm/processor.h:11,
                 from /home/user/linux-2.4.24/include/linux/prefetch.h:13,
                 from /home/user/linux-2.4.24/include/linux/list.h:6,
                 from /home/user/linux-2.4.24/include/linux/module.h:12,
                 from xyzzy.c:2:
/usr/include/asm/sigcontext.h:79: error: syntax error before '*' token
/usr/include/asm/sigcontext.h:82: error: syntax error before '}' token
In file included from /usr/include/asm/processor.h:11,
                 from /home/user/linux-2.4.24/include/linux/prefetch.h:13,
                 from /home/user/linux-2.4.24/include/linux/list.h:6,
                 from /home/user/linux-2.4.24/include/linux/module.h:12,
                 from xyzzy.c:2:
/usr/include/asm/math_emu.h:6: error: syntax error before '*' token
/usr/include/asm/math_emu.h:7: error: syntax error before '*' token
In file included from /home/user/linux-2.4.24/include/linux/prefetch.h:13,
                 from /home/user/linux-2.4.24/include/linux/list.h:6,
                 from /home/user/linux-2.4.24/include/linux/module.h:12,
                 from xyzzy.c:2:
/usr/include/asm/processor.h:421: error: syntax error before '*' token
/usr/include/asm/processor.h:427: error: syntax error before '}' token
make: *** [xyzzy.o] Error 1

Any ideas how I can complie a 2.4 kernel module on a system that is currently running 2.4 but was originally compiled for 2.6?

Thanks,
Dusty

Offline

#2 2006-07-08 20:09:50

barebones
Member
Registered: 2006-04-30
Posts: 235

Re: Kernel hacking

Do you have the 2.4 headers installed? Ubuntu packages the headers seperatly, IIRC. Doing a search in synaptic for headers should find them pretty quick.

Offline

#3 2006-07-08 20:22:52

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Kernel hacking

I'm using the sources, actually, rather than headers... turns out the problem was I needed to run make dep in the source directory first... its not working yet, but that particular error is solved.

Dusty

Offline

#4 2006-07-08 20:28:01

user
Member
Registered: 2006-03-29
Posts: 465

Re: Kernel hacking

try "make clean" before doing "make dep"


I removed my sig, cause i select the flag, the flag often the target of enemy.

SAR brain-tumor
[img]http://img91.imageshack.us/img91/460/cellphonethumb0ff.jpg[/img]

Offline

Board footer

Powered by FluxBB