Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .
Version 68 (modified by matt, 9 years ago)
typo.

Debian

The following notes and guide are about getting and installing madwifi on a Debian system. Quicklinks:-


MadWifi-old

Debian MadWifi-old Packages

There is an official package based on madwifi-old in the non-free section of the Debian archive. It currently exists in the unstable and testing branches. Below is an example /etc/apt/sources.list file, that would allow you to use apt to get madwifi:-

# Unstable
deb http://ftp.au.debian.org/debian unstable main contrib non-free
deb-src http://ftp.au.debian.org/debian unstable main contrib non-free

# Testing
deb http://ftp.au.debian.org/debian testing main contrib non-free
deb-src http://ftp.au.debian.org/debian testing main contrib non-free

Please see the list of Debian mirrors for repositories at your location or simply adjust your existing entries as required (you may need to add non-free to your existing entries).

backports.org also provides a version of the package for the current stable branch, sarge. See the instructions page for more information.

# Sarge Backports
deb http://www.backports.org/debian/ sarge-backports non-free

The madwifi debian source package provides 3 binary packages: madwifi-source, madwifi-tools and madwifi-dev.

Installation (with module-assistant)

The preferred method of installing madwifi-modules uses the module-assistant (m-a) tool to automate all of the following steps: preparing the kernel source/headers, unpacking the module tarball, compiling, building a binary-modules debian package, installing and cleaning up.

$ su
# apt-get update
# apt-get install madwifi-source
# m-a prepare
# m-a a-i madwifi-source

See /usr/share/doc/madwifi-source/README.Debian for extra details. The module-assistant docmentation may also be of value; man m-a.

Installation (with kernel-package)

An alternative method of building madwifi-modules involves the use of the scripts provided by kernel-package. An exhaustive set of instructions for building madwifi for Debian kernels exists on Martin List-Petersen's site and is also applicable to the official madwifi-source package.

Post-Installation

By now the modules should be installed to the correct location, and module dependencies updated. So it should just be a matter of loading the correct module:-

# modprobe ath_pci

Most up-to-date systems will load this module automatically at boot time via the hotplug mechanism, if not you can make sure it is loaded by adding it to the /etc/modules list:-

# echo ath_pci >> /etc/modules

madwifi-dev?

This package provides the headers required for wpa_supplicant to support MadWifi interfaces. Below is an example of a minimalistic .config for compiling wpa_supplicant against madwifi-dev:-

CONFIG_DRIVER_MADWIFI=y
CFLAGS += -I/usr/include/madwifi
CONFIG_WIRELESS_EXTENSION=y

NOTE: The wpasupplicant package for Debian (testing,unstable) currently supports madwifi-old. However, as wpasupplicant is built against version specific MadWifi headers, the same binary will not work with older (old madwifi CVS) or newer versions (madwifi-ng) of the MadWifi driver.


MadWifi-ng (EXPERIMENTAL)

Debian MadWifi-ng Packages

The pkg-madwifi developers are also working on a madwifi-ng package. For testing, binary and source packages are available at this location. Users of debian unstable (i386 & amd64) may also like to use (use at own risk!) this repository by adding the following lines to their sources.list:-

# Kanotix experimental GPG key: 71409CDF
deb http://debian.tu-bs.de/project/kanotix/experimental/ experimental non-free
deb-src http://debian.tu-bs.de/project/kanotix/experimental/ experimental non-free

The madwifi-ng debian source package provides 3 binary packages: madwifi-ng-source, madwifi-ng-tools and madwifi-ng-dev.

Installation (with module-assistant)

The preferred method of installing madwifi-ng-modules uses the module-assistant (m-a) tool to automate all of the following steps: preparing the kernel source/headers, unpacking the module tarball, compiling, building a binary-modules debian package, installing and cleaning up.

$ su
# apt-get update
# apt-get install madwifi-ng-source madwifi-ng-tools
# m-a prepare
# m-a a-i madwifi-ng-source

See /usr/share/doc/madwifi-ng-source/README.Debian for extra details. The module-assistant docmentation may also be of value; man m-a.

Installation (with kernel-package)

An alternative method of building madwifi-ng-modules involves the use of the scripts provided by kernel-package. An exhaustive set of instructions for building madwifi for Debian kernels exists on Martin List-Petersen's site and is also applicable to the madwifi-ng-source package.

Installation of madwifi-ng-tools with Debian Sarge

The madwifi-ng-tools packages are built against the libc6 for Debian unstable, and do not install onto Sarge. Simply rebuild the packages against Debian sarge libraries, which satisfy the dependencies. (requires fakeroot)

$ su
# apt-get build-dep madwifi-ng-tools
# exit
$ fakeroot apt-get --build source madwifi-ng-tools

The .debs created can be installed using dpkg -i. The madwifi-ng-dev, madwifi-ng-source and madwifi-ng-tools binaries are created.

NOTE: Sarge users may also be interested in the Debian unstable wireless-tools package has been added to the archives at backports.org.

Post-Installation

