Notes on Life, ‘Puters and Hawaii

Compiling Fuse kernel module for Debian 4.0 (Etch) on EC2

I run Debian 4.0 (Etch) images at EC2 that I created on Xen and bundled to EC2. I discovered while trying to compile a kernel module for FUSE that Debian has GCC 4.1 while all of EC2’s kernels were built with GCC 4.0. This is a problem in that the kernel module, even though it compiles fine, will not insert into the EC2 kernel.

This was a bit of a road block for me as Debian Sarge has GCC 3.3/4 and Etch only has 4.1. I had no access to 4.0. Luckily Amazon provides their stock Fedora images with developer tools. I personally hate RPM-based Linux distributions and Amazon’s Fedora images are broken and won’t ‘yum update’. However, Amazon’s ‘developer’ image at least has GCC 4.0 on it along with the kernel source. With that you can compile a binary kernel module and tar it up for use elsewhere (on your nice clean Debian images).

Here are the steps I took to compile Fuse Kernel module on Amazon’s Developer Fedora image and move it to Debian 4.0. Although this is tailored for compiling the Fuse kernel module the same steps will work for any other kernel module.

# DESKTOP: Fire up an EC2 fedora "developer" instance
ec2-run-instances -g sandbox -k sandbox ami-26b6534f

# DESKTOP: Login
ssh -i ~/.amazon/id_rsa-sandbox \\
  root@ec2-72-44-51-242.z-1.compute-1.amazonaws.com

# EC2: Remove old fuse
rpm -e `rpm -qa | grep fuse`

# EC2: Install FUSE module
cd /usr/local/src
curl -O http://superb-west.dl.sourceforge.net/sourceforge/fuse/fuse-2.6.5.tar.gz
tar xzf fuse-2.6.5.tar.gz
cd fuse-2.6.5
./configure --enable-kernel-module --with-kernel=/usr/src/linux-`uname -r`
cd kernel
make && make install

# EC2: Package up the modules
tar -czf modules-`uname -r`.tgz /lib/modules/`uname -r`

# DESKTOP: Pull the modules off and stash them somewhere to use with your 'real' linux distro
cd ~/Projects/sysadmin/files
scp -i ~/.amazon/id_rsa-sandbox
  root@ec2-72-44-51-242.z-1.compute-1.amazonaws.com:/modules-2.6.16-xenU.tgz .
svn commit . -m 'Updated kernel modules for ec2'

Comments are closed.