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.

Werbung


I’ve used a x86_64 Virtual Server from Hosteurope where Debian 6.0 was installed. I can’t speak for other environments, maybe it works otherwise as well. I needed to install a few Packages first:

apt-get install gcc libncurses5-dev libncursesw5-dev apt-get install ia32-libs

The last package is needed as we compile the module for a 32 Bit OS but run the compilation on a 64 Bit OS.

Now we download the build environment:

cd /where/ever/you/like/
wget ftp://ftp.dlink.de/dns/dns-320/driver_software/DNS-320_sw_revA_GPL-Code_1-00_all_en_20120313.zip
unzip DNS-320_GPL_code_revA.tgz
cd dns320_GPL
unzip dns320_GPL.tgz
cd dns320_GPL
wget http://wolf-u.li/u/275

With the last download the file uwkernelbuilder.sh was downloaded which leads you through make clean, make menuconfig and make modules:

sh uwkernelbuilder.sh

For future reference here the content of the uwkernelbuilder.sh as as of 01-Jun-2011:

#!/bin/sh
# AUTHOR: D-Link
# MODIFIED BY: Uli Wolf <ffp@wolf-u.li> (https://wolf-u.li / https://nas-tweaks.net)
 
# This was tested on the DNS-320/DNS-325-package from
#  ftp://ftp.dlink.de/dns/dns-320/driver_software/DNS-320_GPL_code_revA.tgz
 
if [ ! -d "arm-none-linux-gnueabi-6xxx" ]; then
        # directory did not exists unpack it
        echo "Extracting arm-none-linux-gnueabi-6xxx.tgz..."
        tar zxf arm-none-linux-gnueabi-6xxx.tgz
        echo "done."
fi
 
export WORKDIR=$(pwd)
export PATH=${WORKDIR}/arm-none-linux-gnueabi-6xxx/bin:$PATH
export CC=arm-none-linux-gnueabi-gcc
export CROSS_COMPILE=arm-none-linux-gnueabi-
export CXX=${CROSS_COMPILE}g++
export RANLIB=arm-none-linux-gnueabi-ranlib
export LD=arm-none-linux-gnueabi-ld
export STRIP=arm-none-linux-gnueabi-strip
env|sort
 
# Unpack Ramdisk if not existant
if [ ! -d "ramdisk" ]; then
        echo "Extracting ramdisk.tgz..."
        tar xzf ramdisk.tgz
        echo "done."
fi
PATH=${WORKDIR}/ramdisk:$PATH
 
# Extract kernel if not existant
if [ ! -d "linux-2.6.22.18" ]; then
        echo "Extracting kernel..."
        tar xzf linux-2.6.22.18.tgz
        echo "done."
fi
 
# Configure Kernel
cd ./linux-2.6.22.18
sh cv.sh
# Clean up
make clean
 
# Menubased configuration
make menuconfig
# Make Kernel
#make
# Make Kernelmodules
make modules
# Make uImage
#make uImage
 
cd ../

