by lunarg on January 30th 2007, at 23:07

For work, I started experimenting with writing C programs for (flashed) Linksys WRT54GL routers.

Basically, the WRT54GL routers are running OpenWRT, a very lightweight linux distro, specifically designed for those type of routers. The router uses a Broadcom CPU, and uses the MIPS architecture. For more information, check the OpenWRT site at

At first, I was a bit worried about the differences between the full availability of the GNU C Libary, and the very slim version on the OpenWRT distro. Luckily, I quickly found out that the C Library on OpenWRT has the most used functions well covered.

Compiling C programs for MIPS might seem tricky (since you can't plainly fire up your GCC), but OpenWRT has an SDK available at their site, along with a bit of an explanation on how to get it compiled with it.
However, if your C program is very small, and doesn't use fancy Makefiles and such, you can directly execute the MIPS-GCC compiler; a bit like this:

$ cd OpenWrt-SDK-Linux-x86_64-1/staging_dir_mipsel/bin
$ ./mipsel-linux-gcc -c program.c
$ ./mipsel-linux-gcc -o program program.o

That's it for now. More explanations and findings will be reported as I learn a bit more.

« July 2020»
« If the batteries of a TV remote run out, why do we press the buttons so much harder? »