lkml.org 
[lkml]   [2001]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Insmod problems
More important activities lacking, "Michael Zhu" <apiggyjj@yahoo.ca> wrote:

> 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 command line to build the
> module.
>
> gcc -c -D__KERNEL__ hello.c
>
> 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.

You're not picking up the correct kernel header files. Don't allow GCC to pick
up the files from "/usr/include/linux":

$ gcc -I/usr/src/linux/include -c -D__KERNEL__ hello.c

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- --
Tommy Reynolds | mailto: <reynolds@redhat.com>
Red Hat, Inc., Embedded Development Services | Phone: +1.256.704.9286
307 Wynn Drive NW, Huntsville, AL 35805 USA | FAX: +1.256.837.3839
Senior Software Developer | Mobile: +1.919.641.2923
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:13    [W:0.060 / U:21.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site