40 thoughts on “Building an additional Kernel Module for the DNS-320 / DNS-325”

  1. Hi Uli,
    Thanks for figuring this out.. should be helpful. Would it be more than a few minutes work for you to compile the ftdi_sio (http://sourceforge.net/projects/ftdi-usb-sio/files/) and usbserial kernel modules with the DNS-320 kernel? I’ve been trying to figure it out but it’s taking me much too long. There’s certainly a few coffees in it for you…Thanks, Jeff

  2. Hi Uli,

    I build a kernel module with your how to. Where to put the module on the DNS-320 and how can I load this module:
    modprobe and insmod not working.

    Thanks, David.

    1. Hello David,

      which one are you compiling? You can take the modules from here if available.

      insmod is normally correct, what is the error message?

      Cheers,
      Uli

  3. i have compiled iptables support modules and bridge support (i need one of these openVPN).
    Istalling iptable modules:

    insmod x_tables.ko
    insmod nfnetlink.ko
    insmod ip_tables.ko

    gives errors:
    ip_tables: Unknown symbol nf_register_sockopt
    ip_tables: Unknown symbol nf_unregister_sockopt

    On the other hand, about brige (llc.ko llc2.ko bridge.ko)

    bridge: Unknown symbol br_handle_frame_hook
    bridge: Unknown symbol nf_register_hooks
    bridge: Unknown symbol br_fdb_put_hook
    bridge: Unknown symbol nf_unregister_hooks
    bridge: Unknown symbol nf_hook_slow
    bridge: Unknown symbol nf_hooks
    bridge: Unknown symbol br_fdb_get_hook

    The problem, as to me, is that these symbols has to be into the kernel (they are in iptabels.c file in linux/net folder.

    1) Is it possible to build these symbols into a module?
    2) How to build a kernel for dns-325?

      1. i’ve just seen that page, there aren’t the modules i need.
        I don’t see ip_tables.ko in that list, for example, and that is required by iptable command. As well bridge.ko required by brctl command.

          1. Did you get iptables installed? I’m still stuck at

            # iptables -L
            iptables v1.4.9: can’t initialize iptables table `filter’: Table does not exist (do you need to insmod?)
            Perhaps iptables or your kernel needs to be upgraded.

          2. Hi,
            I would like to install iptables on my dns325.
            FaByS did you get iptables working ?
            “thanks for the answer and for the great job!!” what response are you talking about ?
            I don’t see the required modules on the page of precompiled modules of Uli.

            Thanks

      2. Hi Uli,

        any chances to build yet another module: fuse.ko ?

        I want to use truecrypt and it seems to me that it is last thing I’m missing.

        Many thanks in advance,
        Wojtek

        p.s. Generally great job!

      3. Do you have compiled the module for iptables? I have found some comments about these modules but not a download link…

  4. Hi uli,
    As we can compile kernel and module.

    Is it possible to install a new kernel ?
    It seem we need it to enable ipv6 and iptables.
    Anyone already tried ?

  5. Hello Uli,

    may I ask you to compile a bluetooth module set for me? I’m working since a few days on it and no one tutorial about compiling new modules worked. I tryed to generate a cross-compiling environment, tryed native compiling – i’m going crazy wit it.
    I’m working on a virtual machine with Kubuntu 11.1. My NAS is the DNS-323 with the newest firmware (1.10), the 2.6.12.6 kernel and fonz plug (doesn’t matter which version – I’m flexible)

    Thanks alot for your help
    Cris

    1. Hello,

      I’ve done it finally by myself, yeah.

      !!!! Bluetooth is working by now. !!!

      It took nearly a week to to get all working together: compile the BT driver, find out what is needed else to get it working…

      Thanks
      Cris

  6. I successfully compiled the ext4dev module. So I copied the file from linux-2.6xxxxx/fs/ext4/ext4dev.ko onto my NAS and then tried to insmod it with:

    insmod ext4dev.ko

    but i receive following error:
    insmod: error inserting ‘ext4dev.ko’: -1 Unknown symbol in module

    What am I missing?

  7. Hi,
    searced for DNS-320_GPL_code_revA.tgz on the ftp site but not found. what’s the correct file to download?

  8. Hallo Uli,

    hast Du jemals probiert ein modifiziertes Image zu erstellen ?

    z.B. ssh direkt zu aktivieren ?

  9. Hi,

    Looks like the link for the DNS-320 GPL source code has changed again or the server is down for a long time. Can’t find other alternative site.

  10. Hi Uli,

    is there any way to compile modules for dns 320L? If so, could you please provide me with further information?

    Thanks for your help

  11. Hello Uli,

    I have compiled modules for iptables, but when i do:
    insmod *.ko there are some errors like:
    error inserting : -1 Unknown symbol in module

    Could you pleaze explain to me what I missed?

  12. the scripts need updating again it seems,

    “root@d1:/ffp/home/root/test# ls
    DNS-320_sw_revA_GPL-Code.tgz DNS-320_sw_revA_GPL-Code_1-00_all_en_20120313.zip
    root@d1:/ffp/home/root/test# unzip DNS-320_sw_revA_GPL-Code.tgz
    Archive: DNS-320_sw_revA_GPL-Code.tgz
    End-of-central-directory signature not found. Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive. In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
    unzip: cannot find zipfile directory in one of DNS-320_sw_revA_GPL-Code.tgz or
    DNS-320_sw_revA_GPL-Code.tgz.zip, and cannot find DNS-320_sw_revA_GPL-Code.tgz.ZIP, period.
    root@d1:/ffp/home/root/test#

    id like to see a new 2014 collection for all the available USB TV sticks.

    a funtional iSCSI module client and server preferably with the added web pages to set/configure it and monitor its use.

    and all the extra files required for sabnzbd that will run on the 320 such as “par2” and the other internal unpackers it needs to function properly.

    the latest ffmpeg with all the x264,aac, and mkv/mp4 output libraries included…

    the newest vlc for taking those USBTV mpeg streams and multicasting them over the local lan would be good too please…

  13. looks like we need an update to fix this

    “root@d1:/ffp/home/root/test# ls
    DNS-320_sw_revA_GPL-Code.tgz DNS-320_sw_revA_GPL-Code_1-00_all_en_20120313.zip
    root@d1:/ffp/home/root/test# unzip DNS-320_sw_revA_GPL-Code.tgz
    Archive: DNS-320_sw_revA_GPL-Code.tgz
    End-of-central-directory signature not found. Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive. In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
    unzip: cannot find zipfile directory in one of DNS-320_sw_revA_GPL-Code.tgz or
    DNS-320_sw_revA_GPL-Code.tgz.zip, and cannot find DNS-320_sw_revA_GPL-Code.tgz.ZIP, period.
    root@d1:/ffp/home/root/test#”

  14. can we have an updated set of modules for
    iSCSI client and server with preferably a web interface to monitor and set the option etc.

    all the current working known USB TV modules and firmware loading for them…

    extra apps for making sabnzbd work after downloading the rars etc “par2” and all the unrar apps etc…

    and updated ffmpeg with the mkv,mp4,aac output capabilities and perhaps even a new vlc for taking all these USB DVB TV streams and putting them on the wire for the local aln use etc… if you can please.

  15. while i was tr ying to make a working dev env i also tried the http://forum.dsmg600.info/viewtopic.php?id=6914

    tutorial where the full Debian sqeeze was referenced
    ftp://ftp.dlink.pl/dns/dns-320/driver_software/DNS-320&325_linuxDebian_revA_Squeeze_all_en_20110111.zip

    it seems dlink no longer host that full zip and its nowhere to be found on the net after days of searching, shouldnt they always keep a copy somewhere public for the FLOSS coverage, anyone know where id get a full 320 usable linux dev env from now ?

    1. got it (thanks Brian!)
      http://tsd.dlink.com.tw/downloads2008list.asp?OS=GPL

      it was a little tricky to compile cdc-acm.ko but it works fine

      i have to load cdc-acm.ko after my usb-hub is detected

      dev/ttyACM0 is not autocreated so i create it on demand in my start-script (fhem.sh)
      mknod /dev/ttyACM0 c 166 0

      output of fhemlog:
      2015.03.03 05:04:02 3: Opening CUL_0 device /dev/ttyACM0
      2015.03.03 05:04:02 3: Setting CUL_0 baudrate to 38400
      2015.03.03 05:04:02 3: CUL_0 device opened
      2015.03.03 05:04:02 3: CUL_0: Possible commands: BbCFiAZEGMKUYRTVWXefmltux
      2015.03.03 05:04:02 2: Switched CUL_0 rfmode to HomeMatic
      2015.03.03 05:04:02 1: Including /mnt/USB/HD_c1/fhemlog/fhem.save
      2015.03.03 05:04:02 1: usb create starting
      2015.03.03 05:04:03 1: usb create end

  16. Hi, I’m stuck trying to build new modules, missing some knowledge…
    Following the recipe only builds
    i2c-mv64xxx.ko
    scsi_wait_scan.ko
    sd_mod.ko
    usblp.ko
    fat.ko
    msdos.ko
    ntfs.ko
    vfat.ko
    usb-storage.ko
    even if I reconfigure using menuconfig.
    What do I miss?

    Thanks!!!!
    Eric

  17. Does anyone know where one can download the GPL code for the latest firmware version 1.04b05? In particular, where can one get the kernel code and the corresponding config for that firmware to compile modules for the latest version?

    The d-link support page only gives GPL code downloads from 2003, while the latest firmware itself was created in 2015…

Leave a Reply to Uli Cancel reply

Your email address will not be published. Required fields are marked *

Exit mobile version