LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-13-2005, 04:28 PM   #1
zuralin
Member
 
Registered: Sep 2003
Distribution: Debian testing/unstable
Posts: 229

Rep: Reputation: 32
HOWTO: install mythtv under debian


Note: This guide isn't for the faint of heart. It requires you to build your own kernel, however if this is really needed isn't known to me. Also, this does not cover setting lirc for one reason: I couldn't get lirc to work, however I did learn of a substitute. Everytime you see "edit FILE" replace edit with your favorite text editor, such as vim, nano, etc.

Before we do anything, go into your BIOS and make sure you set "Halt on" to "No Errors", this allows us to not have a keyboard and mouse attached when booting up.

Install base system, preferably with XFS as the filesystem for the partition where you want to store your recordings (if you prefer something over XFS then use it!)
Add a user (not mythtv) when asked to add users
# apt-get install kernel-source-2.6.11 libncurses-dev kernel-package libdb3-dev docbook-utils defoma-doc psfontmgr x-ttcidfont-conf dfontmgr alsa-base alsa-oss alsa-utils libasound2 nvidia-kernel-source nvidia-kernel-common dh-make cvs gettext-doc fakeroot patchutils curl devscripts build-essential nvidia-settings xserver-xfree86 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-scalable configlet-frontends libfreetype6-dev screen unzip ttf-freefont mysql-client libqt3c102-mt-mysql libdbi-perl libdbd-mysql-perl libmysqlclient12 libmysqlclient12 mysql-server libplrpc-perl gawk libnet-daemon-perl
# apt-get install udev //optional
# cd /usr/src; tar zxvf kernel-source-2.6.11.tar.bz2; tar zxvf nvidia*
# cd kernel-source-2.6.11
# make menuconfig

I can't help you out with compiling the kernel, you NEED to know your hardware. Can anyone confirm if we need to compile our own kernel for all the options used?

# make-kpkg clean
# make-kpkg --initrd --append-to-version=".DATE" kernel_image modules_image
# dpkg -i kernel-image-*.deb nvidia-kernel-*.deb
# shutdown -r now
# edit /etc/X11/XF86Config-4
comment out Load "GLCore", and Load "DRI" under the "Module" Section, and add Load "glx"
delete generic mouse section (optional)
under generic video card replace current driver with nvidia.
Read APPENDIX D in readme.txt for the nvidia drivers to decide what options you need/want in your driver. Here are the relevent portions of /etc/X11/XF86Config-4 that I use.

Section "Device"
Identifier "Generic Video Card"
Driver "nvidia"
Option "NoLogo" "1"
Option "RenderAccel" "1"
Option "ConnectedMonitor" "TV"
Option "UseEdidFreqs" "1"
Option "TVOutFormat" "SVIDEO"
Option "TVOverScan" ".1" # May need to comment this out
Option "TVStandard" "NTSC-M"
EndSection

Section "Monitor"
Identifier "Generic Monitor"
HorizSync 30-50
VertRefresh 60
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "640x480"
EndSubSection
EndSection

Note: You are going to want to play around with TVOverScan later on http://www.ivtv.tv/releases/
grab latest ivtv-0.2.*.tgz and the Current Reccommended Firmware (located at the top of the page)
or just:
$ wget http://www.ivtv.tv/releases/ivtv-0.2...0.2.0-rc3j.tgz
$ tar zxvf ivtv-0.2.0-rc3j.tgz
$ cd ivtv-0.2.0-*/utils
Use wget to grab the latest firmware (located at the top of the page)
$ wget ftp://ftp.shspvr.com/download/wintv-..._1.8.22037.exe

# ~/ivtv*/utils/ivtvfwextract.pl pvr48wdm_1.8.22037.exe
which will place the firmware in your /lib/modules directory

$ cd ~/ivtv-0.2.0-rc3h/driver
$ KERNELDIR=/lib/modules/2.6.11.05092005 make (or wherever your kernel exists)
# make install

