MythTV UK DVB-T Guide


This guide is based around Gentoo using a DVB-T LR6650 (Conexant CX23881 based board - you can these for around £30 from EBay) and a Nvidia GeForce 4 for s-video out. Much of this info I've put togther with help from Kevin Lee and his DVB web site, also the Gentoo Forums and MythTV mailing list. If you have any comments etc drop me a mail at df -at- comp -dot- lancs -dot- ac -dot- uk.

Configuring the DVB-T hardware

Kernel 2.6.9

From memory I started with kernel 2.6.9-r10 which was probably in portage, the easiest way to go is to just compile everything under:

Device Drivers --- > Multimedia devices --- > Video For Linux --- > Video For Linux

Device Drivers --- > Multimedia devices --- > Video For Linux --- > Digital Video Broadcasting Devices

as modules (you can ignore the radio stuff). Now you don't actually want these modules to be loaded (not with an LR6650 anyway - you won't be able to get all channels), so you may have to turn off coldplug.  Next download the latest Video4Linux snaphot from:
wget http://dl.bytesex.org/cvs-snapshots/video4linux-xx-xx.tar.gz
(If you run into problems video4linux-20041217-141849.tar.gz is known to work with the LR6550) uncompress (tar -zxvf video4linux-xx-xx.tar.gz) and build it with 'make DVB=1' you can now load the modules, it is important that this is done in the right order:
insmod ./btcx-risc.ko
insmod ./video-buf-dvb.ko
insmod ./dvb-pll.ko
insmod ./tveeprom.ko
insmod ./cx88xx.ko
insmod ./cx8802.ko
insmod ./cx22702.ko
insmod ./cx88-dvb.ko
This can be added to your local startup script (/etc/conf.d/local.start in Gentoo) but obviously the paths will need sorting out. I think I ran into problems after running make install though it might be be worth having a play if you use coldplug. If you get dependency errors it's time to go back to you kernel config. If everything works ls /dev/dvb/adaptor0/ will give you:

demux0  dvr0  frontend0  net0

Kernel 2.6.11-rc3

Using the latest 2.6.11-rc3 kernel seems the most pain free method of getting your LR6650 working, download the kernel:

wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.11-rc3.tar.gz

Copy it to /usr/src/ then uncompress it (tar -zxvf linux-xxx.tar.gz) the dowload the patch from www.bytesex.org:

wget http://dl.bytesex.org/patches/2.6.11-rc3-1/All-2.6.11-rc3.diff.gz

Copy it to the directory /usr/src uncompress the patch:

gzip -d All-2.6.11-rc3.diff.gz

Then patch the kernel:

patch -p0 < All-2.6.11-rc3.diff

Build and install your kernel (include all the v4l stuff as modules as per the previous instructions). If you are not running coldplug the modules will be loaded on reboot, otherwise do:

#modprobe btcx-risc
#modprobe video-buf-dvb
#modprobe cx88xx
#modprobe cx8802
#modprobe cx22702
#modprobe cx88-dvb
#modprobe bttv

This can be added to you statup scripts (see above) or add just the names of the modules to your /etc/modules.autoload.d/kernel-2.6 file. If you are not running UDEV used the method from above to see if your hardware is working.

Kernel 2.6.11-rc3 + DVB-t + UDEV (Project Utopia)

Project Utopia attempts to provide unified hardware and device management (e.g. plug in your USB pen and a window pops up showing your files like in windoze), this works really well, check out the HOWTO. The only minor drawback is that you have to modify the UDEV configuration files so that your legacy dev nodes are consistent for MythTV to work (i.e. /dev/dvb/adapter0/... instead of just /dev/dvb0....). Just do:

nano /etc/udev/permissions.d/20-local.permissions

And put in it:

dvb/adapter[0-3]*/*:root:video:0660

Then do:

chmod +x /etc/udev/permissions.d/20-local.permissions

Next:

nano /etc/udev/scripts/dvb.sh

And put in it:

#!/bin/sh
/bin/echo $1 | /bin/sed -e 's,dvb\([0-9]\)\.\([^0-9]*\)\([0-9]\),dvb/adapter\1/\2\3,'

And finally

nano /etc/udev/rules.d/20-local.rules

And put in it

KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c"

When you reboot you should now be getting /dev/dvb/adapter0/... if you have any problems try tweaking the privileges on those files.

Installing MYTH from CVS

To start with you need the following packages emerged (make sure you follow the instructions to enable mod_php in apache):

mplayer lame libvorbis vorbis-tools apache php mod_php

Next you need a copy of the dvb-kernel sources from cvs (blank password) - I never managed to get DVB support working using a copy of the DVB sources from my kernel:

(cd /usr/local && mkdir dvb-kernel && cd dvb-kernel)
cvs -d :pserver:anonymous@linuxtv.org:/cvs/linuxtv login
cvs -d :pserver:anonymous@linuxtv.org:/cvs/linuxtv co dvb-kernel


Download MythTV from CVS (password 'mythtv'):
(cd /usr/local && mkdir mythtv && cd mythtv)
cvs -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs login
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mytht cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythvideo cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythdvd
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythmusic
cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythweather cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythweb
Next you need to configure settings.pro in the mythtv directory, if you edit the file it's fairly easy to see what's going on. The import thing to configure is DVB-T support and the path to your dvb-kernel sources:

# DVB support
CONFIG += using_dvb
DEFINES += USING_DVB
# Note: INCLUDEPATH should point to the directory with
#   'linux/dvb/frontend.h', not the directory with frontend.h
# Note: This _must not_ be your linux kernel source includes.  Copy the dvb
#       includes into a separate directory for now.
INCLUDEPATH += /usr/local/dvb-kernel/dvb-kernel/linux/include/
#define the following if you want On Air Guide information
DEFINES += USING_DVB_EIT

Next build everything using (probably a good idea to put this lot in a script):
cd mythtv
./configure --enable-mp3lame --enable-vorbis
qmake mythtv.pro
make
make install
cd ..

cd mythmusic
./configure --enable-all
qmake mythmusic.pro
make
make install
cd ..

cd mythvideo
qmake mythvideo.pro
make
make install
cd ..

cd mythdvd
./configure --enable-transcode --enable-vcd
qmake mythdvd.pro
make
make install
cd ..

cd mythweather
qmake mythweather.pro
make
make install
cd ..

cp -r mythweb/* /var/www/localhost/htdocs/mythweb
To setup MythTV run mythtv/setup/setup - make sure your 'TV Server' and 'Master Server' are set to the same IP if you only have a single server. I accidentally built MythTv without configuring settings.pro ('Recompile With DVB-Support!' error) and had loads of problems. To clean your MythTv build do:

make uninstall distclean clean

I also had to set the permissions on the image_cache directory so mythweb worked properly.