Update the ath9k/ath10k wireless driver

The ath9k/ath10k drivers are included in the linux kernel. By default, when using Ubuntu, some fixes are needed to enable 5GHz channels (CRDA + DFS fixes).

The instructions below could serve as a guideline to fix these problems.

# instructions from https://wiki.ubuntu.com/KernelTeam/GitKernelBuild
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
cp /boot/config-`uname -r` .config
make oldconfig
yes '' | make oldconfig
make menuconfig
# enable the following features:
#    Networking Support > Wireless > cfg80211 certification onus
#    Device drivers > Network device support > Wireless LAN > Atheros dynamic user regulatory hints / Atheros dynamic user regulatory testing / DFS for ath9k / DFS for ath10k
cd drivers/net/wireless/ath
cp /share/403-ath-regd-optional.patch .
patch -Np5 -i 403-ath-regd-optional.patch
echo "#define ATH_USER_REGD 1"|cat - regd.c > /tmp/out && mv /tmp/out regd.c
cd -
make clean
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-custom
cd .. ; ls
# You should now see a bunch of .deb files, which you can install
dpkg -i linux-*.deb
reboot

(Deprecated) Update the ath9k wireless driver

The steps below can be followed to update the ath9k to the latest backports driver. The example is given for version 3.18.1, but the steps can be repeated for any version.

After updating the ath9k driver, please make sure everything still works as desired. For example, v3.17.1 is known to cause issues when using click modular router to inject packets.

sudo -s
wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.18.1/backports-3.18.1-1.tar.xz
tar -xJf backports-3.18.1-1.tar.xz
cd backports-3.18.1-1/
cd drivers/net/wireless/ath/
#the steps below will make sure the ath9k driver uses the correct regulatory restrictions for your country
wget --no-check-certificate https://dev.openwrt.org/export/32952/trunk/package/mac80211/patches/403-ath_regd_optional.patch
patch -Np5 -i 403-ath_regd_optional.patch
echo "#define ATH_USER_REGD 1" | cat - regd.c > /tmp/out && mv /tmp/out regd.c
cd -
make defconfig-ath9k
make
make install
reboot

After reboot, check if your new driver is correctly installed by issuing the command below, which should result in showing you the correct backports version on the first output line.

modinfo ath9k