1. Changelog
  2. Warnings/Preface
    1. Basic Expectations
    2. Basic Diagram of Component Interaction
    3. Understanding what each part does
  3. Get Code & Patch
  4. libnl
  5. crda
  6. iw
  7. hostapd
  8. compat-wireless
  9. Addendums/Notes
    1. hostapd Configuration
    2. ath9k notes
  1. Changelog

  2. Warnings/Preface

    This document is written targeting those who are looking to jump onto the bleeding edge of linux wireless development. Odds are good that at least one of the packages listed, in the state you grab it, is broken. In fact, they all might be broken when you jump onto it. Once a kernel is released with master mode available by default, and stable releases of all of these packages are available, I'll release a new version of this document that uses stable releases of these packages and outlines all the necessary steps to a stable router.

    Basic expectations:

    1. Linux Kernel 2.6.27 or later with wireless extensions enabled
      The compat-wireless patchset is not maintained for kernels older then 2.6.27, making older kernels impractical targets
    2. Comfortable using the command line
    3. Not afraid to break the system we're configuring
    4. Basic developmental tools available (gcc, autoconf, git)
    5. The account being used to do this has sudo abilities
    6. You have a good system backup, and a working restore procedure

    Basic Diagram of Component Interaction

    [Wireless Card]
          |
    [Linux Kernel ]
      |    |
    [udev][libnl]-[iw]       
       |  /   \       
     [crda]    \     
        |       \     
    [ Wireless ] |
    [Regulatory] |
    [ Database ] |
                 |
                 |
            [ hostapd ]
    

    Understanding what each part does

    Wireless Card: Should be self explanitory... handles sending/receiving wireless packets

    Linux Kernel: The linux kernel contains the driver for the wireless card, the mac80211 subsystem which handles packet generation and scheduling, and the nl80211 subsystem, which handles configuring the wireless interfaces for userspace

    libnl: libnl is the transport layer used to communicate with the kernel via netlink

    udev: udev is the facility the kernel uses to pass events/calls to crda

    iw: iw is a userspace utility that we can use to test that libnl is working correctly, as well as create additional virtual wireless interfaces on the wireless card

    crda: crda is a userspace program that the kernel queries (through udev) to find what channels/frequencies are usable, and at what powers. This moves the information out of static tables maintained in kernel to userspace, which allows them to be updated without reloading drivers/rebooting

    Wireless Regulatory Database: database of allowable frequencies and transmit power levels used by crda

    hostapd: This is the daemon that handles generation of beacons and other wireless packets, as wel as wpa-psk, wpa2, etc encryptions.

    Successes/Failures/Questions/Concerns to: wireless@erley.org

  3. Get Code

    Known working version:
    libnl:f9071054d0f2512dea9e95f99c308e931ed78dba
    iw:5406d9e4ee819aec48f384a6f6854513e40e9f26
    hostapd:97865538ba250730841727a42b7beccd9f7af414
    compat-wireless:35fe528611e6a82f5e76fd02583437909a53593b
    wireless-regdb:dd661723f474ab5c538542ff78e6a28cc3493aa8
    crda:8e7bec8bb9022544fa8c6383f440c06e38a564db

    Tested drivers and the wireless-testing git commit tested:
    ath9k2.6.28-gentoo-r1f69a360f7c2b7bfebae35bb440622c0743157e97
    # you'll want to change this if you're doing this somewhere other than /usr/src
    cd /usr/src
    
    # Get the wireless-testing tree (this will take a while) 
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
    
    # Get compat-wireless
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat-wireless-2.6.git
    
    # Get wireless regdb
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
    
    # Get crda
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git
    
    # Get libnl (optional)
    git clone git://git.kernel.org/pub/scm/libs/netlink/libnl.git
    
    # Get Hostapd, wpa-supplicant, etc...
    git clone git://w1.fi/srv/git/hostap.git
    
    # Get iw 
    git clone http://git.sipsolutions.net/iw.git
    
  4. Build libnl & install it

    # You only need to do this if your distro doesn't ship a relatively recent version
    # of libnl.  Most distros are shipping libnl-1.1 or later, which will work for
    # what we need.
    cd libnl
    
    # This is going to install libnl into /usr.
    # you may need to point this elsewhere for your system.
    autoconf
    ./configure --prefix=/usr
    make && sudo make install
    cd ..
    
  5. Build crda & install it (and install the wireless regdb)

    cd wireless-regdb
    
    # First we need to create the location for the wireless regulatory
    # database
    mkdir -p /usr/lib/crda
    
    # Now we copy the regulatory db over.  Note, no need to 'make' here as
    # the wireless regdb shipped by git is already signed and setup as needed
    cp regulatory.bin /usr/lib/crda/
    
    cd ..
    
    # Now we build crda
    cd crda
    
    # I HIGHLY recommend installing this as it configures udev for using crda
    # automatically.
    make && sudo make install
    
    cd ..
    
  6. Build iw & install it

    cd iw
    
    # You can leave out the 'sudo make install' if you don't want
    # to install iw or overwrite your system iw.
    make && sudo make install
    
    cd ..
    
  7. Build hostapd & install it

    cd hostap/hostapd
    
    # Copy the default config to .config for use during this build
    cp defconfig .config
    
    # Edit .config
    vi .config 
    
    #  you need to uncomment these lines, at a minimum, and make sure
    #  CONFIG_LIBNL_LOC points to wherever you installed libnl to in
    #  step 3.
    # 
    #  CONFIG_DRIVER_NL80211=y
    #  LIBNL=/usr
    #  CFLAGS += -I$(LIBNL)/include
    #  LIBS += -L$(LIBNL)/lib
    #
    #    and add
    #
    #  CONFIG_LIBNL20=y
    #
    #  If it dies with: 
    #      error: 'struct hostapd_config' has no member named 'ieee80211n'
    #
    #  uncomment
    #
    #  CONFIG_IEEE80211N=y
    # 
    
    # You can leave out the 'sudo make install' if you don't want 
    # to install hostapd or overwrite your system hostapd.
    make && sudo make install
    
    cd ../..
    
  8. Build compat-wireless & install it

    cd compat-wireless-2.6
    export GIT_TREE=../wireless-testing
    scripts/admin-update.sh
    make && sudo make install
    
  9. Notes & Addendums

    1. hostapd Configuration

      Configuring hostapd to use the nl80211 driver is as easy as:

      interface=wlan0 # Replace this with your wireless interface
        driver=nl80211
    2. ath9k notes

      802.11n support can be configured in the appropriate section of hostapd.conf, here's the config I'm currently using for my ath9k device, listed as: Atheros AR5416 MAC/BB Rev:2 AR2133 RF Rev:81

      ieee80211n=1
        ht_capab=[HT40-][SHORT-GI-40][DSSS_CCK-40]

      the ht_capab shown here is based on a combination of voodoo and the output of iw list, and may or may not be accurate as I don't yet have any other 802.11n devices to test with

Do not feel obligated to donate. Donations won't make me more likely to update the guide or attempt to solve any issues. I have a full time job and am only adding this as it has actually been requested. I won't complain if people do donate though, haha.