public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* "couldn't find the kernel version the module was compiled for" - help!
@ 2000-11-14 21:58 Timur Tabi
  2000-11-14 22:31 ` Steven Walter
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Timur Tabi @ 2000-11-14 21:58 UTC (permalink / raw)
  To: Linux Kernel Mailing list

I'm at a loss to explain why I can't get this working.

I have a driver written for 2.4 that I'm porting back to 2.2.  Every time I
think I got it working, something surprises me.  

First, I had a bunch of link errors on the redifintion of
__module_kernel_version.  To fix that, someone told me to do this:

#define __NO_VERSION__
#include <linux/version.h>

And sure enough, no more errors.

However, now I get this error from insmod when I try to load my driver:

[root@two ttabi]# insmod tdmcddk.sys 
tdmcddk.sys: couldn't find the kernel version the module was compiled for

I've tried all sorts of things - recompiling the kernels, changing the order of
#include files (version.h, module.h, modversions.h, whatever).  Either the
driver won't link, or it won't load.

I had our other Linux programmer (who works only with 2.2) look at the problem,
but he couldn't figure it out, either.

I'd be very appreciative of any assistance.



-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please direct the reply to the mailing list only.  Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
  2000-11-14 21:58 "couldn't find the kernel version the module was compiled for" - help! Timur Tabi
@ 2000-11-14 22:31 ` Steven Walter
  2000-11-14 22:51 ` Timur Tabi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Steven Walter @ 2000-11-14 22:31 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linux-kernel

If my understanding is correct, you need to include version.h without
"#define __NO_VERSION__" in one and only one of your module's .c files.
More than one, and you get redefinition errors; less than one, and its
undefined.

On Tue, Nov 14, 2000 at 03:58:38PM -0600, Timur Tabi wrote:
> I'm at a loss to explain why I can't get this working.
> 
> I have a driver written for 2.4 that I'm porting back to 2.2.  Every time I
> think I got it working, something surprises me.  
> 
> First, I had a bunch of link errors on the redifintion of
> __module_kernel_version.  To fix that, someone told me to do this:
> 
> #define __NO_VERSION__
> #include <linux/version.h>
> 
> And sure enough, no more errors.
> 
> However, now I get this error from insmod when I try to load my driver:
> 
> [root@two ttabi]# insmod tdmcddk.sys 
> tdmcddk.sys: couldn't find the kernel version the module was compiled for
> 
> I've tried all sorts of things - recompiling the kernels, changing the order of
> #include files (version.h, module.h, modversions.h, whatever).  Either the
> driver won't link, or it won't load.
> 
> I had our other Linux programmer (who works only with 2.2) look at the problem,
> but he couldn't figure it out, either.
> 
> I'd be very appreciative of any assistance.
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
  2000-11-14 21:58 "couldn't find the kernel version the module was compiled for" - help! Timur Tabi
  2000-11-14 22:31 ` Steven Walter
@ 2000-11-14 22:51 ` Timur Tabi
  2000-11-14 23:31 ` Keith Owens
  2000-11-14 23:35 ` Timur Tabi
  3 siblings, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2000-11-14 22:51 UTC (permalink / raw)
  To: linux-kernel

** Reply to message from Steven Walter <srwalter@hapablap.dyn.dhs.org> on Tue,
14 Nov 2000 16:31:54 -0600


> If my understanding is correct, you need to include version.h without
> "#define __NO_VERSION__" in one and only one of your module's .c files.
> More than one, and you get redefinition errors; less than one, and its
> undefined.

I tried that, and it didn't help.



-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please direct the reply to the mailing list only.  Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
  2000-11-14 21:58 "couldn't find the kernel version the module was compiled for" - help! Timur Tabi
  2000-11-14 22:31 ` Steven Walter
  2000-11-14 22:51 ` Timur Tabi
@ 2000-11-14 23:31 ` Keith Owens
  2000-11-14 23:35 ` Timur Tabi
  3 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2000-11-14 23:31 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Linux Kernel Mailing list

On Tue, 14 Nov 2000 15:58:38 -0600, 
Timur Tabi <ttabi@interactivesi.com> wrote:
>First, I had a bunch of link errors on the redifintion of
>__module_kernel_version.  To fix that, someone told me to do this:
>
>#define __NO_VERSION__
>#include <linux/version.h>

"#define __NO_VERSION__" must be in all but one of the sources that
also include module.h.  It suppresses the module_version string in
module.h so it only make sense if the code includes module.h.  But
exactly one of the objects in a module must have a module_version
string.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
  2000-11-14 21:58 "couldn't find the kernel version the module was compiled for" - help! Timur Tabi
                   ` (2 preceding siblings ...)
  2000-11-14 23:31 ` Keith Owens
@ 2000-11-14 23:35 ` Timur Tabi
  3 siblings, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2000-11-14 23:35 UTC (permalink / raw)
  To: Keith Owens; +Cc: Linux Kernel Mailing list

** Reply to message from Keith Owens <kaos@ocs.com.au> on Wed, 15 Nov 2000
10:31:22 +1100


> "#define __NO_VERSION__" must be in all but one of the sources that
> also include module.h.  It suppresses the module_version string in
> module.h so it only make sense if the code includes module.h.  But
> exactly one of the objects in a module must have a module_version
> string.

Ok, I made this change:

#ifndef __ENTRY_C__
#define __NO_VERSION__
#endif
#include <linux/version.h>

and in entry.c:

#define __ENTRY_C__
#include "include.h"

Unfortunately, it still doesn't work.

I tried "insmod -f tdmcddk.sys", but that didn't help either.



-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please direct the reply to the mailing list only.  Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
@ 2000-11-14 23:41 Keith Owens
  2000-11-14 23:44 ` Timur Tabi
  0 siblings, 1 reply; 8+ messages in thread
From: Keith Owens @ 2000-11-14 23:41 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Linux Kernel Mailing list

On Tue, 14 Nov 2000 17:35:37 -0600, 
Timur Tabi <ttabi@interactivesi.com> wrote:
>Ok, I made this change:
>
>#ifndef __ENTRY_C__
>#define __NO_VERSION__
>#endif
>#include <linux/version.h>
>
>and in entry.c:
>
>#define __ENTRY_C__
>#include "include.h"
>
>Unfortunately, it still doesn't work.

__NO_VERSION__ must be defined before #include <module.h>.  Do it by hand.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
  2000-11-14 23:41 Keith Owens
@ 2000-11-14 23:44 ` Timur Tabi
  2000-11-15  0:41   ` David Schleef
  0 siblings, 1 reply; 8+ messages in thread
From: Timur Tabi @ 2000-11-14 23:44 UTC (permalink / raw)
  To: Keith Owens; +Cc: Linux Kernel Mailing list

** Reply to message from Keith Owens <kaos@ocs.com.au> on Wed, 15 Nov 2000
10:41:42 +1100


> __NO_VERSION__ must be defined before #include <module.h>.  

It is:

#ifdef LINUX
#ifndef __ENTRY_C__
#define __NO_VERSION__
#endif
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>

>Do it by hand.

I don't know what you mean by that.




-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please direct the reply to the mailing list only.  Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: "couldn't find the kernel version the module was compiled for" - help!
  2000-11-14 23:44 ` Timur Tabi
@ 2000-11-15  0:41   ` David Schleef
  0 siblings, 0 replies; 8+ messages in thread
From: David Schleef @ 2000-11-15  0:41 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Keith Owens, Linux Kernel Mailing list

On Tue, Nov 14, 2000 at 05:44:42PM -0600, Timur Tabi wrote:
> ** Reply to message from Keith Owens <kaos@ocs.com.au> on Wed, 15 Nov 2000
> 10:41:42 +1100
> 
> 
> > __NO_VERSION__ must be defined before #include <module.h>.  
> 
> It is:
> 
> #ifdef LINUX
> #ifndef __ENTRY_C__
> #define __NO_VERSION__
> #endif
> #include <linux/version.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/types.h>
> 
> >Do it by hand.
> 
> I don't know what you mean by that.
> 


Module source should look like this:

  single .c -> single .o

    #include <linux/kernel.h>
    #include <linux/module.h>

  multiple .c -> single .o, main .c file (contains init_module(), etc.)

    #include <linux/kernel.h>
    #include <linux/module.h>

  multiple .c -> single .o, secondary .c file

    #include <linux/kernel.h>

  multiple .c -> single .o, secondary .c file that requires module.h
  for a particular purpose, such as EXPORT_SYMBOL()

    #define __NO_VERSION__
    #include <linux/kernel.h>
    #include <linux/module.h>

Note that in most cases, you _don't_ need to include module.h.

Your Makefile should call gcc with '-D__KERNEL__ -DMODULE', as well
as other approprate flags.




dave...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-11-15  1:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-14 21:58 "couldn't find the kernel version the module was compiled for" - help! Timur Tabi
2000-11-14 22:31 ` Steven Walter
2000-11-14 22:51 ` Timur Tabi
2000-11-14 23:31 ` Keith Owens
2000-11-14 23:35 ` Timur Tabi
  -- strict thread matches above, loose matches on Subject: below --
2000-11-14 23:41 Keith Owens
2000-11-14 23:44 ` Timur Tabi
2000-11-15  0:41   ` David Schleef

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox