Voyage Linux - Development
My main goal is to install a new version of the madwifi drivers to see if I can run the Ubiquity XR9 card up to full power. Right now (5/21/08), the driver that comes with Voyage is old. It reports the wrong frequencies and won't adjust to anything greater than 18dbm.
In general the idea is to put together a chroot environment using the voyage distro. Then compile the packages you need under the chroot so all the library dependencies are right, etc. Then copy the resulting packages to the ALIX and install. The instructions on the voyage site help, but the context of the instructions aren't clear, nor are they updated. (I'm still learning about Debian, so I don't mean to be critical!)
After all of this - I was NOT able to get 28dbm from the XR9 card. Drat. At least the frequencies are correct now. (900MHz) I checked the power using an spectrum analyzer. The max power is 18dbm, even though the new driver allows me to set the power to 28dbm. (wlanconfig ath0 txpower 28) I'm not sure why this is... there are couple of possible reasons. 1) The FCC wants to make sure normal mortals can't exceed the max power allowed by law, which appears to be 18dbm. 2) I think there may be a licensing issue with Ubiquiti. The drivers in the X86 private version of dd-wrt are supposed to allow a full 28dbm, but I haven't verified this. Note, dd-wrt has a public x86 version, but it doesn't contain the wireless drivers. Openwrt is another option, but I decided to stick with voyage-linux for now. 3) It's a bug. I see references to SR5s not providing full power and I also see references to a 10db offset. Perhaps the EEPROMS need to be updated? Apparently, the replacement for madwifi, ath5, may allow this, but I don't want to brick these radios.
- http://wiki.voyage.hk/dokuwiki/doku.php?id=voyage_kernel - Compiling the kernel
- http://wiki.voyage.hk/dokuwiki/doku.php?id=development - building a development environment
- http://wiki.voyage.hk/dokuwiki/doku.php?id=temp_customization - Customizing the environment
- http://www.ubnt.com/support/ - Ubiquiti madwifi driver and current HAL
- http://www.hol4g.com/cgi-bin/wireless.main.cgi - 802.11 Link Analysis Calculator
Real high level
The Voyage wiki talks about frameworks, development environments, etc., which was somewhat confusing. I wanted build new software packages to load on the ALIX computer. I wasn't after recompiling everything or building Voyage from scratch. So at a high level:
- Use the voyage distribution to load an image on the CF card. Get the system running on the ALIX board. The instructions and scripts worked well for me.
- Set up a build environment on Ubuntu (use voyage-current or a copy of voyage-0.5.0)
- chroot into the build enviornment, add the kernel sources, new software etc. compile, build packages, etc.
- copy the newly built stuff to the ALIX board
This ensures all the support files (e.g GLIBC) are used by the freshly compiled programs. I 'think' you can create a customized voyage distro by moving the freshly complied .deb packages from the development environment to the 'install distro', chroot into the install distro, dpkg -i 'package' and go. (I haven't tried this, but should.)
These are the steps for creating a build environment. You can use this information to build a new kernel, new modules and new software packages for your ALIX board. The instructions on the voyage wiki are pretty good. So read them for the missing peices. In general:
- install (download and unpack) the voyage distribution (e.g. use wget to retreive voyage-current.tar.gz) - follow the voyage wiki - this provides a copy of the entire root file system.
- download kernel and store it under the distro directory (e.g. usr/src)
- get the kernel .config file (see the wiki) this is the important piece! It's the config file generated by 'make menuconfig.' The Voyage guys did all the work to choose the right modules and settings.
- download/unpack modules and/or other software and store in usr/src under the distro's root directory. This will make sure the sources are available when you chroot. The wiki has you mount an external directory (mount --bind /usr/src ./usr/src) but I have lots of disk space and wanted to reduce any confusion.
- chroot into the distro directory
cd /usr/src/voyage-current chroot . /bin/bash
At this point, you are in a chroot environment, where the new file system root is at /usr/src/voyage-current. The directory structure of voyage-current replicates a full install, so you can apt-get, etc. Just be careful. If you forget to chroot, any changes you make will be applied to your base system. You can create a VM using VMWARE to prevent this from happening.
Once in the chroot system, you need to add the necessary development packages and start building stuff.
Installing the software to compile a kernel
apt-get install kernel-package ncurses-dev fakeroot wget bzip2 sharutils nano
Compile the kernel
Making a .deb package, which will be stored in /usr/src
cd /usr/src/linux-sources-2.6.3 #or whatever your kernel source directory is make-kpkg --revision="0.5-2" --append-to-version "-486-voyage" kernel-image --rootcmd fakeroot
Compile the other software
I compiled the madwifi drivers from the [Ubiquiti] site (ubnt-hal-0.6.280.tar.gz) using the following:
where KERNELPATH points to the linux source tree.
As an aside, you can make .deb packages with this software. http://www.debian-administration.org/articles/337 - for more info. I was disappointed to find the ubnt distro didn't have an 'install' target in the make file. So I couldn't complete the process and make a .deb package automatically. Oh well.
apt-get install dpkg-dev debhelper devscripts dh-make fakeroot linda
For madwifi, I had to tar up the modules and the tools for copying to the ALIX box. The Note, tar the *.ko files from the src directory like this:
cd /usr/src/modules/ubnt-hal-0.6.280/src/madwifi-dfs-r3319-20080201/ find ./* -name *.ko | xargs tar cvf ath_modules.tar
I tarred up the tools by hand using this list:
80211debug 80211stats athchans athctrl athdebug athkey athstats madwifi_multi wlanconfig
When you're all done, exit the chroot environment: 'exit'
Copy the new kernel and software to the ALIX box
I used ssh to copy the tar files over to the ALIX box. I untarred the ath modules in /lib/modules/2.6.3-486-voyage, keeping the directory structure the same.
depmod -a modprobe ath_pci
Check for errors, reboot, troubleshoot, etc. Check the output of 'dmesg' for clues. I had to remove the option "autocreate=none" in /etc/modules.d/madwifi. Otherwise, I got the 'wlanconfig: ioctl: No such device' message.
To install the kernel, cd to where you copied the file to, then:
dpkg -i linux-image-2.6.23-486-voyage_5.0-3_i386.deb
You may need to move the /lib/modules directory out of the way. I just renamed it. Once you know the kernel works, you can delete it.
Take care of grub. I also had to edit /boot/grub/menu.lst to make sure the default pointed to the new kernel. (changed default 0 to 1) I also had to connect to the serial console to fix this the first time through. I forgot to update grub and change the default boot kernel.
More on Making a Deb Package
High Level Steps taken from: http://www.debian-administration.org/articles/337
apt-get install dh-make autotools-dev
Edit the Control file. Here's the one for gpsd. Note the Dependencies were filled in automatically.
atila:/usr/src/gpsd-2.37# more debian/control Source: gpsd Section: unknown Priority: extra Maintainer: stu <[email protected]> Build-Depends: debhelper (>= 5), autotools-dev Standards-Version: 3.7.2 Package: gpsd Architecture: any Depends: Description: gpsd compiled without X or Phython for use as a time server. PPS on DCD.
Edit debian/rules to add the right tags to the configure, make and install clauses. I added --without-x for the configure because I was compiling for a non-X11 environment. (i.e. PC Engines WRAP) I added the KERNELPATH to the make clause because I did that when I made the kernel. I probably don't need it, but I'm not sure. Check the DESTDIR variable. This variable is used in the Makefile, so it basically tells the package maker where to install the packages before they are 'packed.' This is very cool because all the files will be stored under (CURDIR)/debian/gpsd so you can see what actually gets installed! The instructions add the PREFIX variable, but I needed DESTDIR for gpsd.
config.status: configure dh_testdir # Add here commands to configure the package. #./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) $ ./configure --without-x build-stamp: config.status dh_testdir # Add here commands to compile the package. $(MAKE) KERNELPATH=/usr/src/linux-source-2.6.23-voyage install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/gpsd. $(MAKE) install DESTDIR=$(CURDIR)/debian/gpsd
You can build the binary like this:
fakeroot debian/rules binary
Then build the package like this:
debuild -us -uc
The .deb package will be stored in /usr/src. Copy this to the WRAP/ALIX board and install using:
dpkg -i gpsd_2.37_i386.deb
The -c switch lets you list the files.