By now the modules should be installed to the correct location, and module dependencies updated. So it should just be a matter of loading the correct module:-

# modprobe ath_pci

In syslog or the output of dmesg you should see something similar to the following messages for successful insertion of the MadWifi modules:-

ath_hal: 0.9.16.13 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, DFS)
wlan: 0.8.4.2 (Atheros/multi-bss)
ath_rate_sample: 1.2
ath_pci: 0.9.4.5 (Atheros/multi-bss)
ACPI: PCI Interrupt 0000:02:02.0[A] -> Link [LNKC] -> GSI 10 (level, low) -> IRQ 10
wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: H/W encryption support: WEP AES AES_CCM TKIP
wifi0: mac 5.6 phy 4.1 radio 1.7
wifi0: Use hw queue 1 for WME_AC_BE traffic
wifi0: Use hw queue 0 for WME_AC_BK traffic
wifi0: Use hw queue 2 for WME_AC_VI traffic
wifi0: Use hw queue 3 for WME_AC_VO traffic
wifi0: Use hw queue 8 for CAB traffic
wifi0: Use hw queue 9 for beacons
wifi0: Atheros 5212: mem=0xd0000000, irq=10

Most up-to-date systems will load this module automatically at boot time via the hotplug mechanism, if not you can make sure it is loaded by adding it to the /etc/modules list:-

# echo ath_pci >> /etc/modules

Contact

Development of the Debian packages for MadWifi is coordinated through a Debian Alioth project (pkg-madwifi). You may like to browse the pkg-madwifi svn archive.


Installing MadWifi 'By Hand'

Prerequisites

First, you should make sure you have everything you need in your kernel. Chances are that, if you are running the stock debian kernel, everything will be OK. A description of the necessary kernel options can be found on our kernel configuration page. You'll need to be running at least Sarge in order to have working WEP and iwpriv.

# apt-get install sharutils subversion wireless-tools

To make sure you can uudecode the HAL files and configure your wireless card.

Now, make sure you have the sources for your current kernel installed:

# apt-get install kernel-source-{your-kernel-version}

Or for Debian testing/unstable:-

# apt-get install linux-source-{your-kernel-version}

If your wireless card is a PC Card (Cardbus), then you’ll need to make sure you have card services installed:

# apt-get install pcmcia-cs

For linux kernels >=2.6.13-rc1:

# apt-get install pcmciautils

Note: Madwifi cards are never, ever PCMCIA, they are always cardbus. Therefore there is no need to edit any of the files under /etc/pcmcia

Instructions

Please refer to the First Timers HowTo for a complete guide about building MadWifi from source, and initial configuration of the device.

Troubleshooting a Manual Installation

Modules Not Found

If after make installing, and doing modprobe ath_pci you get a “module not found” error, you may need to copy the modules to the correct location in /lib/modules. For example, if you are running a 2.6.11-1-686 kernel, you may need to copy the directory /lib/modules/2.6.11/net to /lib/modules/2.6.11-1-686/net and then run

depmod -ae

(This problem only occurs when you compile kernels the Debian way with --append-to-version.)

Make-Kpkg

Eric Van Buggenhaut sent me the following, on how to get make-kpkg to leave a built kernel tree in place after its made (and perhaps packaged) your kernel.

If you are trying to build madwifi on an x86 Debian system (using kpkg), you may find that make fails, complaining that it can’t find modpost.

After searching the web, I realized that the madwifi build wants to be able to find modpost in /lib/modules/${VERSION}/build, but the default kernel-package config runs a make clean in the kernel tree after the deb is built. To leave the built executables around, I modified /etc/kernel-pkg.conf to include the line:

do_clean := No

As described at http://www.gag.com/~bdale/nc4000/.

I’m informed by Joe Milbourn, that you can also use do_clean := !([Yy]es).


Configuring the MadWifi device

The /etc/network/interfaces file is the standard debian method of controlling network interfaces. This file is well documented in the debian distribution, both internally and by external sources. These include:-

The following paragraphs will consist of a handful of example interfaces entries for using MadWifi devices. Wireless devices are more complex to setup correctly, because of the nature of their usage, and the broad range of features available to them. For example, some of them are removeable and some support multiple VAP's (madwifi-ng). Therefore, some special handling is required to exploit as much as possible out of these features.

MadWifi-ng users will be particualy interested in reading Howto Automate VAP creation before inspecting the following examples.

Client to an access point (essid of "wep.net") with wep security and ip via dhcp:-

auto ath0
iface atho inet dhcp
	wireless-mode managed
	wireless-essid wep.net
	wireless-key 46f04863257ac8040905ea0002

Client to an access point with wpa security and ip via dhcp:-

auto ath0
iface ath0 inet dhcp
	pre-up wpa_supplicant -i ath0 -D madwifi -c /etc/wpa_supplicant.conf -B
	post-down pkill -x wpa_supplicant

The previous example can be made more robust, by checking for any existing wpa_supplicant processes that are using the device, and killing only the process that is using the device:-