You should get a warning similar to:
You appear to have a /lib/modules/2.6.11.05092005/kernel/drivers/media/video/msp3400.ko.
That can cause a conflict with the msp3400.ko from ivtv.
It is wise to remove /lib/modules/2.6.11.05092005/kernel/drivers/media/video/msp3400.ko.
After that run depmod again.

remove that file as root

# depmod -ae

# edit /etc/modutils/ivtv
alias char-major-81 videodev
alias char-major-81-0 ivtv
alias char-major-81-1 ivtv

# update-modules

$ cd ~/ivtv*/utils
$ make
# cp ivtvctl ivtvfbctl /usr/local/bin

$ edit /etc/sysctl.conf
vm/min_free_kbytes=16384

$ edit ~/.profile
if [ -z "$DISPLAY" ] && [ `tty` == /dev/tty1 ]; then
startx
fi

$ edit ~/.xinitrc
/usr/local/bin/ivtvctl -d /dev/video0 -l 2 -u 0x3000 -p 4 -f width=640,height=480 -c dnr_mode=0,dnr_temporal=3,dnr_spatial=3 &
/usr/local/bin/ivtvctl -d /dev/video1 -l 2 -u 0x3000 -p 4 -f width=640,height=480 -c dnr_mode=0,dnr_temporal=3,dnr_spatial=3 &


note: you can try setting the width to 720 to see if you get better results, and also try playing dnr_temporal/spatial to try and get a better picture

$ edit ~/.Xsession
mythfrontend

Add whats listed and any other modules you need loaded at boot time.
# edit /etc/modules
nvidia
evdev
ir-kbd-i2c
ivtv

# edit /etc/apt/sources.list
deb ftp://ftp.nerim.net/debian-marillat/ unstable main
deb http://dijkstra.csh.rit.edu/~mdz/debian unstable mythtv
deb-src ftp://ftp.nerim.net/debian-marillat/ unstable main
deb-src http://dijkstra.csh.rit.edu/~mdz/debian unstable mythtv

Now if you want you can either build from source or grab the binary package. Read on if you want to build from source, else apt-get install mythtv and skip below to where we begin mythtv-setup

# apt-get build-dep mythtv
this will install the necessary packages that are needed to build mythtv from source

# edit /etc/ld.so.conf
/usr/local/lib
# /sbin/ldconfig (courtesy of HappyTux)

$ cd /tmp
# apt-get install nvidia-glx-dev xlibs-dev
# apt-get source mythtv

$ cd /tmp/mythtv-0.18
$ ./configure
# dpkg-buildpackage -rfakeroot -us -uc -b
# dpkg -i libmyth-0.18_0.18-1_i386.deb mythtv-common_0.18-1_all.deb mythtv-backend_0.18-1_i386.deb mythtv-doc_0.18-1_all.deb mythtv-frontend_0.18-1_i386.deb mythtv_0.18-1_all.deb mythtv-database_0.18-1_all.deb

Give the new mythtv user a password
# passwd mythtv

Anything done as a user from now on is done under the mythtv user.

Turn your sound on!
note: if you have not logged out and back in since installing myhtv-common you may need to do that before this works
$ alsamixer
By default everything is muted so your going to want to unmute (using m) and turn just about everything up (using the up arrow)

Since this is going to be a full time MythTV box we need to make sure we don't need to login everytime the box gets restarted (hopefully never)
# apt-get install mingetty
# edit /etc/inittab
Replace: 1:2345:respawn:/sbin/getty 38400 tty1
With: 1:2345:respawn:/sbin/mingetty --autologin mythtv tty1

Create the database:
$ mysql < /usr/share/mythtv/sql/mc.sql

Set a password for the root account in your mysql db
$ mysqladmin -u root password PASSWORD

Now when you installed mythtv-database you probably left the password field blank, so now we are going to make it sure it uses the correct password for root
# dpkg-reconfigure mythtv-database

Now we need to setup an account at http://labs.zap2it.com in order to grab channel information. At the site find the link to Sign Up and follow the instructions. For the Certificate Code enter ZIYN-DQZO-SBUT


Now we need to run mythtv-setup
$ mythtv-setup

Answer the few simple questions, and your given the main interface.

