Print Version | Search Site

Mythtv, Fedora Core 5, EPIA-M1K motherboard, WinTV PVR 250, and Dish Network 301.

This web page is a collection of notes I took while getting MythTV working with my Dish Network's 301 tuner. I generally don't like installing third party RPM's so all my steps listed will require installing from source code.

  • Hardware
    • EPIA-M1K motherboard
    • WinTV PVR 250
    • Dish Network 301 tuner
  • Software
    • Fedora Core 5 Test 2
    • MythTV SVN (around 0.19 release)

I was hoping to share this information and also store it for my future reference. Feel free to email me if there is a topic that your interested in that I haven't written yet. Chris at cnpbagwell dot com

NOTE: I actually used Fedora Core 5 Test 2 to install since final version isn't currently avaliable. I'm assuming these direction will apply pretty close to the final version as well. Also, these instructions were updated based on Fedora Core 5 Test 3.

Installing Fedora Core 5

I installed Fedora Core 5 normally. Core 5 install application now includes options to select/deselect applications to install. I left all the default applications to be installed and in addition I needed to select the follow.

  • Development
    • Development Libraries
    • KDE Software Developement
  • Servers
    • MySQL
    • Web Server
    • Server Configuration Tools
    • Windows File Server

After the install completed, I rebooted. During the firstboot configuration screen, I disabled SELinux because that tends to cause only headaches.

From this point I did an "yum update" to upgrade all the packages.

During installing of various programs, I noticed the following packages were missing.

 yum install gnupg vim-X11 subversion usbutils libXvMC-devel \
   xorg-X11-drv-via-devel "mesa-lib*" libXmu-devel qt-MySQL \
   php-mysql

Installing custom kernel

The default kernel installed is not optimized for the C3-2 CPU that the EPIA-M has. Also, CPU temperature monitoring support is not currently included in the standard kernel but is avaliable as a patch.

Starting with Fedore Core 3, to recompile the kernel you need to download the Source version of the kernel package.

FIXME: up2date is out of favor... Can this be done with yum?

 up2date --get-source kernel

This downloads it to a semi-wierd location. To install the source code you need to do the following steps. You'll need to replace the downloading kernel*.src.rpm name with whatever you downloaded.

 cd /var/spool/up2date
 rpm -i kernel-2.6.15-1.1097_FC5.src.rpm
 cd /usr/src/redhat/SPECS
 rpmbuild -bp --target noarch kernel-2.6.spec

Now you will have the source code installed under /usr/src/redhat/BUILD.

UPDATE: With Fedora 7, I used the following commands to download and unpack the latest kernel source.

 rpmdev-setuptree 
 su -c 'yumdownloader --source kernel'
 su -c 'yum-builddep kernel-<version>.src.rpm'
 su -c 'yum install sparse'
 rpm -Uvh kernel-<version>.src.rpm

To get the source ready (patch it with Fedora patches):

 cd ~/rpmbuild/SPECS 
 rpmbuild -bp --target=`uname -m` kernel-2.6.spec

CPU temperature sensor

UPDATE: This patch is already included in latest kernels. Not needed to manually add any more.

My mythtv box is a very small box that collects a lot of heat. Plus its got some circulation issues. Because of this, I need to monitor the temperature.

Support for this has in the Linux 2.4 kernels but for some reason the lmsensor project has not yet ported the needed module to the 2.6 kernel. As luck would have it, a nice person has stepped up and done this port and posted their efforts. A patch to add to the 2.6 kernel can be downloaded from vt1211 module for 2.6 kernel.

Get path then patch kernel:

 cd /usr/src/redhat/BUILD/kernel-2.6.15/linux-2.6.15.noarch
 patch -p1 < /path/to/patch/vt1211-vt1211-2.6.15.patch.txt

Compiling the kernel

Now its time to compile the custom kernel. To do this, we need to set some configuration options. To get up the GUI to do this, run the following commands.

 cd /usr/src/redhat/BUILD/kernel-2.6.15/linux-2.6.15.noarch
 [ Edit Makefile. ]
 [ Change EXTRAVERSION to include a custom marker. ]
 [ I suggest EXTRAVERSION=-1.1907_FC5-vt1211 ]
 [ but replace 1.1907_FC5 with your kernel version. ]
 cd configs
 cp kernel-2.6.15-i686.config ../.config
 cd ..
 make xconfig

UPDATE: From Fedora 7's Wiki, I now use the following procedures:

 cd ~/rpmbuild/BUILD/kernel-<version>/linux-<version>.<arch>/
 cp configs/kernel-<version>-<arch>.config .config
 make xconfig

Change Processor Type->Processor Family to VIA C3-2 (Nehemiah).

