嵌入式软件工程师&&太极拳
全部博文(548)
分类: 嵌入式
2011-09-24 22:18:04
2009-12-25 14:09:36| 分类: Linux系统移植 | 标签: |字号大中小
一、移植gspcav1-20071224
gspcav1-20071224 下载地址:%7Ealien/slackbuilds/gspcav1/build/gspcav1-20071224.tar.gz
FS2410开发板上移植的是Linux-2.6.22.6内核,USB及CS8900A均能工作,由于linux-2.6.22.6/drivers/usb 目录下没有 media 目录,故移植步骤如下:
步骤一、在 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/
步骤三、为加载gspcav1-20071224驱动编译选项,在 media 下新建 Kconfig、Makefile 文件。
[linux@weijing media]$ pwd
/work/kernel/linux-2.6.22.6/drivers/usb/media
[linux@weijing media]$ vim 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]$ vim Makefile
#
# Makefile for USB Media drivers
#
obj-$(CONFIG_USB_SPCA5XX) += gspcav1-20071224/
步骤四、修改 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
步骤五、编译内核
(1)Device Drivers --->
Multimedia devices --->
<*>Video For Linux
(2)Device Drivers --->
USB 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";
把新生成的 zImage 烧进开发板,重启。插上中星微芯片的摄像头,命令行出现
# 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)
说明移植的驱动已经能识别设备,如果udev安装好的话,设备名所在路径 /dev/video0。
http://canlynet.blog.163.com/blog/static/25501365200911252936816/