Test Area Index

QNAP NMP-1000

Customisation

This page contains technical support notes on customising the QNAP NMP-1000 Network Media Player.

The original NMP-1000 firmware's functionality can be extended very easily by installing OpenNMP on a USB stick as per the instructions given in the linked pages, and this is the method I would recommend.  Attempting to install, say, Optware directly on hard disk fails due to the impossibility of making symbolic links of the correct type on NTFS file systems, which is apparently all that the firmware will support on the Hard Disk.  This happens as follows …

As with customising most embedded devices running Linux, the process can be broken down into stages:

  1. Gaining Administrator (root) Access To Linux

    Fortunately this is easy for this particular device, as you can telnet into it.  Follow the instructions in section 9.7.6 on p132 of the manual to enable telnet, ensure that your firewall allows the connection, and then go into a console/DOS prompt and type …
    telnet <Network Name or IP>
    … where <Network Name or IP> is either the network name you gave to the device as per section 9.2.1 p107, or the device's IP address  the latter will either be acquired dynamically (by default), and will therefore have to be discovered via your router's web browser configuration pages, usually under a heading such as DHCP, or else fixed as per section 9.3.1 p109.  All being well, you should see:
    <Network Name> login: <Unless you've changed the administrator account name, type admin>
    Password: <Type the one you set as per section 9.1 p104>
    When desired, you can close the telnet session by typing:
    exit

  2. Customisation Of The Device's Linux Boot Process

    Again with this device, this is fairly easy, the OpenNMP installation script reveals how to do it.  The boot script /etc/init.d/autorun.sh contains the following:
    #!/bin/sh
     
    if [ -x /mnt/manufacture/autorun.sh ]
    then
    /mnt/manufacture/autorun.sh
    fi
    However, by default there is no /mnt/manufacture/autorun.sh and /mnt/manufacture is mounted read-only …
    mount | grep /mnt/manufacture
    /dev/mtdblock8 on /mnt/manufacture type jffs2 (ro,noatime)
    … thus apparently preventing customisation.  The trick is to dismount this folder and remount it as read-write:
    umount /mnt/manufacture
    mount -t jffs2 /dev/mtdblock8 /mnt/manufacture -o rw
    Now you can create your /mnt/manufacture/autorun.sh customisation script.  Here's a suitable example, which should work whether or not you have the OpenNMP USB stick plugged in.  It searches for the OpenNMP USB stick and runs it if found, otherwise it searches for Optware on the hard disk and runs that if found:

    #!/bin/sh
    # OpenNMP script by AdNovea - Sept 2009, adapted by Charles Macfarlane - Dec 2013
    # (using the USB_BASE detected drive)
     
    # Customise the login profile
    echo
    echo "" >> /etc/profile
    echo Running $0 ...
    echo "# From $0 ..." >> /etc/profile
    echo
    echo "" >> /etc/profile
     
    # Clean up PATH
    export PATH="$(echo $PATH | sed 's/::/:/g' | sed 's/^://' | sed 's/:$//')"
    echo 'export PATH="$(echo $PATH | sed '\''s/::/:/g'\'' | sed '\''s/^://'\'' | sed '\''s/:$//'\'')"' >> /etc/profile
     
    # Find the OpenNMP stick's folder under /share
    for datadirtest in `/bin/ls /share | /bin/grep -i USB`
    do
    if [ -d /share/$datadirtest/.npkg ]
    then
    USB_BASE="/share/${datadirtest}"
    fi
    done
    unset datadirtest
     
    # Load OpenNMP if its USB stick present
    if [ "${USB_BASE}" !=""]
    then
    # Log the OpenNMP stick's folder
    echo "USB_BASE is ${USB_BASE}"
    # If root has a home directory on the stick, mount it
    # (need to do this first to avoid potential spurious getcwd errors)
    if [ -d ${USB_BASE}/home/root ]
    then
    mount ${USB_BASE}/home/root /root -o bind
    fi
    # Run OpenNMP
    if [ -x ${USB_BASE}/autorun ]
    then
    source ${USB_BASE}/autorun
    echo "${USB_BASE}/autorun completed and returned exit code $?"
    fi
    # Otherwise load Optware if present on hard disk
    elif [ -d /share/HARD_DISK_A1/opt ]
    then
    # If root has a home directory on the hard disk, mount it
    # (need to do this first to avoid potential spurious getcwd errors)
    if [ -d /share/HARD_DISK_A1/home/root ]
    then
    mount /share/HARD_DISK_A1/home/root /root -o bind
    fi
    # mount Optware
    mount /share/HARD_DISK_A1/opt /opt -o bind
    # Add the Optware binaries to the PATH
    if [ -d /opt/bin ]
    then
    export PATH=$PATH:/opt/bin
    echo 'export PATH=$PATH:/opt/bin' >> /etc/profile
    fi
    if [ -d /opt/sbin ]
    then
    export PATH=$PATH:/opt/sbin
    echo 'export PATH=$PATH:/opt/sbin' >> /etc/profile
    fi
    # Run the Optware initialisation scripts
    for SCRIPT in $(ls -A1 /opt/etc/init.d/S*)
    do
    if [ -x "$SCRIPT" ]
    then
    echo "Running $SCRIPT ..."
    . "$SCRIPT" start
    else
    echo "$SCRIPT is inactive."
    fi
    done
    unset SCRIPT
    fi
    unset USB_BASE

  3. Add Custom Software

    Normally, this can either be done using a Linux distro package manager or a userland package manager such as (link now dead) <a href="http://www.nslu2-linux.org/wiki/Optware/HomePage" title="nslu2-linux.org">Optware</a>, Embedded devices, including this one, often do not have the hardware resources to run a full distro package manager, and quite possibly onboard compilation, and anyway the latter or cross-compiling on another machine is a level of effort and expertise beyond that expected here.  Hence, as an example of what can be achieved, this page demonstrates how to get Optware running on the NMP-1000.

    1. Make a suitable directory on the hard disk for Optware:
      mkdir /share/HARD_DISK_A1/opt
      chmod 755 /share/HARD_DISK_A1/opt

    2. If there is no existing /opt directory, create one …
      mkdir /opt
      chmod 755 /opt
      … otherwise, if the existing /opt directory is non-empty , copy its contents to the new directory:
      cp -a /opt/* /share/HARD_DISK_A1/opt

    3. Bind the two directories:
      mount /share/HARD_DISK_A1/opt /opt -o bind

    4. Create a directory for Optware's package manager ipkg:
      mkdir /opt/ipkg
      chmod 755 /opt/ipkg

    5. Download ipkg into this directory:
      cd /opt/ipkg
      wget http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/stable/ipkg-opt_0.99.163-10_mipsel.ipk

    6. Install ipkg:
      tar -xzf ipkg-opt_0.99.163-10_mipsel.ipk
      cd /
      tar -xzf /opt/ipkg/data.tar.gz

    7. Configure ipkg:
      echo"src/gz optware http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/stable">> /opt/etc/ipkg.conf
      /opt/bin/ipkg update

    At this point an error is encountered …
    ipkg: can't load library 'libipkg.so.0'
    … and examination of /opt/lib shows that there is not the expected symbolic link …
    libipkg.so.0 -> libipkg.so.0.0.0
    … and this is because, as forewarned, symbolic links of the right type cannot be created on an NTFS file system.

Note that if somehow you got the above to work, you need a /mnt/manufacture/autorun.sh such as that listed above for those configuration changes needed for running ipkg to survive a reboot.  So, if you have succeeded in getting this far without the above error, you may wish to reboot now, to ensure that the directory binding survives a reboot and that the system PATH is extended to cover the Optware directories  After the reboot:
ls -al /opt # Shoud show a number of directories, including bin and etc
ipkg --help # Should give ipkg help, without you having to type in the full path

FAQs And Notes On Possible Problems