Cross compile nzbget EM7075
From Eminent Opensource
This page will show you how to cross-compile your own version of NZBGET for the EM7075. Note, NZBGET is already contained inside your unit, and this is only intended as an example to show how you can crosscompile a version that you changed or improved. Ensure the cross-compilation tools are installed and working, as explained [here.]
- Nzbget requires several libs and headers that we need to build first.
Contents |
Zlib
#!/bin/sh mkdir /usr/local/mips wget http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz tar -xvzf zlib-1.2.3.tar.gz cd ./zlib/1.2.3 make clean export CFLAGS="-EL " export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc" export PATH=/opt/Sourcery_G++_Lite/bin:$PATH export AR="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ar rc" export LDFLAGS=" -s -Xlinker -rpath /lib -Xlinker -rpath-link /opt/Sourcery_G++_Lite/lib/gcc/mips-linux-gnu/4.3.2/el" ./configure --prefix=/usr/local/mips make make install cd ..
Simply save this as Zlib.sh and run it.
Libxml2
#!/bin/sh wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz tar -xvzf libxml2-2.7.3.tar.gz cd libxml2-2.7.3 make clean export CFLAGS="-EL " export LDFLAGS=" -s -Xlinker -rpath /lib -Xlinker -rpath-link /opt/Sourcery_G++_Lite/lib/gcc/mips-linux-gnu/4.3.2/el" export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc -EL" export CXX="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-g++ -EL" export STRIP=/opt/Sourcery_G++_Lite/mips-linux-gnu/bin/strip ./configure --host=i386-linux-gnu --target=mips --prefix=/usr/local/mips make sudo make install-strip # strip means a 200kb smaller bin :) cd ..
Save as Libxml2.sh and run it.
Openssl
#!/bin/sh wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz tar -xvzf openssl-0.9.8k.tar.gz cd openssl-0.9.8k make clean export PATH=/opt/Sourcery_G++_Lite/bin:$PATH export CFLAGS="-EL" export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc" export CXX="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-g++" export AR="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ar rc" export LDFLAGS=" -s -Xlinker -rpath /lib -Xlinker -rpath-link /opt/Sourcery_G++_Lite/lib/gcc/mips-linux-gnu/4.3.2/el" ./Configure dist -EL --openssldir=/usr/local/mips/ make make install cd ..
Save as openssl.sh and run..
Libsigc++
#!/bin/sh wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.3.tar.gz tar -xvzf libsigc++-2.2.3.tar.gz cd libsigc++-2.2.3 make clean export PKG_CONFIG_PATH="/usr/local/mips/lib/pkgconfig/" export CFLAGS="-EL " export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc -EL" export CXX="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-g++ -EL" export CPPFLAGS="-I/usr/local/mips/include" export LDFLAGS="-L/usr/local/mips/lib" export STRIP=/opt/Sourcery_G++_Lite/mips-linux-gnu/bin/strip ./configure --host=i386-linux-gnu --target=mips --prefix=/usr/local/mips make make install-strip cd ..
Save & run :)
Libpar2
#!/bin/sh wget http://downloads.sourceforge.net/sourceforge/parchive/libpar2-0.2.tar.gz?use_mirror=kent tar -xvzf libpar2-0.2.tar.gz cd libpar2-0.2 make clean export PKG_CONFIG_PATH="/usr/local/mips/lib/pkgconfig/" export CFLAGS="-EL " export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc -EL" export CXX="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-g++ -EL" export CPPFLAGS="-I/usr/local/mips/include" export LDFLAGS="-L/usr/local/mips/lib" export STRIP=/opt/Sourcery_G++_Lite/mips-linux-gnu/bin/strip ./configure --host=i386-linux-gnu --target=mips --prefix=/usr/local/mips make make install-strip cd ..
Curl
#!/bin/sh wget http://curl.haxx.se/download/curl-7.19.5.tar.gz #needs (ssl,zlib) tar -xvzf curl-7.19.5.tar.gz cd curl-7.19.5 make clean export CFLAGS="-EL " export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc" export PATH=/opt/Sourcery_G++_Lite/bin:$PATH export AR="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ar" export STRIP=/opt/Sourcery_G++_Lite/mips-linux-gnu/bin/strip ./configure --disable-shared --prefix=/usr/local/mips --build=mips-linux-gnu --target=mips-linux-gnu --host=i686-pc-linux-gnu --with-ssl=/usr/local/mips --without-random --with-zlib=/usr/local/mips sleep 10 make sudo make install-strip cd ..
NZBGet
#!/bin/sh wget http://sourceforge.net/projects/nzbget/files/nzbget-stable/nzbget-0.6.0.tar.gz/download tar -xvzf nzbget-0.6.0.tar.gz cd nzbget-0.6.0 make clean export CFLAGS="-EL " export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc -EL" export CXX="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-g++ -EL" export LDFLAGS=" -L/usr/local/mips/lib -s -Xlinker -rpath /lib -Xlinker -rpath-link /usr/local/mips/lib" export CPPFLAGS="-I/usr/local/mips/include" export PKG_CONFIG_PATH="/usr/local/mips/lib/pkgconfig/" export STRIP=/opt/Sourcery_G++_Lite/mips-linux-gnu/bin/strip ./configure --host=i386-linux-gnu --target=mips --prefix=/usr/local/mips --disable-curses --disable-tls --enable-parcheck \ --with-libpar2-includes=/usr/local/mips/include/libpar2-0.2/include/libpar2 \ --with-libpar2-libraries=/usr/local/mips/lib/libpar2-0.2/lib \ --with-libsigc-includes=/usr/local/mips/include/sigc++-2.0 \ --with-libsigc-libraries=/usr/local/mips/lib \ --with-libxml2-includes=/usr/local/mips/include/libxml2 \ --with-libxml2-libraries=/usr/local/mips/lib make make install-strip cd ..
And we're done! Your new nzbget-binary is now in /usr/mips/local/bin and ready to be integrated into the firmware. You can check if the output file is indeed correct:
file /usr/local/mips/bin/nzbget nzbget: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), for GNU/Linux 2.6.12, dynamically linked (uses shared libs), stripped
Please note, newer versions of NZBGet will eventually be picked up into the mainstream firmware releases, so there should be no need to cross-compile a version of your own (Unless you're living on the edge and wish to use the unstable or CVS version off course.)
