LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


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

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


Hello,

I've got a binary only module build for kernel 2.6.25.9-76.fc9.i686, and I would like to use it on a '2.6.26.8-57.fc8.i686' kernel.

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

Code:
version magic '2.6.25.9-76.fc9.i686 SMP mod_unload 686 4KSTACKS ' should be '2.6.26.8-57.fc8 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:
2.6.26.8-57.fc8 SMP mod_unload 686 4KSTACKS
and on the driver I want to use:
Code:
2.6.25.9-76.fc9.i686 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:
Code:
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:
Code:
10 .modinfo      00000072  00000000  00000000  0000165a  2**0
                  CONTENTS, READONLY
but the original driver have:
Code:
4 .modinfo      00000077  00000000  00000000  0000044c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
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...

regards
 
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.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:12 AM.

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
Open Source Consulting | Domain Registration