First run through general and make sure everything looks good
Under Capture Cards add a new capture card
Card Type should be MPEG-2 Encoder card, Video device: /dev/video0, Default input: Tuner 0
If you have more than one card add another entry and make sure it uses the next /dev/video available

Next go to the Video Source setup, and fill everything out, which is self explanatory

Next go to Input Connections, for each input you added change the Tuner 0 to the name you used in the previous section

Close the setup by hitting esc a few times


Now lets add some pretty channel icons to our db.
If you didn't compile from source you need to download the source your going to want it now
$ cd /tmp
# apt-get source mythtv

We need to install xmltv in order to grab the icons
# apt-get install xmltv liburi-perl

# cd mythtv-0.18/contrib
# perl mkiconmap.pl
$ mythfilldatabase --import-icon-map iconmap.xml --update-icon-map

MythTV setup should be complete and should start up as soon as you start X. Before we forget let's make sure our channels get updated automatically
$ mythfrontend

Go to Utilities/Setup, Setup, General, click next a bunch of times until you see Automatically run mythfilldatabase, and check it. Change the defaults if you want.


Now let's get that remote working

Make sure the following modules are loaded:

evdev
ir-kbd-i2c

If they aren't, you need to load them via modprobe.

Follow the directions on: http://ivtv.writeme.ch/tiki-index.php?page=Remotes
or you can follow my near identical directions. Make sure to read on for how to create your own remote bindings without using lirc.

$ wget http://dl.bytesex.org/cvs-snapshots/...-115547.tar.gz
$ tar zxvf input-20040421-115547.tar.gz
$ cd input
$ make
# cp lsinput /usr/local/bin/
# cp input-kbd /usr/local/bin/
# cp input-events /usr/local/bin/

To find out your remote you need to use /usr/local/bin/lsinput. Look for something like:

/dev/input/event0
bustype : BUS_I2C
vendor : 0x0
product : 0x0
version : 0
name : "i2c IR (Hauppauge)"
phys : "i2c-0/0-0018/ir0"
bits ev : EV_SYN EV_KEY EV_REP

Remember what event # your remote is on.

You need to create a ~/.remote (or name it whatever you want) file with the correct key codes to get loaded. Here is mine:

0x003d = 116 # KEY_POWER
0x003b = 132 # KEY_FRONT
0x001c = 20 # KEY_T
0x001b = 47 # KEY_V
0x0014 = 103 # KEY_UP
0x0016 = 105 # KEY_LEFT
0x0025 = 28 # KEY_ENTER
0x0017 = 106 # KEY_RIGHT
0x001f = 1 # KEY_ESC
0x0015 = 108 # KEY_DOWN
0x000d = 50 # KEY_M
0x0010 = 27 # KEY_RIGHTBRACE
0x0011 = 26 # KEY_LEFTBRACE
0x000f = 43 # KEY_BACKSLASH
0x0020 = 103 # KEY_UP
0x0021 = 108 # KEY_DOWN
0x0037 = 19 # KEY_R
0x0036 = 24 # KEY_O
0x0032 = 104 # KEY_PGUP
0x0035 = 25 # KEY_P
0x0034 = 109 # KEY_PGDN
0x0024 = 107 # KEY_END
0x0030 = 25 # KEY_P
0x001e = 102 # KEY_HOME
0x0001 = 2 # KEY_1
0x0002 = 3 # KEY_2
0x0003 = 4 # KEY_3
0x0004 = 5 # KEY_4
0x0005 = 6 # KEY_5
0x0006 = 7 # KEY_6
0x0007 = 8 # KEY_7
0x0008 = 9 # KEY_8
0x0009 = 10 # KEY_9
0x0000 = 11 # KEY_0
0x0022 = 18 # KEY_E
0x002e = 45 # KEY_X
0x0038 = 23 # KEY_I
0x0039 = 20 # KEY_T

*Note: My key bindings were modified a bit in mythweb.
# apt-get install mythweb
Point your browser to http://localhost/mythweb/.
I highly reccomend this plugin.

