Re: Mismatched driver vs. kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/05/07, Eric Fowler <eric.fowler@xxxxxxxxx> wrote:
I am running into this when I run insmod on my newly built minimal driver:

[root@rwfedora play]# insmod play.ko
insmod: error inserting 'play.ko': -1 Invalid module format

/var/log/messages ends with:
May 21 20:08:44 rwfedora kernel: play: no version for "struct_module" found:
kernel tainted.
May 21 20:08:44 rwfedora kernel: play: version magic '2.6.20 SMP mod_unload
PENTIUMIII ' should be ' 2.6.20-1.2944.fc6 SMP mod_unload 586 4KSTACKS '

And uname tells me:

[eric@rwfedora play]$ uname --all
Linux rwfedora 2.6.20-1.2944.fc6 #1 SMP Tue Apr 10 17:27:49 EDT 2007 i686
athlon i386 GNU/Linux

Now I am savvy enough to know that I have some mismatches here but I am a
little puzzled as to exactly what mismatches and why.

Obviously 2.6.20-1.2944.fc6 != 2.6.20 but do I need to match EXACTLY at
every decimal place?

Not just that, the kernel you build the module for has to be the
*exact* kernel you are running and try to load the module into. That
is, it has to be the exact same version and it has to be build with
the exact same config.


Doesn't this complicate distribution of drivers as
binaries?

Yes.
Don't distribute drivers as binaries - if you really want to do that,
then distribute a small glue layer that gets build at install time -
like nVidia does - but really, don't do that.


Is the mismatch PENTIUMIII != 586 alsoa problem? What is the simplest fix?

Simplest fix: Build the module against the exact (configured) source
of the kernel you are running (or replace the running kernel with the
one you build the module against).

What is the basic rationale behind this checking and how does it work?

The rationale behind it is to ensure compatibility between the module
and the kernel. If the kernel the module was build for is not exactely
the one you try to load it into, then symbols may be at different
addresses, data structures may have changed, etc etc, all things that
could make your kernel blow up spectacularly.
For how it works, start by reading Documentation/kbuild/modules.txt

--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux