Skip to contentSkip to conversation

Insmod problems

DISCUSSION Tyler BIRD 1 participant 1 message Dec 4, 2001

lore
Share & tools
lore

Tyler BIRD

author
#0 lore raw

in linux/module.h header file
KERNEL_VERSION is defined.

what you need to do is make sure the directory /usr/include is a link
to the include directory in your kernel source and not the header files os some other kernel.

if you cant do that try something like this

___NO_VERSION___
#include <linux/module.h>
KERNEL_VERSION(major,minor,release)

read more on this site

http://www.xml.com/ldd/chapter/book/ch02.html#t2

Quoted 1 line
Quoted 1 line
Quoted 1 line

Michael Zhu <[email protected]> 12/04/01 11:13AM >>>

I've changed my source file like this:
#define MODULE

#include <linux/module.h>

int init_module(void) { printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void) { printk("<1>Goodbye cruel world\n"); }

And I use the following message to build the module. But when I use insmod to load the module I got the following error message:

hello.o : kernel-module version mismatch
hello.o was compiled for kernel version
2.4.12
while this kernel is version 2.4.8

What is wrong? My kernel version is 2.4.8. Is there something wrong with the gcc compilier? My gcc compilier is gcc-2.95.

Thanks to everyone. Your help is very beneficial to me.

Michael

Quoted 22 lines · --- Christine Ames
Quoted 3 lines

-----Original Message-----
From: Michael Zhu [mailto:[email protected]]
Sent: Tuesday, December 04, 2001 9:07 AM

<snip>

Quoted 3 lines

I've define these two when I compile the module.

The

Quoted 5 lines

command line is:

gcc -D_KERNEL_ -DMODULE -c hello.c

<snip>

Quoted 1 line

See http://www.xml.com/ldd/chapter/book/ch02.html

Where your source should be similar to:

Quoted 8 lines

#define MODULE // <- HERE!!! define MODULE
#include <linux/module.h>

int init_module(void) { printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void) { printk("<1>Goodbye cruel world\n"); }

______________________________________________________
Send your holiday cheer with http://greetings.yahoo.ca