編譯spca5xx的Webcam Driver
September 20, 2006The command to install these packages is:
Become root:
$ sudo -s
# apt-get install linux-headers-`uname -r` linux-restricted-modules-`uname -r` build-essential gcc-3.4
The linux stuff is installed under /usr/src. So I suggest, you go there:
# cd /usr/src
and move the spca5xx source from your home directory to this location:
# mv ~/spca5xx-20051212.tar.gz .
Unpack it
# tar xfvz spca5xx-20051212.tar.gz
Enter the spca5xx directory
# cd spca5xx-20051212
Workaround to make the Makefile use gcc-3.4
The Makefile which controls the compiling process for this driver has to be told to use gcc-3.4 instead of the default version 4.0:
CC=gcc-3.4
export CC
This sets the environment variable CC, which is used in the spac5xx Makefile to select the compiler.
Setting a link back to the source code (headers)
Furthermore the spca5xx Makefile expect a pointer to the kernel source at a specific location. Let’s create it:
# ln -s /usr/src/linux-headers-`uname -r` /lib/modules/`uname -r`/build
(Note: If you compile a kernel, this link is usually there. But as we use a pre-compiled kernel, we have to cheat.)
Compiling the spca5xx source code
# make
There should be no errors.
Removing the old driver from memory
# modprobe -r spca5xx
Removing the old driver from the hard drive
# rm -rf /lib/modules/`uname -r`/kernel/drivers/usb/media/spca5xx*
Install the new driver
# make install
Load the new driver
# modprobe spca5xx
There should be no errors.
