32 bit Debian Linux Userspace with Custom 64bit AMD64 kernel -
I 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;
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:
Next download the latest kernel sources to /usr/src, extract them and copy the current config if desired;
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, get the wrappers from here. 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.
Once the compile is done, it's time to install the package you've created:
I 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
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 gcc-3.4 bzip2
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
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, get the wrappers from here. 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
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!

