My laptop, an HP pavilion with an nVidia card, has some issues with suspending. Namely firewire breaks on suspend and the nvidia drivers cause Xorg to hang on resume. I'd like to compile my own kernel to build firewire in instead of as a loadable module, and disable agpart to see if these changes fix these issues...

However, my laptop isn't the fastest nor does it have a ton of RAM, and its fans are on their last legs. I'd like to configure the kernel build on the laptop buy compile the kernel on our in-house VMware server which has a lot more horsepower. Both the laptop and the server have Ubuntu on them (Ubuntu desktop on the laptop, Ubuntu... wait for it... Server on the Server. Bet you never would have guessed that!)

How can I use one linux system to compile a kernel for the architecture of a different linux system?

  • Is your laptop actually a different architecture? – mattdm Mar 8 '11 at 19:53
  • @mattdm: Yes. Laptop is an AMD Athlon, server is an Intel(R) Core(TM) i5 CPU – Josh Mar 8 '11 at 19:57
  • 1
    — that's the same x86_64 architecture as far as the kernel is concerned. – mattdm Mar 8 '11 at 20:06
  • @mattdm: Oh, ok, I would have thought that they would need to be different, but I know very little about the internals of the kernel. – Josh Mar 8 '11 at 21:15
  • 1
    — since they do have differences, you can optimize code differently and get different performance on each (some of which the kernel does at runtime, actually). But they're the same instruction set and generally work the same way at a high level. – mattdm Mar 8 '11 at 21:17

The generic approach here is that you want to build a kernel package which you can install. After all, the kernel you're running on your laptop now was built on some server somewhere.

For Fedora or other Red Hat based distributions, you'd simply download the kernel source rpm (yum-downloadonly --source kernel), unpack that, modify the config to meet your needs, and rebuild under mock with the appropriate parameters for the target system.

For Ubuntu, the actual actions taken are different but the steps is similar. I haven't ever done this myself, but there's a detailed help document on this here https://help.ubuntu.com/community/Kernel/Compile, and in summary:

  1. Download the kernel source package with sudo apt-get install linux-source
  2. Make your modifications to the config
  3. Build using fakeroot and the debian/rules script that's part of the package
  4. Take the resulting .deb files and there you go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.