Open Turbostation:Software

Custom Software Packages for the QNAP Turbostation Family
This page will serve as a placeholder for user developed custom packages for the QNAP Turbostation family. Feel free to add your own solutions: but make the effort to validate them first!

GPL Firmware Downloads
QNAP currently provide GPL packages for the systems indicated below. Old versions do not seem to be listed. Note: Internet Explorer has problems downloading .tar.gz files (you will need to rename the downloaded file to replace the lost 'gz' suffix); ideally use Firefox, Opera or similar.

Missing Files
Unfortunately QNAP have been a bit selective about what to include in their GPL. Most things are there but the following appear to be absent:


 * qraid1 kernel module and associated daemon
 * /dev/pic device driver and associated daemon
 * MTD physmap partitioning (easily reverse engineered from console boot output)
 * U-Boot source (although this has been provided on request).

At this time it is not clear if this is deliberate or just a case of poor organisation. We can only hope that their customer support people will eventually respond.

Overview
The firmware for the TS-101 (and its cousin, the TS-201) is based on uClibc (http://uclibc.org/) and BusyBox (http://busybox.net/). There are pre-built PowerPC rootfs available for download from the uClibc site that contains a number of ready-to-run utilities not included in the TS-101 firmware; including gcc and dropbear ssh.

However if you wish to roll your own and want to make sure you are using matching versions of the kernel headers and gcc, instructions for creating your own cross-toolchain are provided below.

Creating a Cross Compiler
A cross compiler is generally necessary to produce code to run on the PowerPC603 core. Linux users can generally follow the instructions below. Windows users can install [www.cygwin.com Cygwin] or CoLinuxwhich provides simple Linux commands on a Windows platform.

Windows installation of Cygwin
Windows users can download Cygwin and execute the Setup.exe file. This brings up a Windows programme which requires further network access to install the necessary components.

Generally it is safer and quicker to install from Internet, the default option. Choose a suitable installation directory (e.g. c:\cygwin), and package directory (where the downloaded packages are stored). After choosing your connection method, you can select your favorite download site.



It is necessary to install the packages listed below. The best way to find them is to click the 'View' button until it displays 'All' or 'Full'. You can also drag the edge of the dialog box to display more information.

To install the package, select the corresponding 'Skip' item, it should toggle to the default version. Other dependancy packages will also be auto-selected. Multiple clicks will toggle the versions or return the package to 'skip'.


 * automake
 * bison
 * flex
 * gcc
 * gettext-devel
 * libncurses-devel
 * make
 * patchutils
 * python
 * subversion
 * wget

Once fully installed, you can start cygwin from the c:\cygwin\cygwin.bat file. You can specify your username and start directory by creating a windows environment variable called HOME, and setting it to c:\cygwin\home\ . This can be done entering Control Panel-> System -> Advanced -> Environment Variables, and selecting 'New'.

You should also check your $PATH environment variable doesn't have any weird and wonderful entries, especially directories with spaces! Since Cygwin generally parses your Windows PATH variable it is useful to 'overwrite' it. This can be done in the ${HOME}/.bash_rc file. After the #Set PATH..... #fi comments you can add a line like...
 * PATH=/usr/local/bin:/usr/bin:/bin

Cygwin has a 'rxvt' terminal that runs in native Windows (i.e. no X-server is required) which is more convenient than using the 'cmd.exe' based shell. See http://oinkzwurgl.org/cygwin for details on how to setup this.

Cygwin case sensitivity
There are issues with cygwin not being case sensitive; and for shared uclibc support it is necessary :( .This patch aims to correct this. Place it in the buildroot\toolchain\uClibc directory. Note you need version 2 of the file.

Windows installation of CoLinux
Use the instructions here or here (recommended) for installing CoLinux. Make sure you also follow the instructions for configuring network access - it is needed by buildroot!. Once installed and working, follow the instructions for Linux users below. Debian seems to be a safe option for installing.

Linux (and CoLinux) Users
Linux (and CoLinux) users should make sure they have the packages identified in the Cygwin installation list (above). If not they need to be installed. E.g. under debian use  followed by   where package can be wget etc.

Download Buildroot Snapshot
Download the latest Buildroot snapshot from here and untar it to wherever you wish to build your cross toolchain.
 * tar -xvjf buildroot-snapshot.tar.bz2


 * Cygwin users: Use the cygwin-tar!!! Although packages like Winzip, Winrar and 7Zip may be able to unpack the tarball; they do not correctly deal with symbolic links, and this could generate later errors!

Alternatively you can use subversion to do this for you...
 * svn co svn://uclibc.org/trunk/buildroot


 * Note this will install into your current directory.

Run make menuconfig
Cd into the buildroot directory and run 'make menuconfig' to choose what to build.


 * Target Architecture - choose powerpc
 * Build Options - defaults are fine
 * Toolchain options - select the 2.6.12 kernel headers and gcc 3.4.3 [Option : 3.4.6 also works]
 * Package Selection - uncheck Busybox
 * Target options - defaults
 * Board Support - defaults

Then exit and when prompted save your configuration.

Run make
Then just run 'make' to build the toolchain. You will be prompted for some answers to questions - select the default (i.e. press enter). If you are doing the compilation under Cygwin you may have a bit of a wait (1 to 7 hours) - it depends upon configuration, antivirus activity etc. However under native Linux it doesn't take that long.

There may be a couple of errors. Firstly - in compiling bin-utils link.h is not found. For some reason it is not correctly linked in during compilation of readelf.c (this might change in the future). As yet we have not found the cause; but you can safely copy the link.h file from
 * /buildroot/build_powerpc/staging_dir/include

to
 * /buildroot/toolchain_build_powerpc/binutils-2.16.91.0.7/binutils

The second error appears to be related to problems compiling libgcc_s_nof.so.1, and moving it to libgcc_s_nof_so.1. However by this point your cross tools should have been compiled.

The cross tools are created in the directory buildroot/build_powerpc/staging_dir/bin and are all prefixed  or. The option for the uclibc is in the  section of the config.in file; or through 'target' options of menuconfig

Build more stuff
Now either just use the cross tools directly for your own projects or go back and configure in a few packages to build from the 'Package Selection' list.

C++ Support
It should be possible to enable C++ support for the powerpc options; however the obvious trick of enabling C++ for build options does not seem to work :( After digging a little, it appears necessary to set   which can be done by entering the menuconfig, selecting packages, and selecting 'Native Toolchain in Filesystem'. This is the same as adding the line above to the config.in file.

Running make generates another error about cctype.h and. The fix can be found in the patch file associated with http://bugs.uclibc.org/view.php?id=904. Download the patch and save it to buildroot\toolchain\gcc\3.4.6. Note you will need to change the filename to 3.4.6; and also change the internal filenames from



to


 * NOTE: This patch file currently fails automatic installation (i.e. do manual changes); any guru's out there willing to fix it?

Alternatively download the updated patch file from OpenTurbostation/Files

Run make; and go for a cup of tea, do some shopping or surfing... After 1-2 hours (system dependant) you will find powerpc-linux-c++ and powerpc-linux-g++ have appeared in staging_dir/bin; and an error about ln trying to link .exe files to themselves... But it works!!!!


 * Note use the C++ / G++ programmes when attempting to compile C++; and not the gcc extension.

Some further information on using Buildroot can be found here

Buildroot, packages and Cygwin Version Quirks
Buildroot and cygwin have many quirks - and some of the known issues are detailed below...

Main Build
 * Buildroot [05/01/07], uclibc 0.2.98, binutils 2.16.91.0.7, kernel 2.6.12, gcc 3.4.x : WORKS (with patches above)
 * Buildroot [05/01/07], uclibc 0.2.98, binutils 2.16.91.0.7, kernel 2.6.12, gcc 4.x.x : Errors about cc-dummy not existing.

Packages
 * Buildroot [05/01/07], Gettext Package needs this patch

Working Cygwin / Buildroot Configs Various Buildroot .config files have been uploaded to the Group files section. These can be copied to /buildroot/.config and used to generate a working buildroot system. Before copying make sure you clean any previous installation with Assuming the patches above work, you will end up (upto 7 hours later) with a directory stucture like...

Using your Qnap as a Compiler
It is possible to download the precompiled uclibc sources which are matched to powerpc, uclibc0.9.27 (the same as used in the Qnap). Following the installation instructions wont work easily since there is no loop mount point on the Qnap :( However it is possible to mount the .ext2 file on another linux system and copy the files out into a tarball; and copy this into a Qnap share directory (e.g. Qweb).

Installing new uclibc environment
You should now have a fully functional build environment which also includes C/C++, awk etc. This can be used to build packages, with the correct shared library support. Once you have built your code, it can be used in the normal Qnap environment. However; currently the Qnap runs its OS in Ram drive; so any changes are lost at reboot! To return to the environment it is necessary relogin as administrator, and re-issue the mount and chroot commands.
 * 1) Download the tarball from here
 * 2) Copy the tarball to a Qnap share directory (e.g. Qweb)
 * 3) Telnet in as administrator
 * 4) Unpack the tarball
 * 5) Mount the new directory
 * 6) Now log into the new filesystem

