Installing Tvheadend in unRAID
From unRAID
Use these instructions with discretion.
This guide is a walk through for unRAID users that want to be able to compile their own custom kernel in order to enable Multimedia features, and therefore compile and run Tvheadend on an unRAID server. Note that for compiling a kernel requires huge amount of RAM.
These steps made and tested only on unRAID 4.7 and might need to be altered for 5.x series.
Contents |
Dependencies
First of all, you have to satisfy these dependencies:
a) Vanilla copy of Linux kernel;
b) gcc, glibc, binutils, make, patch, perl, ncurses, cpio, pkgtools, cxxlibs, libidn, curl, pkg-config, openssl and infozip packages;
c) Tvheadend source;
d) Vanilla copy of unRAID in the format downloadable from Lime-Technology
At the time of writing, using unRAID 4.7, all those packages can be found at the following locations:
- Linux kernel 2.6.32.9 --> http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.9.tar.gz
- gcc --> http://slackware.oregonstate.edu/slackware-12.2/slackware/d/gcc-4.2.4-i486-1.tgz
- glibc --> http://slackware.oregonstate.edu/slackware-12.2/slackware/l/glibc-2.7-i486-17.tgz
- binutils --> http://slackware.oregonstate.edu/slackware-12.2/slackware/d/binutils-2.18.50.0.9-i486-1.tgz
- make --> http://slackware.oregonstate.edu/slackware-12.2/slackware/d/make-3.81-i486-1.tgz
- cxxlibs --> http://slackware.oregonstate.edu/slackware-12.2/slackware/a/cxxlibs-6.0.9-i486-1.tgz
- pkgtools --> http://slackware.osuosl.org/slackware-12.2/slackware/a/pkgtools-12.1.0-noarch-7.tgz
- perl --> http://slackware.osuosl.org/slackware-12.2/slackware/d/perl-5.10.0-i486-1.tgz
- cpio --> http://slackware.osuosl.org/slackware-12.2/slackware/a/cpio-2.5-i486-3.tgz
- patch --> http://slackware.osuosl.org/slackware-12.2/slackware/a/patch-2.5.4-i486-1.tgz
- ncurses --> http://slackware.osuosl.org/slackware-12.2/slackware/l/ncurses-5.6-i486-3.tgz
- git--> http://slackware.osuosl.org/slackware-12.2/slackware/d/git-1.6.0.3-i486-1.tgz
- libidn--> http://slackware.osuosl.org/slackware-12.2/slackware/l/libidn-1.5-i486-1.tgz
- curl--> http://slackware.osuosl.org/slackware-12.2/slackware/n/curl-7.19.2-i486-1.tgz
- pkg-config--> http://slackware.osuosl.org/slackware-12.2/slackware/d/pkg-config-0.23-i486-2.tgz
- openssl--> http://slackware.osuosl.org/slackware-12.2/slackware/n/openssl-0.9.8i-i486-1.tgz
- infozip--> http://slackware.osuosl.org/slackware-12.2/slackware/a/infozip-5.52-i486-2.tgz
- unRAID 4.7--> http://lime-technology.com/download/doc_download/18-unraid-server-version-47-aio
Installing the kernel source and prepare for compiling
First, download and install all ".tgz" packages above. Make sure you're in the root directory:
$ cd
Create a folder for the packages, then go into this folder:
$ mkdir packages $ cd packages
Download the above packages one by one:
$ wget <linksabove>
Install all the downloaded packages:
$ installpkg <filename>.tgz
You also need to create a temporary directory on one of your drives (instead of the flash drive), because symlinks are not supported on the FAT file system the flash drive formatted with. I used the cache disk for that purposes, but potentially you can use any drive for this.
$ mkdir /mnt/cache/.unraiddev
Unzip the downloaded unRAID package to this folder:
$ unzip unRAID* -d /mnt/cache/.unraiddev/
Go to "/usr/src" directory, and rename the folder "linux" to "linux_original".
$ mv /usr/src/linux /usr/src/linux_original
Now extract the vanilla kernel file (e.g. linux-2.6.32.9.tar.gz ) into "/usr/src":
$ tar -C /usr/src/ -zxvf linux-2.6.32.9.tar.gz
Link the new source directory (e.g. linux-2.6.32.9 ) to "/usr/src/linux" path:
$ ln -sf /usr/src/linux-2.6.32.9 /usr/src/linux
Copy all default drivers and configuration to the new source directory:
Code:
$ cp -rf /usr/src/linux_original/* /usr/src/linux-2.6.32.9/ $ cp -f /usr/src/linux_original/.config /usr/src/linux-2.6.32.9/
Link kernel headers includes to the new source includes:
$ ln -sf /usr/src/linux/include/asm-generic /usr/include/asm-generic $ ln -sf /usr/src/linux/include/linux /usr/include/linux $ ln -sf /usr/src/linux/arch/x86/include/asm /usr/include/asm
Configure and Compile the new Kernel
Be prepared, because here comes the 2nd hardest part (the hardest comes later): you need to reconfigure the kernel config to enable Multimedia support:
$ cd /usr/src/linux/ $ make clean $ make menuconfig
You're in the kernel configuration utility. Scroll down and select (press enter):
$ Device Drivers --->
Now go down to
$ Multimedia Support --->
and press an 'M' on it to compile it as a module. After that, go into Multimedia support (press enter), then configure
$ Video for Linux --->
to be compiled as a module as well by pressing 'M' on it.
After that press 'SPACE' on
$ Enable Video For Linux API 1 (DEPRECATED)
and leave only the new there.
Following that you have to enable the support for your tuner card. To be on the safe side first I suggest not to select your card specifically (unless you're a real expert), but enable the entire
$ DVB for Linux
as a module (unless you only have an analoge card whereas you might only need Video for Linux, but I cannot test this myself) by pressing 'M' once more. (I tried to be smart and selecting only the card I have, but it turned out at the end that DVB-S cards require a SEC controller to be configured as well which I didn't do and spent a week to figure this out)
Probably you also need to dig into
$ Video Capture Adapters and configure the appropriate Video Encoders according to what is on your card.
Once configured everything select 'EXIT' until you see a question: 'Do you wish to save your new kernel configuration?'. Select yes here.
$ make bzImage $ make modules $ make modules_install
Package new bzimage and bzroot files
Copy the fresh bzImage to your boot directory:
$ cp arch/x86/boot/bzImage /boot/bzimage_new
Create a temporary directory and extract the vanilla unRAID bzroot into it:
$ mkdir /mnt/cache/.unraiddev/bz-mod $ cd /mnt/cache/.unraiddev/bz-mod $ zcat ../bzroot | cpio -i -d -H newc --no-absolute-filenames
Backup the 'Extra' directory from it, because it will be removed during syncronization with the new kernel modules:
$ cp -r lib/modules/2.6.32.9-unRAID/extra/ /root/
Syncronize (overwrite) the extracted vanilla modules with the newly compiled modules:
$ rsync -av --delete /lib/modules/2.6.32.9-unRAID/ /mnt/cache/.unraiddev/bz-mod/lib/modules/2.6.32.9-unRAID/
Copy back the saved 'extra' folder after syncronization.
$ cp -r /root/extra/ /mnt/cache/.unraiddev/bz-mod/lib/modules/2.6.32.9-unRAID/
...and here comes the hardest part: you will need to find and place a proper firmware file for your tuner card (note that you also need the firmware file according the firmware version in your card). You're alone with this. I can only use my card as an example here (Hauppauge WinTV-NOVA-HD-S2). This part will not work with another card, again, this is only an example.
$ cd /mnt/cache/.unraiddev/bz-mod/lib/firmware/ $ wget http://www.wintvcd.co.uk/drivers/88x_2_125_28070_WHQL.zip $ unzip -jo 88x_2_125_28070_WHQL.zip Driver88/hcw88bda.sys $ dd if=hcw88bda.sys of=/lib/firmware/dvb-fe-cx24116-1.26.90.0.fw skip=105768 bs=1 count=32674 $ ln -s /lib/firmware/dvb-fe-cx24116-1.26.90.0.fw /lib/firmware/dvb-fe-cx24116.fw
Finally to package the new bzroot:
$ cd /mnt/cache/.unraiddev/bz-mod/ $ find . | cpio -o -H newc | gzip > /boot/bzroot_new
Congratulations, now you have your new bzImage and bzroot files which supports Multimedia.
Installing Tvheadend
Make a directory to store your configuration (e.g. /boot/custom/htsconfig), then go into /boot/custom folder.
$ mkdir -p /boot/custom/htsconfig $ cd /boot/custom/
Checkout the newest Tvheadend, then enter to its directory:
$ git clone git://github.com/tvheadend/tvheadend.git $ cd tvheadend
Configure it with:
$ ./configure --release --disable-avahi
To compile:
$ make
Running Tvheadend
glibc is a runtime dependency, so you will need to reinstall this package on every reboot.
$ mv /root/packages/glibc-2.7-i486-17.tgz /boot/custom/tvheadend
To have glibc reinstalled on every reboot, edit your go script and add:
$ installpkg /boot/custom/tvheadend/glibc-2.7-i486-17.tgz
To run Tvheadend on every reboot add the following line as well to your go script:
$ /boot/custom/tvheadend/build.Linux/tvheadend -c /boot/custom/htsconfig -u root -g video -f
Switch to new bzimage and bzroot files
Now to boot up with your Multimedia enabled kernel you still need to switch to the new image files we created above.
First, make a backup from the original bzimage and bzroot:
$ mv /boot/bzimage /boot/bzimage_original $ mv /boot/bzroot /boot/bzroot_original
Then rename the newly created image files:
$ mv /boot/bzimage_new /boot/bzimage $ mv /boot/bzroot_new /boot/bzroot
After a reboot all the above created temporary files and packages will be removed from the flash drive, the only place you have to remove it manually is the drive you used for packaging unRAID:
$ rm -R /mnt/cache/.unraiddev
Now reboot your unRAID and after the next bootup you should be able to access tvheadend via a web browser:
$ tower:9981
If you don't see your tuner card in Tvheadend configuration panel, then something went wrong during kernel configuration.