Verify Power Mangment->CPU Frequency scaling->VIA Cyrix III Longhaul is enabled. Click to compile into kernel to be safe (a check mark instead of a dot). You can disable this feature in software if it gives you problems.

Enable Device Drivers->I2C Support->Hardware Sensors->Via VT1211 SuperIO. FIXME: I think this got renamed to Device Drivers->Hardware Monitoring->Via VT1211 SuperIO.

UPDATE: Under Fedora 7, Its now under Device Drivers->Hardware Monitoring support-> VIA VT1211. This is auto-enabled and doesn't require a patch.

Now do:

 make
 make modules_install install

UPDATE: With Fedora 7, I now use the follwing.

 cd ~/rpmbuild/SPECS 

Edit the kernel-2.6.spec file and uncomment line:

 %define buildid .local

To do the actual build:

 rpmbuild -bb --target=`uname -m` kernel-2.6.spec 
 rpm -ivh ~/rpmbuild/RPMS/i686/kernel-<version>.<arch>rpm 

Reboot and select the new kernel for testing.

Longhaul support

WARNING: Longhaul support has always been flacky. It was working pretty good for a while but with the current linux kernel I keep getting DMA timeouts. Although the system doesn't lock up, it does freeze for 10 seconds at a time.

Fedora Core has support for using the longhaul driver. All that normally would be required is to edit the /etc/cpuspeed.conf and add DRIVER="longhaul". Then the "cpuspeed" program will keep the CPU frequency as low as possible based on CPU load. This will greatly reduce the CPU temperature during idle periods.

I'm also expermenting with having cpuspeed reduce the frequency when its overheating. I'm doing this by pointing to the lm_sensors's i2c output file. My cpuspeed.conf looks like this:

 VMAJOR=1
 VMINOR=1
 OPTS="-t /sys/bus/i2c/drivers/vt1211/*/temp3_input 128000"
 DRIVER="longhaul"

If you seem to be having lockups or other strange behavior then comment out the DRIVER= line and reboot.

CPU Temperature

Login as root and run /usr/sbin/sensors-detect and follow prompts. This should detect vt1211. Allow it to create /etc/sysconfig/lm_sensors.

To see temperature run the "sensors" commnand. FIXME: Use sensors.conf from above link.

Installing IVTV

Download latest software from http://ivtvdriver.org.

 gunzip -dc ivtv-0.7.0.tar.gz | tar xvof -
 cd ivtv-0.7.0
 make
 su
 make install

Before using the ivtv driver, its firmware must also be installed. Please note that the PVR-250 only needs one firmware. Other cards may need more.

ftp://ftp.shspvr.com/download/wintv-pvr_150-500/inf/pvr_2.0.24.23035.zip unzip pvr_2.0.24.23035.zip cp HcwFalcn.rom /usr/lib/hotplug/firmware/v4l-cx2341x-enc.fw modprobe ivtv

When hooking the Dish Network reciever to the PVR-250 card, there are two options. Either via the tuner or the composite input. I chose the composite input. Its useful to remember that this is labeled as Composite Input #3 by IVTV driver even though there is only 1 physical input. This is the value you will give to MythTV.

Building Serial Port IRBlaster

Unless you have the parts alreadying laying around, I suggest checking out this site that has pre-built IRBLaster's for around $15 each. Thats pretty much the same price as buying the parts at Radio Shack. http://www.irblaster.info/

I happen to have a spare serial cable, resisters, and diodes laying around. So I spent the few bucks and bought the IR LED. I lost the link to a nice picture from someone that built the IRBlaster described on LIRC website... I'll keep looking because it was the most useful tip for me.

Compiling lirc for both IRBlaster and IVTV

This site gave useful information on compiling lirc with both IRBlaser and IVTV drivers at the same time and how to use them. http://www.lircsetup.com/lirc/blaster/index.php

That page describes how you can use lirc for both the IR transmitter and for the IR receiver on the WinTV card. I did things a little more simple.

First, you have to have the Linux kernel header files installed for lirc to compile (for what ever reason). This can be installed from the kernel-devel that is associated with you kernel.

 yum install kernel-devel

Next, I grabbed the latest CVS version of LIRC. With each kernel upgrade, something seems to break compiling LIRC that is only resolved by upgradign to latest CVS first.

 cvs -d:pserver:anonymous@lirc.cvs.sourceforge.net:/cvsroot/lirc login
 cvs -z8 -d:pserver:anonymous@lirc.cvs.sourceforge.net:/cvsroot/lirc co lirc
 cd lirc

Next, I used the following command line to compile the IR transmiter mode and install it:

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

This compiled and installed the needed lirc_serial kernel module to allow transmitting remote codes out the IRBlaster. It will also install the lircd deamon program but we are not interested in this version of the binary because it doesn't include support for WinTV's IR receiver.

