MythTV 0.20 + Ubutnu 6.10 + Hauppauge PVR-150 + nVidia GeForce 5500 + SyncMaster 205BW + Dish Network


Sometime in the winter of 2005 I attended a LUG presentation about MythTV.  I was very intrigued and impressed.  MythTV had more features than TiVo and didn't have a monthly charge.  By the middle of spring, 2006, I had assembled all the parts I would need to build a working Myth box.  


I must point out that I have been a Slackware user for years, but that I wouldn't attempt a Myth setup on Slack.  I know people have gotten it to work, but it would have taken a lot more time because the dependencies would need to be managed manually.


Over the next 6 months I tried to get it working using various distributions and hardware configurations, but had a hard time for one reason or another.  I ended up settling on Ubuntu 6.06 and eventually Ubuntu 6.10.  The main reason being that Ubuntu "just worked" with my widescreen Samsung monitor and the nVidia drivers available via apt-get were recent.  I got my monitor to work on Debian, but was frustrated because the latest nVidia drivers were old (didn't seem to support XvMC).


I will attempt to describe what it was like setting up a system from scratch.  Hopefully, this can serve as a guide to a few lost souls. If you happen to find these notes useful, or would just like to offer some suggestions, drop me a message at gdusbabek at gmail dot com.


I am an old school Linux user and am comfortable working as the root user.  If you are not, feel free to sudo everything.


$ sudo passwd root

$ su root


Then I updated /etc/apt/sources.list to include just about everything.


# cat /etc/apt/sources.list


deb http://us.archive.ubuntu.com/ubuntu/ edgy main restricted

deb-src http://us.archive.ubuntu.com/ubuntu/ edgy main restricted

deb http://us.archive.ubuntu.com/ubuntu/ edgy-updates main restricted

deb-src http://us.archive.ubuntu.com/ubuntu/ edgy-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ edgy universe multiverse

deb-src http://us.archive.ubuntu.com/ubuntu/ edgy universe multiverse

deb http://us.archive.ubuntu.com/ubuntu/ edgy-backports main restricted universe multiverse

deb-src http://us.archive.ubuntu.com/ubuntu/ edgy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu edgy-security main restricted universe multiverse

deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted universe multiverse


nVidia Drivers


Install the nVidia drivers.


# apt-get install nvidia-glx

# nvidia-glx-config enable


Achtung!!! Here I made the mistake of restarting X (ctrl+shift+bkspc).  I don't remember exactly what got fouled up, but X wasn't even failing in a way that shunted me out to a command prompt.  I was really hosed.  My solution was to put in the live CD (Ubuntu installation) and manually mount my hard drive.  I replaced the severely busted xorg.conf with the one being used by the live CD, which wasn't that bad.  I then rebooted with success.  After that reconfigured xorg so and selected the nvidia card.


# dpkg-reconfigure xserver-xorg


I modified /etc/X11/xorg.conf to support my Samsung SyncMaster 205BW (a great monitor, by the way).


I realize that I should have run dpkg-reconfigure xserver-xorg after installing the nvidia stuff and before restarting X or my machine.  This is your chance to learn from my mistakes.


Update Ubuntu


Do all of this now, because you won't want to later on unless you really know what you're doing.  Since you will be building several kernel modules, you don't want to upgrade your kernel after building them. 


# apt-get update

# apt-get upgrade

# apt-get install build-essential dialog apache2 mysql-server phpmyadmin gcc-3.4 

# apt-get install libapache2-mod-php5 libapache2-mod-auth-mysql dvdauthor ntp 

# apt-get install ntp-simple gsfonts-x11 tcsh libqt3-mt-mysql


You could have done all of that with one apt-get statement as I did.  I broke it into multiple lines to be easier to read and print.


Make a note of what kernel you are using.  It has ramifications on what version of ivtv you will need to compile later on.


# uname -r


gives me: 2.6.17-10-generic.


Next I need to prepare Ubuntu so that I can build kernel modules and add a bunch of dependencies needed by Myth.  Linux headers are already present in this version (were they in the past? seems like I had to download them before), so I don't need to apt-get them.


# apt-get install linux-restricted-modules-generic linux-source-2.6.17


Xmms and Mplayer will be handy later on.  mplayer will be used to test ivtv and xmms will allow you to listen to some tunes while compiling.


# apt-get install xmms mplayer


Linux Source


# cd /usr/src/linux

# tar -xvjf linux-source-2.6.17.tar.bz2 

# ln -s /usr/src/linux-source-2.6.17 /usr/src/linux

# rm /lib/modules/2.6.17-10-generic/build

# ln -s /usr/src/linux /lib/modules/2.6.17-10-generic/build


Edit the Makefile to set EXTRAVERSION to -10-generic


# cp /boot/config-2.6.17-10-generic /usr/src/linux/.config

# make oldconfig

# make prepare0

# make scripts


ivtv


ivtv is the project that manages the Hauppauge card.  Go to ivtvdriver.org to get the code that applies to your version of the linux kernel.


# cd /usr/src/

# wget http://dl.ivtvdriver.org/ivtv/archive/0.7.x/ivtv-0.7.1.tar.gz

# tar -xvzf ivtv-0.7.1.tar.gz 

# cd ivtv-0.7.1

# make && make install

# depmod

# modprobe ivtv

# echo ivtv >> /etc/modules


You should have no warnings at this point.  If so, go back and check your steps.  Next thing is to load the Hauppauge firmware.


# cd /usr/src/ivtv-0.4.7/utils/

# wget ftp://ftp.shspvr.com/download/wintv-pvr_150-500/inf/pvr_2.0.24.23035.zip

# wget ftp://ftp.shspvr.com/download/wintv-pvr_250-350/inf/pvr_1.18.21.22254_inf.zip

# unzip pvr_2.0.24.23035.zip

# ./ivtvfwextract.pl pvr_1.18.21.22254_inf.zip

# cp HcwMakoA.ROM /lib/firmware/2.6.17-10-generic/v4l-cx25840.fw

# cp HcwFalcn.rom /lib/firmware/2.6.17-10-generic/v4l-cx2341x-enc.fw

# mv /lib/modules/ivtv-fw-dec.bin /lib/firmware/2.6.17-10-generic/

# mv /lib/modules/ivtv-fw-enc.bin /lib/firmware/2.6.17-10-generic/

# cp ../v4l-cx2341x-init.mpg /lib/firmware/2.6.17-10-generic/

# ln -s /lib/firmware/2.6.17-10-generic/ivtv-fw-dec.bin /lib/firmware/2.6.17-10-generic/v4l-cx2341x-dec.fw


You will have to edit /etc/modprobe.d/aliases to reference the ivtv module.  Add the following line:


alias char-major-81-0 ivtv


At this point, I always restart my machine.  I have never got the ivtv drivers to load manually after building without errors.


lirc


Lirc is in charge of sending and receiving IR signals.  For Dish Network users, this is the hardest part of setting up MythTV by far.  If you can make it through this stage intact, you are in good shape.


the first thing to note is that, as of this writing (Oct 2006), the lirc available at lirc.org IS NOT capable of changing the channels on my Echostar 311 tuner using the IR blaster included with the Hauppauge card.  After a lot of thrashing around and then some googling, I happened on a blog entry that cleared a lot of things up (where I got my lircd.conf and channel_changer script).  The next few steps are a synopsis of the instructions from the blog entry.


# cd /usr/src/

# wget http://www.blushingpenguin.com/mark/lmilk/lirc-0.8.1-CVS-pvr150.tar.bz2

# tar -xvjf lirc-0.8.1-CVS-pvr150.tar.bz2 -C /usr/src/

# cd lirc-0.8.1-CVS-pvr150

# ./configure


Choose TV Card, h (not g).  Then have the wizard run configure for you.


# make && make install

# cd /usr/src

# wget http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin

# mv haup-ir-blaster.bin /lib/firmware/


Add the following to /etc/modprobe.d/modutils


alias char-major-61 lirc_pvr150


# echo lirc_pvr150 >> /etc/modules 

# depmod -ae

# modprobe lirc_pvr150


No message is good.


# chmod 666 /dev/lircd

# chmod 666 /dev/lirc

# chmod 666 /dev/lirc0

# chmod 666 /dev/lircm


Copy this custom lircd.conf to /etc/lircd.conf and then start lircd.


# lircd --device=/dev/lirc0


Copy this channel changer script to /usr/local/bin/ and test changing the channel.


# change_channel 1_136_KEY_0

# change_channel 1_136_KEY_5


I had a problem here.  The LED blaster device was not sending a signal.  I could see the red LED blinking, but there was no infrared signal coming out.  I happened to have a serial blaster from an older project laying around that I could cannibalize.  After swapping out the part, it worked.  Your TV should be on channel 5 now.  Additionally, you can use irw to test receiving signals from your remote.


At this point you are finally ready to build myth.  You know, what you originally set out to do.


MythTV


Download and extract the MythTV tarball into /usr/src/.  My nVidia card supports Xvmc, so I want to be sure to enable that, and lirc too.


# cd /usr/src/mythtv-0.20

# ./configure --enable-lirc --enable-xvmc --enable-v4l --enable-ivtv --enable-xvmc-opengl

# qmake mythtv.pro

# make

# make install


Set up rlimits.  I admit that everything up until this point was completely within my realm of linux understanding.  I have never dealt with rlimits though, and can't explain what is going on here without some research of my own.  Add the following to /etc/security/limits.conf:


    *               -       rtprio     0

    *               -       nice       0

    @audio          -       rtprio     50

    @audio          -       nice       0


Next initialize the Mysql database.  The "10.10.2.%" in the grant statement I execute applies to my network only.  If you're unsure about what your values should be, use "%.%.%.%" instead.


# mysql -u root mysql

>UPDATE user SET Password=PASSWORD('root') WHERE user='root';

>FLUSH PRIVILEGES;

>quit

# cd /usr/src/mythtv-0.20/database

# mysql -u root -p < mc.sql

# mysql -u root mythconverg

> grant all on mythconverg.* to mythtv@"10.10.2.%" identified by "mythtv";

> flush privileges;

> quit


Then pick a directory where myth will store videos.  I chose /xfs2/myth/video/


# mkdir /xfs2/myth/video

# chmod a+rwx /xfs2/myth/video/


Go back into normal user mode and setup myth.


# exit

$ mythsetup

$ mythfilldatabase

$ mythfrontend


Adding instructions on how to configure MythTV will require a new write up.  I am not prepared to do that now, but brave users will be able to figure things out without messing up too badly.