Precompiled Kernel-Modules for the D-Link DNS-320 and DNS-325

German version of this tutorialA while back i wrote a tutorial on how to compile additional kernel-modules for the D-Link DNS-320 and DNS-325. From time to time i get asked if it would be possible to compile module XYZ. In this post I’m publishing the past results of my compilation sessions. If you need further modules, i can provide them on request.
Continue reading Precompiled Kernel-Modules for the D-Link DNS-320 and DNS-325

Building an additional Kernel Module for the DNS-320 / DNS-325

A while back i updated the openvpn-package with the tun.ko for the DNS-320 and DNS-325. Problem was, that i needed to compile a kernel module first. Thankfully D-Link provides a ZIP-File with the sources of Code used for the DNS-320. Unfortunately it didn’t work out of the box, but i was able to pull a script which works together for you. If you want to download all my finished modules just visit this page.
Continue reading Building an additional Kernel Module for the DNS-320 / DNS-325

Compiling Software for the Fonz fun_plug

This tutorial is for advanced users only!

Fonz provides many pre-compiled packages for the NAS in his repository, but obviously cannot provide every package which someone out there might need. So to help users compile and link packages themselves, Fonz has created a complete software environment for building packages for the NAS device.

This ffpbuildenv environment consists of a few scripts and a standardized process for building software packages. It runs on the NAS itself, rather than requiring special cross-compilation tools on a PC. This helps guarantee full compatibility with the target system and ensures that the environment is familiar to developers with a Linux background.

The following tutorial builds on Fonz’s work, but also contains procedures and descriptions by Uli. User PeterH did his usual testing and polishing routine on this text.



Setup a fun_plug and install ALL packages available as described in the linked tutorial.


ffpbuildenv can best be installed on one of the hard disks:

mkdir /mnt/HD_a2/ffpbuildenv
cd /mnt/HD_a2/ffpbuildenv
svn co svn:// .

These steps create a new directory on drive /mnt/HD_a2/ and copy the required files from Fonz’ repository using the [ Subversion] version control system.

General Use

Chrooting to the build environment

To get a well-defined environment, you chroot to this directory using a script appropriately called

cd /mnt/HD_a2/ffpbuildenv/
cd /mnt/HD_a2/ffpbuildenv/source/

It makes the ffpbuildenv look like the root directory of the file system, at least for the current process. Note that the chroot step creates a new command shell running within your current command shell: if you later exit from the that shell, you end up back in the original shell.

Downloading the distribution file

cd /mnt/HD_a2/ffpbuildenv/source/

Compiling a package

cd /mnt/HD_a2/ffpbuildenv/source/

The compiled and packaged archive is placed in /mnt/HD_a2/ffpbuildenv/packages/ then. Errors are logged to /mnt/HD_a2/ffpbuildenv/build-logs/--.log

Setting up a package

If you take a look into the directory of a package, you will see several files. In the following text, I will describe lighttpd if not stated otherwise.

Required files


Tells the Revision of the compiled package. E.g. if you compiled a package, forgot to include something and want to redo the package, e.g. the third version of php-5.2.6: php-5.2.6-3.tgz



This is the version of the source code, e.g. lighttpd-1.4.20.tar.bz2



Link to the source-file. You can use the following variables:

  • $PV – Packageversion – Value from above
  • $PN – Packagename – Value from above
  • $P – Concated Variable: “Packagename-Packageversion” ($PN-$PV)$PV.tar.bz2

This will result in

Optional files


Describes the package. If present, it is shown during installation.

Lighttpd is a secure, speedy, compliant, and very flexible web-server
which is designed and optimized for for high-performance environments.
With a small memory footprint compared to other web-servers, effective
management of the CPU-load, and advanced feature set (FastCGI, SCGI,
Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the
perfect solution for every server that is suffering load problems.


This is the general homepage of the program.

This file gets executed during the installation of a compiled package. Here you can add additional commands, like adding system accounts or printing additional information.

This file is not needed in lighttpd, the code below is from sudo

        if [ ! -r "$1" ]; then
                mv $ $1
        elif cmp -s $1 $; then
                rm $
def ffp/etc/sudoers

This file is used for configuring the source code with other commands than ./configure. If it is not available ./configure with the optional configure_args (see below) will be run in the source directory.

This file is not needed in lighttpd, the code below is from openssl

    ./config \
        --prefix=$CPREFIX \
        --openssldir=$CSYSCONFDIR/ssl \
        zlib shared


These arguments are used, if there is no available in the directory. Only the part after ./configure is included!



This file is used for “make” on the source code. If it is not available,

make DESTDIR=$D install

will be used in the source directory.

This file is not needed in lighttpd, the code below is from screen

    make DESTDIR=$D install
    mkdir -p $D$CPREFIX/etc
    install -m 0644 etc/etcscreenrc $D$CPREFIX/etc/screenrc


Additional actions like moving or adding files. * can be replaced by etc or whatever, they all are run after compilation.

This is the content of

mkdir -p $D$CPREFIX/etc/examples
cd $X/etc/examples
install -m 0644 -o root -g root \
        lighttpd.conf lighttpd.conf-with-php \


These files get installed into the directory “/ffp/start/” during the installation. These contain a starter file.

This is the content of

# PROVIDE: kickwebs
# BEFORE: lighttpd
. /ffp/etc/ffp.subr
        echo "Kicking webs ..."
        killall webs
run_rc_command "$1"

This is the content of

# PROVIDE: lighttpd
. /ffp/etc/ffp.subr
lighttpd_flags="-f /ffp/etc/lighttpd.conf"
run_rc_command "$1"


Install an editor (like nano), you will need one for editing the above files.

This walk-through will show you how to compile nano.

We start by changing to the correct directory:

>cd /mnt/HD_a2/ffpbuildenv/source/

Now we create the directory and change to it:

mkdir nano
cd nano

We open for the latest stable version, which is 2.0.9. Open the file PV for the package version:
And enter 2.0.9.

Reset PR, we do this process for the first time. Open PR:
And enter 1.

Now we search for the [ download-url]. Is there a consistent way of numbering the releases? The example of nano shows us this numbering:

Do you see the similarity?
If so, then we can substitute the version by using $PV:$PV.tar.gz

If not, you need to enter the url manually:

Pull this URL to SRC_URI.

Now we fulfilled the requirements for compiling, but nano will fail in some sections with these settings due to missing libraries (spellchecker). So we need to add some configure arguments using configure_args:


Now everything is set for compiling. Now we chroot to the respective directory:

sh /mnt/HD_a2/ffpbuildenv/
cd /mnt/HD_a2/ffpbuildenv/source/

And run the download:

./ -F nano

And run the compilation:

./ nano

This will take a while. If you get you prompt back and the line above states “OK.” everything went fine and you will find the final package in /mnt/HD_a2/ffpbuildenv/packages/. Otherwise, you should check the log:

tail /mnt/HD_a2/ffpbuildenv/build-logs/nano*log