Invalid Module format error in Linux kernel 2.6.28

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

tittuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Let_Me_BeCommented:
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
mrjoltcolaCommented:
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
tittuAuthor Commented:
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
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

mrjoltcolaCommented:
>>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
Duncan RoeSoftware DeveloperCommented:
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
tittuAuthor Commented:

I will try  
0
tittuAuthor Commented:
Sun VirtualBox is compiling the kernel and Integrating into the existing kernel how is it doing
0
Duncan RoeSoftware DeveloperCommented:
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
tittuAuthor Commented:
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
Duncan RoeSoftware DeveloperCommented:
(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
tittuAuthor Commented:
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
Duncan RoeSoftware DeveloperCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tittuAuthor Commented:
not complete solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.