Recent Changes - Search:

Axon microserver

InterplayMedium Hardware

Installation on OpenWRT ASUS WL-HDD with OpenWRT Kamikaze firmware (kernel 2.4) was used as an example.


You may run Axon micro-server on your router without losing the basic functionality. Here is step-by-step instructions. It should work fine for the majority of OpenWRT based routers.

Step-by-step tutorial


If you already have preinstalled OpenWRT on your device with additional CF-drive or other media, just skip the first part and go to the point 10.

1. Download the firmware and flash utility

Please choose suitable version of OpenWRT by following this list of supported devices. I have Asus WL-HDD, so I chose OpenWRT Kamikaze for WL-HDD. OpenWRT already has a fresh Backfire version. Theoretically, it should work fine, but, since I didn't try it yet, I focused on Kamikaze in this tutorial.

And the last thing you need is a flashing utility.

2. Reflash your device

Different routers have different methods to get into "reflash mode". Please google it or find suitable instructions on [OpenWRT wiki]. In case of WL-HDD, I have to

  1. connect device via ethernet cable to a computer
  2. hold a small button near the USB socket
  3. then plug the power wire in
  4. wait until a yellow LED starts to blink. this means that the device is preparing for flashing.
  5. ping the device (it should have 192.168.1.1 or 192.168.1.220 - IP address by default). If it doesn't answer, just re-plug Ethernet cord and try again until you get an answer.

ping 192.168.1.1

  1. flash it with flash.sh utility

./flash.sh brcm-2.4/openwrt-brcm-2.4-squashfs.trx asus

  1. wait until LED stops to blink (Important!)
  2. reboot by replugging the power

3. Change the password and setup network concerning your local conditions

your device should have 192.168.1.1 IP address after reflashing by default. Try to open it in a browser and, in case of success, change the password to activate SSH access.

Use http interface. It should be trivial. Just keep in mind that LAN (Local area network) usually has fixed IP (something like 192.168.0.1 or 10.0.0.1 and mask 255.255.255.0) and offers DHCP lease to others (work as Access point). WAN is a Wide area network. It usually hooks on Internet connection and has just DHCP discover settings and no fixed IP address. Double check router network settings before applying them to avoid a possibility to loose connection (you will have to re-flash device in this case and start again). For more sophisticated settings, look at this instructions.

4. Install file system kernel modules

ssh to it ssh <username>@<device IP address> you will be asked for your password (that you chose previously)

update the packages DB opkg update install required modules opkg install kmod-ide-core kmod-ide-pdc202xx kmod-fs-ext2 kmod-fs-ext3

This is a well known bug with a file-system loading order on Kamikaze (at least with my firmware). You need to change the order of modules loading like that: cd /etc/modules.d; mv 30-ide-pdc202xx 21-ide-pdc202xx; mv 30-ide-core 22-ide-core; mv 40-ide-core 23-ide-core

and reboot reboot

5. HDD Installing and initializing

install fdisk opkg update; opkg install fdisk

at this moment you should have your disk logically available on /dev/ide/host0/bus0/target0/lun0/ (or something like that). Check it out and mark your new drive up fdisk /dev/ide/host0/bus0/target0/lun0/disc

