LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-12-2009, 09:04 AM   #1
bin
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Rep: Reputation: 0
Smile 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
 
Old 08-12-2009, 11:11 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,388
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
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.

Last edited by neonsignal; 08-12-2009 at 11:15 AM.
 
Old 08-13-2009, 01:46 AM   #3
bin
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by neonsignal View Post
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.
Attached Thumbnails
Click image for larger version

Name:	error.JPG
Views:	4
Size:	14.0 KB
ID:	1215  
 
Old 08-13-2009, 03:07 AM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,388
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel-Module version mismatch vddmanikanta Linux - Newbie 2 07-25-2009 11:22 AM
Kernel-module Version Mismatch !!! lionking_x Linux - Networking 1 02-02-2004 03:07 PM
Kernel-module Version Mismatch !!! lionking_x Linux - Software 1 02-02-2004 03:06 PM
Kernel-module Version Mismatch !!! lionking_x Linux - Newbie 1 02-02-2004 02:01 PM
kernel-module version mismatch louai Linux - General 2 01-08-2004 12:22 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration