NasDVR looks good but it looks very limited regarding hardware it can work with.
Since yesterday, I own a Synology DS 710+ (2-bay nas with Intel Atom processor / x86 architecture). Fantastic buy! It is much more quiet than my DS209+II I owned previously, despite being more powerful.
But the best part: It is somewhat more straightforward to get TVHeadend running

. Still not as easy as one would want, but at least doable for anyone with decent knowledge of Linux. And in contrast to my former Synology model, it has no problems with recording 3 channels (on the same transponder) at a time and also streaming them simultaneously to my Ubuntu desktop with VLC.
Unfortunately, a 100% covering howto is difficult to write because there can be differences between the different architectures. But I will try to sum up the major points:
The hardware and driver:
* I bought a "MediaTV pro" stick at
http://www.sundtek.de* The drivers also linked there consist of 1 .sh file with hybrid binary and shell scripting code.
* The driver will install on >= 8 different system architectures that are known to run Linux.
* After the driver is installed, a daemon called "mediasrv" will be running. This one communicates with the hardware and offers the major known devices in /dev (eg. /dev/dvb/* ).
* With "mediaclient -e", you can sum up all devices that are made available
* With "mediaclient -m DVBC -D DVBC", I explicitly told the DVB frontend to be DVB-C
So far, the hardware and getting it to run on almost any Synology NAS is fairly easy.
The major challenge is getting "tvheadend" running, as I stated before. On none of the platforms (even including x86), cross-compiling it proved to give any success. For x86, the compilation process actually succeeds and gives a (at first glance) running binary, but with 2 major problems:
* On a TERM signal, it will not shut itself down probably. All "tvheadend" processes need a KILL signal.
* Performance is downright dramatic. When opening a stream from tvheadend to VLC, the stream is distorted and full of artefacts.
When calling a "uname -a" on the shell of my Synology, I discovered that Synology is running a 64 bit (!) kernel.
Now comes the key part of this whole adventure:
* On my PC, I fired up a VirtualBox, installed a 64 bit version (amd64) of Debian Squeeze.
* Inside that virtual machine installation, I installed "build-essential" and "debootstrap"
* With the latter, I 'bootstrapped' yet another fresh debian installation with architecture type "AMD64". What "debootstrap" does, is take a directory and put a complete (as if just installed from CD) debian installation in it.
* I put the whole directory in a TAR ball (compressed with gzip of bzip) and copied the archive to my Synology.
* Extract the fresh chroot'ed image to a directory on your Synology (I choose "/volume1/@debian"
* In the directory, you should see /bin, /etc, /usr, etc. as If you would see the root of a Linux installation
Now for some configuration:
* In you synology web interface, create a user called "hts". On the Synology part, it does not really need to have access to anything, but on the Linux part, it is good to have a system user that, for example, you can give filesystem permissions for writing in a specific directory for storing recordings.
* In /etc/passwd on your Synology filesystem, lookup the user and copy-paste the line to the /etc/password in your Debian directory. Be especially careful that the UID of the user will not conflict with a UID already in /etc/password of the Debian setup.
* In the debian directory, create a file named "debian_chroot" in the "etc" directory. Put a small identifying text in there. Later on, you can see more easily if you are performing steps inside the chroot jail, or on your synology.
Now the 'black magic' is going to happen:
- Code: Select all
#!/bin/sh
export CHROOTDIR=/volume1/@debian
mount -o bind /dev ${CHROOTDIR}/dev
mount -o gid=4,mode=620 -t devpts none ${CHROOTDIR}/dev/pts
mount -t proc none ${CHROOTDIR}/proc
mount -t usbfs ${CHROOTDIR}/proc/bus/usb ${CHROOTDIR}/proc/bus/usb
mount -t sysfs ${CHROOTDIR}/sys ${CHROOTDIR}/sys
mount -o bind /volume2/video/recording /volume1/@debian/home/hts/recording
This is a shell script that exports/re-directs some essential virtual system directory's to your Debian 'chroot'. Especially /proc and /dev are important, because everythin you are going to run from inside the 'chroot' will need to be able to access the TV stick.
I put the script in /opt/etc/init.d, so the 'Optware' addon I also installed on my Synology will also prepare the chroot at startup of the NAS.
The last command will take the directory I choose to store recordings in and exported it to a directory inside the -to be- chroot. /volume2/video/recording is owned by the "hts" user I created in the steps before and, because the UID in both passwd files is the same, tvheadend should have no problems writing to it.
* Now, execute the following: "chroot /volume1/@debian /bin/bash". Of course, replace the path with whatever path you choose to extract the Debian installation to.
And be amazed: You see whatever string you enterd in /etc/debian_chroot and from now on (for this session), it will seem that you are not on you Synology box anymore but on a Debian system!
Run an "apt-get update" to update package repositories and install whatever you like. I installed "build-essential", "usbutils". Talking about USB, the "lsusb" command contained in the usbutils package should show your list of USB devices connected to the NAS. This way, you also will know that proc is working right.
Now, the most important things to do:
* Install the driver from Sundtek, as I already described above. On my previous Synology, I ran the driver from inside the normal Synology environment, but on the new NAS, I choose to let the Sundtek driver also run from the chroot jail. The "mediasrv" daemons should start and it should be able to communicate with the TV stick
* From
http://www.lonelycoder.com, download "tvheadend". As you will see, the auther offers Debian packages. When you choose to use these and you are running an Intel-based NAS, be sure to pick the AMD64 one! If your Synology kernel is running 64 bit and you run the 32 bit version of TVheadend, it will probably show the same behavior as I described.
When you don't have an Intel-based Synology, you will have to do some work. From inside the chroot-jailed shell, just compile from the tvheadend sources.
When installed, run tvheadend as the "hts" user and be sure to have a home for him (/home/hts). All configuration and tvheadend databases will be under $HOME/.hts .
PHEW... it's a long story, I know. I also hope people will not be too disappointed to see it involves a lot more than just following some simple steps. But unfortunately with all that ARM, Powerpc, X86 and X86-64bit, it is what we have to deal with. So bottom line, the summary:
* Cross-compiling tvheadend to run directly from Synology shell has proven to be a no go. Because of binary problems library trouble, etc.
* Setting up a chroot with Debian (or any favourite linux distribution) is the least intruding way to create an environment within your Synology NAS to experiment to your liking
* But be SURE to have a Linux that consists of binary's and library's that are binary 100% compatible with the architecture of your nas! Especially PowerPC NAS'es with the E500v2-SPE extensions are a PITA, because there are almost no or only few Debian chroot's built for that (see
http://wiki.debian.org/PowerPCSPEPort and
http://download.breakpoint.cc/debian/li ... ny-gnuspe/.
* The sundtek driver can be ran from the chroot jail of the Synology environment. The one or the other may work better for you. If you run it from the Synology environment, you could get trouble with tvheadend accessing /dev/dvb/* from the chroot'ed /dev.
* I still have not created scripts to also automatically start tvheadend and the mediasrv daemon automatically. But it should be as simple as executing "chroot <normal commandline to startup the software>", called from a shellscript

.
Hope this can help some people. I will keep subscribed to this topic so if you run in to any specific problems, feel free to ask. But remember, it is not for the faint of heart and I will not teach people basic Linux skills
