LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-06-2003, 05:56 AM   #1
akaBeaVis
LQ Guru
 
Registered: Apr 2003
Location: Maryland
Distribution: Slack 9.1,10 Mandrake 10,10.1, FedCore 2,3, Mepis 2004, Knoppix 3.6,3.7, SuSE 9.1, FreeBSD 5.2
Posts: 1,109

Rep: Reputation: 45
compiling a kernel module for a different target


I would like to compile a pcmcia kernel module (atmelwlandriver) on a Mandrake 8.2 machine (2.4.18-6mdk), for a different machine running slackware 8.0 (2.2.19). I was able to compile the 2.2.19 kernel on the 2.4 machine fine, but it's a more self-contained type of thing. I just can't seem to get my mind around how to set it up to compile for that kernel so as to avoid unrecognized symbols, etc. My pcmcia package on the slackware machine is 3.1.34, it's the "external" version as 2.2 doesn't have the drivers built in.

anyone done this type of thing?
 
Old 06-06-2003, 09:42 AM   #2
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Re: compiling a kernel module for a different target

Quote:
Originally posted by akaBeaVis
I would like to compile a pcmcia kernel module (atmelwlandriver) on a Mandrake 8.2 machine (2.4.18-6mdk), for a different machine running slackware 8.0 (2.2.19). I was able to compile the 2.2.19 kernel on the 2.4 machine fine, but it's a more self-contained type of thing. I just can't seem to get my mind around how to set it up to compile for that kernel so as to avoid unrecognized symbols, etc. My pcmcia package on the slackware machine is 3.1.34, it's the "external" version as 2.2 doesn't have the drivers built in.

anyone done this type of thing?
If you have two machines it is not appropriate that you compile the kernel in one machine and use the same in another machine.In most of the cases the kernel would work but the kernel compilation is machine dependent that means that kernel compiled in one machine may not work in another machine.Another problem you may face is the gcc version.Suppose on your Mandrake machine you use gcc-2.96 to compile the kernel(gcc 2.96 is the most buggy compiler ever known) and in your slackware you have a differnent version of gcc.Now if you try to compile modules of a kernel in different machines using different gcc ,it would simply not work-with printk returning the kernel has been compiled with different gcc version and the module through another it is not known to work etc.
 
Old 06-06-2003, 04:43 PM   #3
akaBeaVis
LQ Guru
 
Registered: Apr 2003
Location: Maryland
Distribution: Slack 9.1,10 Mandrake 10,10.1, FedCore 2,3, Mepis 2004, Knoppix 3.6,3.7, SuSE 9.1, FreeBSD 5.2
Posts: 1,109

Original Poster
Rep: Reputation: 45
greetings RCH, thanx for responding , however, I guess we will have to "agree to disagree"...

Unless I missed it somewhere during the many installations of slackware, mandrake, debian, and knoppix, no kernel was compiled on my machine at any time during the installation process. Thus, I would assume the kernels and their modules (which work fine as far as I can tell) must have been compiled on a different machine than the machines I installed them on, perhaps even under a different kernel version, does this make sense?

When I compiled the 2.2.19 kernel on the 2.4.18 machine, in addition to all the other variables in the .config, I was able to select a target architecture as well, while the "compiler" machine was an amd athlon, the "target" machine was an i486. The kernel and it's modules as well as a few other files were then transferred to the target machine, configured for bootup, and are running fine a year later. This worked fine and was fairly easy to do given the advanced nature of the config process for the kernel sources.

My question involves using source code not found in the official kernel sources (the atmelwlandriver project on sourceforge, which works well and is being used to post this reply), which, when compiled, produces a loadable kernel module, in theory I guess what I'm really trying to do is to "fool" the makefile for this source code into thinking it's being "made" in a slackware 8.0 environment, eg: kernel 2.2.19 (uname refuses to lie for me ) . Do you suppose this is possible? and if so, how to fool the makefile?
 
