[mythtv-users] FC3 + CVS dvb-kernel + Nova-T Install MINI-HOWTO (1Jan05)

merge at paulpettigrew.com merge at paulpettigrew.com
Fri Dec 31 22:27:56 EST 2004


Produced in appreciation of the support and knowledge gained from linux-dvb & 
mythtv-users mailing lists, with the hope of helping others.

(Drafting note - yet to complete modprobe.conf section - tips appreciated!)

Paul

PS: Feedback / improvements most welcome.
PPS: Happy New Year!

===========================================================================
========= FC3 + CVS dvb-kernel + Nova-T Install MINI-HOWTO ================
========= By: Paul Pettigrew, Sydney-Australia. 1 Jan 2005 ================
===========================================================================
0. ACKNOWLEDGEMENTS

This guide is the result of many months of trial & error and a heavy
reliance on  the following information sources:
http://www.linuxtv.org/mailinglists/linux-dvb/
http://wilsonet.com/mythtv/
http://mythtv.info/moin.cgi/FrontPage
http://www.ethics-gradient.net/myth/mythdvb.html
http://www.google.com/
...and many others...

To those who have contributed to their development, thank you. I hope that
this MINI-HOWTO adds to the available documentation and makes it easier
(than it was for me) for others in the future.
---------------------------------------------------------------------------
1. PREAMBLE

Note: FC3 has switched from a static /dev/ directory to one that is
dynamically managed via udev. This allows device nodes to be created on
demand as drivers are loaded. For more information on udev, refer to the
udev(8) man page and the following link:
http://people.redhat.com/~harald/udev.html

This MINI-HOWTO assumes that an FC3 Installation has been completed, and
that a Hauppauge WinTV-NOVA-T DVB card has been installed prior to
installing FC3.

I follow this guide as a pre-requisite to running MythTV, and some of the
steps (such as using apt-get to update the system and setting access rights
for the user 'mythtv') are linked to that outcome.
---------------------------------------------------------------------------
2. GET & INSTALL APT TO UPDATE SYSTEM

Get the latest version of the ATrpms-kickstart tool from:
http://download.atrpms.net/other/packages/fedora-3-i386/atrpms/
atrpms-kickstart-25-1.rhfc3.at.i386.rpm

Now install the apt package list by entering the following:
# rpm –Uvh atrpms-kickstart-25-1.rhfc3.at.i386.rpm

Now we'll run a command that fetches all the latest metadata for apt to
process, so it knows what is out there and available to install:
# apt-get update

With Fedora Core 3, there's a little intermediate step that wasn't
necessary with FC2, but it'll save some trouble at dist-upgrade time:
# apt-get install apt yum modutils

Now kickoff an OS upgrade by entering the following:
# apt-get update && apt-get dist-upgrade

The above command will take an eternity. Once it is done, you can
check what version of kernel is running / installed with the following
commands:
# uname –r
# rpm –qa | grep kernel

Which for me gave the following output (respectively):
2.6.9-1.667

kernel-utils-2.4-13.1.39
kernel-2.6.9-1.667

Ie, that kernel 2.6.9-1.667 is installed. Note: I have experienced udev
segmentation faults with kernel 2.6.9-1.681_FC3, which prevents the
/dev/dvb/adapter0/xxx structure being created. The vanilla FC3 kernel
works just fine.
---------------------------------------------------------------------------
3. SET THE MYKERNEL VARIABLE

Now, we're going to set up a custom environment variable that will make
life easier when installing kernel modules via apt. With the latest
change in kernel module naming conventions (a coordinated effort between
ATrpms, DAG, FreshRPMs and a few other rpm repositories), all systems
can simply use this environment variable, like so:
# export MYKERNEL=`uname -r`
# echo "export MYKERNEL=\`uname -r\`" > /etc/profile.d/kver.sh

The latter command means it will survive reboots (i.e. you cannot set an
environemnt variable in /etc/rc.local).
---------------------------------------------------------------------------
4. CHECKING THE HAUPPAUGE CARD (HARDWARE)

Check to see that the system has detected the Hauppauge WinTV-NOVA-T DVB
card. Type in the following command and look for the phrase
“Multimedia video controller” to check that the card is being recognized
on the PCI bus:
# /sbin/lspci

My Hauppauge NOVA-T, as recognised on the PCI bus, gives me the following:
02:08.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)

