Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 05-25-2009, 12:07 PM   #1
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
How to change the vermagic of a module


I've got a binary only module build for kernel, and I would like to use it on a '' kernel.

When I try to "insmod" the module, I've got the following error:

version magic ' SMP mod_unload 686 4KSTACKS ' should be ' SMP mod_unload 686 4KSTACKS '
If I make a "modinfo -F vermagic" on one of the driver I'm using on my system, I've got:
Code: SMP mod_unload 686 4KSTACKS
and on the driver I want to use:
Code: SMP mod_unload 686 4KSTACKS
So to change this vermagic, I:
-create a file with the closed module .modsection contents,
-into this file I'm changing the vermagic with thhe target one
-then I "objcopy" like this:
objcopy --remove-section=.modinfo --add-section .modinfo=modinfo_file $MODULE
Then when I try to insmod the module, I've got an "Invalid module format" error, but dmesg say nothing more...

If I make an "objdump -h" on the module I can see that the .modinfo section now have following info:
10 .modinfo      00000072  00000000  00000000  0000165a  2**0
                  CONTENTS, READONLY
but the original driver have:
4 .modinfo      00000077  00000000  00000000  0000044c  2**2
I think that why I'm not able to load the modified module, but after some googling, I can't found any way how to adjust these section parameters. Can anybody tell me if:
-it's possible to do what I want to do since the kernels version are really close
-if it's the good way to do this
-how I can specify the section information to force its index, its offset, the alignment and add the "ALLOC", "LOAD", and "DATA" parameters...

Old 05-26-2009, 05:14 AM   #2
Valery Reznic
ELF Statifier author
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
You can use 'modprobe --force', so all version information will be ignored.

But version inserted (and checked) in the kernel modules for the reason:
if you force module loading kernel crash is likely.


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
Manually change module dependencies DeadlyMuffin Linux - General 8 01-16-2008 11:21 AM
Kernel compilation: Is it posiible to change built-in[] option to module<> ravime Linux - Kernel 4 07-30-2007 08:12 AM
kernel vermagic bong.mau Linux - General 4 04-30-2007 02:16 PM
How to change module loading sequence? benk Fedora 1 07-09-2004 12:48 PM
HPT370 detects and using module HPT366, change ?? DaveQB Linux - Hardware 0 02-19-2004 02:36 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

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

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