移植spca5xx-v4l1goodbye到立宇泰ARMSYS244O开发板
2010-05-09 19:55
281 查看
前面我讲解了如何移植spca5xxle到立宇泰ARMSYS244O开发板。但是spca5xxle只能输出JPG格式的图像数据,如果我们想要 RGB格式的数据就必须自己解码,如果移植的是完整的spca5xx驱动就不会有这些问题。所以今天我将spca5xx-v4l1goodbye到立宇泰 ARMSYS244O开发板上。
我的开发板是立宇泰ARMSYS2440,内核是2.4.20_elfin-d1.5。
1、首先下源码包spca5xx-v4l1goodbye.tar.gz,然后解压
#tar -xzvf spca5xx-v4l1goodbye.tar.gz
解压后得到一个spca5xx-v4l1goodbye目录,里边是spca5xx-v4l1goodbye的源代码。
2、修改Makefile
#cd spca5xx-v4l1goodbye
#gedit Makefile&
将
ifneq ($(shell uname -r | cut -d. -f1,2), 2.4)
ifneq ($(KERNELRELEASE),) # We were called by kbuild
CFLAGS += $(DEFINES)
obj-m += spca5xx.o
spca5xx-objs := drivers/usb/spca5xx.o drivers/usb/spcadecoder.o
else # We were called from command line
KERNEL_VERSION = `uname -r`
KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
PWD := $(shell pwd)
MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/
# Targets, don't change!
default:
@echo ' Building SPCA5XX driver for 2.5/2.6 kernel.'
@echo ' Remember: you must have read/write access to your kernel source tree.'
$(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) CC=$(CC) modules
install:
mkdir -p $(MODULE_INSTALLDIR)
rm -f $(MODULE_INSTALLDIR)spca50x.ko
rm -f $(MODULE_INSTALLDIR)et61x.ko
install -c -m 0644 spca5xx.ko $(MODULE_INSTALLDIR)
/sbin/depmod -ae
uninstall:
rm -f $(MODULE_INSTALLDIR)/spca5xx.ko
/sbin/depmod -aq
endif
else # kernel version test
以及
endif # End kernel version test
删除,应为这些都是针对2.6内核的,我们不需要。
将
KERNEL_VERSION = `uname -r`
替换为自己的内核版本号,我的是
KERNEL_VERSION = 2.4.20_elfin-d1.5
将
KINCLUDE = /lib/modules/$(KERNEL_VERSION)/build/include
替换为自己的内核的代码路径
KINCLUDE = /root/kenerl2440_64m30/include
将
CC = gcc
LD = ld
替换为
CC = /usr/local/arm/2.95.3/bin/arm-linux-gcc
LD = /usr/local/arm/2.95.3/bin/arm-linux-ld
3、修改scpca5xx目录下spca5xx.c
找到定义spca5xx_driver的地方,将原来的定义
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
static struct usb_driver spca5xx_driver = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
.owner = THIS_MODULE,
#endif
.name = "spca5xx",
.id_table = device_table,
.probe = spca5xx_probe,
.disconnect = spca5xx_disconnect
};
#else
static struct usb_driver spca5xx_driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)
THIS_MODULE,
#endif
"spca5xx",
spca5xx_probe,
spca5xx_disconnect,
{NULL, NULL}
};
#endif
替换为下边的内容:
static struct usb_driver spca5xx_driver = {
name: "spca5xx",
id_table: device_table,
probe: spca5xx_probe,
disconnect: spca5xx_disconnect
};
找到spca5xx_probe函数定义的地方,将原来的
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static int
spca5xx_probe(struct usb_interface *intf, const struct usb_device_id *id)
#else
static void *spca5xx_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
#endif
替换为:
static void *
spca5xx_probe (struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
如果不修改这两个地方,编译不会有问题,但是驱动不能工作。
4、编译
#make
在spca5xx-v4l1goodbye目录下生成spca5xx.o文件,这就是我们需要的驱动。将这个文件拷到开发板的文件系统里。
5、将驱动加载到内核
#insmod spca5xx.o
Using spca5xx.o
drivers/usb/spca5xx.c: Unable to initialise /proc/video/spca50x//提示无法初始化,先不管
usb.c: registered new driver spca5xx
drivers/usb/spca5xx.c: spca5xx driver 00.60.00.1 registered
插上你的zc301摄像头,就可以看到如下的信息
[root@lyt /]# hub.c: new USB device usb-ohci-1, assigned address 2
Manufacturer: Vimicro Corp.
Product: PC Camera
drivers/usb/spca5xx.c: USB SPCA5XX camera found. Type Vimicro Zc301P 0x303b
drivers/usb/spca5xx.c: [spca5xx_probe:5488] Camera type JPEG
drivers/usb/zc3xx.h: [zc3xx_config:527] Find Sensor PB0330
drivers/usb/spca5xx.c: [spca5xx_getcapability:1767] maxw 640 maxh 480 minw 176 minh 144
同时在/dev下创建了v4l/video0设备文件。
恭喜你的摄像头现在可以使用了。
我的开发板是立宇泰ARMSYS2440,内核是2.4.20_elfin-d1.5。
1、首先下源码包spca5xx-v4l1goodbye.tar.gz,然后解压
#tar -xzvf spca5xx-v4l1goodbye.tar.gz
解压后得到一个spca5xx-v4l1goodbye目录,里边是spca5xx-v4l1goodbye的源代码。
2、修改Makefile
#cd spca5xx-v4l1goodbye
#gedit Makefile&
将
ifneq ($(shell uname -r | cut -d. -f1,2), 2.4)
ifneq ($(KERNELRELEASE),) # We were called by kbuild
CFLAGS += $(DEFINES)
obj-m += spca5xx.o
spca5xx-objs := drivers/usb/spca5xx.o drivers/usb/spcadecoder.o
else # We were called from command line
KERNEL_VERSION = `uname -r`
KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
PWD := $(shell pwd)
MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/
# Targets, don't change!
default:
@echo ' Building SPCA5XX driver for 2.5/2.6 kernel.'
@echo ' Remember: you must have read/write access to your kernel source tree.'
$(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) CC=$(CC) modules
install:
mkdir -p $(MODULE_INSTALLDIR)
rm -f $(MODULE_INSTALLDIR)spca50x.ko
rm -f $(MODULE_INSTALLDIR)et61x.ko
install -c -m 0644 spca5xx.ko $(MODULE_INSTALLDIR)
/sbin/depmod -ae
uninstall:
rm -f $(MODULE_INSTALLDIR)/spca5xx.ko
/sbin/depmod -aq
endif
else # kernel version test
以及
endif # End kernel version test
删除,应为这些都是针对2.6内核的,我们不需要。
将
KERNEL_VERSION = `uname -r`
替换为自己的内核版本号,我的是
KERNEL_VERSION = 2.4.20_elfin-d1.5
将
KINCLUDE = /lib/modules/$(KERNEL_VERSION)/build/include
替换为自己的内核的代码路径
KINCLUDE = /root/kenerl2440_64m30/include
将
CC = gcc
LD = ld
替换为
CC = /usr/local/arm/2.95.3/bin/arm-linux-gcc
LD = /usr/local/arm/2.95.3/bin/arm-linux-ld
3、修改scpca5xx目录下spca5xx.c
找到定义spca5xx_driver的地方,将原来的定义
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
static struct usb_driver spca5xx_driver = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
.owner = THIS_MODULE,
#endif
.name = "spca5xx",
.id_table = device_table,
.probe = spca5xx_probe,
.disconnect = spca5xx_disconnect
};
#else
static struct usb_driver spca5xx_driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)
THIS_MODULE,
#endif
"spca5xx",
spca5xx_probe,
spca5xx_disconnect,
{NULL, NULL}
};
#endif
替换为下边的内容:
static struct usb_driver spca5xx_driver = {
name: "spca5xx",
id_table: device_table,
probe: spca5xx_probe,
disconnect: spca5xx_disconnect
};
找到spca5xx_probe函数定义的地方,将原来的
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static int
spca5xx_probe(struct usb_interface *intf, const struct usb_device_id *id)
#else
static void *spca5xx_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
#endif
替换为:
static void *
spca5xx_probe (struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
如果不修改这两个地方,编译不会有问题,但是驱动不能工作。
4、编译
#make
在spca5xx-v4l1goodbye目录下生成spca5xx.o文件,这就是我们需要的驱动。将这个文件拷到开发板的文件系统里。
5、将驱动加载到内核
#insmod spca5xx.o
Using spca5xx.o
drivers/usb/spca5xx.c: Unable to initialise /proc/video/spca50x//提示无法初始化,先不管
usb.c: registered new driver spca5xx
drivers/usb/spca5xx.c: spca5xx driver 00.60.00.1 registered
插上你的zc301摄像头,就可以看到如下的信息
[root@lyt /]# hub.c: new USB device usb-ohci-1, assigned address 2
Manufacturer: Vimicro Corp.
Product: PC Camera
drivers/usb/spca5xx.c: USB SPCA5XX camera found. Type Vimicro Zc301P 0x303b
drivers/usb/spca5xx.c: [spca5xx_probe:5488] Camera type JPEG
drivers/usb/zc3xx.h: [zc3xx_config:527] Find Sensor PB0330
drivers/usb/spca5xx.c: [spca5xx_getcapability:1767] maxw 640 maxh 480 minw 176 minh 144
同时在/dev下创建了v4l/video0设备文件。
恭喜你的摄像头现在可以使用了。
相关文章推荐
- 2440开发板linux3.x.xx版移植
- Spca5xx 摄像头驱动移植(For Linux 2.6.14)
- 在RH9.0+vmware 5.xx上从开始到最后实现spca5xx驱动的安装 以及 嵌入式板上的驱动移植
- linux-2.6.30.4移植至2440开发板经验谈
- u-boot在s3c2410开发板上移植(NAND Flash Boot)过程
- 新唐N32926开发板移植mcp2515(二)
- 移植u-boot-2009.06-rc3到友善之臂matrix4开发板step1
- 向嵌入式linux开发板移植openSSH
- Fedora8上交叉编译qtopia4移植成功到s3c2410开发板
- RT-thread-2.0.1移植(基于STM32F4xx)
- 基于s3c2410开发板2.6.25内核的USB驱动的移植 (转)
- x210v3开发板u-boot-2012.10移植之五---点亮led进行调试
- x210v3开发板u-boot-2012.10移植之八---DDR2初始化我也能搞定
- 嵌入式arm210开发板移植Apache的详细步骤
- [正在学习开发板]分享--- iTOP-4412移植CAN
- 移植PWM蜂鸣器驱动到GEC2440开发板
- MPlayer在ARM上的移植(S5PV210开发板)
- 移植openssh至arm9嵌入式开发板
- 如何将QT程序移植到开发板上运行
- linux-2.6.32在mini2440开发板上移植(12)之SD卡驱动移植