To see more detail, enter:
# /sbin/lspci -v
Look for our entry above, and additional lines will be below it:
02:08.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
         Subsystem: Technotrend Systemtechnik GmbH Technotrend-Budget /
Hauppauge WinTV-NOVA-T DVB card
         Flags: bus master, medium devsel, latency 32, IRQ 11
         Memory at f6020000 (32-bit, non-prefetchable) [size=512]

If you don't see your card on the PCI bus, make sure that it's been
installed in a bus-master slot (for some motherboards, only the PCI slots
closest to the AGP slot have this capability).
---------------------------------------------------------------------------
5. OBTAIN THE PATEST NOVA-T DRIVER SOFTWARE (FROM CVS)

With development occurring all the time, it is recommended to get the
latest version of dvb-kernel from CVS by changing to a directory to
download into (e.g. /share) and entering the following for our 2.6 Kernel:
# mkdir /share/dvb-cvs
# cd /share/dvb-cvs
# cvs -d :pserver:anonymous at linuxtv.org:/cvs/linuxtv login
<enter> as password

# cvs -d :pserver:anonymous at linuxtv.org:/cvs/linuxtv co dvb-kernel dvb-apps
---------------------------------------------------------------------------
6. INITIAL CONFIGURATION

Examine the following file obtained in the CVS download for more info:
# vi /share/dvb-cvs/dvb-kernel/linux/Documentation/dvb/udev.txt

Note: this next step should not be required. However, when we run
“./insmod.sh” for the linuxtv drivers, it has an error in that it cannot
find the depmod command when we have su’d. An easy (and not permanent, i.e.
it will be reset when the shell session closes) is to add a directory to
the $PATH, enter the following just to be sure:
# export PATH=$PATH:/sbin

To confirm, view the output of:
# set | grep PATH

This next step is to ensure that when we run make install for the linuxtv
drivers, we do not get errors like “chown:  ‘root.video’:  invalid group”
and only ‘root’ (not our user ‘merge’) being able to access the DVB
devices.
# /usr/sbin/groupadd video
# /usr/sbin/usermod -G video mythtv

Download the firmware (~12.6 Mb) for our device by entering:
# cd /share/dvb-cvs/dvb-kernel
# linux/Documentation/dvb/get_dvb_firmware tda10045

