PS3 Media Server on Synology 411j revisited

Previously I wrote about installing this awesome media server onto a Synology NAS here. However this guide referred to another guide on a different site which subsequently went down, and I couldn’t find a copy of it anywhere else.

So here’s an attempt to rebuild the guide to include the missing steps. Since I’ll just be copying and pasting from the original forum discussion, there might still be errors. If you encounter any, let me know in the comments and we’ll see how we can get it corrected. As always, follow these steps at your own risk. This “worked” when my DSM was 4.0-2197; I cannot guarantee that these steps will work any more (or work at all).

  1. Install nano via ipkg. It’s much easier than vi for the purpose of editing files.
    ipkg install nano
  2. Download the Java SE Embedded Runtime from Oracle here. Choose one Linux version that is appropriate for your Synology’s CPU (in my case, ARMv5 Linux). Try this link to check. Get a file that starts with ejre instead of ejdk. For me, I would download ejre-7u55-fcs-b13-linux-arm-sflt-headless-17_mar_2014.tar.gz. Transfer this file to /volume1/@tmp.
  3. Create a local java installation directory, then copy the archive contents over.
    mkdir /opt/java
    cd /volume1/@tmp
    tar zvxf ejre-7u55-fcs-b13-linux-arm-sflt-headless-17_mar_2014.tar.gz
    mv ejre7u55 /opt/java
    /opt/java/ejre7u55/bin/java -version

    The last command was just to test that java can run. If it doesn’t, maybe you downloaded the wrong version.
    The directory ejre7u55 may be different depending on the version you downloaded (and I didn’t really check if it was ejre7u55 either :P). Adapt accordingly.

  4. Update /etc/profile to include the path to Java.
    nano /etc/profile

    You should be able to add the following safely to the end of the file:-

    PATH=/opt/java/ejre7u55/bin:/opt/bin:/opt/sbin:$PATH
    JAVA_HOME=/opt/java/ejre7u55
    export JAVA_HOME

    Press Ctrl-O to save, then Ctrl-X to exit.

  5. Update /opt/etc/profile. Don’t recall why this step is needed but it doesn’t seem to hurt.
    nano /opt/etc/profile

    File contents (I think this file didn’t exist before, or was empty):

    PS1="[\u@\h \W]$ "
    PATH=/opt/sbin:/opt/bin:/sbin:/bin:/usr/sbin:/usr/bin
    LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}
    JAVA_HOME=/opt/java/ejre7u55export PS1 PATH LD_LIBRARY_PATH JAVA_HOME
  6. At this point, you can try relogging into the terminal and run java without a path to check your file changes.
    java -version
  7. Install classpath via ipkg.
    ipkg install classpath
  8. Install svn and coreutilsvia ipkg.
    ipkg install svn
    ipkg install coreutils
  9. Install git via ipkg.
    ipkg install git
  10. Now we install mplayer.
    mkdir /opt/local/mplayer
    cd /opt/local/mplayer
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    ./configure
    make
    make install

    During one of the steps above, it’ll ask you to include ffmpeg from git. I just did it just to continue.

  11. Continue following the guide till after the libpthread section.
    Backup and replace libpthread libraries.

    mkdir /opt/arm-none-linux-gnueabi/lib_disabled
    mv /opt/arm-none-linux-gnueabi/lib/libpthread* /opt/arm-none-linux-gnueabi/lib_disabled
    cp /lib/libpthread.so.0 /opt/arm-none-linux-gnueabi/lib/
    cd /opt/arm-none-linux-gnueabi/lib/
    ln -s libpthread.so.0 libpthread.so
    ln -s libpthread.so.0 libpthread-2.5.so

    Directory arm-non-linux-gnueabi might be different. Adapt accordingly.

  12. Now we install libzen, libmediainfo, and the mediainfo CLI, in that order. Instead of copying the lib files, I created symbolic links. I didn’t have to do copy/link the libmediainfo files.
    cd /volume1/@tmp/
    wget http://mediaarea.net/download/binary/mediainfo/0.7.68/MediaInfo_CLI_0.7.68_GNU_FromSource.tar.bz2
    tar zxvf MediaInfo_CLI_0.7.68_GNU_FromSource.tar.bz2
    cd /volume1/@tmp/MediaInfo_CLI_GNU_FromSource/ZenLib/Project/GNU/Library
    ./configure –enable-shared=yes
    make
    make install
    ln -s /usr/local/lib/libzen.so.0.0.0 /usr/lib/libzen.so
    cd /volume1/@tmp/MediaInfo_CLI_GNU_FromSource/MediaInfoLib/Project/GNU/Library
    ./configure –enable-shared=yes
    make
    make install
    cd /volume1/@tmp/MediaInfo_CLI_GNU_FromSource/MediaInfo/Project/GNU/CLI
    ./configure -enable-shared=yes
    make
    make install
  13. We install libffi, again using symbolic links instead of copying. make install worked for me.
    cd /volume1/@tmp/
    wget ftp://sourceware.org/pub/libffi/libffi-3.0.9.tar.gz
    tar zxvf libffi-3.0.9.tar.gz
    cd libffi-3.0.9/
    ./configure
    make
    make install
    ln -s /usr/local/lib/libffi.so.5.0.10 /usr/lib/libffi.so
    ln -s /usr/local/lib/libffi.so.5.0.10 /usr/lib/libffi.so.5
    ln -s /usr/local/lib/libffi.so.5.0.10 /usr/lib/libffi.so.5.0.10

    These libffi versions might be different now. Adapt accordingly.

  14. Download PS3 Media Server (grab the generic-linux file, like this one), and put it in /volume1/@tmp. Then unpack it, and move it to a permanent location:
    tar zvxf pms-1.90.1-generic-linux-unix.tar.gz
    mv pms-1.90.1 /opt/local
  15. Add libjnidispatch to the jar file. gjar needs to be run in the PMS folder to preserve the relative placement of the .so file within the jar file.
    cd /volume1/@tmp/
    wget http://ftp.nl.debian.org/debian/pool/main/libj/libjna-java/libjna-java_3.2.7-4_armel.deb
    ar vx libjna-java_3.2.7-4_armel.deb
    tar -xzf data.tar.gz
    mkdir /opt/local/pms-1.90.1/com
    mkdir /opt/local/pms-1.90.1/com/sun
    mkdir /opt/local/pms-1.90.1/com/sun/jna
    mkdir /opt/local/pms-1.90.1/com/sun/jna/linux-arm
    cd /opt/local/pms-1.90.1
    cp /volume1/@tmp/usr/lib/jni/libjnidispatch.so com/sun/jna/linux-arm/
    gjar uf /opt/local/pms-1.90.1/pms.jar com/sun/jna/linux-arm/libjnidispatch.so
    chown -R admin:users /opt/local/pms-1.90.1/

    The last command changes ownership of the PMS directory to admin. Replace with another user if you’re worried about running PMS as root/admin.
    Directory linux-arm may also be different if your NAS not using an ARM processor. The libjna download may also be different. Adapt accordingly.

  16. Link a few more library files for mencoder to work.
    ln -s /opt/lib/liba52.so.0.0.0 /usr/lib/liba52.so.0
    ln -s /opt/lib/libbz2.so.1.0.6 /usr/lib/libbz2.so
    ln -s /opt/lib/libbz2.so.1.0.6 /usr/lib/libbz2.so.1
    ln -s /opt/lib/libbz2.so.1.0.6 /usr/lib/libbz2.so.1.0
    ln -s /opt/lib/libfontconfig.so.1.4.4 /usr/lib/libfontconfig.so
    ln -s /opt/lib/libfontconfig.so.1.4.4 /usr/lib/libfontconfig.so.1
    mencoder

    Last line is just to check if mencoder is still looking for anything. Link accordingly.

  17. Think you need to generate a D-Bus UUID:
    dbus-uuidgen --ensure
  18. Edit your pms.conf file according to your needs. Then you can try running PMS:
    cd /opt/local/pms-1.90.1
    ./PMS.sh

    If it doesn’t work, check the debug.log to see if we missed anything.

Leave a Reply