Creating the codes for your own remote can be a pain in the ass. Here is how I managed to create mine tho. First I start a "screen" session. If you don't know how to use screen I reccomend learning. Next create new windows for the follow:
less /usr/src/kernel-source-2.6.11/include/linux/input.h
edit ~/.remote
input-kbd X (where X is the event # your remote is on from above)
tail -f /var/log/messages
(empty) for running input-events

Now you need to press one button and look in the /var/log/messages screen. If you see something come up then you need to take the hex code from there and put it your remote file. For ex:
May 13 16:08:56 localhost kernel: i2c IR (Hauppauge): unknown key: key=0x1a raw=0x379a down=1

Take the key and add two zero's after the 0x so it looks like 0x001a. Now place it in your remote file follow by "=". Now look in the input.h screen to find a key to bind it to. For example, lets say we want to bind that key to 'P'. Find KEY_P in the input.h screen, you should see something like:
#define KEY_P 25

Now go in your ~/.remote file and add the line:
0x001a = 25 # KEY_P

This will set the key you pressed to be the equivalent of typing P on a keyboard.

If nothing showed up /var/log/messages it means that you are pressing a "known" key. In order to find the hex for this key you need to go to the empty screen and use:
$ input-events X (where X is your remote)
Then, press the key again. Something should show up similar to:
13:25:45.454661: EV_KEY KEY_PAUSE pressed
13:25:45.454664: EV_SYN code=0 value=0

Which means you pressed the Pause the key. Now in order to find the hex for this key go to the screen you typed input-kbd X in. These are all of the codes that are set for your remote. Find KEY_PAUSE and grab the hex code and place it in your ~/.remote file. Follow the procedure above to bind a key to it.

Now that your ~/.remote is done you need to make sure it gets loaded when you restart your box.
$ edit ~/.xinitrc
At the top place:
/usr/local/bin/input-kbd -f ~/.remote X (where X is your remote)

This concludes the guide, plase feel free to make any corrections. There has been basically zero editing so I am sure a few things are off. Information taken from a variety of sources including http://www.mythtv.org and http://ivtv.writeme.ch. To add later on: ACPI/APM

Last edited by zuralin; 05-13-2005 at 07:17 PM.
 
Old 05-13-2005, 04:41 PM   #2
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
Nice guide. Might you post it under the Tutorials/Answers section.
 
Old 05-13-2005, 04:58 PM   #3
zuralin
Member
 
Registered: Sep 2003
Distribution: Debian testing/unstable
Posts: 229

Original Poster
Rep: Reputation: 32
Should I just wait for a mod to move it so I don't double post?
 
Old 05-13-2005, 05:13 PM   #4
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
You need to submit it yourself. Go here then click on the "Submit Howto" button. Your submission will be reviewed, and if approved will appear as a Linux Answer. -- J.W.

BTW nice write-up, it looks good to me
 
Old 05-13-2005, 06:53 PM   #5
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Nice post you may want to add right after this part.

Code:
# edit /etc/ld.so.conf
 /usr/local/lib
This

Code:
# /sbin/ldconfig
To have the library cache rebuilt to include the new ones you have added.
 
Old 05-13-2005, 07:17 PM   #6
zuralin
Member
 
Registered: Sep 2003
Distribution: Debian testing/unstable
Posts: 229

Original Poster
Rep: Reputation: 32
Quote:
Originally posted by HappyTux
Nice post you may want to add right after this part.

Code:
# edit /etc/ld.so.conf
 /usr/local/lib
This

Code:
# /sbin/ldconfig
To have the library cache rebuilt to include the new ones you have added.
Thanks, it has been updated.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't get ivtv to work w/ my pvr-150 using jarod's mythtv howto. thewhippingboy Linux - Software 1 07-27-2005 08:11 AM
MythTV install on suse 9.1 YARDofSTUF Linux - Software 8 12-18-2004 10:06 PM
New to MythTV howto configure channels sendas4 Linux - Software 0 11-16-2004 05:37 PM
Ok, so i'm trying to install MythTV... gbdavidx Linux - Software 0 11-02-2004 03:11 PM
Trying to install MythTV rm6990 Linux - Software 1 09-22-2004 03:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration