Saturday, September 8, 2012

Building optware packages for Synology

On a Synology NAS you can install the optware package system. This gives access to a repository with many handy tools, libraries and utilities. But what do you do when you require something that is not in the repository? Here's how:

Make a checkout from the optware repository:
svn co https://svn.nslu2-linux.org/svnroot/optware/trunk optware

Setup the build system for your target. To find out what that is check here section "bootstrap". For my DJ110j NAS this is "cs08q1armel":
cd optware
make cs08q1armel-target
cd cs08q1armel
make directories toolchain ipkg-utils

Once the toolchain is build, setup your path and crosscompile variables:
export PATH=$PATH:your_path/optware/cs08q1armel/toolchain/bin
export CROSS_COMPILE=arm-linux-none-gnueabi
export ARCH=arm


When you just want to build a newer version of a package, for example neon, edit the packages/neon.mk and change the version number and download location in the file.

Making a new package is a bit more difficult, it is quite wel described here under the template section. I wanted to create a package for davfs2. For whoever needs it, the makefile can be downloaded here and the resulting ipkg for arm can be downloaded here.

Note: When building davfs2 it is required to disable the "AC_FUNC_MALLOC" check in configure.ac, otherwise it will use the non-existent function rpl_malloc(). Another option is to export ac_cv_func_malloc_0_nonnull=yes.

Sources:
http://www.nslu2-linux.org/wiki/Optware/AddAPackageToOptware
http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc