Personal tools
You are here: Home Members gillesgigan gumstix Compiling uvcvideo and installing uvcdynctrl
Document Actions

Compiling uvcvideo and installing uvcdynctrl

by Gilles Gigan last modified 2009-02-19 14:18

This page walks through the process of compiling the uvcvideo module and installing uvcdynctrl on the gumstix

Compiling uvcvideo

These steps are taken from here.

In ~/gumstix/gumstix-oe, make sure

bitbake gumstix-basic-image

goes without trouble.

The following steps

  • download the old version of uvcvideo from SVN
  • modify the Makefile to compile fine with OE
  • compile the module
  • install and load it

svn checkout svn://svn.berlios.de/linux-uvc/linux-uvc/trunk uvcvideo-old
cd uvcvideo-old
vi Makefile
Redefine KERNEL_DIR with
~/gumstix/gumstix-oe/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/
Add
CROSS_COMPILE   := ~/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-
in uvcvideo target, change:
 @(make -C $(KERNEL_DIR) M=$(PWD) CROSS_COMPILE=$(CROSS_COMPILE) modules)
to
 @(make -C $(KERNEL_DIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules)
then
make uvcvideo
scp uvcvideo.ko root@XX.XX.XX.XX:/lib/modules/2.6.21/kernel/drivers/media/video/
On the gumstix:
depmod -a
modprobe uvcvideo

Compiling libwebcam and uvcdynctrl


These steps are also taken from http://www.gumstix.net/wiki/index.php?title=Webcam_drivers_-_Mini_Howto_Part_2_-_Linux_uvc_cameras .

Make sure Cmake 2.6 or later is installed. Ubuntu Hardy comes with 2.4, so enable backports, and install newer version:
sudo vi /etc/apt/sources.list (enable backports repository)
sudo apt-get update
sudo apt-get install cmake
sudo vi /etc/apt/sources.list (disable backports repository)
sudo apt-get update
Get a copy of libwebcam
Get uvcvideo.h and uvc_compat.h
Create a Cmake toolchain file
Adjust libwebcam source to allow compilation
Start compiling
copy libwebcam and uvcdynctrl to the gumstix


svn co http://svn.quickcamteam.net/svn/qct/Linux/ libwebcam
cd libwebcam
cd Common/include/
wget http://svn.berlios.de/svnroot/repos/linux-uvc/linux-uvc/trunk/uvcvideo.h
wget http://svn.berlios.de/svnroot/repos/linux-uvc/linux-uvc/trunk/uvc_compat.h
cd ../../..


cat > toolchain.cmake <<EOF
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER  ~/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER ~/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ~/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
EOF


vi libwebcam/Libs/libwebcam/libwebcam.h (add #define NAME_MAX 255)
cd libwebcam
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchain.cmake ..
make


scp Libs/libwebcam/libwebcam.so.0.1.1 root@XX.XX.XX.XX:/media/card
scp Apps/uvcdynctrl/uvcdynctrl-0.2 root@XX.XX.XX.XX:/media/card
scp ../Apps/uvcdynctrl/data/046d/logitech.xml  root@Xx.XX.XX.XX:/media/card
On the gumstix:

mkdir -p /usr/local/lib
mv /media/card/libwebcam.so.0.1.1 /usr/local/lib/
ln -s /usr/local/lib/libwebcam.so.0.1.1 /usr/local/lib/libwebcam.so
mkdir -p /usr/local/bin
mv /media/card/uvcdynctrl-0.2 /usr/local/bin/
ln -s /usr/local/bin/uvcdynctrl-0.2 /usr/local/bin/uvcdynctrl
mkdir /usr/local/etc
mv /media/card/logitech.xml /usr/local/etc/
ldconfig
uvcdynctrl -i /usr/local/etc/logitech.xml
If you get an error saying "error while loading shared libraries: libxml2.so.2", then install libxml2 with
ipkg -d mmc install libxml2
ipkg-link add libxml2
and try again.









Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: