Lets just say that this is broken. I did not find the i2c and lm_sensors
packages refered to herein. If you do find them, then procede. If you
get the current i2c patch, then you will likely be reversing some of the
work I did, so a review of the cvs change logs at sourceforge may help.
Since the kraxel patch for the v4l2 api has not been updated, that part of
the change set should not be a problem.
Applying
i2c and lm_sensors patches to the kernel and using the kernel modules
with V3TV-Light
1. Preparing
your kernel tree:
2.6.x support: Radio and
Video are stable !!
We don't need the I2C and V4L2 patches, but there are a few smaller
patches to apply just the same.
Visit v3tv-v4l2
for further details.
2.4.x support:
First, fetch a kernel from kernel.org.
Use a mirror! Get the bzip2 file, as it's a few meg
smaller. I'll be starting with 2.4.23, and patching up to 2.4.26
in this session.
Work in /usr/src or your home directory, as you like. If you
have an existing tree, you might move it out of the way. Extract
the kernel, then rename the linux-2.4.23 dir to linux-2.4.25, remove
any existing linux directory and make a new link to linux, change to
the linux directory, and apply the 2.4.24, 2.4.25 and 2.4.26
patches. If
you are not
familiar with applying patches, the README in the kernel
has a few notes on this topic.
tar xjvf linux-2.4.23.tar.bz2
mv linux-2.4.23 linux-2.4.26
rm linux; ln -s linux-2.4.26 linux
cd linux
bzcat ../patch-2.4.24.bz2 | patch -p1
bzcat ../patch-2.4.25.bz2 | patch -p1
bzcat ../patch-2.4.26.bz2 | patch -p1
If you are using a kernel source tree that already exists, I'd suggest
doing a 'make mrproper' to scrub it clean. You will want to save
your .config first: 'cp .config 2423-20031227.kcfg' is what I usually
do. Then copy it back: 'cp *.kcfg .config'
1a. Adding
the V4L2 support in:
Now would be the time to apply
the kraxel patch for V4L2
support. You only need this if you are going to try the EXPERIMENTAL v3tv-v4l2.tar.bz2
module.
If you do apply the kraxel patch fewer patches will be needed further
down the page, and v3tv.o and v3tv-radio.o seem to coexist nicely :)
zcat ../patch-2.4.26-kraxel.gz | patch -p1
1b. Adding
in
the I2c-2.8.x support:
Now we move to I2C. Goto Installation
Guide for I2C and LM
Sensors 2.8.2 and 2.8.4 and get the unified patch for the kernel
you are using.
zcat ../linux-2.4.26-i2c-2.8.4.patch.gz | patch -p1
(Note: If you applied the kraxel patch in 1a, then know that there is a
conflict between the kraxel patch and this unified-i2c patch.
Ignore the reject saying that "Hunk #2 FAILED at 1330.
... 1 out of 3 hunks FAILED...", this will be corrected by another
patch later on.
WARNING: If you apply the
i2c patch first and the kraxel patch afterwards (thus reversing
the suggested order), you will have a bigger reject file, and I'm
going to tell you to do it over!! ( Do you know how to
reverse a patch yet? )
1c.
Adding in the KGDB patch:
I'm also going to apply the kgdb patch, found here: kgdb
This is a kernel source level debugger for developers.
If you do apply this, and then want to compile the kerenl without kgdb
selected in the config, you need another patch...
kgdb_traps.c.diff
1d. Adding
in the sensors-2.8.x support:
Get the latest lm_sensors-2.8.6 package from the lm_sensors
download page. Save it to /usr/src or ~/ as you prefer.
Extract with 'tar xzvf lm_sensors-2.8.6.tar.gz' and cd to
lm_sensors-2.8.6. We will not make any modules here. We are
going to patch the kernel. Look at the INSTALL file and take the
time to read it. I'll step through the process here.
Skip down to about line 290 in the INSTALL file. The command
mkpatch/mkpatch.pl . /usr/src/linux > /tmp/sensors-patch
should run silently, yielding /tmp/sensors-patch. In the
linux source directory run
patch -Ep1 < /tmp/sensors-patch
We are most interested in the i2c-voodoo3 module. If you want to
use the full sensors capabilities, we will come back to making the
lm_sensors user space utilities a little later. The kernel needs
to be configured first.
2. Now we put
in the v3tv support!
Visit the vpx3224 page
for installation instructions. These patches will provide
the kernel config options that compile the msp3400, tuner and
tvmixer modules.
While the vpx3224 module lives in the kernel, the v3tv module is not
yet integrated into the kernel config process.
2a.
Patches to make the kernel modules attach to the Voodoo3 i2c bus:
NOTE:
Did you apply the experimental V4L2 patch at step
1a
?
* If yes: Proceed to the kraxel-diffs directory.
* If no: Proceed to the
non-kraxel-diffs
directory.
3. Configuring
your kernel:
Now we can configure the kernel. If you have a .config already,
do
'make oldconfig' to pick up the new options.
3a. I2C Support:
The V3TV options in the 2.4 kernel are tagged Experimental, so you need
to choose to see developmental drivers at the top of the config
pages. The 2.6 kernel will be tagged this way in the future when
I next update the patches.
The first section we are interested in is I2C support under Character
Devices.
We want to select these items:
I2C support
I2C bit-banging interfaces
I2C mainboard interfaces
Voodoo3 I2C interface
Pseudo ISA adapter
I2C /proc interface (required for hardware sensors)
3b. Hardware Sensors Support:
Next is Hardware sensors support, which can be considered optional.
When you select I2C mainboard interfaces, you need to figure out what
sensors are on your system. Start with lspci. Some Host
Bridge chip sets have sensors built in. My lspci spits out
'00:07.4 Host bridge: VIA Technologies,
Inc. VT82C686 [Apollo Super
ACPI]'.
For my system I
select 'VIA 686a Integrated Hardware Monitor'.
If the stock kernel you are running has support for i2c, then
sensors-detect
is your friend. It will probe any i2c buses it can find and
report what it finds. You will need a .config in the kernel tree
before you can build the new lm_sensors user space tools, so finish up
what you can here, selecting any likely options then run sensors-detect
after rebooting the new kernel.
In Other I2C devices, I find the DDC Monitor and EEprom reader
interesting, but they are optional.
DDC
Monitor EDID EEPROM
EEprom (DIMM) reader
3c. V4L Support:
Before leaving the Hardware sensors support dialog, in Other I2C
devices, we want the BT869 module.
Brooktree BT869 Video Modulator ( not
yet available for 2.6 )
Then we need to look in Sound. At the bottom of the list, almost
an
after thought, is
TV card (bt848) mixer support
Finally we get to the Video for Linux support. Under Multimedia
Devices, you want to select
these items:
Video For Linux
V4L information in proc filesystem
V3TV Video For Linux ( if the vpx3224 is patched in )
Excessive V3TV debugging output
That should wrap up oldconfig if you have an existing .config. If
you don't have a .config, your on your own. lspci is your
friend. Look at what modules are already installed. Many
services rely on kernel features being present, so try 'service
--status-all' and see what's running.
If you are doing the lm_sensors patch, now you can build the user space
utilities. There are two make
targets, 'user', and 'user_install'. It will spit out
a list of errors about
missing dependency files, then make some object files. The
dependency messages are normal.
4. Compiling and
installing the kernel:
You should be ready to do 'make dep bzImage modules' now. After
this
completes, do 'make modules_install' as root.
I have a script called setlilo floating around from back when lilo was
the default boot manager. It has these lines:
cp arch/i386/boot/bzImage
/boot/bzImage-2.4.26
cp System.map /boot/System.map-2.4.26
If you already have a kernel named 'bzImage' it's not recommended
to over write it. Use the unique names as above until you are
sure the new kernel performs reliably.
If you have a /boot partition, some distributions set /boot read only
for security. It ought to be read only on any production
system. If this is the case then try 'mount /boot -o remount,rw'
then copy the files to /boot.
Add a section to /boot/grub/grub.conf or /etc/lilo.conf for the new
kernel. Copy an existing section or, for example only, with grub:
title Red Hat Linux (2.4.26)
root (hd0,0)
kernel /bzImage-2.4.26 ro
Or with lilo try something like this, then run lilo:
image=/boot/bzImage-2.4.26
root=/dev/hda3
read-only
These are only for demonstration. They are unlikely to work on
any one elses system.
Now you should be ready to reboot! Come back in a few minutes and
try out the updated v3tv driver.
5. Getting,
compiling and using the updated v3tv driver:
If you applied the kraxel patch, you want to get the
v3tv-v4l2.tar.bz2
archive, then refer to
README-v3tv-radio.
If you did not apply the kraxel patch, you want to get the
v3tv-I2C284.tbz
archive.
The Makefile in thev 3tv-I2C284.tbz package is set to not compile the
v3tv i2c adapter code. You will use i2c-voodoo3 provided by the
lm_sensors patch. It excludes all the extra modules as well.
You should be able to use msp3400, tvmixer, and tuner from the kernel.
To aid in managing modules while things are still volatile, I've got
this script, v3tv.sh Just type
v3tv, and it will print usage.
Now that all that is done, I've got another project for you to look
at! Wander on over to my ALSA snd-tvmixer
page.
You may find that full screen does not work if the XFree v4l modules
causes the v3tv module to load. Add to the ~/.Xdefaults or
/etc/Xdefaults file these lines, Then do 'xrdb -load ~/.Xdefaults' or
'xrdb -load /etc/Xdefaults' to use these settings.
xawtv.device: /dev/video0
motv.device: /dev/video0
Now that you have all of the kernel modules working, you ask how to
make the magic that loads them auto magically? I have an answer!!
I've made some more refinements to the modules.conf file, and am using
ALSA drivers in part of these examples.
First, the section for the video device:
alias char-major-81 videodev
above char-major-81 v3tv vpx3224 tuner snd-tvmixer msp3400 i2c-voodoo3
snd-your_card_here
or for the kernel default OSS mixer,
above char-major-81 v3tv vpx3224 tuner tvmixer msp3400 i2c-voodoo3
your_sound_card_here
The 'above' statment loads modules from right to left, so all the
things that v3tv needs will be present. With this complete
configuration, I can close
motv, and any mixers, do two 'modprobe -ar' to flush modules, and when
I
launch motv again, everything is loaded.
This is the modules.conf section for the ALSA ens1370 driver. I'm
using the OSS utility aumix-minimal to restore settings for now. alsactl
would not work reliably for me
( Change sound-[card | slot]-X and index=X to match your configuration. )
alias snd-card-X snd-your_card_here
alias sound-slot-X snd-your_card_here
options snd-your_card_here
index=X
id=Describe_your_card[X]
alias sound-service-X-0
snd-mixer-oss
alias sound-service-X-1
snd-seq-oss
alias sound-service-X-3
snd-pcm-oss
alias sound-service-X-8
snd-seq-oss
alias sound-service-X-12
snd-pcm-oss
post-install snd-your_card_here
/bin/aumix-minimal -d /dev/mixerX\
-f /etc/aumixrc.your_card_here
-L >/dev/null 2>&1
pre-remove snd-your_card_here
/bin/aumix-minimal -d /dev/mixerX\
-f /etc/aumixrc.your_card_here
-S >/dev/null 2>&1
The OSS/Free config is simpler. ( Change sound-slot-X match
your
configuration. )
alias sound-slot-X your_card_here
post-install sound-slot-X
/bin/aumix-minimal -d /dev/mixerX\
-f /etc/aumixrc.your_card_here
-L >/dev/null 2>&1
pre-remove sound-slot-X
/bin/aumix-minimal -d /dev/mixerX\
-f /etc/aumixrc.your_card_here
-S >/dev/null 2>&1
The ALSA snd-tvmixer config follows. (
Change sound-[card | slot]-X and index=X to match your configuration. )
alias snd-card-X
snd-tvmixer
alias sound-slot-X
snd-tvmixer
options snd-tvmixer index=X
id="ALSA tvmixer[X]"
alias sound-service-X-0
snd-mixer-oss
The default values in /proc/asound/cardX/ossmixer
(one(1) for you, two(2) for me ?) won't let
xawtv/motv adjust volume correctly. Another line in
/etc/modules.conf solves the problem, plus lines to save/restore mixer
settings at reboot. The aumix parts are not really effective,
since xawtv does not respect the mute switch, and just sets volume to
zero.
post-install snd-tvmixer echo 'VOLUME
"Master Playback Volume" 0'\
> /proc/asound/cardX/oss_mixer
&& \
/bin/aumix-minimal -d /dev/mixerX\
-f /etc/aumixrc.tvmixer -L
>/dev/null 2>&1
pre-remove snd-tvmixer /bin/aumix-minimal -d /dev/mixerX\
-f /etc/aumixrc.tvmixer -S >/dev/null 2>&1
If you don't use the ALSA snd-tvmixer,
then these two lines should get the OSS/Free tvmixer mixer
working. ( Change sound-slot-X and devnr=X to
match your configuration. )
alias sound-slot-X tvmixer
options tvmixer devnr=X
A few more lines to help load and unload modules...
(Take these two out!! They are no
longer needed, and can cause problems now.)
pre-remove msp3400
/sbin/modprobe -r
i2c-voodoo3
pre-remove tuner
/sbin/modprobe -r i2c-voodoo3
post-remove v3tv /sbin/modprobe -r
vpx3224 msp3400 tuner
pre-remove msp3400 /sbin/modprobe -r snd-tvmixer
pre-install msp3400 /sbin/modprobe
i2c-voodoo3
pre-install vpx3224 /sbin/modprobe
i2c-voodoo3
pre-install tuner /sbin/modprobe i2c-voodoo3
These options are optional ;)
options vpx3224 debug=0
options v3tv debug=0
options tuner
options msp3400 debug=0
options i2c-algo-bit i2c_debug=0
options eeprom checksum=1
Gerd Knorr has indicated that the tuner module should not be given a
'type' parameter, and the v4l device driver should set the tuner
type. v3tv has always done this, so we are
covered.
If you load the eeprom module, the 'checsum=1' option will prevent it
from erroneously seeing the ddcmon client's chip.
Best of luck,
Perry Gilfillan