Pundit-R + Gentoo + MythTV
Manage your television time-shifting with open source software MythTV on the Gentoo operating system.
Table of Contents
Documentation
1. IntroductionWhy spend big bucks on a Windows Media Center Edition computer when you can build a linux-based PVR for half the price? Open source solutions like MythTV and Freevo provide free and alternative solutions to building your own PVR. Check out features and screenshots of MythTV to view some of it's best qualities.
2. Hardware
Barebone system: Pundit-R
Case: Asus Pundit-R Barebone Case DVI, 4-in-1 card reader, PCMCIA, FireWire IEEE1394, USB 2.0
MotherBoard: ASUS P4R8L based on ATI RS300 chipset (SATA, onboard LAN, Video, 5.1 Sound)
Memory: DDR 333 512mb
Hard Drive: ATA 160gb
DVD: LITE-ON DVD R+/- RW +/-
Tuner Card: Hauppauge PVR-500
However there are many other hardware choices that can be made....Other resources:
We prefer the pundit mythtv frontend as a comprehensive hardware selection and installation tutorial
MythTV Hardware custom system for 500
Super $500 Myth Project
If you'd like to pimp your ride, here are some slick looking custom cases
3. Gentoo Install
Choosing an OS is a very important part to any project. I am a native Debian user and have worked extensively with Fedora. There are solid howtos for these operating systems:
Debian Howto
KnoppMythWiki
FedoraMyth(TV)ology HowTo
MythTV and Gentoo GNU/Linux
Hardware Setup Mythtv - Gentoo-Portage Wiki
Download and burn Gentoo Univeral LiveCD
Boot with default kernel options.
wget http://www.kazer.org/part.shchoose username, hostname, and localdomain
chmod +x part.sh
./part.sh && ./part2.x86.sh
if you need to configure your cpu - more /proc/cpuinfo
proxy server? just press enter unless you have a proxy server.
for
formater /home just type ouiyou can check the progress by typing alt+f2 and ls -sh /mnt/gentoo (full output of script is also available by typing alt+f12)
configure grub:
root (hd0,0)
setup (hd0)
quit
now setup your network - nano /etc/conf.d/net... edit the file to fit your needs (don't forget gateway)
If everything went fine, you're done with the basic gentoo installation!
4. Kernel Configuration
First you will have to make sure a few modules are installed in the kernel.
cd /usr/src/linuxDevice Drivers --->
make menuconfig
Networking Support --->
Ethernet (10 or 100Mbit) --->
<*> 3 COM Cards
<*> 3c590/3c900 series (592/595/597) "Vortex/Boomerang" support
I2C support --->
<*> I2C support
I2C Algorithms --->
<*> I2C bit-banging interfaces
Multimedia devices --->
<M> Video For Linux
Cryptographic options --->
[*] Cryptographic API
<*> MD5 digest algorithm
<*> SHA1 digest algorithm
General setup --->
[*] Kernel .config support
[*] Enable access to .config through /proc/config.gz
Processor type and features --->
Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon) --->
(X) Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon
[ ] Symmetric multi-processing support
Next will upgrade kernel to a more recent release:
emerge sync
emerge -Dup world
emerge -av gentoo-sources
cd /usr/src
rm linux
ln -s linux-2.6.12-gentoo-r10 linux
cd linux
cp ../linux-2.6.11-gentoo-r5/.config .
make menuconfig
make && make modules_installcopy the 3 lines title, root and kernel and change vmlinuz to vmlinux-beta and rename title
cp arch/i386/boot/bzImage /boot/bzImage-2.6.12-r10
ln -s /boot/bzImage-2.6.12-r10 /boot/vmlinuz-beta
nano /etc/grub/grub.conf
5. Alsa
emerge alsa-utilsunmute your sound levels by pressing m and increase volume.
rc-update add alsasound default
/etc/init.d/alsasound start
alsamixer
6. X Setup
emerge fluxboxIf you would like to start X upon boot for each user you will need to type:
echo "exec fluxbox" > .xinitrcHere is my working xorg.conf file
7. ATI TV-Out
/dev/agpgart (AGP Support): MODULE
Direct Rendering Manager (XFree86 4.1.0 and higher DRI support): DISABLED
emerge -C ati-drivers
If you get these errors:
(EE) open /dev/fb0: No such device
this means that you don't have vesa FB installed
(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_ENODEV"
(EE) fglrx(0): cannot init AGP
Be sure to use the ATI AGP driver in character devices, and to load it if it's compiled as module
http://forums.gentoo.org/viewtopic-p-2442329.html#2442329
If the picture is in black and white
Check the standard : was PAL-M in the config, switch to NTSC-M
Also, add CONFIG_PROTECT_MASK="/etc/init.d /etc/rc.d /etc/hotplug /etc/udev /etc/pam.d" to your make.conf file so that etc-update don't bother you with the files in theses directories.
8. ivtv
As of ivtv 0.4.0, it is now recommended that you:
emerge ivtv
Then put the following lines into the configuration file /etc/modules.d/ivtv
alias char-major-81 videodev
alias char-major-81-0 ivtv
alias char-major-81-1 ivtv
options ivtv ivtv_std=1,1 tuner=57,57
If you would still like to build from source, here's how:
wget http://www.ivtv.tv/releases/ivtv-0.3/ivtv-0.3xx.tgzNote: You can also use the driver cd that came with the card.
tar -zxf path-to-ivtv-0.3xx -C /root/
cd ivtv-0.3xx/driver
make && make install
wget http://hauppauge.lightpath.net/software/mce/mce_cd_v27a.zip
mkdir ~/pvrfirmware
unzip mce_cd_v27a.zip -d ~/pvrfirmware
cp ~/pvrfirmware/WinTV-PVR-150500MCE_2_0_30_23074_WHQL/HcwMakoA.ROM /lib/modules
cp ~/pvrfirmware/WinTV-PVR-150500MCE_2_0_30_23074_WHQL/HcwFalcn.rom /lib/modules
ln -sf
/lib/modules/HcwFalcn.rom /lib/modules/ivtv-fw-enc.bin
Then update and load the module:
modules-update
modprobe ivtv
Once you get ivtv installed, if you would like to test your card manually...
emerge mplayerIf you would like to use KaZeR's ivtv tester which outputs some useful information on your card.
mplayer /dev/video0
mplayer /dev/video1
wget http://www.kazer.org/ivtvtester.tgzYou can view my file at http://kazer.homeip.net:81/~fosten/
tar xzvf ivtvtester.tgz
wget http://www.kazer.org/update.sh
chmod +x update.sh
cd /root/ivtvtester
./update.sh
rm test.mpg *.png
cat /dev/video0 > test.mpg
cp test.mpg ivtvtester
ncftp -u username server
mplayer test.mpg -vo png -z 9
ivtvctl -a
ptune.pl -c 34
9. lirc
I have yet to order a remote control for my box, however if you're looking for additional information a good resource is the Gentoo HOWTO_LIRC.
10. MythTV
Before we emerge mythtv we should get media-fonts/corefonts
emerge corefontsNow lets get all the deps for myth, and then the masked version of myth.
echo "media-tv/mythtv ~x86" >> /etc/portage/package.keywordsIf you are planing to use myth through an X server, run this command.
echo "media-plugins/mythvideo ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythdvd ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythbrowser ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythgallery ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythgame ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythmusic ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythnews ~x86" >> /etc/portage/package.keywords
echo "media-plugins/mythweather ~x86" >> /etc/portage/package.keywords
echo "dev-perl/SOAP-Lite ~x86" >> /etc/portage/package.keywords
echo "x11-themes/mythtv-themes ~x86" >> /etc/portage/package.keywords
echo "media-tv/mythtv -directfb" >> /etc/portage/package.use
We can now emerge mythtv and some optional plugins
emerge mythtv mythvideo mythdvd mythbrowser mythgallery mythmusic mythnews mythweatherMythTV should now be installed and ready to configure.
useradd -G users,audio,video,games,wheel mythtvNow let's setup mysql.
passwd mythtv
mkdir /home/mythtv
chown -R mythtv:users /home/mythtv
/usr/bin/mysql_install_dbIf you're in USA to get your tv listings you need to create a zap2it account use the certificate code: ZIYN-DQZO-SBUT.
/etc/init.d/mysql start
mysqladmin -u root password new-password (new-password should be your new password)
rc-update add mysql default
mysql -u root -pnew-password < /usr/share/mythtv/database/mc.sql
mysql -p
drop database test;
Now startx and run mythsetup.
Be sure to associate your tuner card with a tuner in step 2. Capture card type should be mpeg-2 encorder card (pvr-250, pvr350) In step 3 configure the channel data. In step 4, associate your tuner in step 2, with the channel data in step 3. (You need to add your user to the video group if Input Connections in blank.)
Now run mythfilldatabase
To run mythfilldatabase as a daily cron job, issue the command:
# crontab -u mythtv -e
Add the line:
0 1 * * * mythfilldatabase
I needed to adjust my clock.
rm /etc/localtimeAnd my program guide was off by -6:00.
ln -s /usr/share/zoneinfo/EST5EDT /etc/localtime
date
mythsetup
video sources
set to -6:00
If you've already run mythfilldatabase, then you will need to erase your previous channel lineup
mysql -pNow you should have a working MythTV! Check it out, browse some of the features, and record away!
use mythconverg;
delete from program;
If you'd like to monitor precious elements of your backend server, feel free to download this perl script and submit your results. Visit http://www.kazer.org/index.php?page=mythtv
If you're planning on adding additional mythfrontend boxes to your network, you will need to configure your backend to accept connections from multiple clients.
nano /etc/mysql/my.cnf
comment # out the line bind-address = 127.0.0.1
Then setup mysql
use mysql;Then you should set up a samba share
update user set host='%' where user='mythtv';
select user,host,password from user;
select user,host,db from db;
update db set host='%' where user='mythtv';
show databases;
delete from db where db like 'test%';
flush privileges;
/etc/init.d/samba startset the workgroup
cp smb.conf.example smb.conf
nano /etc/samba/smb.conf
add this stanza as a publicly accessible directory
[mythtv]
comment = MythTV Buffers
path = /home/store
public = yes
writable = no
11. MythWeb
The first plug-in we will look at it is the web-based GUI MythWeb.
echo "media-plugins/mythweb ~x86" >> /etc/portage/package.keywordsBrowse to "http://name_or_ip_address/mythweb/" to access the web interface.
emerge mythweb
/etc/init.d/apache2 start
rc-update add apache2 default
nano /etc/conf.d/apache2
change the line to APACHE2_OPTS="-D PHP4 -D DEFAULT_VHOST"
Now we want to secure our MythWeb installation.
htpasswd2 -c /usr/local/sbin/httpd-passwords MYUSER1Please make sure you DO NOT use the -c after the initial user, as this will overwrite the file and start from scratch.
htpasswd2 /usr/local/sbin/httpd-passwords MYUSER2
Modify ownership of the file as follows:
chown apache.apache /usr/local/sbin/httpd-passwordsNow nano /etc/apache2/vhosts.d/00_default_vhost.conf and add the following section:
chmod 640 /usr/local/sbin/httpd-passwords
<Directory "/var/www/localhost/htdocs/mythweb">
Options Indexes FollowSymLinks
AuthType Basic
AuthName "MythTV"
AuthUserFile /usr/local/sbin/httpd-passwords
Require user MYUSER1 MYUSER2
Order allow,deny
Allow from all
</Directory>
Modify the password file location and required users per your needs.
12. MythStreamTV, Torrentocracy, MythStream, and MythPodder
MythStreamTV
KaZeR is the maintainer of a developmental ebuild of MythStreamTV so please visit his site http://kazer.org/index.php?page=code for more information.
Torrentocracy
mkdir -p /usr/local/portage/media-plugins/torrentocracyput the patches in the files directory
mkdir -p /usr/local/portage/media-plugins/torrentocracy/files/
cd /usr/local/portage/media-plugins/torrentocracy
wget http://bugs.gentoo.org/show_bug.cgi?id=92054
nano /usr/local/portage/media-plugins/torrentocracy-0.11.ebuild
change these lines:
RDEPEND="|| ( ~media-tv/mythtv-0.18 ~media-tv/mythfrontend-0.18 )"
DEPEND=">=net-p2p/bittorrent-3.4.0"
to:
RDEPEND="|| ( ~media-tv/mythtv ~media-tv/mythfrontend )"
DEPEND=">=net-p2p/bittorrent"
cd
ebuild /usr/local/portage/media-plugins/torrentocracy/torrentocracy-0.0.11.ebuild digest
echo "media-plugins/torrentocracy ~x86" >> /etc/portage/package.keywords
FEATURES="-sandbox" emerge torrentocracy
rc-update add bittorrent default
MythStream
emerge libxml-perl XML-DOM XML-XQL
wget http://home.kabelfoon.nl/~moongies/sw9vc4htz2/mythstream-v0.16_5.tar.gz
tar xzvf mythstream-v0.16_5.tar.gz
cd mythstream-0.16_5
qmake mythstream.pro
make
make install
cd /usr/share/mythtv
add the following stanzas in the corresponding files:
in library.xml
<button>
<type>STREAM</type>
<text>Play Internet streams</text>
<action>PLUGIN mythstream</action>
<depends>mythstream</depends>
</button>
in media_settings.xml
<button>
<type>STREAM</type>
<text>Stream settings</text>
<action>CONFIGPLUGIN mythstream</action>
<depends>mythstream</depends>
</button>
in themes/blue/theme.xml (for the default theme)
<buttondef name="STREAM">
<image>stream.png</image>
<offset>50,40</offset>
</buttondef>
cd mythstreamweb
sh install.sh
The script will ask for the mythweb location. The command locate program_detail.php will return the correct directory.
MythPodder
To install CastPodder:
echo "dev-python/wxpython unicode" >> /etc/portage/package.useYou will now need to make the changes outlined at http://mysettopbox.tv/phpBB2/viewtopic.php?t=5609
echo "x11-libs/wxGTK unicode" >> /etc/portage/package.use
emerge -av libxml2 pyxmms wxpython
wget http://borgforge.net/frs/download.php/8/CastPodder-3.1.tar.bz2
tar xvjf CastPodder-3.1.tar.bz2
cd castpodder
./install.sh
If you're running a debian system you can simply download and run the runipodder.sh script from the previous thread.
13. MythFrontend
Small embedded computers with little or no moving parts built on mini-itx or soekris boards offer relatively inexpensive solutions for installing a wide-array of slimed-down linux distros and packages. A mythfrontend client is perfectly suited for a diskless architecture because the master backend server does all of the hard work.
As I set out to build my diskless frontend, I found a good amount of information. If you're looking for hardware suggestions some good resources for quiet PCs are silentpcreview.com and endpcnoise.com. Diskless frontend machines are addressed at length in this mythtv-users thread and a linuxpunks.org blog mentions the setup of a gentoo-based diskless frontend. I decided to go with the VIA EPIA-MII6000E because I wanted to install the operating system on a CompactFlash Card and add a wifi card to the CardBus slot. If you plan to use NFS to PXE boot over a network, the VIA EPIA-ME6000 is sufficient.
Here are the Froogle results for each component:
VIA EPIA-MII6000E or VIA EPIA-ME6000
Morex 3688 Mini-ITX case
PC2100 DDR266 DIMM
Sandisk CF 512mb or 1gb
Panasonic CW-8123/8124/UJ845 Slimline Slotloading DVD drive
As a hardware guide we will use:
EpiaHowto
Epia M II - Gentoo Linux
For an operating system we are going to look at:
Embedded Gentoo
Tiny Gentoo
Also of use:
Build your own Gentoo install / boot / rescue LiveCD and USBStick



