Re: Module problems!
Quoting Ramakrishnan M (rkrishnan@vayu.ee.iitm.ernet.in):
> hello,
> I had been reading the Linux Device Drivers,and tried running the
> first program.
> #define KERNEL
> #include ...
> ...init_module(...)
> .....
That first line is wrong, but I guess you copied into the email
wrongly.
> when I do insmod prog.o it says the program has been compiled to run on
> kernel 2.2.5 and the running kernel is 2.2.10. Sure! I have 2.2.10 kernel
> running but I am not able to understand the 2.2.5 business. Itried
> installing an older kernel and recompiled it,with no useful result.Please
> help!
I compile modules with something like
gcc -DMODULE -D__KERNEL__ -I. -I/usr/local/src/linux/include \
-O2 -m486 -g -Wall -c $@ -o foo.o foo.c
where linux is a link to the kernel source tree. Now that
kernel-source packages just install a .tgz file rather than
the tree, and you have to untar the tree yourself, you have
to make sure that link is correct (or use the full name
-I/usr/local/src/kernel-source-2.2.10/include instead).
Cheers,
--
Email: d.wright@open.ac.uk Tel: +44 1908 653 739 Fax: +44 1908 655 151
Snail: David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer: These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.
Reply to: