A propos
Home About News Download Links Compatibility Charts
SPCA5xx | SPCA5xx-LE
Documentation
SPCAView & SPCATools | Chipsets Gspca-devel


Howto build the spca5xx-le driver on the osk5912 board
Author Fifth
from the WuHan University of Technology, in China.

email: quanlidi AT whut.edu DOT cn,
1.An introduction of osk5912 board.
	The MCU of the osk5912 board is omap5912. It integrated dual CPU cores and many other interface parts. The dual CPU cores are ARM926EJ-S and TMS320C55x.
	More details you can get from here: http://omap.spectrumdigital.com/osk5912/

2.Prepare the document and the source code.
	Linux kernel source: linux-2.6.12.6, I get it directly from kernel.org.
	patch-2.6.12-rc6-omap1.bz2. I get it from http://www.muru.com/linux/omap/patches/old/  
	usb-2.6.12LE06.patch.tar.gz, Get from this site.
	Buzybox. Used for build rootfs. Get it from http://www.busybox.net/download.html.
	UBoot. Get it from http://linux.omap.com/pub/bootloader/osk/source/ubootosk-1.1.1.tar.gz.
	A useful document. Get it from http://www.capgo.com/Resources/SoftwareDev/osk-newbie-guide.pdf. 

	Host platform:
		Hiweed linux(based on debian, kernel version 2.6.8.2).
		Cross compiler. Arm-linux-gcc 3.3.2. Get it from http://linux.omap.com/pub/toolchain/obsolete-gcc-3.3.2.tar.bz2.

3.Let's begin.	
	3.1 Uncompressed the cross compiler gcc to a fixed directory, append the directory's path to the enviroment var of PATH.
		For me, just edit the file named .bashrc in my home directory.
	3.2 Setup minicom to suit your hardware. The defult port your minicom configure file is /dev/ttyS1, but we always use /dev/ttyS0.
	Then, modify the serial port settings to 11500bps,8,N,1. Enable the tftp service on your host platform. 
	For tftpserver, modify the tftpserver's home directory where you will put the newly built kernel image.
	Enable the NFS service on your host platform, be careful the read/write rights and the home directory's position.
	
		We use the tftp service to download the kernel image and rootfs image and use the serial
	port as a console, because when you use a serial port download file to the board, it will spend much time on waiting.	
	
	3.3 Modify the uboot parameter to suitable your host platform. For my board like this:
	U-Boot 1.1.1 (Aug  4 2005 - 10:41:25)

	U-Boot code: 11080000 -> 11095DD4  BSS: -> 1109A5A4
	RAM Configuration:
	Bank #0: 10000000 32 MB
	Micron StrataFlash MT28F128J3 device initialized
	Flash: 32 MB
	In:    serial
	Out:   serial
	Err:   serial
	Hit any key to stop autoboot:  6
	# setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=192.168.0.12 root=/dev/nfs nfsroot=192.168.0.2:/home/share/filesys,nolock mem=30M
	# saveenv
	The ip=192.168.0.12 is for my osk5912 board. The ip=192.168.0.2 is for my host platform. /home/share/filesys is the home directory of my NFS server.
 
	An example to howto download and run:
		Run minicom to monit the serial port, then reset the board, hit the keyboard to stop the defalut kernel image load processing.
	Use command tftp to download the kernel image from the host, you will seen three or four lines' "###############################".
	If not, maybe something incorrect in your uboot config or tftpserver config! Then you can use the command bootm 0x10000000 to load the kenel image
	download before. At the end of kernel image loading, it will automaticlly mount the NFS filesys from your host.
 
	3.3 Build kernel source tree.
		Uncompressed the kernel source file. First put on the patch-2.6.12-rc6-omap1 to kernel source,
	go into the directory, follow the instructions in the file of osk-newbie-guid.pdf.
	Like this:		
	# cd /usr/src/
	# tar -xjvf ${DOWLOADDIR}/linux-${VERSION}.tar.bz2
	# cp ${DOWLOADDIR}/patch-${VERSION}-omap1.bz2 .
	# bunzip2 patch-${VERSION}-omap1.bz2
	# cd linux-${VERSION}/
	# cat ../patch-${VERSION}-omap1 | patch -p1
	Now your kernel is ready for you to prepare. The standard steps to set up your
	kernel, after ensuring your PATHs are set correctly, are as follows:
	# make clean
	# make omap_osk_5912_defconfig
	Then, go into the directory of /usr/src/linux-${VERSION}/drivers/usb, put on the spca5xx-le driver patch usb-2.6.12LE06.patch.tar.gz. 	
	From now on just:
	# make xconfig
	# make
	# arm-linux-objcopy -O binary -R .note -R .comment -S arch/arm/-boot/compressed/vmlinux linux.bin
	# gzip -9 linux.bin
	# ${U-BOOTDIR}/tools/mkimage -A arm -O linux -T kernel -C gzip-a 0x10c08000 -e 0x10c08000 -n ’Linux Kernel Image’ -d linux.-bin.gz uImage.cc	
	The output file uImage.cc is the kernel image, we get it.
	But be sure you selected the videforlinux and the spca5xx driver in your kernel config file.
	I always make the videoforlinux include by kernel image and take the spca5xx driver as a module.
	
	3.4 Build rootfs. Please just choose the modules you really need. :-)

	3.5 Move the new kernel image to the tftpserver home directory. Move the rootfs to the NFS server home directory,
	Use the command "make modules_install INSTALL_MOD_PATH=/home/share/filesys" to install modules into the rootfs.
	Then, we finished basic works.
	
	Have a test to the new kernel image and rootfs, check if it loaded successfully.
	Do not forget to make a device file. "mknod c 81 0"
	
	3.6 Build servfox or spcaserv for the board.
		Get servfox from here, uncompressed it, modify the Makefile.arm to suitable your host platform.	
	Then, use the command "make -fMakfile.arm" to build it. Move the output file to the NFS server home directory.
	Goto minicom, input like this:
	cd /lib/modules/2.6.12.6-omap1/kernel/drivers/usb/media/spca5xx/
      	insmod spca5xx.ko
	/root/servfox -d /dev/video0 -s 320x240
	Then the server is ready.

	3.7 Build spcaview, get the source file of spcaview from here.
	Just build it.
	spcaview -w192.168.0.12:7070
	You will see the captured picture from the board.

FAQ.
1 v4l open error?
	Check if the USB camera pluged. Do not tell me you have not a USB camera. :-(  A jok! Ha,Ha.
2 When I run servfox, after print out many informations, oop occur?
	Plese modify a file at the directory of linux-2.6.12.6/drivers/usb/media/spca5xx,
	In the file named spca_core.c , at the part of "case VIDIOCSYNC", I must 
	change this line: 
	PDEBUG (3, "syncing to frame %d, grabstate = %d", frame,
	spca50x->frame[frame].grabstate); to 	PDEBUG (0, "syncing to frame %d,
	grabstate = %d", frame, spca50x->frame[frame].grabstate);
	Or, use a piece of modified source in this site.
	
Download packages:
OSK5912