MythTV Version 0.20 setup on Slackware 11.0

Written by: Nishant Limbachia
Email: tuxrules.in_AT_gmail.com
Created: October 5, 2006 Modified: April 12, 2007

NOTE: **This page documents fairly detailed steps to get MythTV installed and running on Slackware 11.0. This also includes compiling other software required to run MythTV smoothly.**
NOTE: **Newer version of this how-to has been published with mythtv 0.21 and slackware 12.1. Please see the news section below.**

News

July 06, 2008, 09:38 PM CST
Finally found time to upgrade this how-to to slackware 12.1. Please visit MythTV on Slackware 12.1 for the most updated info. ***This page is now deprecated in favor of 12.1***

Apr 12, 2007 07:30 PM CST
Nothing major, just a few changes. Upgraded kernel to version 2.6.19.7 and ivtv to version 0.10.1. Updated the mythtv.SlackBuild to include "INSTALL_ROOT" option to make install. I am not a pro at creating scripts and I was hunting for a hint to do that. Alessandro Ranieri's (alessandro_ranieri_AT_alice.it) build scripts provided the hint. Thanks for the hard work my friend. His packages can be found at the url below.
http://www.slacky.eu/repository/slackware-11.0/multimedia/mythtv/

Feb 27, 2007 05:45 PM CST
I just upgraded my mythtv installation to kernel version 2.6.19.5, upgraded lirc to a stable release (0.8.1), upgraded ivtv to version 0.10.0. I have also upgraded build scripts and added one for ivtv. A few more builds scripts of various packages that I use on my personal desktop. Please refer this upgrade how-to if you want to upgrade your slack-myth box.

Feb 26, 2007 01:15 PM CST
I just noticed ivtv has released driver version 0.10.0, looks like tweaking time...:)

Feb 26, 2007 12:21 PM CST
I've just updated this how-to for minor corrections and also made it a bit more verbose in few places. Since writing this how-to, I've upgraded the kernel, lirc and ivtv packages. I will soon post a how-to on upgrading.



Let's first begin with the hardware. Hardware specs to run mythtv are fairly publicized. You can either refer the official mythtv documentation or PVR Hardware Database. The list below details hardware on my custom built machine specially for mythtv.

Hardware Setup

A bit more detailed look at my hardware...

lspci
00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.1 RAM memory: nVidia Corporation C51 Memory Controller 0 (rev a2)
00:00.2 RAM memory: nVidia Corporation C51 Memory Controller 1 (rev a2)
00:00.3 RAM memory: nVidia Corporation C51 Memory Controller 5 (rev a2)
00:00.4 RAM memory: nVidia Corporation C51 Memory Controller 4 (rev a2)
00:00.5 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.6 RAM memory: nVidia Corporation C51 Memory Controller 3 (rev a2)
00:00.7 RAM memory: nVidia Corporation C51 Memory Controller 2 (rev a2)
00:04.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:05.0 VGA compatible controller: nVidia Corporation C51G [GeForce 6100] (rev a2)
00:09.0 RAM memory: nVidia Corporation MCP51 Host Bridge (rev a2)
00:0a.0 ISA bridge: nVidia Corporation MCP51 LPC Bridge (rev a2)
00:0a.1 SMBus: nVidia Corporation MCP51 SMBus (rev a2)
00:0a.2 RAM memory: nVidia Corporation MCP51 Memory Controller 0 (rev a2)
00:0b.0 USB Controller: nVidia Corporation MCP51 USB Controller (rev a2)
00:0b.1 USB Controller: nVidia Corporation MCP51 USB Controller (rev a2)
00:0d.0 IDE interface: nVidia Corporation MCP51 IDE (rev a1)
00:0e.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev a1)
00:10.0 PCI bridge: nVidia Corporation MCP51 PCI Bridge (rev a2)
00:10.2 Multimedia audio controller: nVidia Corporation MCP51 AC97 Audio Controller (rev a2)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
02:05.0 Multimedia video controller: Internext Compression Inc iTVC15 MPEG-2 Encoder (rev 01)
02:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
cat /proc/cpuinfo
processor       	: 0
vendor_id       	: AuthenticAMD
cpu family      	: 15
model           	: 39
model name      	: AMD Athlon(tm) 64 Processor 3700+
stepping        	: 1
cpu MHz         	: 2200.000
cache size      	: 1024 KB
fdiv_bug        	: no
hlt_bug         	: no
f00f_bug        	: no
coma_bug        	: no
fpu             	: yes
fpu_exception   	: yes
cpuid level     	: 1
wp              	: yes
flags           	: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni lahf_lm ts fid 
vid ttp tm stc
bogomips        	: 2010.87
df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hda3     ext3    9.3G  4.7G  4.2G  54% /
/dev/hda1     ext3     93M   14M   75M  16% /boot
/dev/hda5     ext3     19G  270M   18G   2% /var
/dev/hda6     ext3    7.4G  1.4G  5.6G  20% /home
/dev/hdb1      jfs    280G  168G  112G  61% /mythtv