Old 06-06-2003, 11:50 PM   #4
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Well the kernels that we get from distros work coz of the target machine as you pointed.You may not know this but doing a similiar compilation like yours ,I got a very suprising result.I compiled my kernel on another machine and used it in another.When kernel boots up it checks a delay loop which is called BogoMIPS (if interested check <your kernel source>/init/main.c.Apparently becoz the kernel has been compiled in another machine the delayloop was different.I learnt later that it was not good to compile the kernel on another machine.(kernel mailing list).As for your query,usually the modules when being compiled check /lib/modules/'uname -r'/build for the kernel source.You have just to symlink the build to your kernel that you wish to compile the module with.(you may also do that through the makefile or the configure script).

Last edited by rch; 06-06-2003 at 11:56 PM.
 
Old 06-07-2003, 06:12 PM   #5
akaBeaVis
LQ Guru
 
Registered: Apr 2003
Location: Maryland
Distribution: Slack 9.1,10 Mandrake 10,10.1, FedCore 2,3, Mepis 2004, Knoppix 3.6,3.7, SuSE 9.1, FreeBSD 5.2
Posts: 1,109

Original Poster
Rep: Reputation: 45
thanx again for your response, I tried that trick before posting my question, sadly, it did not work. There's enough difference in the way the 2.4 and the 2.2 kernels handle pcmcia that the easy symlink is not going to fly. I guess what I should do is see if someone who's currently running a 2.2.19 kernel with pcmcia, will compile this driver for me. Do you know anyone running slack 8 with pcmcia installed?

The target machine for this has a ridiculously small disk (256mb, that's megs, not gigs) and there was no room for development tools or kernel sources when I installed slack 8 on it. It has no cdrom either. That is why I had to compile a new kernel for it, at the time it only had 4mb of ram and so I had to compile a new kernel that had the barest of minimum features to conserve memory. Now it has 28mb ram thanks to Ebay and a Compaq bios upgrade and I'd like to get it on the wireless portion of my network, right now it uses a wired linksys pcm100 16bit pcmcia card for network connection, but I'd like it to use my belkin f5d6020rev2 wireless card.
 
Old 06-07-2003, 11:14 PM   #6
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Quote:
Originally posted by akaBeaVis
thanx again for your response, I tried that trick before posting my question, sadly, it did not work. There's enough difference in the way the 2.4 and the 2.2 kernels handle pcmcia that the easy symlink is not going to fly. I guess what I should do is see if someone who's currently running a 2.2.19 kernel with pcmcia, will compile this driver for me. Do you know anyone running slack 8 with pcmcia installed?

The target machine for this has a ridiculously small disk (256mb, that's megs, not gigs) and there was no room for development tools or kernel sources when I installed slack 8 on it. It has no cdrom either. That is why I had to compile a new kernel for it, at the time it only had 4mb of ram and so I had to compile a new kernel that had the barest of minimum features to conserve memory. Now it has 28mb ram thanks to Ebay and a Compaq bios upgrade and I'd like to get it on the wireless portion of my network, right now it uses a wired linksys pcm100 16bit pcmcia card for network connection, but I'd like it to use my belkin f5d6020rev2 wireless card.
the build symlink is to include the
<kernel source>/include/ directory.So naturally it should work.Just copy the kernel source (targeted at the target machine),change the symlink and it should work.As I said you change the configure script/makefile to change the location of the kernel source,but you are essentially doing the same thing as the symlink.
Finally are the glibc version same in both the machines?
 
Old 06-08-2003, 11:17 AM   #7
akaBeaVis
LQ Guru
 
Registered: Apr 2003
Location: Maryland
Distribution: Slack 9.1,10 Mandrake 10,10.1, FedCore 2,3, Mepis 2004, Knoppix 3.6,3.7, SuSE 9.1, FreeBSD 5.2
Posts: 1,109

Original Poster
Rep: Reputation: 45
If you're referring to the /lib/libc.so.6 files, then, no, the versions aren't quite the same, slack8 has 2.2.23, mdk82 has 2.2.24, and yet I've compiled a number of user space apps on the one for the other and they work without incident, odd?

Additionally, I compiled the entire pcmcia package on the one for the other and it too works without incident, very odd? I guess I've been getting lucky, and I'm hoping for a bit more good luck . The errors I'm getting on compile appear to be coming from includes out of the /usr/include dir, I'm going to temporarily symlink that also and see what happens...

thanx again for your responses.
 
Old 06-08-2003, 04:58 PM   #8
akaBeaVis
LQ Guru
 
Registered: Apr 2003
Location: Maryland
Distribution: Slack 9.1,10 Mandrake 10,10.1, FedCore 2,3, Mepis 2004, Knoppix 3.6,3.7, SuSE 9.1, FreeBSD 5.2
Posts: 1,109

Original Poster
Rep: Reputation: 45
Talking Success!

Ok, I'm not going to go into all the gory details here but suffice it to say I got me a brainstorm and that the module in question is compiled, installed, and working fine on the target machine, differing glibc versions notwithstanding, once again da BeaV get's lucky!

So the next time somebody asks how to "fool" the machine into compiling for a different kernel, tell them to rename uname, and create a shell script in it's place that simply echoes whatever kernel version you'd like. If you want to get fancy, you can actually trap and respond to all the switches as well, eg: uname -r, uname -a, etc...clever, ain't it?

And I said I couldn't get uname to lie!, Hah! now uname's got an evil twin that is a compulsive liar!

of course, you need to do a few other things like: have the kernel source in question symlink'd out of /usr/src as "linux" and you also need to symlink the target machine's /usr/include (via nfs, etc), but it works!

for the love of God, I've placed this question on a half dozen forums over the last week or so, and you, RCH, are the only one to even respond, I thank you again for expressing any interest in this problem, I was beginning to believe my posts were invisible.
 
Old 06-08-2003, 10:19 PM   #9
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
That's some good news!.Success at last but by your own efforts.
Incidentally , I replied to your post coz it had 0 replies.Usually I choose posts with 0 replies and interesting topics (like yours!).
 
Old 06-08-2003, 11:36 PM   #10
akaBeaVis
LQ Guru
 
Registered: Apr 2003
Location: Maryland
Distribution: Slack 9.1,10 Mandrake 10,10.1, FedCore 2,3, Mepis 2004, Knoppix 3.6,3.7, SuSE 9.1, FreeBSD 5.2
Posts: 1,109

Original Poster
Rep: Reputation: 45
*chuckle*, we are of the same mind on that one, I too, look for posts where no one has replied, but I prefer hardware issues and especially the laptop forum. but seriously, wasn't this just a bit more interesting than the usual "why doesn't my winmodem work?" or "where's the driver for my radeon9800?"
 
Old 06-09-2003, 12:47 AM   #11
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Of course .I think that those questions could be answered by
trying the howtos
http://tldp.org
or the mighty google
http://google.com/linux
 
  


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
compiling only one module without recompiling the kernel l_9_l Linux - General 8 07-06-2009 10:00 PM
Trouble Compiling Kernel Module... Elric of Grans Linux - General 2 05-31-2006 12:57 AM
Compiling kernel...whats a module? TheDude05 Linux - Newbie 2 01-18-2005 09:29 PM
Compiling a module/Kernel mismatch fbarre Linux - Newbie 2 09-04-2003 08:26 PM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

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

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