Solved

Invalid Module format error in Linux kernel 2.6.28

Posted on 2009-07-04
13
535 Views
Last Modified: 2012-05-07
I have compiled open source USB driver for Fedora 8, when I Insert  the driver module .ko file on
Fedora 9 using  insmod driver.ko  i get the error Invalid Module format error  ?
why is this coming when i am inserting/deploying on higher version i.e Fedora 9 and compiled driver.ko on Fedora 8 ?
1.) Do i need to compile the driver along with kernel source where ever driver.ko is deployed ?
2.) I there any way at least for the minor number version change the driver.ko will insert ?
3.) It is not a good solution in every machine driver source is compiled, infact some of the client  
    machines doesn't have compilers and kernel sources installed

0
Comment
Question by:tittu
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 12

Expert Comment

by:Let_Me_Be
ID: 24777236
Both Fedora 8 and Fedora 9 are old releases, you should upgrade to Fedora 11.

You are saying you were compiling open source USB driver, but that doesn't make much sense. Why would you do so? Standard kernel packages support USB for a very long time.

If you want to compile a driver, you need to compile it for the exact version of kernel, it even must be the same flavour, because distribution specific patches might make your driver incompatible.
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24777313
As stated, a module needs to match the base kernel. You can try loading with -f flag, but I'm sure this won't work between kernels of Fedora 8 vs 9, I only ever use it between minor patch level differences.

See the Kernel Loadable Module howto:

http://tldp.org/HOWTO/Module-HOWTO/basekerncompat.html#AEN507
0
 

Author Comment

by:tittu
ID: 24780032
The USB driver is a custom driver not a standard driver
It is working fine with FC8 when compiled and installed.
my question can i atleast insert this driver module even in FC8 without recompiling every time on the
deployment targets, in brief how windows drivers work like simple layman installation without compiling
compiling driver sources even for minor kernel version releases is a bad thing ?
some of the client machines even doesn't have compilers and kernel sources installed.
please give me a good solution for this instead of pointing links , i already tried all the links
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24781471
>>my question can i atleast insert this driver module even in FC8 without recompiling every time on the deployment targets,

Yes, using the -f flag as I said. Did you try that?

With major kernel versions you really should be distributing a module for each kernel. Note, it has nothing to do with FC8 vs FC9, sometimes the distribution versions use the same base kernel version.

0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 24789645
You absolutely have to compile it. It relies on addresses in the built kernel. The smallest thing can make these change.
You could integrate the driver source into the kernel source tree so it will "just build" as you generate a new kernel. You need to pick some folder where the source will go (e.g. /usr/src/linux/drivers/usb/serial) and edit the files Kconfig and Makefile there. Your driver will then be visible in "make xconfig" &c.
Once complied by whatever means, you can deploy it with that kernel to other machines without recompiling (i.e. the modules folder and the kernel image are a matched pair. If there is also an initrd, then it's part of a matched triplet).
0
 

Author Comment

by:tittu
ID: 25366436

I will try  
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:tittu
ID: 25371613
Sun VirtualBox is compiling the kernel and Integrating into the existing kernel how is it doing
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 25376282
What commands are you using to start the build? When you say "Integrating into the existing kernel", what exactly do you mean? Has a new kernel been built? Can you boot into it? Is your new module present?

I guess I'm saying I need rather more specific feedback to be able to help you further.
0
 

Author Comment

by:tittu
ID: 25400284
when Sun Virtual Box is installed using an RPM, it is integrating virtual box module into the existing
kernel. and now the virtual box is working fine with the existing new kernel is not installed and infact
compiling without kernel sources installed in the system.
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 25438126
(Back from overseas trip)
That's as may be. Perhaps the RPM had a precompiled version for your kernel. Maybe it used mod-versions. There are all kind of advanced techniques it might have used.
If you simply have source for your custom driver, none of these are available to you. You have to have kernel source and you have to be running the kernel you built from that source. It sounds like you had better include the virtual box module in that kernel.Ideally you should have the configuration file (.config) for your current kernel, otherwise you have to build absolutely everything as a module and have an initrd (which is what distributors do, but the build takes ages). Or you might get away with working back from  an lsmod to know what you actually need. Without an initrd, you need to ensure that your kernel has built in support for your boot media - that's what I always do.
It's a bit of an undertaking if you haven't done this sort of thing before, but once you get the hang of it the next one will be much easier.
0
 

Author Comment

by:tittu
ID: 25513939
I need some clarification , why do i need always kernel sources when ever iam going to install drivers or .ko files , windows OS is intelligent in this case.
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 total points
ID: 25520318
It is possible to make LKMs that are revision-tolerant to an extent, I think it needs the kernel to be built a special way too. (for other experts - I'm thinking of the system whereby you could build revision information into modules - I never used it myself).
However the Linux kernel evolves fairly rapidly so sometimes you just have to rebuild stuff.
0
 

Author Closing Comment

by:tittu
ID: 31599780
not complete solution
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now