Messages in this thread | | | Date | Tue, 4 Dec 2001 12:33:27 -0600 | From | Tommy Reynolds <> | Subject | Re: 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] | |