How to install the development version of atk9k

From ThinkWiki
Revision as of 09:31, 31 July 2008 by Kevmitch (Talk | contribs) (Ok, now see if it worked)
Jump to: navigation, search

ath9k is the new open source driver for newer atheros cards including those with 11n hardware support.

At the time of writing, ath9k will not compile against the current kernel release 2.6.26. Thus, in order to get it running, you will first have to download and compile the wireless testing branch of the current Linux kernel. Once you have that running, you can then install the ath9k driver itself which is still separate. This howto will outline the entire process without assuming any prior knowledge of git or kernel compilation.

Install git and other stuff

You will need to have git up and running to access both the wireless testing branch, and the ath9k driver itself which is not yet included. Git is the revision control system used for the Linux kernel and associated projects. Your distribution will most likely have a package for it so install that using aptitude, yum or portage or whatever first. Additionally, compiling your kernel is at a minimum going to require "gcc" and "make" and you're also going to need either the qt3 development libraries to run the x-configuration utilities or ncurses development libraries to run the menuconfig 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

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 using git-clone.

$ cd /usr/src
$ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

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 need 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

QoS and/or fair queueing → Networking Options → [Y]Networking (CONFIG_NET_SCHED)

Multiband Priority Queueing (PRIO) → QoS and/or fair queueing → Networking Options → [M]Networking (CONFIG_NET_SCH_PRIO)

Multiband Priority Queueing (PRIO) → QoS and/or fair queueing → Networking Options → [M]Networking (CONFIG_NET_SCH_PRIO)

Improved wireless configuration API → Wireless Networking → [M]Networking (CONFIG_CFG80211)

nl80211 new netlink interface support → Improved wireless configuration API → Wireless Networking → [Y]Networking (CONFIG_NL80211)

Wireless Extensions → Wireless Networking → [Y]Networking (CONFIG_MAC80211)

Generic IEEE 802.11 Networking Sta ck (mac80211) → Wireless Networking → [M]Networking (CONFIG_WIRELESS_EXT)

Default rate control algorithm → Rate control algorithm selection → Generic IEEE 802.11 Networking Stack (mac80211) → Wireless Networking → [Y]Networking (CONFIG_MAC80211_RC_DEFAULT_PID)

PID controller based rate control algorithm → Rate control algorithm selection → Generic IEEE 802.11 Networking Stack (mac80211) → Wireless Networking → [Y]Networking (CONFIG_MAC80211_RC_PID)

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.26-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.26-wl
root		(hd#,#)
kernel		/boot/linux-2.6.26-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.

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.26-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.26.mykernel-wl_2.6.26.mykernel-wl-10.00.Custom_amd64.deb
or if you're running 32-bit i386

# dpkg -i /usr/src/linux-image-2.6.26.mykernel-wl_2.6.26.mykernel-wl-10.00.Custom_i386.deb

which should take care of all of the above for you.

Finally! Download and install ath9k

Now use git to download ath9k

$ cd /usr/src
$ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/ath9k.git
$ cd ath9k
$ make
$ su
# make install

Ok, now see if it worked

# 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.

Keeping up to date

If you want to keep up to date with the latest developments, you can always check the git tree of both ath9k and the wireless-testing kernel for code changes.

$ cd /usr/src/ath9k && git-pull
$ cd /usr/src/wireless-testing && git-pull

Of course you will have to repeat the necessary steps above to recompile and reinstall any changes.