Software Setup

Operating System: Slackware 11.0 (Full Install) with Dropline GNOME Version 2.16.1. I installed Slackware with huge26.s (kernel version 2.6.17.13) and once installation was done, I recompiled the kernel to include v4l (video4linux) and other stuff. Refer to my kernel config in the files section if you are using kernel version 2.6.17.13.

IMPORTANT NOTE: **I am using 2.6.17.13 kernel headers package that came with slackware**

Some of the software I have listed here may not be required but I'm doing a full install of mythtv with all plugins so this setup works for me. I will also be posting slackbuilds so anybody needing them can use them or even improve them.

Physical Setup

The box I'm using is a head-less stand-alone box that is directly connected to the TV (via PVR-350 TV-Out). MythTV is controlled by LIRC (via the bundled PVR-350 remote). Database administration is done via phpMyAdmin while system admin is done using OpenSSH.

Right now, I'm using one TV-Tuner card (PVR-350) with Dish Network but I'm planning to buy another one soon. The input to PVR-350 is via S-Video cable from the Dish Network set-top box. Since the input is via S-Video, mythtv would not able able to change channels on the set-top box. So to change channels on the set-top box, I am using serial irblaster (via lirc_serial module).

Installation

I would only list steps to install MythTV and some other packages listed above. Slackware 11.0 and Dropline GNOME installation seem fairly simple so I won't go there. My preferred choice of Window Manager is Fluxbox and since we won't see the desktop most of the time on the mythbox, we don't want it to be too resource-heavy. That way we can free-up memory for actual recordings/transcodings.

I've created a convenient fluxbox menu file that is only geared to start mythtv daemons. Please refer the files section for fluxbox-menu.txt file. GDM would be setup as your default login manager after dropline installation. In order to load fluxbox automatically, see autologin option of GDM.

You can also add a special user to do start mythtv. I have made a special group (mythtv) and user (mythtv) to facilitate this. As previously mentioned, I am using an entire disc to save recordings, the disc uses IBM's JFS as the file system mounted on /mythtv. Here's my fstab option to mount /mythtv.

/dev/hdb1 /mythtv jfs auto,users,rw 1 2

My preferred method of installation is via package build scripts (slackbuilds) as it gives nice and easy way to customize/install/upgrade packages. During the course of mythtv installation I prepared slackbuilds for most of the above packages. I am sharing the scripts here in the hope that people will use them and eventually improve them. Tarballs containing slackbuild and slack-desc files can be found in the slackbuild section. Please don't run the slackbuild scripts before referring to the README in the slackbuild area.

LIRC Installation

Since I am using the build-in port remote port on PVR-350 and also using irblaster, I would need lirc_i2c and lirc_serial kernel modules. The most convenient way for me is to use lirc.SlackBuild to build the lirc package. You can follow my lirc.SlackBuild only if you if you have hauppauge PVR-x50 card/remote and also plan to use irblaster serial channel changer. If you intend to build from source follow generic build instructions on the lirc website.

lirc.SlackBuild now uses the latest stable version of lirc. If you are want to live on bleeding edge, you can invoke lirc-cvs.SlackBuild. If you like manual compilation, you can take a clue from configure options shown below and change according to your system.

Here's my configure options for manual lirc (lirc_i2c) compile. You can then make and install lirc with checkinstall.

