Preparation

Compiling your kernel is at a minimum going to require gcc, make and the qt3 development libraries to run the x-configuration utility. The names of these packages and how to install them will vary from distro to distro. You'll also want to add yourself to the src group so that you can do most of the kernel compilation as a regular user. You will have to log out and log back in for this change to take effect.

Get the kernel sources

Kernel config

This is the part most people are afraid of. However, you can use your current kernel's configuration as a baseline to help ease the pain. Most self-respecting distributions keep a copy of your kernel configuration in the /boot directory alongside the kernel itself. If this is not the case, you might find a copy of the kernel config at /proc/config.gz (which will of course needs to be gunziped). Whatever the case, you will want to copy the the current config file to the directory of the the kernel tree you are about to compile /usr/src/linux-2.6.27/.config

Debian/Ubuntu

$ cp /boot/config-`uname -r` ./.config

Configure the kernel

Now run

$ make xconfig

You'll likely see some messages in the terminal about unset or unrecognized configuration variables which automatically either get added or removed respectively. You might want to make sure the following are enabled

Also, unless you want to worry about creating an initrd (initial RAM disk), you're also probably best to build anything necessary to read your root filesystem into the kernel rather than as modules. This includes both filesystem (e.g. ext3) and low level hardware drivers (e.g. libata). The particular drivers required will depend on your particular setup. You can try and get an idea of what you might need to include by examining the output of lsmod. If you see any modules in there that might be required to boot the system, you should make sure you compile these in.

Make sure you save any changes you make before you exit.

Compilation

Now it's time to compile your kernel. If you have NCPU cpus, the generic way to do this is

You're going to have to set (hd#,#) and root=/dev/<your root device> to reflect your boot device configuration. The best bet is probably to just copy and modify an existing entry.

NOTE!

If you compiled the drivers needed to access your root device (filesystem and hardware driver) as modules rather than building them directly into the kernel, you're going to have build an initrd, using something like mkinitramfs and add the resulting initrd to the above grub stanza as follows:

initrd /boot/initrd.img-2.6.27

Now reboot into your new kernel.

Debian/Ubuntu

Debian has a system to help you build kernels as Debian packages. If NCPU is the number of CPUs you have,

Again it is recommended that you build what you need into your kernel. However, if aren't sure what is needed to read your root file system and so can't just build it into your kernel, you can create an initrd using update-initramfs

# update-initramfs -c -k 2.6.27.mykernel# update-grub

Ok, now see if it worked

Once you have your kernel compiled and install, reboot and choose it from your grub or lilo menu. Hopefully it boots Ok, and you can open a command line and
# modprobe ath9k# iwconfig
The first command should hopefully generate no errors and the second is purely diagnostic and should show you a working wireless device. You can then proceed to use wpa_supplicant or network manager or iwconfig to setup your wireless networking.

Hardware specific

168c:0024 (MacBook Wireless)

Currently with this hardware (output of lspci -vvv), the driver installs, but does not allow association with an access point.