After few unsuccessful attempts I tried to reflash the router with newer firmware but that did't help. Moreover custom software refused to work with new DD-WRT firmware. And I did't find the revision it worked with. So I had to find a new way to make it working.
I wanted to run openvpn server, transmission bittorrent daemon and samba server on the router. It has enough resources (400MHz CPU, 64Mb of RAM) to handle such a mission. It's anyway always on and consumes little power.
There are a few manuals what explain how to install software on such a router. Approaches are following:
1. Install OpenWRT. It designated to install optional software fo it should work just fine. Disadvantages of that: it's not supported by manufactorer, screenshots of its Web UI I'd seen were a bit ugly and I like the idea of having readonly filesystem like DD-WRT (so reset do almost always recover it whatever you've done).
2. Mount external drive to /opt or /jffs and install OpenWRT packages overthere. DD-WRT even has the ipkg utility to help with it. However with utility only partially works. It can install downloaded packages if you set all the needed switchers. Bad thing is that OpenWRT packaged don't work with DD-WRT libraries. You need to install all the libraries and and make sure that each executable runs in right environment. You must run DD_WRT utilities with one value of LD_LIBRARY_PATH and OpenWRT with another. I's really tricky. You never can be sure what a script don't call something from 'alien world'.
Finally I come to conclusion that OpenWRT packaged need to work in completely separated chrooted environment. It solves many problems of both approaches (and actually is modification of #2):
1. It's very hard to break DD-WRT functionality.
2. OpenWRT executables will never be occasionally lined with DD-WRT libraries. If some library is missing you will get readable message.
3. Directories what packages and installation scripts expect to be writable are writable indeed (especially /ect).
4. Package management system works in default configuration where it's better tested.
I wrote a script what automates installation process. To setup software in chroot environment you should to the following things:
1. Setup mounting USB disk in the administration web UI. I selected mounting it at /opt.
2. Login to the router via telnet or ssh. It also can be done via the web UI but you wont see any diagnostics messages.
2. Extecute the following command:
wget -q -O - "http://sites.google.com/site/sryazanov/files/install-optware.sh?attredirects=0&d=1" | sh -s /mnt/opt http://downloads.openwrt.org/backfire/10.03.1-rc6/atheros/packages/
The script accepts 2 parameters: where to install the chroot and where to get packages (busybox's wget only works with http and ftp).
Using /nmt/opt allows to install a few environment side by side.
http://downloads.openwrt.org/backfire/10.03.1-rc6/atheros/packages/ is the lates for now build for my architecture.
The script creates a few utility scripts in the target directory:
scripts/chroot-optware.sh - runs shell or a command in the chroot environment.
scripts/startup-optware.sh - initializes chroot and start services.
scripts/shutdown-optware.sh - stops services and deinitializes chroot.
3. Instruct the DD-WRT to automatically run /mnt/opt/scripts/startup-optware.sh on disk mount via Web UI.
4. Run scripts/startup-optware.sh manually first time (or remount the disk or reboot the router).
5. Run shell in chroot scripts/chroot-optware.sh -l
6. Install additional software:
opkg install packagename
7. Configure the apps in /etc/config
8. /etc/init.g/
Комментариев нет:
Отправить комментарий