Building mpeg4ip with V4L2 support

A. Redhat Linux 9 Installation

This section only applies if you setting up a machine from scratch.
If not, go here
Pick the custom install option.

Package Group Selection

Package Name
Selected
X Window System
31/33
GNOME
35/35
KDE
14/16
Editors
2/4
Graphical Internet
8/14
Sound and Video
14/19
Graphics
10/13
Server Configuration Tools
9/13
Web Server
12/17
Development Tools
35/46
Kernel Development
4/4
X Software Development
18/18
GNOME Software Development
42/48
Administration Tools
11/11

B. Build a Custom Kernel

The instructions are given in
Redhat Linux 9 Customization Guide. You must have the kernel source installed before continuing
  1. Open a terminal.
  2. su -
  3. cd /usr/src/linux-2.4
  4. make mrproper
  5. cp config/kernel-2.4.20-i686.config .config
  6. make xconfig
  7. This will bring up the Linux Kernel Configuration window. Just click Save and Exit.
  8. make clean
  9. make bzImage
  10. make modules
  11. make modules_install
  12. make install
  13. Verify that /boot/initrd-2.4.20-8custom.img exists
  14. reboot

C. Install V4L2

V4L2 is a work in progress. So far, I've only gotten the 20030717 CVS snapshot to work.

You should read the directions from the V4L2 web site - they only apply for the versions that we've specified.

  1. Download v4l2-20030717.tar.gz to the home directory
  2. tar xvfz v4l2-20030717.tar.gz
  3. su
  4. cd v4l2
  5. mv /usr/include/linux/videodev.h /usr/include/linux/videodev.h.orig
  6. cp videodev.h /usr/include/linux
  7. cp videodev2.h /usr/include/linux
  8. Edit Makefile and change depmod to /sbin/depmod
  9. make
  10. make install

D. Install New bttv Driver

  1. Download bttv9-20030717.tar.gz to the home directory
  2. tar xvfz bttv9-20030717.tar.gz
  3. su
  4. cd bttv-0.9.12
  5. Edit Makefile and change depmod to /sbin/depmod
  6. make
  7. make install

E. Setup modprobe to load bttv from new location

The V4L2 and bttv drivers are installed in the /lib/modules/2.4.20-8custom/v4l2 directory. You should see a listing similar to this:

-rw-r--r--    1 root     root         4936 Aug  4 18:54 btcx-risc.o
-rw-r--r--    1 root     root       113484 Aug  4 18:54 bttv.o
-rw-r--r--    1 root     root        15616 Jul 18 10:48 v4l1-compat.o
-rw-r--r--    1 root y    root         8084 Jul 18 10:48 v4l2-common.o
-rw-r--r--    1 root     root        19544 Aug  4 18:54 video-buf.o


The original V4L2 and bttv drivers are installed in /lib/modules/2.4.20-8custom/kernel/drivers/media/video.

modprobe is a program which loads/unloads loadable kernel modules (LKMs). By default, modprobe searches for an LKM in /lib/modules/boot before looking in /lib/modules/2.4.20-8custom. This can be verified by using the 'modprobe -c' command. modprobe also uses /lib/modules/2.4.20-8custom/modules.dep for resolving module dependencies.

The bttv driver installation does not remove the original bttv.o entry from the modules.dep file (bug ???). Since we want to load the bttv driver (and its dependencies) from the new location (/lib/modules/2.4.20-8custom/v4l2 directory), an easy way is to rename the original bttv LKM and remove its entry from the modules.dep file. We recommend removing all bttv.o files. Do a find . -name bttv.o -print and make sure all copies of bttv.o are purged. The following steps do that:
  1. cd /lib/modules/2.4.20-8custom/kernel/drivers/media/video
  2. mv bttv.o bttv.o.orig   (We recommend rm bttv.o)
  3. cd /lib/modules/2.4.20-8custom
  4. Edit modules.dep and delete /lib/modules/2.4.20-8custom/kernel/drivers/media/video/bttv.o and its dependencies.
  5. Reboot and select the custom kernel when the kernel load screen appears. Alternatively, change /etc/grub.conf to indicate a default of 0 (that will be the custom kernel you created, and will automatically select it when you reboot).
Do a find to make sure that you've overwritten all bttv.o files.

F. Testing the Installation

filename:    /lib/modules/2.4.20-8custom/v4l2/bttv.o
description: "bttv - v4l/v4l2 driver module for bt848/878 based cards"
author:      "Ralph Metzler & Marcus Metzler & Gerd Knorr"
license:     "GPL"
...
filename:    /lib/modules/2.4.20-8custom/v4l2/v4l2-common.o
description: "misc helper functions for v4l2 device drivers"
author:      "Bill Dirks, Justin Schoeman, Gerd Knorr"
license:     "GPL"