Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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).
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.
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?
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...
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.
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!).
*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?"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.