MythTV Version 0.21 setup on Slackware 12.1

Written by: Nishant Limbachia
Email: tuxrules _AT_ mnspace dot net
Created: June 18, 2008
Modified: July 6, 2008

NOTE: **This page documents fairly detailed steps to get MythTV installed and running on Slackware 12.1. This also includes compiling other software required to run MythTV smoothly.**

News

Jan 18, 2008 05:45:37 PM CST
I'm back after a long hiatus and eventful 2007. Actually I was planning to update this how-to for 12.0 but got busy and then 12.1 arrived so I got a bit delayed in updating this doc. So here it is...a fairly detailed how-to on running MythTV on Slackware 12.1.

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. I've added two more pieces of hardware since the original setup 1. Hauppauge PVR-150 2. Airlink101 AR5212 (Atheros-based) wifi card

Hardware Setup

Below is listing of new pci hardware that I added

lspci
02:06.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
02:07.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

Software Setup

Operating System: Slackware 12.1 (Full Install)

Slackware 12.1 comes with 2.6.24.5 kernel but I've since upgraded to version 2.6.24.7 and trimmed down the kernel. Here's my kernel config for reference.

Apart from the essential software for mythtv, some additional packages are listed here if you want to extend your box. e.g. I use it to encode video as well. Please check out build scripts in the downloads section or you can use SlackBuilds.org (aka SBo).

Required Software
Optional Software

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 two TV-Tuner cards PVR-350 and PVR-150 and only have DishNetwork so the sat box's output goes to both cards. To change channels for recording, I use serial irblaster (via lirc_serial module).

Installation

Before starting installation, figure out the filesystem type/layout. I am using the following scheme for various partitions. MythTV recordings go to a separate disc mounted on /mythtv.

/dev/hda2	ext3	/
/dev/hda1	ext3	/boot
/dev/hda5	ext3	/var
/dev/hda6	ext3	/home
/dev/hdb1	jfs	/mythtv
/dev/sda1	ext3	/mythstore
none	tmpfs	/tmp
		

Do a full install of Slackware 12.1 and take updates using slackpkg. Configure your custom kernel if you like, refer to my kernel config if you feel like. Also please refer to the ivtv README files in the source package before you configure your kernel.

I usually go in a particular order to take care of the dependencies. You can check out installorder.txt to get started. Once you have your kernel up and running, you can start installing additional software. You can either use the slackbuilds on this site or from Slackbuilds.org...choice is yours.

SlackBuilds

My preferred method of installation is via 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. In addition to those, there are some other packages that I built so check them out too. Please report back any problems or enhancements to tuxrules _AT_ mnspace dot net.

Please don't run the slackbuild scripts before referring to the README in the slackbuild area.

LIRC

For lirc, please run the script the slackbuild script. I've upgraded the script for version 0.8.3 of lirc so everything should work as before.

ivtv

For kernel version 2.6.24.x, use ivtv version 1.0.2, run the build and install the package. If you need TV-out from PVR-350, you'll need xf86-video-ivtv package. You can build and install that package using the slackbuild...check out the slackbuilds section

MythTV

For mythtv, just run the slackbuild and install the package.

Channel Changers

I only use dishnetwork service and since I'm using S-Video out of the receiver, I need a channel changer script to change channels via a separate irblaster. Script is almost identical to the one on LIRCSetup.com. You can get my script in the config section.

Post-Install Configuration

Once you are done installing the packages you need, you can start to configure everything. I'm using mythtv:mythtv (user:group) to run everything. Let's begin by creating a separate user to run mythtv and its daemons. Fill in appropriate values for UID, GID & PASSWORD.

Below is a small post-install checklist, which I'll go through in a bit detail.

MySQL Configuration

Starting mysql and configuring is a bit tricky (if you are not a database guy...like me). Here are the steps that have worked for me.

For more info, check out mysql docs.

LIRC configuration

LIRC uses three config files that are used for get different functionalities of lirc. The slackbuild script for lirc install sample files in /etc. You will have to modify them to fit your needs.

You can find all the above files in the config section, please modify as per your settings.

LIRC devs and users have contributed ir codes for a ton of remotes. All you have to do is to find one that matches your hardware. You can even generate your codes if you have esoteric hardware. Check out the remotes section of LIRC website.

Last but not the least, we need to add udev device entries for lirc. Earlier, we had to append those to the udev config files. Since 12.1, we can add them to a separate file and have udev run it. lirc slackbuild includes 95-lirc.rules file that will be installed and ready to run at boot...no more configuration on user's part.

