Preparing Debian Base Install for MythTV

Introduction

For a more general introduction of what these instructions are and why I wrote them, head over to my main MythTV page.

These instructions - really, more like a cheat sheet - are written for squeeze (6.0). I presume you have --with-recommends (the default in squeeze) enabled for aptitude.

While there is a little bit of hand-holding here, these instructions are not geared toward beginners. You should have a pretty solid background with Debian and a good understanding of how MythTV works in order to understand these instructions. Again, this really is just my notes cleaned-up a little.

Conventions

Code run as root

# run as root

Code run as regular or administrative user

$ run as user

Placeholder for appropriate argument in command

<parameter>

e.g.

$ sudo splashy_config --set-theme <theme>

Insert argument from list of options

<option1|option2>

e.g.

$ sudo aptitude install mysql-<client|server>

Edit file as reflected

filename:

...

Look for a line like this and change it as shown // if not obvious, original will be presented

...

Install Debian squeeze

This is pretty straightforward: install Debian squeeze as you normally would. At the task selection menu, install just the base or standard system. Do not install the full desktop system - you will get much more than you need.

Support Packages

I install a few extras during my automated Debian install. If you are using the stock installer provided by Debian, install the following extra packages:

# aptitude install plymouth v86d sudo ssh screen usbutils hwinfo xfsprogs

sudo

Set sudoers

# visudo

My standard installation has three users: root (obviously), a "standard" account with very specific execute permissions allowed via sudo, and an "administrative" user with full execute access via sudo. The remainder of the commands provided here are run under the administrative account via sudo.

SUDOERS:

...

# User alias specification

User_Alias ADMINS = <super user account>

User_Alias USERS = <regular user account>

...

# Command alias specification

Cmnd_Alias REBOOT = /sbin/reboot

Cmnd_Alias HALT = /sbin/halt

...

# User privilege specification

...

ADMINS ALL = NOPASSWD: ALL

USERS ALL = NOPASSWD: REBOOT, HALT

...

Modify Hostname

Set hostname as appropriate, if not already done during installation

$ sudo nano /etc/hostname

$ sudo hostname --file /etc/hostname

$ sudo nano /etc/hosts

Time Synchronization: ntp or ntpdate

Install ntp (preferred) to maintain proper time

$ sudo aptitude install ntp

Alternately, install ntpdate and run on regular basis (change "M" in the sample crontab to a different, random number, between 0 and 59 of course)

$ sudo aptitude install ntpdate

$ sudo crontab -e

CRONTAB:

# m h dom mon dow command

M * * * * ntpdate 0.pool.ntp.org

Database: mysql

Install mysql-server for master backend, mysql-client (only) for frontend or slave backend

$ sudo aptitude install mysql-<server|client>

For "public" master backends, change mysql bindings (nota bene - configuring as shown will permit ANYONE with network access to your machine to be able to access your mysql databases; use at your discretion)

$ sudo nano /etc/mysql/my.cnf

my.cnf:

...

bind-address = 0.0.0.0 # you also could be more specific, e.g. 192.168.0.2-192.168.0.255

...

$ sudo /etc/init.d/mysql restart

Sound: ALSA

Install ALSA and test it

$ sudo aptitude install alsa-utils

$ sudo amixer | less

Review amixer results to make sure ALSA recognized your card correctly. If not, run alsaconf; see below.

$ sudo alsamixer

Move Master, PCM, (perhaps) Headphone, and (perhaps) Front to an appropriate level (~90%). If you are using a digital output, make sure it is not muted. Test your audio:

$ sudo speaker-test -c2 (tests two channels)

$ sudo speaker-test -c6 (tests six channels, i.e. 5.1)

Capture Card Drivers

Install capture card drivers if necessary

IVTV (not necessary in squeeze):

IVTV and CX18 (e.g. Hauppauge HVR-1600) firmware (needed in squeeze):

  • Obtain firmware (www.ivtvdriver.org for IVTV; see MythTV wiki for CX18)
  • Extract into /usr/lib/hotplug/firmware

Graphical Display: X (x.org)

Install X and test it

$ sudo aptitude install xserver-xorg xbase-clients \

ttf-linux-libertine ttf-mscorefonts-installer \

iceweasel chromium-browser [vnc4server] xvnc4viewer \

openbox libxml2-dev menu obconf python ttf-dejavu xterm roxterm thunar

$ startx

I choose to install a lightweight window manager, openbox, plus a file manager, thunar. If you want a more complete desktop environment complete with graphical login, install gdm and lxde.

I included the installer for the Microsoft core web fonts, since a lot of the MythTV themes still require these fonts. Note that ttf-mscorefonts-installer requires the contrib repository.

Add appropriate users to video, staff (for access to /usr/local), and powerdev groups

$ sudo adduser <user> <audio|video|staff|powerdev>

Display Drivers and Configuration

nVidia GeForce

Install display drivers for nVidia video cards, if needed

  • Download current nVidia driver package
  • Install module-assistant to get the prerequisites for compiling kernel modules
  • Quit X if running
  • Note: MythTV 0.24 is incompatible with the newer, 300-series version of the nVidia drivers. Use a 200-series driver instead (295.75, 295.71, and 275.21 have worked for me).

