Re: "couldn't find the kernel version the module was compiled for" - help!

From: David Schleef (ds@stm.lbl.gov)
Date: Tue Nov 14 2000 - 19:41:48 EST


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/



This archive was generated by hypermail 2b29 : Wed Nov 15 2000 - 21:00:27 EST