Saturday, 13 December 2014

Cross Compiling Tools For Routers

I have been searching for a solution to the Torrent problem I have. I sometimes need to download few hundreds gigabytes of torrents, meaning I need a stationary PC at home to download. My PC makes a lot of noise and probably taking a lot of electricity. The RPi I own is used for experiments, and also it fried during my last experiment (RF Switches). The only running system I have is the router I got from my ISP, Bezeq.






The router costs almost nothing and ISP forces to buy it, but surprisingly its very powerful!
http://wiki.openwrt.org/toh/d-link/dsl-6850u
128mb flash and ram
Dual core mips 400mhz cpu
The Ferrari of routers..
The hardware should easily handle torrents.

First I got the official gpl sources of the router from the openwrt website.
The file contains the sources and uclibc toolhcain to build it.
The compilation process is quite easy, it also compress the content to a image that can be flashed directly from the web. In my previous attempts to try the flash a compiled firmware, the router didn't boot up. I didn't try CFE bootloader recovery from tftp because I didn't know there is one back then, and I didn't want to try a serial method because that will break my warranty.
So in the meantime, my first rule is not to do anything that can cause a crash.

I used this compilation process of the firmware (including the kernel) to add TUN device option, libpcap, add more busybox features and so on..

I used the uclibc to compile more things from external sources like libcurl, latest openssl, transmission, pptpd,...

In order to use uclibc to compile source packages you need to add the uclibc to the PATH, add PKG_CONFIG_PATH pointing to uclibc, and to the ./configure add:

--host=mips-linux-uclibc --prefix=$TOOLCHAIN/usr

If the source code is well organised, it should work.

At the end of this process, I took the tun.ko from the kernel build directory and all the compiled .so and binaries and copy them to the router (using telnet). insmod to tun.ko and everything is working well!

The perfomace is good:
Torrents are downloading at 1-3MB/s over ext3
SMB read speed is about 7MBs
All of this without making any difference in speed for the rest of the devices in the network (only one cpu is busy, the other serve the rest of the users).
The only problem is writing to NTFS disk (about 1MBs max) because the ntfs-3g is very very sensitive to fragmentation, but its happen with every linux I tested..
Overall I am pleased with result.

Next, using the kernel and combining it with openwrt. Yes, I know its not the point of openwrt but it probably impossible to rewrite all the drivers, and without them its no use (no dual core support, xdsl, wlan....). Also the kernel is very stable and very optimised: in heavy usage of multiple computers downloading torrents and streaming video, the cpu utilisation was less than 10% !!
I don't know if it possible to combine them, I don't know what is the connection of the kernel features and user apps in openwrt, But maybe in the future I will find out what I can do to make this work. Thanks for reading!


2 comments:

  1. Hi Yaron could you publish the compiled files and explanation of how to use telnet to upload them ?

    ReplyDelete
  2. Technology Blog About Everything!: Cross Compiling Tools For Routers >>>>> Download Now

    >>>>> Download Full

    Technology Blog About Everything!: Cross Compiling Tools For Routers >>>>> Download LINK

    >>>>> Download Now

    Technology Blog About Everything!: Cross Compiling Tools For Routers >>>>> Download Full

    >>>>> Download LINK n7

    ReplyDelete