LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Question on kernel-Module version mismatch (https://www.linuxquestions.org/questions/linux-newbie-8/question-on-kernel-module-version-mismatch-746982/)

bin 08-12-2009 08:04 AM

Question on kernel-Module version mismatch
 
Hi All,

I'm newer here who now is learning linux driver development.

As I tried to insmod my first module "Hello.c" in Linux,

system indicated like this:

hello.o: Kernel-Module Version mismatch
hello.c was compiled for kernelversion 2.4.20
while this kernel version is 2.4.20-8.

My question is:

1. why version mismatch happened?
2. How to solve this problem?

Thanks for your best helps, looking forward to your replies :)

Yours truely,

bin

neonsignal 08-12-2009 10:11 AM

When you compiled your module, you would have used the kernel header files.

1) You need to make sure that the version of the header files you are using match the kernel version you are running. Otherwise the module may not work (and insmod is protecting you because of the mismatched versions). Perhaps you have multiple versions of the header files, or have compiled a custom kernel with a different subversion.

2) If you are certain that the header files are correct (matching), you can force the module to be inserted (using 'modprobe -f module'). But you do not normally need to do this.

bin 08-13-2009 12:46 AM

1 Attachment(s)
Quote:

Originally Posted by neonsignal (Post 3640594)
When you compiled your module, you would have used the kernel header files.

1) You need to make sure that the version of the header files you are using match the kernel version you are running. Otherwise the module may not work (and insmod is protecting you because of the mismatched versions). Perhaps you have multiple versions of the header files, or have compiled a custom kernel with a different subversion.

2) If you are certain that the header files are correct (matching), you can force the module to be inserted (using 'modprobe -f module'). But you do not normally need to do this.

Thanks for your help. Follow your guides, I change the version from "version.h" header file to match the kernel version, then insmod works.
But,as attched, there is a warning related to the license.Again, I have no idea how to deal with it, need more helps.

neonsignal 08-13-2009 02:07 AM

That is merely a warning that your module has not defined its licensing.

This is not a problem (because it doesn't affect the functionality), but it is a way of making sure that restricted license modules don't get accidentally distributed with free software.

You need to define a MODULE_LICENSE string, eg
Code:

MODULE_LICENSE("GPL");
(assuming that is the license you are going to apply to the code).

If you look in the header files at include/linux/module.h, there is a list of compatible licenses.


All times are GMT -5. The time now is 01:46 PM.