LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2010, 11:57 AM   #1
spooticus
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
How can I identify the target architecture of a prebuilt .ko?


Hello Everyone,
I am trying to insert a .ko into my kernel and I am getting the 'invalid module format' error. But the kernel object is being generated from or is included in a binary which sets up and populates a driver path when run.

How can I tell what architecture/target/anything that .ko is meant for?

I know that I can use the uname and /proc/cpuinfo to see my current info, but I am also not sure what I might need to do to get them to sync up.

I am running on a minimal, cli-install of Ubuntu8.10 right now. It's freshly installed (onto a 2GB USB drive) & imaged, so bring on the drastic changes.

Thanks,
Shawn
 
Old 03-19-2010, 12:03 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,245

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Have you tried 'file your_dodgy.ko' ?
 
Old 03-19-2010, 12:17 PM   #3
spooticus
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Ah, I have not. That seems like a useful command, thanks
But the `file x.ko` says:
ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
And uname -a returns:
Linux ubuntu 2.6.27-17-generic #1 SMP Fri Mar 12 03:09:00 UTC 2010 i686 GNU/Linux
But that's i386 and i686, and those are compatible, right?
 
Old 03-19-2010, 12:22 PM   #4
Zuulie
LQ Newbie
 
Registered: Mar 2010
Location: London
Distribution: Ubuntu
Posts: 16

Rep: Reputation: 1
File is definitely the easiest way. You can get some additional information including the "vermagic" string by using modinfo as well.

The "vermagic" string is used to figure out if the module is compatible with the running kernel. That may be a good starting point for further investigations.
 
1 members found this post helpful.
Old 03-19-2010, 12:59 PM   #5
spooticus
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks Zuulie.
modinfo returned the vermagic string: "2.6.24-12-generic SMP mod_unload 586"
(Is there some documentation on the vermagic fields? I don't find anything in the man pages.)
So is the problem just that I have a newer kernel? I guess there's no backwards compatibility there?
 
Old 03-19-2010, 02:05 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
No, there is never any compatibility for modules.

For a module to be compatibel :
1) The same Linux OS
2) The same gcc compiler
3) The same kernel
Nothing but an exact match will work.
.....

Last edited by knudfl; 03-19-2010 at 02:07 PM.
 
Old 03-19-2010, 02:14 PM   #7
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by knudfl View Post
No, there is never any compatibility for modules.

For a module to be compatibel :
1) The same Linux OS
2) The same gcc compiler
3) The same kernel
Nothing but an exact match will work.
.....
That is semi untrue.
If there is no major differences, it may work.
Hey i have even had a 2.4 module work in a 2.6 kernel.
 
Old 03-19-2010, 02:30 PM   #8
spooticus
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
So does the kernel version have to match completely, or is matching the first 3 places (2.6.24-*) going to work?
On a brief search I found that the Ubuntu 8.04 uses kernel 2.6.24-16 kernel. If I switch to this Ubuntu, will that allow me to use this .ko for 2.6.24-12-generic?
I see now that the 8.04 release is marked LTS, for another year or so. Maybe that would be better if that works.
 
Old 03-19-2010, 02:38 PM   #9
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by spooticus View Post
So does the kernel version have to match completely, or is matching the first 3 places (2.6.24-*) going to work?
On a brief search I found that the Ubuntu 8.04 uses kernel 2.6.24-16 kernel. If I switch to this Ubuntu, will that allow me to use this .ko for 2.6.24-12-generic?
I see now that the 8.04 release is marked LTS, for another year or so. Maybe that would be better if that works.
I say give it a shot.
Worst case is it kernel panics and you have to reboot and it does not work.
Best case is it does not make a difference.
 
Old 03-19-2010, 03:11 PM   #10
spooticus
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
I'm installing the 8.04 minimal cli Ubuntu now to try it out. Thanks for all the help! I'll let you know if I get stuck again.
 
  


Reply


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
[SOLVED] Is there any openoffice-org.txz prebuilt package? cola Slackware 4 12-26-2009 06:24 AM
Need to identify Processor architecture fpfernando Linux - Hardware 7 10-30-2009 09:12 AM
VmWare Workstation Prebuilt VMMON modules sevs Linux - Software 11 09-12-2008 01:39 PM
Poll: Do you run linux on a prebuilt machine or a custom. SlipAway172 Linux - General 21 10-24-2005 04:50 PM
Fixing a prebuilt PHP configured improperly number9 Linux - Software 0 05-18-2004 08:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:43 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