Compile 32-bit Kernel on 64-bit Machine – How to Guide

Architecturecompilingkernel

I'm trying to compile a kernel for a 32bit single-core Intel Atom machine. Needless to say, the compile is taking inordinate amounts of time. It's been going for 2 hours and it's still only halfway through the driver modules.

Compiling a kernel on my main desktop only takes 15 minutes but it's a 64bit machine. Can I cross compile to generate a 32bit kernel package from the better machine?

Best Answer

While the kernel can be cross-compiled, the easiest way is to create a 32bit (i386) chroot and build it in there.

Install ubuntu-dev-tools:

$ sudo apt-get install ubuntu-dev-tools

Create an i386 chroot:

$ mk-sbuild --arch=i386 precise

(You will probably have to run that twice. The first time, it installs schroot etc. and sets up mk-sbuild)

Then enter the chroot:

$ schroot -c precise-i386

And build the kernel, as you would, normally.

Related Question