Prior to 10/22/08
James is constructing the "ubiquiti box" which consists of a fanless mini-itx mother board, housed inside a passively cooled case. On the on board mini-pci slot is an Engenius 802.11b high power wireless card. It is connected to its own external antenna that sits close to the pc header. Attached to the pci riser is a 4 port mini-pci expansion card. It houses 3 Ubiquiti high range cards in diffrent spectrums. The 3 ubiuquiti cards are wired to a power splitter, which is then connect to a single antenna to the right of the pic cards. The power splitter is velcroed to the hard drive mounting bracket in the front (side where the power button is) of the case.
James installed Ubuntu 8.04 LTS.
The beta refrence drivers for the Ubiquiti cards is downloadable from the website (http://www.ubnt.com/).
The stock Ubuntu installation comes with madwifi installed. Madwifi successfully enumerated all the devices as they are all based on atheros chipsets, however the stock driver does not enable have the ability to access some of the special features of these cards. Ubiquiti provides their own driver in the form of patches to the madwifi source, and object code for their version of the atheros HAL.
I'm going to try to proceed with the installation of the drivers as follows
- get madwifi to compile but don't install
- patch madwifi driver and compile again
- Install patched modules
I've consulted the madwifi documentation ( @ www.madwifi.org), specfically the 'First Time User' HOWTO. It says for debian derived distributions (like ubuntu) I need to install these packages:
- linux-headers-$(uname -r)
Once these are installed, I downloaded the madwifi latest version (I picked the latest arbitrarily, as the ubiquiti documentation didn't specify a compatible version. )
The guide says to bring down all the athX/wifiX interfaces, and then unload all the ath modules. In the newly created madwifi directory are some scripts that will remove the old kernel objects. Quoting from the madwifi page:
cd scripts ./madwifi-unload ./find-madwifi-modules.sh $(uname -r) cd ..
After that we just run make. But sadly make doesn't work. I get a "No rule to make target" error.
I checked the requirements and it looks like all of them are met. I'm going to assume the running kernel is configured with the necessary options other wise the previous version of madwifi would have had a problem.
I discovered the build problems section of the madwifi documentation list this error first (http://madwifi.org/wiki/UserDocs/BuildProblems). Unfortunately the thing they claim is a problem isn't. They said a certain symbolic link was missing, but I checked and the link was there. There is also some rambling about trying to compile the kernel. Running make on the kernel source tree also fails in a grand fashion.
If you explcitly set the KERNELPATH varible to /usr/src/linux-headers-2.6.24-21-generic, it complains about a missing .config file. This complaint is valid as no such file exists in this directory. With out the KERNELPATH set the Makefile.inc sets the KERNELPATH to /lib/modules/2.6.24-21-generic/build, but this directory is a symbolic link to the other directory (the symbolic link that Madwifi documentation said was missing.
Scratch that, the .config file is in the generic directory, much of this directory is really symlinks to /usr/src/linux-headers-2.6.24-21. When you set the kernel path to that directory then it complains about .config files (rightly so).
Discovered the issue was that I had a space in the name of the containing directory, and the cc targets were getting confused. The 9.04 stock distribution of madwifi does indeed compile appropriately. But make install fails.
This is however of no consequence, because unbt hal (the ubiquiti hal) comes with it's own version of mad-wifi which it patches. Previously I hunted the documentation to find what version of mad-wifi was the one that should be patched with this ubnt hal, but could find it documented any where. It does however list it in the make file, and retains a copy of it in the src directory. For reference the version it comes with is madwifi-dfs-r3319-20080201.
It says I should be able to run make from the "main package directory" which I guess means the top level directory as there is a make file there, and it has patch targets for the included version of madwifi. It looks like there are targets to downlad the src from www.madwifi.org. However the download target does nothing.
The unpack target on the other hand, does extract a copy of the source from a stored tgz file.
The make all command fails with:
/home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.c:87:21: error: macro "for_each_netdev" requires 2 arguments, but only 1 given /home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.c: In function 'ieee80211_setup_macclone': /home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.c:87: error: 'for_each_netdev' undeclared (first use in this function) /home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.c:87: error: (Each undeclared identifier is reported only once /home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.c:87: error: for each function it appears in.) /home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.c:88: error: expected ';' before 'if' make: *** [/home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211/ieee80211_output.o] Error 1 make: *** [/home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211] Error 2 make: *** [_module_/home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201] Error 2 make: Leaving directory `/usr/src/linux-headers-2.6.24-21-generic' make: *** [modules] Error 2 make: Leaving directory `/home/ubiquiti/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201' make: *** [build] Error 2 root@ubiquiti-desktop:~/ubnt-hal-0.6.280#
however if I just unpack and build (i.e. Don't patch), the build happens just fine.
I've figured out where the problem is. In the Makefile of the failing cc call, this is the build command:
$(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules when expanded this should look something like make -C /usr/src/linux-headers-... SUBDIRS=~/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/net80211 moudles
so the make command is calling the modules target of the Makefile in the headers directory. Apparently there is some macro named for_each_netdev that was modified between versions of the kernel. Its documented here (http://forum.tuxx-home.at/viewtopic.php?f=15&t=461) but in the context of installing a cisco vpn client. This error is specfic to the 2.6.24 flavor of the kernel. The specific complain is:
The reason for this is, that 2.6.24 has a different call to for_each_netdev() and the new call contains an additional parameter (init_net) which is in the net namespace and is exported to GPL compatible modules only. As you might already guess, cisco_ipsec.ko has a proprietary license because not all code to build the module is open source.
The only issue is I have no idea how to fix it.
Ivan fixed it. Apparently there was a newer version of the hal/driver (0.7.379) that resolved this issue for 2.6.24 kernels. He said that you had to specify KERNELPATH varible other wise make install would put the binaries in the wrong place.
When the modules are loaded they don't enumerate the ath interfaces. We thought it might be due to stale entries in udev, but I deleted all of the athX entries from /etc/udev/rules.d/70-persistent-net.rules.
The readme specfically says multiple cards had not been tested, but they are enumerated by the driver (the stock atheros driver was also able to enumerate them with out a problem). The logical devices, wifi0 - 2 are enumerated.
The make directive I used to get it to work was:
sudo make KERNELRELEASE=$(uname -r) KMODPATH=/lib/modules/$(uname -r)/net install
make info enumerates all the variables (most of which are wrong).
in dmesg when the modules are being loaded, an error comes up about ath_hal: ubnt license upload failed. In the forums there is a post (http://forum.ubnt.com/forum/viewtopic.php?t=1526&highlight=ath) that recomends removing a line from ath/if_ath.c. I tired to comment out the problem line and then rebuild the modules. Once installed the error did go away, however it still doesn't enumerate ath0-2.
I also tired removing 2 of the cards so that there was only 1 ubiquiti and nothing else on the pci bus. That did not help.
Turns out it was working all the time. You have to use
wlanconfig ath0 create wlandev wifi0
to make the ath0 device. This should happen automagicly, but I guess they don't set it to do that because this is used for setting the cards into diffrent modes (e.g. Monitor mode). I stumbled across this when I was looking at (http://forum.ubnt.com/forum/viewtopic.php?t=3455&highlight=wlanconfig).
I put it back together with all 3 cards and tried to enumerate all the devices, and was successful. It turns out the madwifi beginners guide does tell you about this:
If your svn snapshot is more recent than the 23rd January 2006, (r1407) than you can skip the following step: If not, then follow these instructions to make a normal station mode interface. Type (as root):wlanconfig ath0 create wlandev wifi0 wlanmode sta
iwconfig does now properly enumerate devices, and I can even set the ESSID. All the cards seem to be in different frequency ranges that our AP's are not in, thus attempting to get an ip address on any one of those interfaces if futile. From here I guess we have to test if we can used some of the hals "special features".