Packages successfully compiled (and run!) so far
Perl v5.8.8 / libxml2-devel-2.6.26-1 / flex_2.5.31 / MySQL v4.0.21 / Httpd v2.2.4 / Apache 1.3.37 / PHP 5.2.1

As far as PHP5+Apache are concerned, I still have to find out why the Apache's LoadModule directive doesn't work (it says "File not found" but module is definitely there).

Update: problem not solved but workaround found. Just compiled Apache with PHP 5.2.2 as a static module. That's why I had to stick with Apache v1.3.37 (2.0 does accept dynamic modules loading only). Now everything works like a charm!

MLDonkey 2.8.3
For those of you interested in running MLDonkey, well, I must say it runs like a charm on the QNAP TS-201 (I don't know the TS-101, but it should). Writing a tutorial is pretty time-consuming, so in the meantime I just provide you with the binaries. Please note that the procedure needs you to telnet to the QNAP.

First of all chroot in the buildroot environment following the directions as described in the chapter Using your Qnap as a Compiler.

Download my file from here or here (thanks Rory). Then:


 * 1) After you've chrooted in the buildroot environment (see above) you're actually into the "loopmount" directory
 * 2) Unpack the ZIP file wherever on the QNAP (es. /share/Public/)
 * 3) Unpack the TAR file while in the root directory of buildroot (where you are after the chroot command) with: tar -xf /share/Public/[filename]  (filename should be "test.tar" if you used my binaries)

