How to install the development version of atk9k
ath9k is the new open source driver for newer atheros cards including those with 11n hardware support.
At the time of writing(Kevmitch 21:21, 13 August 2008 (CEST)), ath9k will not compile against the current kernel release 2.6.26. It is however included in the most recent release candidate 2.6.27-rc3. Thus, in order to get it running, you will either need to backport ath9k to your older kernel or download and compile 2.6.27-rc3. It is expected that the latter process will be significantly easier especially now that you can download the necessary kernel source directly off the web without using git. If you have managed to backport the driver to an older kernel, please share your knowledge and add to this page.
Contents
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.
Debian
# aptitude install git-core build-essential kernel-package libqt3-mt-dev fakeroot
Ubuntu
$ sudo aptitude install git-core build-essential kernel-package libqt3-mt-dev fakeroot
Get the wireless-testing branch
It does not appear that you can take the easy way out and use the compat-wireless tree. Instead we have to compile the entire wireless-testing kernel to successfully build ath9k. Once you've got git installed, you can follow the linux wireless git-guide and download the wireless testing branch
$ cd /usr/src
$ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
Patch the kernel
It was found with a T60 that the current 2.6.27-rc2 kernel on which the above wireless testing branch is based has a regression on resume from suspend. Depending on your hardware, you may or may not have to apply this patch to avoid this issue. To apply the patch to your kernel, first create a patch file containing the text in the above link. Open a text editor and paste in the following text:
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 15af618..b5224be 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -299,9 +299,8 @@ static void __pci_restore_msi_state(struct pci_dev *dev) entry->msi_attrib.masked); pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); - control &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); - if (entry->msi_attrib.maskbit || !entry->msi_attrib.masked) - control |= PCI_MSI_FLAGS_ENABLE; + control &= ~PCI_MSI_FLAGS_QSIZE; + control |= PCI_MSI_FLAGS_ENABLE; pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); }
save it as /usr/src/msi-interrupt.patch
Now patch the wireless-tesing kernel:
cd /usr/src/wireless-testing
patch -p1 < ../msi-interrupt.patch
Copy your current kernel's 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 /usr/src/wireless-testing/.config
Debian
$ cp /boot/config-`uname -r` /usr/src/wireless-testing/.config
Configure the kernel
Now run
$ make xconfig
You'll likely see some messages in the terminal about unset or unrecognized configuration variables which should be automatically either added or removed respectively. You might want to make sure the following are enabled
Networking → Networking Options → [Y]QoS and/or fair queueing (CONFIG_NET_SCHED)
Networking → Networking Options → QoS and/or fair queueing → [M]Multiband Priority Queueing (PRIO) (CONFIG_NET_SCH_PRIO)
Networking → Wireless Networking → [M]Improved wireless configuration API (CONFIG_CFG80211)
Networking → Wireless Networking → Improved wireless configuration API → [Y]nl80211 new netlink interface support (CONFIG_NL80211)
Networking → Wireless Networking → [Y]Wireless Extensions (CONFIG_MAC80211)
Networking → Wireless Networking → [M]Generic IEEE 802.11 Networking Stack (mac80211) (CONFIG_WIRELESS_EXT)
Networking → Wireless Networking → Generic IEEE 802.11 Networking Stack (mac80211) → Rate control algorithm selection → [Y]PID controller based rate control algorithm (CONFIG_MAC80211_RC_PID)
and most importantly
Device Drivers → [Y]Network Device Support (CONFIG_WLAN80211)
Device Drivers → Network Device Support → Wireless LAN → [Y]Wireless LAN (IEEE 802.11) (CONFIG_WLAN80211)
Device Drivers → Network Device Support → Wireless LAN → Wireless LAN (IEEE 802.11) → [m]Atheros 802.11n wireless cards support (CONFIG_ATH9K)
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.
Make sure you save any changes you make before you exit.
Compilation
Now it's time to compile your kernel. The generic way to do this is
$ make
$ su
# make modules_install
# cp arch/<your architecture>/boot/bzImage /boot/linux-2.6.27-rc2-wl
Where <your architecture> will be x86 if you're running a 32-bit system or x86_64 if you're running 64-bit.
Then you'll have to set your bootloader to load the new kernel. If you're using grub, you'll add this to /boot/grub/menu.list or /etc/grub.conf or whatever
title Wireless testing Linux kernel 2.6.27-rc2-wl root (hd#,#) kernel /boot/linux-2.6.27-rc2-wl root=/dev/<your root device> ro
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.
initrd /boot/initrd.img-2.6.27-rc2-wl
Now reboot into your new kernel.
Debian
Debian has a system to help you build kernels as Debian packages.
$ fakeroot make-kpkg --append-to-version=.mykernel linux_image
$ su
# dpkg -i /usr/src/linux-image-2.6.27-rc2.mykernel-wl-wl_2.6.27-rc2.mykernel-wl-10.00.Custom_amd64.deb
or if you're running 32-bit i386
# dpkg -i /usr/src/linux-2.6.27-rc2.mykernel-wl_2.6.27-rc2.mykernel-wl-10.00.Custom_i386.deb
which should take care of all of the above for you.
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.
Keeping up to date
If you want to keep up to date with the latest developments, you can always check the git tree of the wireless-testing kernel for code changes.
$ cd /usr/src/wireless-testing && git-pull
Of course you will have to repeat the necessary steps above to recompile and reinstall any changes.