[ENBD] Problems compiling 2.4.26a on RH6.2 kernel 2.2.19
Peter T. Breuer
enbd@lists.community.tummy.com
Fri, 11 Jan 2002 19:34:00 +0100 (MET)
Darn .. I lost the mail I was composing. Oh, well, I'll summarise ..
"A month of sundays ago Nelson Vieira wrote:"
> I'm having some problems compiling 2.4.26a on a RH6.2 box with kernel
> 2.2.19.
>
> I had no problems compiling on a RH7.2 with kernel 2.4.9.
>
> Here's the error I get:
>
> gcc -O2 -Wall -D_LARGEFILE64_SOURCE -D__KERNEL__ -DMODULE -DDEBUG=0 -I/home/
> neno/nbd-2.4.26a/linux/include -I/usr/src/linux/include -c -o nbd.o
> /home/neno/nbd-2.4.26a/linux/drivers/block/nbd.c
> /home/neno/nbd-2.4.26a/linux/drivers/block/nbd.c:227: warning: `module_init'
> redefined
> /usr/src/linux/include/linux/init.h:117: warning: this is the location of
> the previous definition
2.2.19 has backported some definitions from 2.4.* that I provided as
part of the compatibility layer to support 2.2 codes. I don't quite
know what to do about this clash. I welcome suggestions. The problem
is that there is no longer a linear relation between kernel version
numbers.
For example, where I have in nbd.c:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
#define schedule_task(x) queue_task(x,&tq_scheduler)
#define module_init(x) int init_module(void) { return x(); }
#define module_exit(x) int cleanup_module(void) { x(); }
#endif
It is true of 2.2.18 but not of 2.2.19 that it lacked these
definitions. Nevertheless, 2.2.19 is still linearly below 2.4.0
in kernel numbering.
Perhaps put
#ifndef schedule_task
#define schedule_task(x) queue_task(x,&tq_scheduler)
#endif
etc. ?? Suggestions? This will foulup when there are real functions
(not defines) involved, but there is a gcc trick that can be used in
those cases.
> /home/neno/nbd-2.4.26a/linux/drivers/block/nbd.c:259: warning: static
> declaration for `mark_buffer_protected' follows non-static
wooohooooooooooo! Do you mean to say that THEY now define mark_buffer
protected?? Give me!
> /home/neno/nbd-2.4.26a/linux/drivers/block/nbd.c:4811: parse error before
> `nbd_cleanup'
uh, this is strange:
void __exit
nbd_cleanup (void)
{
Have they lost the __exit definition? It should have been in
linux/init.h. Just remove __exit if it bothers you.
The real definition is:
#define __exit __attribute__ ((unused, __section__(".text.exit")))
and I will define that in a backwards compatibility bit if it can be
considered harmless.
> Any ideas?
Try again, and let me have the patch ! You should now have understood
what is happening.
Peter