Weblogs for jonesy

Posted by jonesy on Tue 7 Nov 2006 at 05:22
Tags: none.
had to install 32bit Debian GNU/Linux on an AMD Opteron 64bit system recently, and it was not quite as straightforward as it may seem to get it running with a custom 64-bit kernel, so hopefully these instructions will save you some time and mucking about.

The reason I needed the 64-bit kernel was that I had 8GB of memory which I wanted MySQL to be able to use.

Had all my hardware been supported by the stock debian amd64 kernel, this article would be very short and consist of two steps;

apt-get install kernel-image-2.6-amd64-k8 amd64-libs
shutdown -r now

Unfortunately my MegaRAID RAID controller isn't supported by the stock debian amd64 kernel, so it seemed a recompile was necessary. I could have used the standard kernel built process, but as I'm a debian user, I wanted to compile the kernel the debian way.

Since my system was currently running a 32bit 2.4 kernel, I had to cross-compile the 2.6 kernel for 64-bit.

These steps may not be exact, as it's a while since I actually did the compile, so feel free to leave a comment if I've got something wrong and I'll correct it.

First of all, you'll need to apt-get some packages:

apt-get install amd64-libs kernel-packages libncurses5-dev lib64gcc1 lib64stdc++6 bzip2 gcc-3.4

Say yes to any dependencies.

Next download the latest kernel sources to /usr/src, extract them and copy the current config if desired;

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.2.tar.bz2
tar jxvf linux-2.6.18.2.tar.bz2
ln -s linux-2.6.18.2 linux
cd linux
cp /boot/config-2.4.27-bf24 .config

Now you can run the configuration gui (I choose to use the ncurses gui, but you could just as easily use the standard make config - it's much more fiddly). The ARCH=x86_64 is very important, this is what says what architecture we will be compiling for.

make menuconfig ARCH=x86_64

Go through and change any kernel options you need to (in my case enabling MegaRAID). Make sure you enable IA32 emulation or your 32-bit userland will not run!

Now comes the actual compile, and to use make-kpkg you will need some wrapper scripts which pass the flags to the compiler and linker which specify 64-bit, you can get the wrappers from my site http://www.haqthegibson.com/files.php or extract them out of the debian 64bit kernel source package yourself. unzip the archive and copy the files inside to somewhere on the path, eg /usr/bin, make sure that they're executable. Then run this, to compile your new kernel.

make-kpkg --arch amd64 --append-to-version custom_amd64 --initrd kernel_image

The compile will take a while, so go and make a coffee.

Once the compile is done, it's time to install the package you've created:

cd /usr/src
dpkg -i kernel-image-2.6.18.2_custom_amd64.0.1_amd64.deb

Now you should be able to reboot into your new 64 bit kernel. After the reboot, if all has gone well, uname -a should produce something like this

Linux db6 2.6.18.2 #1 SMP Mon Oct 16 14:31:52 GMT 2006 x86_64 GNU/Linux.

Congratulations, you now are running a 64-bit kernel!

 

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search