Most of people use CF card or other chip-based memory media. This sort of media have limited reading/writing cycles (the number of cycles is huge but it's much less than that of classical HDD), so I wouldn't recommend to make swap on it (and I wouldn't recommend to do it for any kind of chip-based media except SSD). However, If you use micro-drive HDD or something like SSD, it's definitely better to make swap on it.

So, in case of swap, you need to define one small partition (100 MB will be more than enough) and mark it as "swap", the second partition will be defined as the main partition (use all the space left). Otherwise, just create a single partition.

6. Creating the file-system

opkg install e2fsprogs

This is the same situation: it's not recommended to create a journalling file-system for this type of media. so, this is a non-journalling version mke2fs /dev/ide/host0/bus0/target0/lun0/part1 if you use journaling FS, just add "-j" option

don't' forget to change /dev/ide/host0/bus0/target0/lun0/part1 path into yours

make a mount point mkdir /mnt/ide

in case of using swap, you need to install swap utils and initialize it

opkg install swap-utils
mkswap /dev/ide/host0/bus0/target0/lun0/part2

7. Add new HDD mount script in /etc/init.d/ to make it start on boot stage

NB. Now you need to create and edit a new script file. The majority of tutorials refers to vim editor, which is pre-installed on the majority of Linux distros, but if you are doing this at the first time, it could be much easier to use something more intuitive, for example mcedit, which is a part of Midnight Commander package. You may install it with opkg install mc command.

create the file mcedit /etc/init.d/idemount or vim /etc/init.d/idemount

and copy this code in it

#!/bin/sh /etc/rc.common
START=15
start() {
	# swapon /dev/ide/host0/bus0/target0/lun0/part2
	e2fsck -p /dev/ide/host0/bus0/target0/lun0/part1
	mount -o noatime /dev/ide/host0/bus0/target0/lun0/part2 /mnt/ide/
}
  1. don't forget to change paths into yours
  2. uncomment swapon line, if you use swap on your drive

save it, make it executable and reboot

chmod +x /etc/init.d/idemount
/etc/init.d/idemount enable
reboot

after reboot check the drive presence df It could be in /mnt/ide now

8. Reconfigure opkg and create symlink automation script

edit opkg configs

sed -i 's/dest root \//dest root \/\ndest ide \/mnt\/ide/g' /etc/opkg.conf 
sed -i 's/overlay_root \/jffs/overlay_root \/mnt\/ide/g' /etc/opkg.conf 

create a script "/bin/link-ide-items" for automatic file linkage in mounted directories

#!/bin/sh
SPATH=$1
DPATH=$2
ls $SPATH | while read LINE; do
	SRC=$SPATH$LINE;
        DST=$DPATH$LINE; 	
	test -e "$DST";	
	if [ $? = 1 ]; then
		ln -s $SRC $DST;
		echo link file $SRC to $DST;
	fi
done
exit 0

make it executable chmod +x /bin/link-ide-items

create a common linking script /bin/linkif

#!/bin/sh
link-ide-items /mnt/ide/usr/lib/ /usr/lib/
link-ide-items /mnt/ide/usr/bin/ /usr/bin/
link-ide-items /mnt/ide/lib/ /lib/
link-ide-items /mnt/ide/sbin/ /sbin/
link-ide-items /mnt/ide/etc/ /etc/
link-ide-items /mnt/ide/etc/init.d/ /etc/init.d/
link-ide-items /mnt/ide/usr/sbin/ /usr/sbin/
link-ide-items /mnt/ide/etc/modules.d/ /etc/modules.d/
link-ide-items /mnt/ide/lib/modules/2.4.35.4/ /lib/modules/2.4.35.4/

make it executable and run it

chmod +x /bin/linkif
linkif

from this moment you can install everything on HDD. Just use "-dest ide" option for that and run "linkif" after installation.

9. Add the router's IP to "/etc/hosts.local" to make it assessable in web-browsers via "http://axon"

run ifconfig ifconfig and find there "inet addr:" for your LAN interface (usually it's wl0 or br-lan, if you make it as a bridge)

add this IP into the /etc/hosts.local (change <your IP> into your IP) echo "<your IP> axon">>/etc/hosts.local



Final stage


10. Download and untar AXON package

cd /mnt/ide/
wget http://repository.interplaymedium.org/AXON-microserver/OpenWRT/Axon,07.11.2010.OpenWRT.tar.gz
tar -xz -f Axon,07.11.2010.OpenWRT.tar.gz

it should create "/mnt/ide/axon" directory and unpack everything there

NB! there are not so many differences between OpenWRT and Debian versions, they differ just in a number of device paths changes. It's explained in details in "Axon configuration" letter.

11. Allow to execute lua scripts from other directories (not only cgi-bin)

echo "*.lua:/usr/bin/lua" >> /etc/httpd.conf

12. Make both http interfaces (OpenWRT and AXON) accessible

replace httpd root directories (your package must be in /mnt/ide/axon/ directory, change it, if necessary) sed -i 's/\/www/\/mnt\/ide\/axon/g' /etc/init.d/httpd /etc/config/httpd

create custom autorun script /etc/init.d/axon to keep the original OpenWRT interface on port 81, and add "linkif" there just in case, if you ever forget to start linking script after installation of something

#!/bin/sh /etc/rc.common
START=90
start() {
	httpd -p 81 -h /www
	linkif
}

make it executable

chmod +x /etc/init.d/axon 
/etc/init.d/axon enable

from this moment (after reboot) AXON interface will be available on "http://axon" and OpenWRT on "http://axon:81" addresses

13. Install software required by AXON micro-server default configuration

USB sound kernel modules

opkg update
opkg -dest ide install kmod-usb-ohci kmod-sound-core kmod-usb-audio
linkif

madplay music player

opkg -dest ide install madplay
linkif

Input system modules (for RFID reader). Download it, untar and copy into the /mnt/ide/lib/modules/2.4.35.4/

cd /mnt/ide/
wget http://repository.interplaymedium.org/AXON-microserver/OpenWRT/kmod-input-kamikaze-8.09rc1.tar.gz
tar -xz -f /mnt/ide/kmod-input-kamikaze-8.09rc1.tar.gz
mv kmod-input-kamikaze-8.09rc1/* /mnt/ide/lib/modules/2.4.35.4/
rm kmod-input-kamikaze-8.09rc1
linkif

you may remove kmod-input-kamikaze-8.09rc1.tar.gz after this procedure

create modules loader

echo "input" > /etc/modules.d/90-input; echo "hid" > /etc/modules.d/90-input; echo "evdev" > /etc/modules.d/90-input

install modules for serial communication with FTDI chip (Arduino, for example) opkg -dest ide kmod-usb-serial kmod-usb-serial-ftdi it should create a serial port at /dev/usb/tts/0 (most likely, check it out) after plugging Arduino in

install and setup FTP server (optional)

opkg -dest ide install vsftpd
linkif
echo "local_root=/mnt/ide" >> /etc/vsftpd.conf
/etc/init.d/vsftpd start
/etc/init.d/vsftpd enable

and reboot reboot

after this procedure try to connect via ftp using SSH login and password. If everything is fine, you may copy your music on the board via FTP

NB. alternatively you can try to install "samba" and make it accessable in your local network

That's it. The only thing left - is to configure the AXON micro-server and enjoy it.

Page last modified on July 06, 2012, at 04:18 PM