Installing MythTV on a Fedora Core 3 (fc3) system.

By: Scott M. Kriebel

other projects:
The Linux Alternative Project

Update: 20070922 This document is officially in archive mode. Do not expect any updates. It is here for the "greater good" of the Internet.

After a talk at the local Linux user group, I decided to make my own MythTV box. A few months later the hardware purchases were made and I was finally ready to begin.

If there is once piece of advice I would like to give people is that they research thier hardware purchases. Purchasing the hardware that are known to work in linux and with the MythTV project will make this easier.

The Hardware

ASUS motherboard w/ 1ghz Athon and 1G memory (FIXME: get specs)
I got this motherboard from my employer. When they upgrade a server they just end up giving the hardware away.

Hauppauge PVR-150
After reading the advise of many online tutorials, I went ahead and got a hardware decoding card from Hauppauge. This card comes with a built in IR port and remote you can use. Its also very simple to install in linux.

Soundblaster Audigy
I've bought a Creative Labs sound card for every system I built to date. They just work.

ASUS Nvidia GeForce4
I wanted to get the fastest video card I could with Composite TV out and without a fan.

Dlink DWL-G520 802.11g card
The Netgear WG311 (v3) was my first choice in 802.11 cards. I ended up getting burnt for not doing my research and got a lame chipset. It would only work with ndiswrapper. I would have to restart the interface if I put any type of network load on it. I returned it and got DWL-G520, works like a charm with the madwifi drivers.

The Operating System

I chose Fedora Core 3 as the operating system. Redhat was one of the first distro's I tried and I just kind of stuck with it over the years. YMMV with different distros.

The HOWTO

At this point I am going to assume that you have an freshly installed Fedora Core 3 box with all the applical hardware installed. If you need help with installing Fedora Core 3, there are a lot of good tutorials out there. I suggest sprinkling some google dust and find them. :-)

yum is your friend.
yum is a automated update manager for systems that uses rpm's. I will use it through out this tutorial to install and update packages installed on my system. First, you want the import the GPG keys for the repositories at redhat. Run these commands as root:
#rpm -i /usr/share/rhn/RPM-GPG-KEY-fedora
#rpm -i /usr/share/rhn/RPM-GPG-KEY-fedora-test
Ok, now you want to add the atrpms, freshrpm and livna repositories.

Run the following as root:
# cd /etc/yum.repos.d
# wget http://www.scottkriebel.com/mythtv/fc3/files/atrpms.repo
# wget http://www.scottkriebel.com/mythtv/fc3/files/freshrpms.repo
# wget http://www.scottkriebel.com/mythtv/fc3/files/livna.repo
Then import the GPG key for each:
# rpm -i http://atrpms.net/RPM-GPG-KEY.atrpms
# rpm -i http://freshrpms.net/RPM-GPG-KEY-freshrpms
# rpm -i http://rpm.livna.org/RPM-LIVNA-GPG-KEY
Now I would run yum to update the system. Try the following:
# yum update
This will probably take some time to update what you have, search for updates, resolve dependencies, and finally download and install them.

Installing MySQL
MythTV needs MySQL for the backend, this is simple with yum. Try the following:
# yum install mysql
# yum install mysql-server
# yum install mysql-devel
Installing the video capture card
Ok, first want to make sure that the system sees the Haupauge card. As root, run the following command:
# lspci
This command will list the pci interfaces on your system. One of the results should look like the following:
Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)
We can now attempt to install the ivtv drivers on the system. I opted to install them by source. At the time of this writing, the package "ivtv-0.4.2.tar.gz" is the current, stable version at http://dl.ivtvdriver.org/ivtv/stable/. Change to which ever directory you save your sources (ie. /usr/local/src/ ) and run the following commands.
# wget http://dl.ivtvdriver.org/ivtv/stable/ivtv-0.4.2.tar.gz
# tar -xzf ivtv-0.4.2.tar.gz
# cd ivtv-0.4.2
# make 
# make install
(make compiles the software and make install moves everything where it should be.)
During the make install you should get a few lines that look like the following:
Module /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tveeprom.ko conflicts with the ivtv module of the
same name -- please hide or delete it.
To hide:  mv /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tveeprom.ko 
/lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tveeprom.ko.HID
You will have one of these entries for the following modules: tveeprom.ko, tda9887.ko, media/tuner.ko, msp3400.ko, and one for video/tuner.ko. We want to hide these. As root, run the following commands:
# mv /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tveeprom.ko \
/lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tveeprom.ko.HIDE

# mv /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tda9887.ko \
/lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tda9887.ko.HIDE

# mv /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tuner.ko \
/lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tuner.ko.HIDE

# mv /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/msp3400.ko \ 
/lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/msp3400.ko.HIDE

# mv /lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tuner.ko \
/lib/modules/2.6.12-1.1381_FC3/kernel/drivers/media/video/tuner.ko.HIDE

# depmod -a

Lets add the firmware for the IVTV drivers. You can get these off the driver disk that is included with the PVR-150 but its recommended that you download the drivers from the following site: ftp://ftp.shspvr.com/download/wintv-pvr_150-500/inf/pvr_2.0.24.23035.zip. As root run the following commands:
# wget ftp://ftp.shspvr.com/download/wintv-pvr_150-500/inf/pvr_2.0.24.23035.zip
# unzip pvr_2.0.24.23035.zip
# cp HcwMakoA.ROM /lib/firmware/v4l-cx25840.fw
# cp HcwFalcn.rom /lib/firmware/v4l-cx2341x-enc.fw
Since I have the PVR-150, I only have to add the encoding firmware.

Now we want to add the IVTV module to the kernel. You do this by running the following command as root:
# modprobe ivtv
There will be no output if this executes successfully. To verify, run the following:
# dmesg
You should see a portion of the output look like the following:
ivtv:  ==================== START INIT IVTV ====================
ivtv:  version 0.4.1 (tagged release) loading
ivtv:  Linux version: 2.6.12-1.1381_FC3 686 REGPARM 4KSTACKS gcc-3.4
ivtv:  In case of problems please include the debug info between
ivtv:  the START INIT IVTV and END INIT IVTV lines, along with
ivtv:  any module options, when mailing the ivtv-users mailinglist.
ivtv0: Autodetected WinTV PVR 150 card (cx23416 based)
ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 7
PCI: setting IRQ 7 as level-triggered
ACPI: PCI Interrupt 0000:00:0a.0[A] -> Link [LNKC] -> GSI 7 (level, low) -> IRQ 7
ivtv0: Unreasonably low latency timer, setting to 64 (was 0)
tveeprom: ivtv version
tveeprom: Hauppauge: model = 26032, rev = C199, serial# = 8329185
tveeprom: tuner = TCL 2002N 5H (idx = 99, type = 50)
tveeprom: tuner fmt = NTSC(M) (eeprom = 0x08, v4l2 = 0x00001000)
tveeprom: audio processor = CX25841 (type = 23)
tveeprom: decoder processor = CX25841 (type = 1c)
ivtv0: i2c attach to card #0 ok [client=tveeprom, addr=50]
tuner (ivtv): chip found at addr 0xc2 i2c-bus ivtv i2c driver #0
ivtv0: i2c attach to card #0 ok [client=(tuner unset), addr=61]
cx25840 1-0044: ivtv driver
cx25840 1-0044: cx25841-23 found @ 0x88 (ivtv i2c driver #0)
cx25840 1-0044: loaded v4l-cx25840.fw firmware (14264 bytes)
ivtv0: i2c attach to card #0 ok [client=cx25840, addr=44]
wm8775 1-001b: ivtv driver
wm8775 1-001b: chip found @ 0x36 (ivtv i2c driver #0)
ivtv0: i2c attach to card #0 ok [client=wm8775, addr=1b]
ivtv0: loaded v4l-cx2341x-enc.fw firmware (262144 bytes)
ivtv0: Encoder revision: 0x02050032
ivtv0: Allocate DMA encoder MPEG stream: 128 x 32768 buffers (4096KB total)
ivtv0: Allocate DMA encoder YUV stream: 194 x 10800 buffers (2048KB total)
ivtv0: Allocate DMA encoder VBI stream: 120 x 17472 buffers (2048KB total)
ivtv0: Allocate DMA encoder PCM audio stream: 455 x 4608 buffers (2048KB total)
tuner: type set to 50 (TCL 2002N) by ivtv i2c driver #0
ivtv0: Initialized WinTV PVR 150, card #0
ivtv:  ====================  END INIT IVTV  ====================
It looks like everything has been installed succesfully. You can test this out by doing the following:
# cat /dev/video0 > test.mpg
Let that run for a few moments and then close it by hitting Control-C. The output of the Hauppauge 150 is a native MPEG stream. To test this, try the following:
# mplayer test.mpg
The output will probably be TV static, but at least you know the card is working!

Lets make sure that the card is enabled during boot time. Add the following lines in /etc/modprobe.conf:
#add these lines into /etc/modprobe.conf
alias char-major-81 videodev
alias char-major-81-0 ivtv
Congrats, you have successfully installed the TV turner card!

Installing lircd.
Now we want to install IR (infra red) support. Luckily the Hauppauge PVR-150 comes with a remote, IR reciever and a blaster. For what ever reason, this set was the hardest for me. Unfortunately, I did not take good notes during this period. I may have to come back and rewrite this at some point. But from memory, this is what I did. UPDATE: I am having some issues with lircd still, I suggest you consider this part extremely experimental. From experiences that I had since first writing this document, I think compiling lirc from source is your best bet. FIXME: rewrite this section to cover compiling from source.

First, I installed lirc via yum. I ran the following commands as root.
# yum install lirc-lib-devel
# yum install lirc
# yum install lirc-kmdl-`uname -r`
Now create the appropriate lircd.conf file. I have the grey Hauppauge remote, so you can use the following lircd.conf file. If you have a different remote, sprinkle a little google dust and see whats out there.
# wget http://www.scottkriebel.com/mythtv/fc3/files/lircd.conf -o /etc/lircd.conf
We can now start lircd, the daemon process. Run the following as root.
# /etc/init.d/lircd start
To test the daemon, run the following:
# irw
Now you can press a few buttons on the remote and see the output. Once your done, Control-C out of the program.

This is the point I had some issues. The daemon started but when I ran irw, the daemon would die on me. After some research, I figured out the issue was lircd was not pointing to the correct device. So in the file /etc/sysconfig/lircd, I added the following options.
LIRCD_OPTIONS="-d /dev/lirc0"
You milage may very on this one. Once I made these changes, everything worked fine.

Finally, lets make sure that lircd will start up during boot. Try the following:
# chkconfig lircd on
Installing MythTV.
Ok, we are almost done here. We now want to install MythTV. Download the src and put it in your favorite directory, then try the following:
# tar xzf mythtv-0.18.1.tar.gz
# cd mythtv-0.18.1
# configure
# qmake mythtv.pro
# make
# make install
At this point MythTV should now be installed on the system. The actual configuration is out of the scope of this document. I plan on writing one about my experiences with the software configuration one day. You might want to start here with the MythTV documentation.
~
~
:wq!