'''Note: do unpack the .tar archive telnetting to the QNAP and issuing a "tar" command! Windows does not handle UNIX files correctly!!!'''

Doing that you'll be merging the content of two dirs:


 * 1) usr/local/lib
 * 2) usr/src/mldonkey-2.8.3

Now issue:


 * 1) cd /usr/src/mldonkey-2.8.3
 * 2) rm -f users.ini
 * 3) ./mlnet &
 * 4) press return to get back to the prompt.

To administer it:


 * 1) HTTP connect to QNAP port 4080, user/pass = admin/[blank] or
 * 2) Telnet to port 4000, user/pass = admin/[blank] (please note that Windows telnet doesn't work. Use PuTTy with the Terminal option "Implicit CR in every LF")
 * 3) change the admin password: useradd admin [new password]
 * 4) go leeching something and...
 * 5) ...now, if you want, close the shell (exit), shut the PC down and let the QNAP download everything for you... 8-P

If you want a great user interface try Sancho.

DNS problems (cannot resolve names): if your MLDonkey complains about the QNAP not being able to resolve the servers names, do that:


 * 1) find out your connection's default gateway (open a Windows DOS shell and type "ipconfig")
 * 2) create a text file named "resolv.conf" in /etc
 * 3) enter the string "nameserver [IP of your default gateway]" (w/out quotes, e.g. "nameserver 192.168.1.1")
 * 4) save
 * 5) kill the mlnet process and refire it

That should do the trick. Update: interested users can download MLDonkey v2.8.4 ready-to-go binaries from here. See above for instructions. Don't forget to delete the file "users.ini" to get blank password for user admin.

- If someone else is willing to provide me with some additional reliable web space please kindly let me know (mt@fastwebnet.it).

Perl v5.8.8
Please find the Perl v5.8.8 PPC Linux compiled binaries here.

Unrar 3.70 beta 4
Please find the UnRAR 3.70 beta 4 PPC Linux compiled binaries here (rename it as "unrar").

Fully populated buildroot environment (Apache, PHP, MySQL & misc)
Please find here the fully populated buildroot environment (huge, uncompressed size is around 450MB).

It contains:


 * 1) Apache v1.3.37 (with PHP 5 module statically compiled)
 * 2) MySQL 4.0.21
 * 3) PHP 5.2.2
 * 4) Perl v5.8.8
 * 5) MLDonkey v2.8.4
 * 6) Misc stuff (go find it... 8-P )

Start/stop Apache:


 * 1) /wwwroot/bin/apachectl start
 * 2) /wwwroot/bin/apachectl stop

Apache ServerRoot/DocsRoot:


 * 1) /wwwroot
 * 2) /wwwroot/htdocs

'''Please note that Apache HTTP port is set to 6667, since port 80 is already taken by the QNAP webserver. Change the "httpd.conf" file (in /usr/local/apache/conf) to customize the Apache daemon.'''

Start/stop MySQL:


 * 1) /usr/local/mysql/bin/mysqld_safe &
 * 2) killall mysqld

MySQL privileges setup:

Issue:


 * 1) /usr/local/mysql/bin/mysql -u root -p   (password = new_password)

And then at the mysql> prompt:


 * 1) grant all privileges on *.* to root@[your IP] identified by "new_password";<-- don't forget the semicolon!!
 * 2) exit

Please note that [your IP] is the IP you want to connect from.

PHP dir:

/wwwroot/php

Chmode stuff:

Don't forget to "chmode" some dirs:


 * 1) chmode 777 /wwwroot/htdocs
 * 2) chmode 777 /tmp

Chances are that I'll be adding details as soon as people will need them, so keep checking this section. Any doubts feel free to let me know (mt@fastwebnet.it).