./configure --prefix=/usr/local --exec-prefix=/usr/local --sysconfdir=/etc \
--datadir=/usr --docdir=/usr/doc/lirc --enable-shared --enable-static \
--with-x --with-driver=hauppauge --with-kerneldir=/usr/src/linux-`uname -r` \
--program-prefix="" --program-suffix=""

In order to build lirc_serial module, clean up the lirc source with make distclean and use the following options accordingly.

./configure --prefix=/usr/local --exec-prefix=/usr/local --with-transmitter --with-x \
--with-moduledir=/lib/modules/`uname -r`/misc --with-driver=serial --with-major=61 \
--with-port=0x3f8 --with-irq=4 --with-moduledir=/lib/modules/`uname -r`/misc

In order to install lirc_serial, just use make to compile and then copy the module to /lib/modules/`uname -r`/misc. Alternatively, you can make a convenient package using checkinstall.

IVTV Installation

ivtv installation is pretty simple. Just follow the instructions in the README file in the source tree. I actually use Checkinstall to make a package which makes it easier to manage in case you need to remove/reinstall ivtv. You still have to install firmware to /lib/firmware. You will find the instructions on installing firmware at the firmware url I just mentioned.

MythTV installation

For mythtv, you can use my mythtv.slackbuild that will install mythtv (along with themes and all plugins) as one package. Alternative, you can install from source instructions for which are fairly simple and included in the source tree of mythtv.

If you choose the later route, here's my configure options if you need to build manually...improvise on them as you like.

### configure options for MythTV 0.20
./configure --prefix=/usr/local --disable-distcc --enable-lirc --enable-xvmc \
--enable-opengl-vsync --enable-x11
### configure options for MythThemes 0.20
./configure --prefix=/usr/local

If you want to build MythBrowser plugin, you need to make a symlink as follows. No attributions here since I learnt of this hack somewhere on the net while searching and I can't remember where I found it. Apologies to the person who mentioned this hack. Please feel free to email me and I will include the attribution.

ln -s /opt/kde /opt/kde3
### configure options for MythPlugins 0.20a
./configure --prefix=/usr/local --enable-all --enable-opengl

SlackBuilds

Not much to say here...just go to slackbuild section and checkout some of my slackbuilds. I would love any feedback, positive or negative, on those slackbuilds. I have only recently started making slackbuilds and started out by shamelessly copying PV's slackbuilds. Concerns, criticisms or a plain-old thank you are all welcome. Email me at tuxrules.in_AT_gmail.com.

Configuration:

Apart from mythtv, lirc and Xorg configuration are somewhat tricky and I only got it working after a couple of attempts. Obviously now it seems trivial and straight-forward.

Xorg Configuration (TV-Out from PVR-350)

TV-Out from PVR-350 needs XDriver from ivtv project called ivtvdev_drv.so. It is actually recommended to install from source but despite many attempts I have not been successful. So I tried a pre-compiled version for gentoo on my machine and it has worked flawlessly. I got the XDriver for modular X.org (6.9/7.0) from mythtv wiki.

cp /path/to/ivtvdev_drv.so /usr/X11R6/lib/modules/drivers

Obviously, you still need edit the xorg configuration file. I started out with xorgconfig on Slackware that generated a generic xorg.conf file. Later I added the following config options to /etc/X11/xorg.conf.

Section "Module"
	# Load "glx" is for nvidia binary driver
	Load "glx"
	# Load "v4l" used to load video4linux module
	Load "v4l"
EndSection

Section "ServerFlags"
	### Option below is start xserver without the mouse
	AllowMouseOpenFail
EndSection

### This section is specifically to use lirc for mouse movements
Section "InputDevice"
	Identifier "LIRC-Mouse"
	Driver "mouse"
	Option "Device" "/dev/lircm"
	Option "Protocol" "IntelliMouse"
	Option "SendCoreEvents"
	Option "Buttons" "5"
	Option "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
	Identifier "NTSC Monitor"
	HorizSync 30-68
	VertRefresh 50-120
	DisplaySize 183 122
	Mode "720x480"
		DotClock 34.564
		HTimings 720 752 840 928
		VTimings 480 484 488 504
		Flags "-HSync" "-VSync"
	EndMode
EndSection