Now, we need to recompile to install the kernel module that works with the WinTV card.

 ./configure \
 --with-moduledir=/lib/modules/`uname -r`/misc \
 --with-transmitter --with-x --with-driver=hauppauge \
 --with-major=61 --with-port=0x3f8 --with-irq=4
 make
 make install

Last, I recompiled lircd to include support for all drivers and then installed it. Using the "any" with --with-driver doesn't compile or install any kernel modules; it just creates and install a version of lircd that can communicate with any kernel module.

 ./configure \
 --with-moduledir=/lib/modules/`uname -r`/misc \
 --with-transmitter --with-x --with-driver=userspace
 make
 make install

I added the the following to modprobe.conf. This allows giving different device numbers to the WinTV reciver (lirc_i2c) and the IRBlaster (lirc_serial).

 alias char-major-61-0 lirc_i2c
 alias char-major-61-1 lirc_serial
 options lirc_serial irq=4 io=0x3f8 install lirc_i2c 

Add the following to /etc/rc.d/rc.local. This will disable some kernel stuff thats attempting to control the serial port and thn launch 2 seperate copies of lircd to control each IR device.

 /bin/setserial /dev/ttyS0 uart none
 # Try and remove eeprom that lm_sensors may have loaded before
 # doing anything that will load tveeprom for ivtv.  They
 # seem to conflict with each other.
 /sbin/rmmod eeprom
 /sbin/modprobe lirc_i2c
 /sbin/modprobe lirc_serial
 /usr/local/sbin/lircd --device=/dev/lirc0 --output=/dev/lircd
 /usr/local/sbin/lircd --driver=default --device=/dev/lirc1 --output=/dev/lircd1 \
 --pidfile=/var/run/lircd1.pid

The next step is to set up the config files for the WinTV remote and the IRBlaster.

The echostar/SAT_301 file from remotes.tar.gz was the only file that I could get to work with my dish network 301 receiver. Much thanks to all that submitted these files! The file did not contain all the remote buttons but it was pretty easy to figure out the pattern for the missing frequency. So using trial and error I was able to add all the missing buttons in. You can download my http://www.cnpbagwell.com/sat_301_v2 file and append it to your /etc/lircd.conf file.

UPDATE:: I've submitted these changes to the lirc team so you can get the changes by downloading remotes.tar.gz from their website.

For my two pieces of hardware, I copied the following files over to lircd.conf.

 cp remotes/hauppauge/lircd.conf.hauppauge /etc/lircd.conf
 cat remotes/echostar/SAT_301 >> /etc/lircd.conf

NOTE: The lircd.conf.hauppauge includes remote definitions for about 4 different remotes. I had some overlaps with some existing TV remotes. So, for example, when I changed the volume of my TV it would make MythTV start fast forwarding. I suggest deleting the unneeded remotes. In my case, I only needed the hauppauge_pvr remote defined.

Next, starting with MythTV 0.17 the externel channel changing program was not ran in the background. I found that this added around 3-4 seconds to the channel changing process. So I created a simple program that would place itself into the background and change the channel and got my 3-4 seconds back. This program is hardcoded currently to use the remote defined in SAT_301_v2 (it requires the select and cancel buttons defined in it). Its pretty trivial program directly based off of lirc's irsend.

Download http://www.cnpbagwell.com/changechannel.c and install with

 gcc -o changechannel changechannel.c
 cp changechannel /usr/local/bin

A couple of nice points about this channel changing program:

  1. Does it in the background and always returns success sinces its impossible to know if it really work. This saves at least 3 seconds on tunning if not more.
  2. It hits the Cancel button after changing the channel to remove the OSD that Dish Network box puts up. In my test, this makes it unseen.
  3. For 1 digit channel changes, it does Digit + Select button to speed the channel change. For 2 digit channel changes, it pads it with a zero to make it instant. For 3 digit, it only sends the 3 digits. I never use the 4 digit channels so I hope it works OK for those.

Installing Unichrome Drivers

Installing X drivers to support via's MPEG HW decoding used to be pretty difficult. As of Fedora Core 5, all the drivers are included! Nothing special needed.

For extra information on using the installed drivers, I suggest OpenChrome.

Here is a copy of my xorg.conf that I setup to display a picture on an NTSC TV using overscan and the "noscale" option.

Installing MythTV

LAME

Only one package is not in Fedora that the base MythTV application relies on. This is LAME. The latest version cane be downloaded from http://lame.sf.net.

 gzip -dc lame-3.93.1.tar.gz | tar xvof -
 cd lame-3.93.1
 ./configure
 make
 su
 make install

MythTV

More information on MythTV can be found at http://www.mythtv.org and http://wiki.mythtv.org.

I like to compile from the latest SVN sources. MythTV releases are far and few between so you'll get more features this way. SVN has been pretty stable from my experience. So wemake sure that subversion is installed. So make sure you have subversion installed first.

 yum install subversion

Now download and compile:

 svn co http://svn.mythtv.org/svn/trunk/mythtv
 svn co http://svn.mythtv.org/svn/trunk/myththemes
 cd mythtv
 ./configure --enable-xvmc
 qmake mythtv.pro
 make
 make install
 cd ../myththemes
 ./configure
 qmake myththemes.pro
 make
 make install

Now the base MythTV application has been installed.

Need to install a MythTV specific lirc config file to the home directory of the user that MythTV will run as.

 cp configfiles/lircrc.example ~/.lircrc

Make sure MySQL is started during reboots.

 /sbin/chkconfig mysqld on
 /sbin/service mysqld start

Initialize the database.

 cd database
 mysql -u root < mc.sql

Edit /etc/ld.so.conf and make sure that /usr/local/lib is listed. Run /sbin/ldconfig for that change to take effect.

Setup MythTV following the directions in mythtv/docs/mythtv-HOWTO.txt.

To get the backend auto started on reboots, do the following:

 cp mythtv/contrib/etc.rc.d.init.d.mythbackend /etc/rc.d/init.d/mythbackend
 /sbin/chkconfig mythbackend on
 /sbin/service mythbackend start

You can have mythfrontend automatically start up using GNOME. Select System->Preferenes->More Preferences->Sessions. In that program, there is a tab to for "Startup Programs". Add mythfrontend using that.

Also, /usr/sbin/gdmsetup can be used to have a specific user auto login.

FIXME: Post my .lircrc file. Its pretty unique to the PVR 250.

As suggested by install docs, I added the following to the end of /etc/security/limits.conf.

 *               -       rtprio     0
 *               -       nice       0
 @audio          -       rtprio     50
 @audio          -       nice       0

Install mythweb

Edited /etc/httpd/conf/httpd.conf and change AllowOverride None to AllowOverride All in the section for /var/www/html. This was needed by mythweb.

 /sbin/chkconfig httpd on
 /sbin/service httpd start
 cp -r mythweb /var/www/html
 chgrp -R apache /var/www/html/mythweb/data
 chmod g+rw /var/www/html/mythweb/data

Configuring MythTV to be Dish Network-like

I've used the following settings to make MythTV act as close as possible to the Dish Network receivers. The following can be found under the Setup menu on mythfronend.

  • General
    • Master Volume = 85 and PCM Volume = 85
    • Monitor CD/DVD
    • Automoatically run mythfilldatabase
  • Appearance
    • Them = Titivillus
    • GUI Width = 690 Height = 440 X offset = 0 Y offset = 20
  • TV Settings
    • General
      • Change channels immediately without select.
    • Program Guide
      • Use select to change the channel in the program guide.
      • ("Allow channel jumping in guide" would be Dish-like but breaks page up/down on simple remotes)
    • Playback
      • Preferred MPEG2 Decoder = VIA XvMC
      • OSD = Titivillus-OSD
    • Playback Groups
      • Deafult
        • Skip back (seconds) = 10

TV's and overscan

I have a flatscreen Sony TV and a GUI width of 690x440 with a Y offset of 20 works good. I also have an old Magnavox (non-flatscreen) and a GUI width of 690x452 with a Y offset of 16 works good.

Chromakey OSD

The via XvMC support doesn't allow color OSD. There is an experiemental Chromakey OSD though that does work in color. To use this, you current must manually add an entry to the database. Replace yourhost with the output from the command hostname.

 mysql -u root -p mythconverg 
INSERT INTO settings SET value='UseChromaKeyOSD',data='1',hostname='yourhost';

wlan-ng and Netgear MA111

This is pretty specific to my setup. I use a Netgear MA111 for network access when the box is not convient to any LAN connection. All the USB 802.11b devices I found do not have drivers in the kernel.

The wlan-ng driver does have support for this device though. Its kinda a pain to install. Basically, download and install the source code as described in README.

Run the following to make sure its working; modifying with your SSID if auto gives you trouble.

 modprobe prism2_usb
 /sbin/wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
 /sbin/wlanctl-ng wlan0 lnxreq_autojoin ssid=auto authtype=opensystem

Next, I used the system-network-config util to configure the device and made sure to select the option to startup on bootup.

Fedora's gotplug doesn't work with this device because it requires the two wlanctl-ng commands before running ifup. To work around this, I modified the /etc/sysconfig/network-scripts/net.hotplug file to run those two lines before doing any ifup's.

Look for a line similar to:

             if [ -x /sbin/ifup ]; then

Right after that line, add the two wlanctl-ng commands from above.

Powered by PmWiki Last modified: August 06, 2007, at 10:49 PM