auto ath0
iface ath0 inet dhcp
	pre-up wpa_cli -i "$IFACE" status > /dev/null 2>&1 || wpa_supplicant -i "$IFACE" -D madwifi -c /etc/wpa_supplicant.conf -B
	post-down wpa_cli -i "$IFACE" terminate > /dev/null 2>&1

A cardbus card is hot-pluggable, and not always present. So the user may be interested in a more advanced setup, that can handle wireless profiles for each different location that you express your wireless fidelity. Gary Vollink has written an excellent HOWTO on setting up Debian using ifplugd and wpa_supplicant for WEP/WPA keys, and makes use of the allow-hotplug option.

TODO: add information on howto config/use wpa_supplicant on debian

TODO: more example interfaces files for multiple ap's, bridging, wds etc. etc.

Automated VAP creation

MadWifi-ng support multiple VAP's. If you are using MadWifi-old, this section is no good to you, it deals with the handling of these special abilities of MadWifi in the Debian networking scripts.

Any snapshot more recent than r1407 will create a sta mode VAP for each atheros device by default. If installed the madwifi-ng-base package, a udev script to automate the creation of a sta VAP, please remove madwifi-ng-base when upgrading to the new version.

To disable the autocreation behaviour:-

# echo "options ath_pci autocreate=none" > /etc/modprobe.d/madwifi

Or you may specify a mode in [sta|ap|wds|adhoc|ahdemo|monitor]:-

# echo "options ath_pci autocreate=ap" > /etc/modprobe.d/madwifi

If your system loads modules defined in /etc/modules before hotplugging occurs, you could also set the behaviour in that file:-

# echo "ath_pci autocreate=ap" >> /etc/modules

Matt Brown has written some more advanced scripts to nicely integrate the madwifi-ng setup with the Debian ifupdown framework. They use the wireless-tools extensions to determine the mode to create the interface in. These are most useful for creating multiple VAP's, especially in ap mode. It may be useful to disable the autocreation of the sta VAP when using these. They are included in the madwifi-ng-tools package and are also available seperately from:

Then to create a MadWifi interface simply create a stanza like

iface ath0 inet static
        madwifi-base wifi0
        ...
        wireless-mode master

and ifup/ifdown will take care of creating and destroying VAPs as necessary. Wireless configuration for the VAP can be configured as per normal with the wireless tools directives.

Alternatively, you can automate all the creation of the device from your /etc/network/intefaces file, simply by using the pre-up/post-down routines. ie:

iface ath0 inet static
        pre-up wlanconfig ath0 create wlandev wifi0 wlanmode ap
        post-down wlanconfig ath0 destroy
        wireless-essid my-essid
        ...

Thus avoiding the requirement of third-party scripting to handle the devices.

International Users

You may have to provide the countrycode module parameter when you modprobe ath_pci. (For more info on countrycodes, see here.)

The standard way of setting module parameters to be applied automatically in Debian is by placing a rule in the /etc/modprobe.d/ directory. For example, Australian users may need to do the following:

# echo "options ath_pci countrycode=36" > /etc/modprobe.d/madwifi

Extra Notes

Hotplug

Cardbus cards (32-bit PCMCIA) are handled by PCI hotplugging, not the myriad /etc/pcmcia/* files, so, to get the card to hotplug, you need to add this to your /etc/network/interfaces:

mapping hotplug
    script grep
    map ath0

Which tells hotplug to bring ath0 up. You can find more information on this in /usr/share/doc/hotplug/README.Debian, provided you have the hotplug package installed.

Note that as of hotplug 20050329-25, released to testing around 16 August 2005, you must use the following instead:

allow-hotplug ath0

This is useful to know if you recently upgraded hotplug and want to know why your wireless card stopped working right. See Debian bug 303383.

Waproamd

This entry was sent in by Achim Steinmetz, and relates to a DWL-G60 (C2), but should work for any supported card.

First madwifi has to be installed. I successfully used the Debian packages available for the driver as well as CVS version. First make sure you have the driver installed and it can recognize the card. Once everything is basically working you can use the following instructions to make it all work automatically after the card is inserted into the slot. The below has been done on Debian Sarge:

# apt-get install waproamd

During install make sure you delete any options which might be suggested by debconf. This is a bug and currently logged in BTS as #252462. Furthermore delete the ‘eth0’ entry for configuration of static devices and leave ‘all’ for the hotplug device settings. Basically after waproamd is installed your /etc/default/waproamd should look similiar to this:

INTERFACES=""
HOTPLUG_INTERFACES="all"
ARGS=""

Ok, you’re almost set now. The missing bit is configuring your WEP key for waproamd. For this you need to determine the $MAC address of your access point. “iwlist scan” should show you this information. Once you know it, do this:

# echo $WEPKEY >> /etc/waproamd/keys/$MAC.wep

Note: For security reasons only the root user should have read access to the above file!

The last step is to put an ath0 stanza into the interfaces file to configure for DHCP usage:

# echo "iface ath0 inet dhcp" >> /etc/network/interfaces

Now plug your card and all should be configured automatically. Enjoy!