Section "Device"
	Identifier "Hauppauge PVR 350 iTVC15 Framebuffer"
	Driver "ivtvdev"
	# your device can be /dev/fb0 or /dev/fb1
	# Do a cat /proc/fb to find out find out fb device
	Option "ivtv" "/dev/fb0"
	Option "VideoOverlay" "on"
	Option "XVideo" "1"
	# BusID for your video card from /sbin/lspci	
	BusID "PCI:2:5:0"
	Screen 0
EndSection

Section "Screen"
	Identifier "Screen 0"
	Device "Hauppauge PVR 350 iTVC15 Framebuffer"
	Monitor "NTSC Monitor"
	DefaultDepth 24
	DefaultFbbpp 32
		Subsection "Display"
			Depth 24
			FbBpp 32
			Modes "720x480"
		EndSubsection
EndSection

Section "ServerLayout"
# The Identifier line must be present
	Identifier  "Simple Layout"
	### Added "Screen 0" to reflect the section
	Screen "Screen 0"
	
	InputDevice "Mouse1" "CorePointer"
	InputDevice "Keyboard1" "CoreKeyboard"
	### This was to set LIRC as input device along with mouse and keyboard
	InputDevice "LIRC-Mouse"
EndSection
LIRC configuration

First we need to create various lirc config files. Sample files are included in lirc source and you can also find files pertaining to your brand of remote at lirc. lirc uses following three config files:

You can also try and start out with lirc files that I am using and improvise as needed. Visit files area to get the files.

In addition to the above files, we also require IR codes for dish network receiver since the serial channel changer would need them to change the channels. Luckily, good folks at LIRC also provide ir codes for receiver, we just had to copy the files, improvise and include them in our lircd.conf. Download the appropriate file from the remotes section of LIRC website.

Apart from these files, we also need to add udev rules to automatically add device (/dev) entries. lirc source includes a sample lirc rules file which, I have modified it a little more to add MODE & SYMLINK options.

### lirc dev entries
KERNEL=="lirc[0-9]*", NAME="lirc/%n", MODE="0666", SYMLINK+="%k"

Kernel Modules

Now that we are almost done with the installation and configuration part, we need a way to setup kernel modules to load at the every startup to set things in motion. Here are some of the kernel modules I have in my /etc/rc.d/rc.modules. Again, please adjust these according to you system.

### setting up for lirc_serial
/sbin/setserial /dev/ttyS0 uart none

### lirc modules
/sbin/modprobe lirc_dev
/sbin/modprobe lirc_i2c
/sbin/modprobe lirc_serial irq=4 io=0x3f8

### ivtv module
/sbin/modprobe ivtv

### ivtv framebuffer module
/sbin/modprobe ivtv_fb

# AMD Cool&Quiet PowerNow!
/sbin/modprobe powernow-k8

### loading acpi modules
/sbin/modprobe fan
/sbin/modprobe button
/sbin/modprobe processor
/sbin/modprobe thermal
/sbin/modprobe video

# Loading CPU frequency stats
/sbin/modprobe cpufreq_stats
# Loading CPU frequency table
/sbin/modprobe freq_table
# Powersave policy, stick frequency to the slower state.
#/sbin/modprobe cpufreq_powersave
# Performance policy, stick frequency to the faster state.
#/sbin/modprobe cpufreq_performance
# Set the frequency on demand. What you want is what you get
/sbin/modprobe cpufreq_ondemand

Final bits

As a final step we need a way to start lircd and lircmd daemons at boot up. Here's a snippet from my /etc/rc.d/rc.local that will conveniently start up those daemons.

NOTE: After the upgrade, paths to the below mentioned lirc daemons have changed because of change in lirc.SlackBuild. Please refer the upgrade page for more info.

echo "Linux Infrared Remote Control daemon"
/usr/local/sbin/lircd --device=/dev/lirc0 --output=/dev/lircd /etc/lircd.conf \
--pidfile=/var/run/lircd.pid

echo "Linux Infrared Remote Control --- serial"
/usr/local/sbin/lircd --device=/dev/lirc1 --output=/dev/lircd1 \
--pidfile=/var/run/lircd1.pid

echo "Linux Infrared Remote Control Mouse daemon"
/usr/local/sbin/lircmd

That's it...just reboot the machine to check out if things work the way we laid out. You should now be ready to configure mythtv to your liking. Please email me if you have suggestions/criticisms. It would help me better this how-to. ENJOY!!!