Install ATBen
Instructions on how to install ATBen can be found on the Qi-hardware Website. This page will attempt to explain and simply the various procedures by focusing only on the Nanonote. You can install the TCR images and binary files or compile them manually (this will require an Openwrt toolchain).
Install the pre-compiled files
Install the ATBen and reflash your device using the images and binary files provided.
Reflash Ben
Use the script to download and reflash your ben.
wget http://theclashingrocks.org/images/reflash_ben_with_wpan_kernel.sh sudo ./reflash_ben_with_wpan_kernel.sh
You can also download the u-boot, ben-wpan kernel, TCR rootfs and manually reflash the Ben.
wget http://theclashingrocks.org/images/openwrt-xburst-qi_lb60-u-boot.bin wget http://theclashingrocks.org/images/uImage wget http://theclashingrocks.org/images/openwrt-xburst-qi_lb60-root.ubi
In the same folder where you have downloaded the above files.
# first boot your nanonote in usbboot mode sudo usbboot -c "boot;nerase 0 4096 0 0" sudo usbboot -c "nprog 0 openwrt-xburst-qi_lb60-u-boot.bin 0 0 -n" sudo usbboot -c "nprog 1024 uImage 0 0 -n" sudo usbboot -c "nprog 2048 openwrt-xburst-qi_lb60-root.ubi 0 0 -n"
Download the binary files
Download the libnl-1, linux-zigbee, and Dirtpan binary files.
wget http://theclashingrocks.org/images/wpan-binaries.tar.gz tar xvzf wpan-binaries.tar.gz cd wpan-binaries scp libnl.so libnl.so.1 libnl.so.1.1 root@192.168.254.101:/usr/lib scp iz izcoordinator izchat dirtpan root@192.168.254.101:/usr/sbin
Install Ben prerequisites
opkg update opkg install ip mkdir -p /usr/local/var/run exit
Compile the kernel and binary files
All instructions listed on this page are mandatory for the correct functionality of ATben, in addition you need to have a working OpenWrt toolchain in order to compile software and libraries.
NB: All the following procedures must be executed on the same terminal window.
Build the Kernel
Download the Qi-hardware kernel and build it on your machine.
git clone git://projects.qi-hardware.com/qi-kernel.git cd qi-kernel git checkout ben-wpan
Get the patch and configuration file from the Qi-hardware website and place them outside the qi-kernel directory for convenience sake.
cp ../ben-wpan-config-2.6.38 .config patch -p1 -s <../openwrt-preinit-hack.patch
For CROSS_COMPILE you will need the path of your working toolchain. e.g. “export CROSS_COMPILE=/home/tcr/xburst-toolchain/staging_dir/toolchain-mipsel_gcc-linaro_uClibc-0.9.32/bin/mipsel-openwrt-linux-”.
export ARCH=mips export CROSS_COMPILE=/path/to/your/mips/toolchain-
Make it.
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE vmlinux.bin
gzip -9 -f arch/mips/boot/vmlinux.bin
mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip -e 0x`${CROSS_COMPILE}nm vmlinux | \
grep " kernel_entry" | cut -f1 -d ' '` -n 'Ben NanoNote Linux Kernel' -d arch/mips/boot/vmlinux.bin.gz uImage
cd ..
If everything went fine you will now have the qi-hardware kernel for the ben wpan.
Reflash the ben
It is now time to install the Kernel on you Nanonote. The qi-hardware instructions have different methods to install the kernel: by using nandwrite or usbboot mode (which is the easiest). Boot your device in usbboot mode and run this command and reboot.
# boot you nanonote in usbboot mode and erase everything sudo usbboot -c "boot;nerase 0 4096 0 0" # go to your toochain bin/xburst/ where the files are located and flash the u-boot sudo usbboot -c "nprog 0 openwrt-xburst-qi_lb60-u-boot.bin 0 0 -n" # go to where you have the uImage from qi-kernel and flash it sudo usbboot -c "nprog 1024 uImage 0 0 -n" # go back to your toolchain bin/xburst/ and run sudo usbboot -c "nprog 2048 openwrt-xburst-qi_lb60-root.ubi 0 0 -n"
Reboot your device, insert the ATBen and test whether the kernel has been successfully compiled.
dmesg | grep at86rf231 #or dmesg | grep at86rf230
If the kernel is installed properly it should return this: “at86rf230 spi32766.0: Detected at86rf231 chip version 2”
Prerequisites
Enable password-less remote access (optional - on your host)
# add this entry in your ~.ssh/config file Host ben HostName 192.168.254.101 StrictHostKeyChecking no UserKnownHostsFile /dev/null User root # in your /etc/hosts and add this 192.168.254.101 ben # create rsa key $ ssh-keygen -t rsa # on your nanonote change password to null , type passwd in command line and type enter enter. # and finally run ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub
ssh in your nanonote and run:
opkg update opkg install ip opkg install ldconfig mkdir -p /usr/local/var/run exit
Build libnl-1
wget http://www.infradead.org/~tgr/libnl/files/libnl-1.1.tar.gz tar xfz libnl-1.1.tar.gz cd libnl-1.1
Before configuring and compiling the library, check if the “which mipsel-openwrt-linux-gcc” command works. If it does not return the path to your gcc toolchain compiler, run this command.
export PATH=/path/to/your/mips/toolchain/bin:$PATH #eg export PATH=/home/tcr/xburst-toolchain/staging_dir/toolchain-mipsel_gcc-linaro_uClibc-0.9.32/bin:$PATH
gcc=`readlink -f \`which mipsel-openwrt-linux-gcc\``
./configure --prefix=${gcc%/bin/*} --host=mipsel-openwrt-linux
make
sudo make install
scp the compiled library on your Ben. NB: if you've added the entry in your .ssh/config you can scp directly to ben:~ otherwise use the full address root@192.168.254.101:~
scp lib/libnl.so.1.1 ben:/usr/lib ssh $NN /sbin/ldconfig cd ..
Build linux-zigbee
git clone git://linux-zigbee.git.sourceforge.net/gitroot/linux-zigbee/linux-zigbee cd linux-zigbee ./autogen.sh --host=mipsel-openwrt-linux make scp src/iz src/izcoordinator src/izchat ben:/usr/sbin/ cd ..
Build Dirtpan
git clone git://projects.qi-hardware.com/ben-wpan.git cd ben-wpan/tools make TARGET=ben_openwrt make -C dirtpan TARGET=ben_openwrt scp dirtpan/dirtpan $NN:/usr/sbin
NB: if ieee802145.h header is missing during make, copy from lowpan-tools-0.2.2/include/ieee802154.h to tools/dirtpan/.
The compiled ben-wpan kernel and the binary files are available on software page.