untitled

Cross-compiling adventures with the WRT54G

I recently purchased a Linksys Wireless-G router, model WRT54G from Amazon. The reasons behind my purchase were three: (1) my home wireless access point was old and didn't work well, (2) I wanted to remove my need for an entire machine running as my firewall (even if it was a floppy-based 486), and (3) I had seen that this router ran Linux and there were ways to add your own software to it.

Little did I know what I was about to get myself into.

Installing a usable shell

There are third-party firmwares for the product, such as Sveasoft. I decided I didn't want to void my warranty quite yet, so I have stuck to adding additional software into the router's /tmp directory. Advantage: (I think) no way to really screw up the router. Disadvantage: a power-cycle wipes out all your changes.

As a result, Jim's Batbox Linux is a logical starting point for anyone. His software works and the documentation is fine. Make sure that you configure the LAN and WAN ports through the Linksys web interface before trying to install, that was the only hangup I ran into.

SSH and SFTP

My next task was to get SSH running, so that I could tunnel into my home network. Also, getting SFTP working would allow me a decent way to get files on and off the router. So, I found this site which had mipsel-compiled binaries of sshd, tinylogin, and sftp-server to install on the box. After a little messing around, I had it up, working, and integrated into the batbox script I use to get the router working the way I want. However, I ran into two problems: (1) with the size of these binaries, I was left with little room in the /tmp directory for other stuff, and (2) SSH tunneling wasn't working. I decided to get to work compiling my own SSH daemon.

To Install:

Update 30 April 2004, 1:40PM EDT: passwd file was corrupted with a DOS linefeed and caused you to not be able to log in as root after changing password. Download updated version in the tarball.

How I compiled

Dropbear was a logical choice, because (A) I knew it supported tunneling and (B) it was designed to be small. So, I got a Debian system up and running (Sarge distribution), downloaded the Linksys GPL build environment, and got to work cross-compiling. I had to make a couple changes in a similar fashion to the changes made on the above SSH compilation

Leaner and Meaner: Sizes of the mysteryvortex compilations were 2.44MB for sshd, 1.90MB for ssh keygen, 648KB for tinylogin, and 718KB for sftp-server -- total 5.69MB; I've knocked it down to 321KB for dropbear, 106KB for tinylogin, and 185KB for sftp-server -- total 613KB.

Caching nameserver

This is a work in progress. My version of the linksys firmware (2.02.2) has a caching nameserver already, but Linksys is set to launch it and ignore the hosts file. I want it to serve names out of my hosts file. I've got a hack working but trying for something more elegant. Progress will be shared here later.

Downloads

Binaries

Download this tarball containing mipsel/uclibc static compiled versions of staticdropbearmulti, tinylogin, and sftp-server. It also contains the stub passwd file. (Updated 30 April 2004, 1:40PM EDT)

Setting up code environment

Steps to get the cross-compiling environment set up. (Note: I used Debian-Sarge; YMMV)

Dropbear

Here is the diff from Dropbear-0.41 to my code. First, set up the environment as directed above. Then, download and extract dropbear-0.41. Then, inside that directory run the command:
./configure --host mipsel-uclinux --disable-zlib --disable-openpty --disable-shadow --disable-loginfunc --disable-lastlog --disable-pututline --disable-pututxline --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx
This will create a config.h and Makefile which the diff will act upon. Now, download the diff and patch your code. You should be set to compile. I compiled with make dropbearmultistatic

Other Code

Other source code diffs will be available as soon as I can get around to creating them. Contact me if you are desperate.


Questions? Comments? Problems? Email me.































Report Content · · Web Hosting · Blog · Guestbooks · Message Forums · Mailing Lists
Easiest Website Builder ever! · Build your own toolbar · Free Talking Character · Email Marketing
powered by a free webtools company bravenet.com