spca5xx-LE in S3C2410

来源:互联网 发布:康熙怒斥群臣知乎 编辑:程序博客网 时间:2024/05/01 10:07

 

做个step by step步骤解释一下:
1.下载针对2.4内核的驱动补丁,http://mxhaard.free.fr/ -〉usb-2.4.31LE06.patch;
2.将这个patch放到$(KERNEL)/driver/usb下,然后常规配置:
 解压:tar -xvzf usb-2.4.31LE06.patch
 打补丁:patch -p1 < usb-2.4.31LE06.patch
3.根据在(KERNEL)/driver/usb产生的两个 .rej文件对Makefile和Configin进行修改

Makefile:

subdir-$(CONFIG_USB_SERIAL) += serial
subdir-$(CONFIG_USB_STORAGE) += storage
subdir-$(CONFIG_USB_SPCA5XX)   += spca5xx     // ++

ifeq ($(CONFIG_USB_SERIAL),y)
 obj-y += serial/usb-serial.o
endif

ifeq ($(CONFIG_USB_STORAGE),y)
 obj-y += storage/storage.o
endif

ifeq ($(CONFIG_USB_SPCA5XX),y)    //++
 obj-y += spca5xx/spca5xx.o
endif

config.in:
dep_tristate '  USB OV511 Camera support' CONFIG_USB_OV511 $CONFIG_USB $CONFIG_VIDEO_DEV
   dep_tristate '  USB SPCA5XX Sunplus Vimicro Sonix Cameras' CONFIG_USB_SPCA5XX $CONFIG_USB $CONFIG_VIDEO_DEV

4.编译内核,make menuconfig -> make bzImage -> make modules
5.ok之后在$(KERNEL)/driver/usb/spca5xx中可以找到spca5xx.o,在加载到arm之前首先加载videodev.o


另外,在PC机上的RH9 2.4.20-8编译spca5xx的驱动时发现一个bug,解决一下
如果直接编译,提示出错:

出现错误信息
[root@126 spca5xx-20060402]# make
Compiling drivers/usb/spca5xx.c
In file included from /lib/modules/2.4.20-8/build/include/linux/vmalloc.h:8,
         from drivers/usb/spca5xx.c:46:
/lib/modules/2.4.20-8/build/include/linux/highmem.h: In function `bh_kmap':
/lib/modules/2.4.20-8/build/include/linux/highmem.h:20: warning: pointer of type
`void *' used in arithmetic
drivers/usb/spca5xx.c: In function `spca5xx_mmap':
drivers/usb/spca5xx.c:5131: warning: passing arg 1 of `remap_page_range_R2baf18f
2' makes pointer from integer without a cast
drivers/usb/spca5xx.c:5131: incompatible type for argument 4 of `remap_page_rang
e_R2baf18f2'
drivers/usb/spca5xx.c:5131: too few arguments to function `remap_page_range_R2ba
f18f2'

打开源码spca5xx.c中的spca5xx_mmap,可以发现在这个函数的调用上RH9和RH9以上的版本调用的都不是同一条函数,在remap_page_range()函数的第一个参数对于RH9就没有做定义,为定义情况下在RH9调用remap_page_range()就缺少了第一个参数的描述,一个小bug在这里,只要在出错的remap_page_range参数添加第一个参数,设为0,编译就通过了,还有几个warming可以忽略....


good luck,and enjoy....