Xorg Configuration with TV-Out from PVR-350
Basically, Xorg configuration is done in two steps,
Step 1: Modifying xorg.conf file to load appropriate drivers.
Step 2: If you need TV-out from PVR-350, you need to install the ivtv framebuffer driver. Fortunately, installing XDriver has become a lot more easier than before with the new official driver from ivtv project.

Modifying xorg.conf

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 "Files"
	FontPath "/usr/share/fonts/MSTTF/"
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

Installing X11 video driver

TV-Out from PVR-350 requires the latest xorg driver called xf86-video-ivtv. All you have to do is run the slackbuild and install the package. Slackbuild for xf86-video-ivtv is in the slackbuilds section.

Fonts

MythTV uses Arial fonts for some of it menus so if you don't have those installed, even if you have everything working fine, you won't see any menus. Remedy is to msttcorefonts package. Download the source tarball,

mkdir .fonts
ln -s /usr/share/fonts/MSTTF ~/.fonts/MSTTF
mkfontdir ~/.fonts
echo "<dir>/usr/share/fonts/MSTTF</dir>" >> ~/.fonts.conf
Kernel Modules

Handy list of kernel modules that I use, some are hardware specific so adjust accordingly. Usually, I just copy the original rc.modules and rename it to rc.modules.local so all my modifications are outside of the original.

# AMD CPU temperature sensor
/sbin/modprobe k8temp

# AMD Cool&Quiet PowerNow!
/sbin/modprobe powernow-k8
	
# Set the frequency on demand. What you want is what you get
/sbin/modprobe cpufreq_ondemand

# loading acpi modules
/sbin/modprobe fan
/sbin/modprobe button
/sbin/modprobe thermal
/sbin/modprobe processor
/sbin/modprobe video
		
# Loop device support (not network loopback)
/sbin/modprobe loop

# Atheros Wireless driver (only if you have atheros chipset)
# substitute the correct module name.
/sbin/modprobe ath_pci

# lirc modules
/sbin/setserial /dev/ttyS0 uart none
/sbin/modprobe lirc_dev
/sbin/modprobe lirc_i2c
/sbin/modprobe lirc_serial irq=4 io=0x3f8

# ivtv modules, load ivtvfb only if you have connected your mythbox
# to the TV.
/sbin/modprobe ivtv
/sbin/modprobe ivtvfb
Window Manager Configuration

I use fluxbox as my window manager. I use fluxbox startup file to automatically load mythbackend and mythfrontend after starting Xorg. See my minimal fluxbox configuration in the config section. Check fluxbox documentation on if you need further help.

Autologin via KDM

I'm using kdm to startup fluxbox automatically and once fluxbox starts it will read the startup file and load mythbackend, irxevent, mtd and mythfrontend. Look through kdm config in /etc/kde/kdm/kdmrc, locate and change options listed below.

PHPMyAdmin & MythWeb

In order to do remote database admin(e.g. from your desktop/laptop), you need a webserver first. Either use apache or lighttpd. I use Apache as it is bundled with Slackware. Please configure your server and run a firewall, this is absolutely necessary but beyond this how-to. I will however, give out phpmyadmin-specific apache config option. Obviously, you need to replace 192.168.1 with your local net.

<Directory "/var/www/htdocs/mn/phpmyadmin">
Order Deny,Allow
Deny from All
Allow from 192.168.1.
</Directory>

For mythweb, the install instructions in the source tarball are extremely helpful to get started. I followed them closely and was able to setup mythweb in no time.

Additional configuration

If you run IDE drives, adjust supported settings

Most hard drives now have S.M.A.R.T support, run smartctl -a on your hard drive to see the supported settings and apply those in /etc/smartd.conf.

This is absolutely necessary to have your recordings start and end on time.

Again, this is useful (and sometimes essential) if you want to conserve power when the mythbox is not under load.

Nothing more to say here, Running a basic firewall is always helpful...choice is yours.

Here's how my rc.local is setup:

/usr/bin/cpufreq-set -g ondemand

### starting iptables firewall
if [ -x /etc/rc.d/rc.firewall ]; then
	/etc/rc.d/rc.firewall start
fi

### starting S.M.A.R.T daemon
if [ -x /etc/rc.d/rc.smartd ]; then
    /etc/rc.d/rc.smartd start
fi

### starting lirc daemons
if [ -x /etc/rc.d/rc.lircd ]; then
        /etc/rc.d/rc.lircd start
fi

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!!!