Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94979
  • 博文数量: 17
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 230
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-24 17:41
文章分类

全部博文(17)

文章存档

2008年(17)

我的朋友

分类: LINUX

2008-09-22 23:11:59

Kernel version :2.6.22.6
Crosstool      :arm-linux-gcc-3.4.5
Board          :FS2410
System         :Fedora 8
Source         :
gspcav1-20071224、servfox-R1_1_3、spcaview-20061208
Author                   :http://viviwei.cublog.cn

一、移植gspcav1-20071224
    gspcav1-20071224下载地址:
FS2410开发板上移植的是Linux-2.6.22.6内核,USB及CS8900A均能工作,由于linux-2.6.22.6/drivers/usb 目录下没有 media 目录,故移植步骤如下:

a)  在
linux-2.6.22.6/drivers/usb 目录下新建 media 目录,将gspcav1-20071224.tar.gz copy 到 media  下并解压。为了使media 编译进内核,需修改linux-2.6.22.6/drivers/usb 目录下的Kconfig、Makefile 文件。

[linux@weijing usb]$ pwd
/work/kernel/linux-2.6.22.6/drivers/usb
[linux@weijing usb]$ vi  Kconfig
添加
source "drivers/usb/media/Kconfig"
[linux@weijing usb]$ vi Makefile
添加
obj-$(CONFIG_USB_SPCA5XX)        += media/

b)  为添加 gspcav1-20071224 编译选项,在
media 下新建 Kconfig、Makefile 文件。

[linux@weijing media]$ pwd
/work/kernel/linux-2.6.22.6/drivers/usb/media
[linux@weijing media]$ vi Kconfig

#
# USB Multimedia device configuration
#
comment "USB Multimedia devices"
        depends on USB

config USB_SPCA5XX
        tristate "USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras"
        depends on USB && VIDEO_DEV
        ---help---
          Say Y or M here if you want to use one of these webcams:

          The built-in microphone is enabled by selecting USB Audio support.

          This driver uses the Video For Linux API. You must say Y or M to
          "Video For Linux" (under Character Devices) to use this driver.
          Information on this API and pointers to "v4l" programs may be found
          at .

          To compile this driver as a module, choose M here: the
          module will be called spca5xx.

[linux@weijing media]$ vi Makefile
#
# Makefile for USB Media drivers
#

obj-$(CONFIG_USB_SPCA5XX)   += gspcav1-20071224/

c)  修改 gspcav1-20071224 的 Makefile

[linux@weijing gspcav1-20071224]$ pwd
/work/kernel/linux-2.6.22.6/drivers/usb/media/gspcav1-20071224
[linux@weijing gspcav1-20071224]$ vi Makefile

gspca-objs := gspca_core.o decoder/gspcadecoder.o
obj-$(CONFIG_USB_SPCA5XX) += gspca.o

clean:
        rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c
        rm -rf .tmp_versions

d)  编译内核

1Multimedia devices  --->
         Video For Linux
2USB support  --->
        Support for Host-side USB
       --- USB Host Controller Drivers   
        OHCI HCD support
3--- USB Multimedia devices
     USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras


此时,可能会提示 gspca_core.c 的一些轻微错误,稍作修改即可:
//static const char gspca_version[] = GSPCA_VERSION;
static const char gspca_version[] = "00.60.00";

把新生成的 uImage 烧进开发板,重启,插上中星微芯片的摄像头,命令行出现

# usb 1-1: new full speed USB device using s3c2410-ohci and address 2          
usb 1-1: configuration #1 chosen from 1 choice                                 
drivers/usb/media/gspcav1-20071224/gspca_core.c: USB GSPCA camera found.(ZC3XX)

说明移植的驱动已经能识别设备,设备名所在路径 /dev/video0。

二、servfox

    服务器端程序用是servfox通过它可以在PC上看到开发板采集来的图像,从这里下载

下载,解压,进入其目录,发现没有一个makefile.arm还有一个makefile.386makefile.arm改名为makefile,然后输入命令 make,生成 servfox 可实行文件,copy 到开发板运行之:
# ./servfox -d /dev/video0 -g -s 640x480 -w 7070                               
 servfox version: 1.1.3 date: 11:12:2005 (C)                   
wrong spca5xx device                                                           
Waiting .... for connection. CTrl_c to stop !!!!                               
Got connection from 192.168.1.2

三、spcaview

    客户端程序使用的是spcaview下载地址为

这个程序在PC 上运行,直接解压编译,生成 spcaview 可实行文件,运行如下:
 
[root@weijing spcaview-20061208]# ./spcaview -g -w 192.168.1.17
 Spcaview version: 1.1.7 date: 06:11:2006 (C)
ERROR Set default port to 7070
using Server 192.168.1.17 Port 7070
bright 32768 contrast 32768
 
附件2是在 Fedora 8 下看到的图像。
 

 



附件2


阅读(3099) | 评论(8) | 转发(1) |
给主人留下些什么吧!~~

chinaunix网友2010-10-27 20:44:04

模块加载时可以成功,楼上yannanfu网友说的我试了,没成功?为什么?

chinaunix网友2010-06-04 16:01:27

undefined reference to `__this_module' 错误的解决办法: 把gspcal目录下的Makefile中的EXTRA_CFLAGS += $(DEFINES)注释掉 就可以了

chinaunix网友2010-04-21 22:00:58

博主你好,按照你说的方法进行移植,下到板子插入摄像头之后显示: / # usb 1-1: new full speed USB device using s3c2410-ohci and address 3 usb 1-1: configuration #1 chosen from 1 choice 没有出现摄像头的信息,我用的内核也是2.6.22.6,摄像头是中星微的zc303b,这个是gspcav1-20071224里就支持的吧,但感觉就是还没驱动成功呀, 呵呵,这篇文章已经写了这么长时间了,但还是希望博主能给点提示,谢谢!

chinaunix网友2010-03-26 11:00:32

哈说错了是2.6.26.5的内核

chinaunix网友2010-03-26 10:58:39

我按照你的方法一步一步做出错了 drivers/built-in.o(.init.text+0x418c): In function `store_mode': drivers/video/fbsysfs.c:143: undefined reference to `__this_module' drivers/built-in.o(.data+0x9688): In function `fbcon_cursor': drivers/video/console/fbcon.c:1385: undefined reference to `__this_module' drivers/built-in.o(.data+0x96ac): In function `fbcon_blank': drivers/video/console/fbcon.c:2379: undefined reference to `__this_module' make: *** [.tmp_vmlinux1] Error 1 我用的是2.6.25内核可以吗?