ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I started reading linux device drivers by rubini. As the part of the book i try to compile and load a simple module. It compiled well but when i m trying to inserting this i m facing a version mismatch problem.
The program looks like this
#define MODULE
#include<linux/module.h>
int init_module(void)
{
printk("<1> Hello \n");
return 0;
}
But when i try to insert the module with the following command
insmod firstmod.c
I m getting the following error message.
Module is compiled for a different kernel and u r inserting into a kernel whose version is different. It is saying that "Version mismatch occurs". And it is saying that version of kernel for which my module is compiled is 2.4.20 and where as kernel version into which im inserting module is 2.4.20-8. But how can it is possible. When i used uname to print info it prints my kernel version as 2.4.20-8. Then how can module is compiled with the kernel 2.4.20
By this output what i understood is my module is compiled with a kernel header whose version is different than the kernel into which i m inserting my module. But i dont know how can i solve this problem. I m using red hat 9.0 on pentium 4 machine. Can any body help me to resolve this version mismatch.
Can u plz tell me how to check the makefile version. I have two directories in /usr/src folder one linux-2.4 and another one is linux-2.4.20-8. Thanx in advance.
That would depend on the linking to the linux headers you are using during your build..
You may find that linux-2.4 is a symlink to linux-2.4.20-8..
Either way, look at the files /usr/src/linux-2.4/Makefile and /usr/src/linux-2.4.20-8/Makefile
These determine the version number used by the built kernel and modules.
You need to have done at least make dep to create the linking that fixes the version number.
Whatever the version & extraversion show in the Makefiles, use that as the name of the directory the sources are in.
Then create symlinks /usr/src/linux and /usr/src/linux-2.4 to the directory with 2.4.20-8 name
If the sources have not been used for a kernel/module build, do make dep to prepare them.
Last edited by peter_robb; 02-28-2005 at 06:44 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.