$ sudo aptitude install module-assistant

$ sudo m-a prepare

$ chmod a+x NV*.run

$ sudo ./NV*.run

ATI/AMD FireGL and Radeon

Install display drivers for ATI or AMD video cards, if needed. You will need to add the non-free repository.

$ sudo aptitude install fglrx-control fglrx-driver

$ sudo aticonfig --initial

Note that this will not enable VAAPI. Upgrade to wheezy to enable VAAPI. Using the packages from squeeze-backports is not recommended.

Graphical Boot: plymouth

Modify appropriate boot files

/etc/initramfs-tools/modules:

...

uvesafb mode_option=800x600-16 mtrr=3 scroll=ywrap

...

/etc/default/grub:

...

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash modeset video=uvesafb:mode_option=800x600-16,mtrr=3,scroll=ywrap"

...

GRUB_GFXMODE=800x600-16

...

/etc/initramfs-tools/conf.d/splash:

...

FRAMEBUFFER=y

...

/etc/modprobe.d/disable-nouveau.conf:

...

blacklist nouveau

options nouveau modeset=0

...

Configure plymouth

$ sudo plymouth-set-default-theme --list # list available themes

$ sudo plymouth-set-default-theme <theme>

$ sudo update-grub

$ sudo update-initramfs -u

$ sudo reboot

Remote Controls: lirc

Install lirc

$ sudo aptitude install lirc lirc-modules-source module-assistant

$ sudo m-a prepare (or module-assistant prepare)

Normally, you would just auto-install the lirc modules with m-a a-i lirc. However, there is a bug in one of the source files that you need to correct manually.

$ sudo m-a get lirc

$ sudo m-a build lirc

The build will fail; choose STOP when it does. Modify the following file near line 402:

/usr/src/modules/lirc-modules/lirc_i2c.c:

...

static struct i2c_driver driver = {

...

.id = I2C_DRIVERID_EXP3, /* FIXME */

#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)

...

Move the line that begins with .id to just below the #if. If you like, here is a patch file:

/usr/local/src/lirc_i2c.c.patch:

--- a/drivers/lirc_i2c/lirc_i2c.c

+++ b/drivers/lirc_i2c/lirc_i2c.c

@@ -399,8 +399,8 @@ static struct i2c_driver driver = {

.name = "i2c ir driver",

},

#endif

- .id = I2C_DRIVERID_EXP3, /* FIXME */

#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)

+ .id = I2C_DRIVERID_EXP3, /* FIXME */

.attach_adapter = ir_probe,

.detach_client = ir_remove,

#else

Apply the patch with

$ sudo patch -u /usr/src/modules/lirc-modules/lirc_i2c.c <location/of/patch/file>

Finish building the lirc modules:

$ sudo m-a --not-unpack build lirc

$ sudo m-a install lirc

$ sudo depmod -a

$ sudo modprobe <lirc_module>

Modify your lirc configuration files

/etc/lirc/hardware.conf:

...

DEVICE=/dev/lirc0

MODULES=<lirc_module, e.g. lirc_usbmce2>

...

Then restart lirc

$ sudo invoke-rc.d lirc restart

For PVR 150, skip debian lirc package and use modified source

Check MythTV wiki

http://www.blushingpenguin.com/mark/blog/?p=24

Quick version:

Download patched lirc 0.8.5

$ cd /usr/local/src

$ sudo tar xfj /path/to/lirc-0.8.5-CVS-pvr150.tar.bz2

$ cd lirc*

$ sudo ./setup.sh

Choose 1 Driver configuration -> 5 TV Card -> i Hauppauge PVR-150 TV card (new I2C layer...)

Choose 3 Save configuration & run configure

$ sudo make

$ sudo make install

$ cd contrib

$ sudo cp lirc.debian.new /etc/init.d/lirc

$ sudo update-rc.d lirc defaults

$ cd /usr/lib/hotplug/firmware

Copy PVR150 blaster firmware and IVTV firmware here

Uninstall current ivtv module so it can re-load

$ sudo rmmod ivtv cx25840 tuner tveeprom msp3400 wm8775 tda9887 saa7115 saa7127

$ sudo nano /etc/modules

Add lirc_pvr150 to the file

Test lirc

$ ls -ld /dev/lirc*

$ sudo chgrp video /dev/<lirc|lirc0>

$ cat /dev/<lirc|lirc0>

Should produce characters on the screen when buttons pressed. Press ^C to stop

Place appropriate configuration in /etc/lirc/lircd.conf or /etc/lircd.conf

$ sudo /etc/init.d/lirc restart

$ irw

lircd should recognized remote control buttons when pressed. Press ^C to stop

$ irsend SET_TRANSMITTERS 1 # if necessary

$ irsend SEND_ONCE <keycode>

Will need to modify /etc/lircd.conf to get irsend to work properly

Finished

System is ready for mythTV packages. Proceed to Installing MythTV.

Links