This will take a couple of minutes to download, and the final display
output should be as follows:
20:54:13 (20.10 KB/s) - `tt_budget_217g.zip' saved [12,656,253/12,656,253]
Firmware dvb-fe-tda10045.fw extracted successfully. Now copy it to either
/lib/firmware or /usr/lib/hotplug/firmware/
(depending on your hotplug version).

Copy the firmware files to the following location and filename (which is
required in FC3’s udev setup), by entering:
# cp dvb-fe-tda10045.fw /lib/firmware

NB, not to either /usr/lib/hotplug/firmware/ or /etc/firmware/
---------------------------------------------------------------------------
7. SETUP FOR DVB DEVICE ENTRIES

In FC3, the MAKEDEV-DVB.sh method has been superceded by using the udev
system. I.e., FC3 has switched from a static /dev/ directory to one that
is dynamically managed via udev. This allows device nodes to be created on
demand as drivers are loaded.

For more information on udev, refer to the udev(8) man page and the
following link: http://fedora.redhat.com/docs/udev/

Examine the following file just obtained in the CVS download for more info:
# vi /share/dvb-cvs/dvb-kernel/linux/Documentation/dvb/udev.txt

We will need to upgrade udev first. Check what you have, with:
# rpm –qa | grep udev

If you get the following:
udev-039-10.FC3.5

You need to upgrade! If not, you will eventually get the following output
when you (do not enter these instructions at this stage):
# ./insmod.sh load
# ls /dev/d*

/dev/dnrtmsg  /dev/dvb0.demux0  /dev/dvb0.frontend0
/dev/dsp      /dev/dvb0.dvr0    /dev/dvb0.net0

Which is NOT what we want!

Download udev-042-1 (4 Nov 04) from here: http://download.atrpms.net/
mirrors/fedoracore/development/i386/SRPMS/udev-042-1.src.rpm

Install this source RPM with the following commands:
# rpmbuild --rebuild udev-042-1.src.rpm

About ~13 lines from the bottom, you will see a line like:
Wrote: /usr/src/redhat/RPMS/i386/udev-042-1.i386.rpm

If so, great – you had a successful compile. Now, upgrade udev by entering
the following:
# rpm –Uvh /usr/src/redhat/RPMS/i386/udev-042-1.i386.rpm

Check that we have upgraded successfully, with:
# rpm –qa | grep udev

If you now get the following:
udev-042-1

You are all done. Reboot the system to test the correct operation of udev
after the upgrade.

Now, we need to create a proper udev rule that will create the device
nodes. The main udev configuration file (/etc/udev/udev.conf) tells you
the directory where the rules are. Enter the following to find out:
# cat /etc/udev/udev.conf | grep udev_rules

You should see something like:
# udev_rules - The name and location of the udev rules file
udev_rules="/etc/udev/rules.d/"

Assuming you get the same output (vary to suit), enter the following to
create a new rule file:
# vi /etc/udev/rules.d/51-dvb.rules

And enter the following lines:
KERNEL="dvb0.dvr*",        NAME="dvb/adapter0/dvr%n"
KERNEL="dvb0.demux*",      NAME="dvb/adapter0/demux%n"
KERNEL="dvb0.frontend*",   NAME="dvb/adapter0/frontend%n"
KERNEL="dvb0.audio*",      NAME="dvb/adapter0/audio%n"
KERNEL="dvb0.ca*",         NAME="dvb/adapter0/ca%n"
KERNEL="dvb0.osd*",        NAME="dvb/adapter0/osd%n"
KERNEL="dvb0.net*",        NAME="dvb/adapter0/net%n"
KERNEL="dvb0.video*",      NAME="dvb/adapter0/video%n"

KERNEL="dvb1.dvr*",        NAME="dvb/adapter1/dvr%n"
KERNEL="dvb1.demux*",      NAME="dvb/adapter1/demux%n"
KERNEL="dvb1.frontend*",   NAME="dvb/adapter1/frontend%n"
KERNEL="dvb1.audio*",      NAME="dvb/adapter1/audio%n"
KERNEL="dvb1.ca*",         NAME="dvb/adapter1/ca%n"
KERNEL="dvb1.osd*",        NAME="dvb/adapter1/osd%n"
KERNEL="dvb1.net*",        NAME="dvb/adapter1/net%n"
KERNEL="dvb1.video*",      NAME="dvb/adapter1/video%n"

KERNEL="dvb2.dvr*",        NAME="dvb/adapter2/dvr%n"
KERNEL="dvb2.demux*",      NAME="dvb/adapter2/demux%n"
KERNEL="dvb2.frontend*",   NAME="dvb/adapter2/frontend%n"
KERNEL="dvb2.audio*",      NAME="dvb/adapter2/audio%n"
KERNEL="dvb2.ca*",         NAME="dvb/adapter2/ca%n"
KERNEL="dvb2.osd*",        NAME="dvb/adapter2/osd%n"
KERNEL="dvb2.net*",        NAME="dvb/adapter2/net%n"
KERNEL="dvb2.video*",      NAME="dvb/adapter2/video%n"

KERNEL="dvb3.dvr*",        NAME="dvb/adapter3/dvr%n"
KERNEL="dvb3.demux*",      NAME="dvb/adapter3/demux%n"
KERNEL="dvb3.frontend*",   NAME="dvb/adapter3/frontend%n"
KERNEL="dvb3.audio*",      NAME="dvb/adapter3/audio%n"
KERNEL="dvb3.ca*",         NAME="dvb/adapter3/ca%n"
KERNEL="dvb3.osd*",        NAME="dvb/adapter3/osd%n"
KERNEL="dvb3.net*",        NAME="dvb/adapter3/net%n"
KERNEL="dvb3.video*",      NAME="dvb/adapter3/video%n"

The next step is to provide a little more control over the device nodes
(i.e. to enable a special group membership). We do this by adding a
section to the udev permissions file, enter:
# vi /etc/udev/permissions.d/50-udev.permissions

Add the following section to the end of the file:
# DVB devices
dvb/*:$local:video:0660
dvb:$local:video:0660
dvb/adapter*:$local:video:0660
Finished! Now, we do not need to run the MAKEDEV-DVB.sh script to create
/dev/dvb/xxx entries
---------------------------------------------------------------------------
8. COMPILING THE DRIVERS

Now, compile the drivers, by entering the following:
# cd build-2.6
# make

At this stage, there will be no devices. Confirm by entering:
# ls /dev/d*

You will just see:
/dev/dnrtmsg  /dev/dsp  /dev/dvd

To unload the drivers that may already be loaded (but are not our fresh
CVS ones), and to load up our CVS ones, enter the following commands
respectively:
# ./insmod.sh unload

# ./insmod.sh load
There will be some errors, as drivers for cards we do not have will attempt
to load. If you get this behaviour, this is fine for now, as we will
determine shortly if our drivers have loaded correctly. For me, I get the
following output to the ‘load’ command:
Inserting DVB modules into kernel
FATAL: Module crc32 not found.
FATAL: Module firmware_class not found.
FATAL: Module evdev not found.

The devices will now be created. Confirm by entering:
# ls /dev/d*

You will now see:
/dev/dnrtmsg  /dev/dvb0.demux0  /dev/dvb0.frontend0
/dev/dsp      /dev/dvb0.dvr0    /dev/dvb0.net0

PS: To remove the driver modules, use (do not do this if all is going
according to plan):
# ./insmod.sh unload
PS: To load and unload in one command, enter:
# ./insmod.sh reload
PS: To load the driver modules with debugging enabled, use (do not do
this if all is going according to plan):
# ./insmod.sh debug

Check the output in the logs, with the following two commands and make
sure similar output is seen:
# dmesg
Linux video capture interface: v1.00
saa7146: register extension 'dvb'.
saa7146: register extension 'budget dvb'.
saa7146: register extension 'budget_ci dvb'.
ACPI: PCI interrupt 0000:02:08.0[A] -> GSI 11 (level, low) -> IRQ 11
saa7146: found saa7146 @ mem 42a6c000 (revision 1, irq 11) (0x13c2,0x1011).
DVB: registering new adapter (TT-Budget/WinTV-NOVA-T     PCI).
adapter has MAC addr = 00:d0:5c:23:14:74
DVB: registering frontend 0 (Philips TDA10045H DVB-T)...
saa7146: register extension 'budget dvb /w video in'.
usbcore: registered new driver Technotrend/Hauppauge USB-Nova
usbcore: registered new driver ttusb-dec
usbcore: registered new driver dvb_dibusb
usbcore: registered new driver cinergyT2

# cat /var/log/messages | grep NOVA
Dec  6 21:44:55 mythtv kernel: DVB: registering new adapter
(TT-Budget/WinTV-NOVA-T      PCI).

---------------------------------------------------------------------------
9. THE TEST APPLICATIONS

The next thing is to install the dvb-apps, so that we can do some testing.
Enter the following (PS: make sure you are still doing this in the shell
with export PATH=$PATH:/sbin still applied):
# cd /share/dvb-cvs/dvb-apps
# make

We will scan for our channels, based on the Sydney-North Shore (aka
Artarmon / Gore Hill) transmitters, and generate a tzap compatible channel
list file. As the scan utility does not actually do a frequency scan, we
must manually provide the data for tuning to one or more start
transponders. We will use the initial-tuning-data file provided with the
drivers (see the utility README if you are in a different area). Enter:
# cd util/scan
# ./dvbscan dvb-t/au-sydney_north_shore | tee merge-channels.conf

This will take several minutes. You should be looking at text scrolling in
the console that looks like:
scanning dvb-t/au-sydney_north_shore
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
Frontend can not do INVERSION_AUTO, trying INVERSION_OFF instead
initial transponder 226500000 1 3 0 3 1 1 0
initial transponder 177500000 1 2 0 3 1 2 0
initial transponder 191625000 1 3 0 3 1 1 0
initial transponder 219500000 1 3 0 3 1 1 0
initial transponder 571500000 1 2 0 3 1 2 0
>>> tune to: 

226500000:INVERSION_OFF:BANDWIDTH_7_MHZ:FEC_3_4:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE
WARNING: >>> tuning failed!!!
>>> tune to: 

226500000:INVERSION_OFF:BANDWIDTH_7_MHZ:FEC_3_4:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE

(tuning failed)
WARNING: >>> tuning failed!!!
>>> tune to: 

177500000:INVERSION_OFF:BANDWIDTH_7_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE
0x0000 0x0520: pmt_pid 0x0200 Seven Network -- 7 Digital (running)
0x0000 0x0524: pmt_pid 0x0240 Seven Network -- 7 HD Digital (running)
0x0000 0x0521: pmt_pid 0x0210 Seven Network -- 7 Digital 1 (running)
0x0000 0x0522: pmt_pid 0x0220 Seven Network -- 7 Digital 2 (running)
0x0000 0x0523: pmt_pid 0x0230 Seven Network -- 7 Digital 3 (running)
0x0000 0x0526: pmt_pid 0x0260 Seven Network -- Program Guide (running)
Network Name 'Seven Network'
<snip>

Make sure you put a copy of the merge-channels.conf file in a safe place,
and copy it to the locations where we will use it. To do the latter, enter:
# mkdir /root/.tzap
# mkdir /home/mythtv/.tzap
# cp merge-channels.conf /home/mythtv/.tzap/channels.conf
# ln –s /home/mythtv/.tzap/channels.conf /root/.tzap/channels.conf

In our first test, we will use the tzap utility to see if we can lock on
to a signal. Enter:
$ cd ..
$ cd szap
$ ./tzap "7 Digital"

You should see the following (note the key word we are looking for is
FE_HAS_LOCK), and the line with this at the end of it should be repeating
itself every second:
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 177500000 Hz
video pid 0x0241, audio pid 0x0242
status 00 | signal c0c0 | snr 3636 | ber 00000000 | unc 00000000 |
status 1f | signal c1c1 | snr fefe | ber 000001c4 | unc 00000000 | FE_HAS_LOCK
status 1f | signal c0c0 | snr 0000 | ber 0000019c | unc 00000000 | FE_HAS_LOCK
status 1f | signal c0c0 | snr 0000 | ber 000001b6 | unc 00000000 | FE_HAS_LOCK

Stop the utility by hitting <Ctrl+c>. You can diagnose the output, as follows:
status 0x1f              --- The demodulator status bits.
                               0x1f means all bits set, everything ok.

signal [0x0000...0xffff] --- Signal Strength. Values above 0x8000 should be 
ok.

snr [0x0000...0xffff]    --- Signal/Noise Ratio. Values above 0x8000 are ok.

ber [0...0xffffffff]     --- Bit Error Rate. The less the better.

unc [0...0xffffffff]     --- Number of Uncorrectable Blocks.
                              Small numbers are Preferable.

Now that we have confirmed that the card is installed properly, we have a
signal, we can tune into a station, and get a solid digital lock, we are
on the home straight.

Unload the driver modules (we are back in the linuxtv-dvb-1.1.1 directory),
by entering:
# cd build-2.6
# ./insmod.sh unload
---------------------------------------------------------------------------
10. MODPROBE CONFIGURATION

Next is to configure the system, so that whenever an application tries to
use the device, the dvb drivers are loaded. Open the file:
# vi /etc/modprobe.conf

And add the following section to the end of it:
#===Start DVB NOVA-T=============================================
echo "Inserting DVB modules into kernel..."

# TODO - HAVE NOT WORKED THIS OUT YET - HELP APPRECIATED!
#================================================================

??? - Following instructions assumes ./insmod load is called manually...

Update all the module dependencies, by:
# /sbin/depmod -a
---------------------------------------------------------------------------
11. CHECKING CORRECT MODULES LOADED

Reboot now, to see if our automatic driver module configuration changes are
working correctly. After the system comes up, we will test to see if we get
a lock-on again, which will tell us that the driver modules have loaded
automatically. Firstly, enter:
# /sbin/lsmod
Module                  Size  Used by    Tainted: P
<snip>
???-what should this be???
<snip>

If you see the above in the output, then so far so good! Next, is to have
a look at the DVB stream running.
---------------------------------------------------------------------------
12. TESTING WITH TZAP & MPLAYER

We will use the tzap utility to record some output to the hard disk. Note,
that this is the first test as user ‘merge’, which will make sure we have
set up the permissions properly. Enter the following (in one console
window) to record the stream to disk (note the first command should be
changed to reflect where you extracted your tarball):
$ cd /share/dvb-cvs/dvb-apps/util/
$ cd szap
$ ./tzap "7 Digital" -r

You should see the FE_HAS_LOCK lines scrolling again. Now, in another
terminal window, enter the following commands to test. The first captures
to a file (hit Crtl+c after 5-10 seconds). The second displays the
captured file.
$ cat /dev/dvb/adapter0/dvr0 > dvb-test.ts
^c

$ mplayer dvb-test.ts

This command displays the live stream in mplayer!
$ mplayer /dev/dvb/adapter0/dvr0

Smile, all done! Now go on to setup MythTV or other application to suit...
===========================================================================


More information about the mythtv-users mailing list