Skip to content

Installation on Asus RT N16

fralik edited this page Apr 10, 2011 · 1 revision

It is possible to use Easysync-server on your own router with DD-WRT. I used a PC with Ubuntu to compile it. DD-WRT v2.24 is installed on my router.

If you prefer the short way, then download pre-compiled binaries. You will need to compile Unison yourself.

  1. First of all, we need a toolchain. A good point to start is DD-WRT wiki. Download a toolchain from there (as for today archive is 716 Mb). Those toolchains are for x86_64 architecture. So if you have x86_32, then you'll need a new toolchain or new OS. I chose the second option.

  2. Open the archive. We need toolchain-mipsel_gcc4.1.2. I unpacked this folder in /home/fralik/. Why exactly do we need toolchain-mipsel_gcc4.1.2? I noticed that Optware on my router are installed from mipsel packages.

  3. Add toolchain to the PATH variable:

PATH=$PATH:~/toolchain-mipsel_gcc4.1.2/bin/
cd ~
mipsel-linux-gcc --version

You should see the information about GCC version.

  1. Now it's time to compile Qt. Download Qt libraries for embedded Linux. I unpacked this archive in /home/fralik/ as well.

  2. Navigate to Qt root directory.

cp -R mkspecs/qws/linux-mips-g++/ mkspecs/qws/linux-mipsel-g++

In the newly created directory you will find qmake file. This is a base file, which is used to compile Qt for a particular architecture.

  1. Edit linux-mipsesl-g++/qmake.conf so that it uses mipsel-linux-* instead of mips-linux-*.

  2. Time to invoke configuration script:

sudo apt-get install libxext-dev
./configure -no-cups -release -shared -no-qt3support -no-phonon -no-audio-backend -no-javascript-jit -no-webkit -qt-sql-lite -no-script -no-scripttools -opensource -no-gui -no-nis -no-opengl -nomake examples -nomake demos

You should see:

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.7.2

Invoke configuration script one more time:

./configure -no-cups -release -shared -no-qt3support -no-phonon -no-audio-backend -no-javascript-jit -no-webkit -qt-sql-sqlite -no-script -no-scripttools -platform linux-g++-64 -xplatform qws/linux-mipsel-g++ -opensource -no-gui -no-nis -embedded mips -little-endian -no-opengl -nomake examples -nomake demos

The first time we just configure Qt for our host architecture. During the second call of configure, we prepared Qt to be compiled for MIPS. Results:

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/QtEmbedded-4.7.2-mips
  1. Run make. It's now time to make yourself a cup of tea. Compilation will take some time. Though, I have a problem on this step:
.obj/release-shared-emb-mips/qrect.o: In function `QRectF::toAlignedRect() const':
qrect.cpp:(.text+0x1468): undefined reference to 'ceilf'
qrect.cpp:(.text+0x1488): undefined reference to 'ceilf'

The problem is that uclibc library (c library for embedded devices) in DD-WRT toolchain is compiled without math support. I didn't find what one can do about it. One option is to recompile the toolchain, but I didn't want to do this. I prefer to modify Qt a little bit. I am sure that I do not need QRect right now. So, edit ~/qt-everywhere-opensource-src-4.7.2/src/corelib/tools/qrect.cpp on line 2379. Change it to "int xmax = int( (float)((int)xp + w));". In other words, replace qCeil(xp+y) by (float)((int)x + y). You will need to do the same changes to line 2381 in the same file and to line 640 in ~/qt-everywhere-opensource-src-4.7.2/src/corelib/tools/qtimeline.cpp. Invoke main again.

  1. Run sudo make install. Verify that Qt had been properly compiled:
file /usr/local/Trolltech/Qt-4.7.2/lib/libQtCore.so.4.7.2

Output:

/usr/local/Trolltech/Qt-4.7.2/lib/libQtCore.so.4.7.2: ELF 32-bit LSB shared object, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), not stripped
  1. It's time to compile Unison. We will do it right on the router:
ipkg-opt install buildroot ocaml
mkdir /mnt/unison
cd /mnt/unison
wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.40.61.tar.gz
tar xvfz unison-2.40.61.tar.gz
ocaml mkProjectInfo.ml > Makefile.ProjectInfo
# Прежде чем собирать унисон, нужно сделать символьную ссылку с libncurses на libcurses
ln -s /opt/lib/libncurses.so.5.7 /opt/lib/libcurses.so.5.7
ln -s /opt/lib/libcurses.so.5.7 /opt/lib/libcurses.so.5
ln -s /opt/lib/libcurses.so.5 /opt/lib/libcurses.so
make NATIVE=false UISTYLE=text
./unison -version
cp ./unison /opt/bin/unison
  1. Using installation guide of easysync-client, verify that unison is ready.

  2. Let's compile Easysync:

cd ~
git clone git://github.com/fralik/Easysync.git
cd Easysync/server
/usr/local/Trolltech/Qt-4.7.2/bin/qmake easysync-server.pro
make
# verify:
file build/easysync-server
  1. Bringing everything together. I assume that IP of the router is 192.168.2.1 and we can write in /mnt/ directory:
scp /usr/local/Trolltech/Qt-4.7.2/lib/libQtCore.so.4.7.2 [email protected]:/opt/lib
scp /usr/local/Trolltech/Qt-4.7.2/lib/libQtNetwork.so.4.7.2 [email protected]:/opt/lib
scp /usr/local/Trolltech/Qt-4.7.2/lib/libQtSql.so.4.7.2 [email protected]:/opt/lib/
cd <Easysync/server>
./build_package_dd-wrt.sh
scp easysync-server_mipsel.tar.gz [email protected]:/mnt
  1. Connect to the router and run:
tar xvfz easysync-server_mipsel.tar.gz
ln -s /opt/lib/libQtCore.so.4.7.2 /opt/lib/libQtCore.so.4.7
ln -s /opt/lib/libQtCore.so.4.7 /opt/lib/libQtCore.so.4
ln -s /opt/lib/libQtCore.so.4 /opt/lib/libQtCore.so
ln -s /opt/lib/libQtSql.so.4.7.2 /opt/lib/libQtSql.so.4.7
ln -s /opt/lib/libQtSql.so.4.7 /opt/lib/libQtSql.so.4
ln -s /opt/lib/libQtSql.so.4 /opt/lib/libQtSql.so
ln -s /opt/lib/libQtNetwork.so.4.7.2 /opt/lib/libQtNetwork.so.4.7
ln -s /opt/lib/libQtNetwork.so.4.7 /opt/lib/libQtNetwork.so.4
ln -s /opt/lib/libQtNetwork.so.4 /opt/lib/libQtNetwork.so
  1. Still on you router, edit config.ini.sample and then run:
./setup_dd-wrt.sh

**Note, that after reboot you will need to start easysync-server manually. You can do it using command

/opt/etc/init.d/easysync-server start

**

Clone this wiki locally