How to Obtain, Build and Install V4L-DVB Device Drivers
Check kernel version
First of all, you need a quite recent kernel. The v4l-dvb tree is backwards compatible with recent vanilla kernels. Kernel version 2.6.10 or later is required to build the dvb modules, and version 2.6.12 or later is required to build support for hybrid devices. If you configured the kernel manually, please note that some capabilities should be enabled like EVDEV. Stock kernels usually have everything required. You also need to install the kernel-source package to have kernel headers.
V4L and DVB kernel modules are available via Mercurial.
To acquire the latest sources, you must first have mercurial installed (which requires python 2.3). Some Linux distributions already include it. In Debian, just do "apt-get install mercurial".
Retrieve v4l-dvb sources
Now you need to pull the tree from hg.
To retrieve the v4l-dvb source tree:
hg clone http://linuxtv.org/hg/v4l-dvb
To update the sources later on:
cd v4l-dvb hg pull -u http://linuxtv.org/hg/v4l-dvb
To retrieve the dvb-apps source tree:
hg clone http://linuxtv.org/hg/dvb-apps
Build the Modules
Change into the v4l-dvb directory:
Build the modules:
Then install the modules:
The command above will copy *.ko module files into your /lib/modules kernel directories.
Load and Unload the modules
To remove (rmmod) all modules at once from the running kernel (in memory):
To insert (insmod) all modules at once into the running kernel, without the need to install them:
To perform the two commands above in a single step:
Usually correctly installed modules will show some info in dmesg, errors will appear in dmesg also.
Errata - Compilation
If compilation fails on v4l-dvb/v4l/dvb_net.c with errors (kernel 2.6.17):
error: 'struct net_device' has no member named 'xmit_lock'
Then edit the v4l-dvb/v4l/dvb_net.c file, go to the error lines and replace this text:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
by this one:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
The compilation should now continue.
At this point, check to see if your device is working. Usually, the make install will install the modules in the kernel module folder, which will autoload the drivers on boot. I ran the below commands and it locked up my box and caused problems. For example, do...
dmesg | grep -i saa [ 33.089365] saa7133: subsystem: 17de:7350, board: Kworld ATSC110 [card=90,autodetected]
If this comes back with your card name to something other than "UNKNOWN", then you on on the right track and do not have to do what is listed below.
Errata - Compilation - Kernels before 2.6.22
On old kernels (2.6.22 and older) there is a set of device drivers which will not compile as they require later kernel for the devices to be supported, and this will result in compilation errors. These can be fixed by disabling the compilation of unneeded (ones that require newer kernel) modules
Still it seems that for kernels older than 2.6.20 the compatibility may have been broken. ( If you figure out a way to compile on 2.6.17 put it here. I updated my kernel to 2.6.20 after trying a while)
Errata - Loading Modules
After running the "make install" command, you might end up with *.ko files and their older compressed version *.ko.gz in the same directory. In this case, the modprobe command might fail (example with the saa7134 module):
sudo modprobe saa7134 FATAL: Error inserting saa7134 (/lib/modules/2.6.17-8mdv/kernel/drivers/media/video/saa7134/saa7134.ko):\ Unknown symbol in module, or unknown parameter (see dmesg)
The dmesg then returns a list of 'unknown symbol' error messages because of compatiblity issues between the new *.ko module files and the old *.ko.gz ones:
Unknown symbol ir_codes_pinnacle_color Unknown symbol ir_codes_encore_enltv Unknown symbol ir_codes_proteus_2309 Unknown symbol ir_rc5_timer_keyup Unknown symbol ir_codes_asus_pc39 Unknown symbol ir_rc5_timer_end Unknown symbol ir_codes_pinnacle_grey
All conflicting *.ko.gz files must be removed. The following command line can help you locate these conflicting files in all your installed kernels:
for file in `find /lib/modules -name "*.ko"`; do if -e $file.gz ; then echo "$file.gz should be removed"; fi; done
Usually all conflicting module files resulting of v4l-dvb installation will be located in:
/lib/modules/[your kernel version]/kernel/drivers/media
Once the conflicting *.ko.gz have been moved elsewhere or renamed (to *.ko.gz.disabled for example), use the v4l-dvb reload command (I usually add a depmod for safety in order to rebuild modules dependencies):
make reload depmod -a
Your modules should now be loaded correctly.
Comment April 06 A kernel 2.6.12 wouldn't build the modules but 2.6.16 worked well. I would suggest cd /usr/src/linux before retrieving the mercurial patches - the scripts couldn't find the kernel headers otherwise.
After following the steps above and getting down all needed sources I get the following output does this mean this driver does support 64bit kernels?
root@1[v4l-dvb]# make make -C /usr/local/src/v4l-dvb/v4l make: Entering directory `/usr/local/src/v4l-dvb/v4l' scripts/make_makefile.pl No version yet. Updating/Creating .config File not found: /lib/modules/2.6.15-27-desktop64-smp/build/.config at ./scripts/make_kconfig.pl line 30. make: Leaving directory `/usr/local/src/v4l-dvb/v4l' make: Entering directory `/usr/local/src/v4l-dvb/v4l' Updating/Creating .config File not found: /lib/modules/2.6.15-27-desktop64-smp/build/.config at ./scripts/make_kconfig.pl line 30. make: *** No rule to make target `.myconfig', needed by `config-compat.h'. Stop. make: Leaving directory `/usr/local/src/v4l-dvb/v4l' make: *** [all] Error 2
or do I move my sources?
If you see the issue above, it is because your symbolic link for /lib/modules/<kernel-version>/build is broken. Before running make, remove the link and create a new pointing to the right location.
For your example above,
rm /lib/modules/2.6.15-27-desktop64-smp/build ln -s /usr/src/kernels/2.6.15-27-desktop64-smp/build /lib/modules/2.6.15-27-desktop64-smp/build
and then, the remaining steps should work fine.
Note: On Ubuntu 8.04 (Hardy Heron), installation had the same error as above but was solved somewhat differently. First you must install the linux-headers and the linux kernel source. To do so, type the following (and those are back ticks, not single quotes, people!)
sudo apt-get install linux-headers-`uname -r` linux-source
You'll notice that the source code is installed as a tar file in the /usr/src directory. This is not particularly useful. Let's untar it, do so by typing:
sudo tar xjf /usr/src/linux-source-`uname -r`.tar.bz2 -C /usr/src
And then create a symbolic link to the source (if there isn't already one) by typing:
cd /usr/src sudo rm linux sudo ln -s /usr/src/linux-source-`uname -r` linux
Finally, let's make sure we have the /lib/modules/`uname -r`/build directory pointing to THE HEADERS... NOT THE KERNEL SOURCE. This is the million dollar hurdle, and it bears repeating. The /lib/modules/<your kernel version>/build should point to the correct linux-headers, not the source code of the kernel. (Yes, weird, I know) Type:
cd /lib/modules/`uname -r` sudo rm build sudo ln -s /usr/src/linux-headers-`uname -r` build
Now you can go to your v4l source directory that you downloaded using hg, and do a
rm v4l/.versions make
and all should be good with the world. This was a supreme PITA, so I am hopeful that this will save somebody their sanity.