做外贸网站要什么条件,计算机电子商务主要学什么,学计算机,男女做那个网站动态图Arm开发板上摄像头的移植有两种方法#xff1a;第一#xff0c;将驱动程序添加到内核#xff0c;通过编译内核#xff0c;烧写到板子上#xff1b;第二种#xff0c;通过动态加载摄像头驱动模块的方法进行硬件的驱动。作者首先在PC的linux系统进行摄像驱动程序的移植第一将驱动程序添加到内核通过编译内核烧写到板子上第二种通过动态加载摄像头驱动模块的方法进行硬件的驱动。作者首先在PC的linux系统进行摄像驱动程序的移植保证驱动程序版本正确然后将驱动程序编译成模块通过文件系统挂载到板子然后进行加载进而创建摄像头设备节点。下面将具体介绍摄像头动态加载的过程。移植过程所使用的摄像头型号ZC301Parm板上的内核版本为2.6.9开发板为pxa270所采用的驱动程序包为spca5xx-20060501.tar.gz。第一步使用命令解压文件 tar zxvf spca5xx-20060501.tar.gz进入spca5xx-20060501 cd spca5xx-20060501第二步修改Makefile文件VERSION 00.60.00Makefile的内容如下注释掉的为蓝色红色表示修改过的内容CC arm-linux-gccLD arm-linux-ldCVSVERSION $Experimental work Michel Xhaard Reza Jelveh 03/02/2004DEFINES #### The following flags enable experimental features.# By default, these are enabled for development versions of the driver, and# disabled for release versions.# Optional: Enable driver debuggingDEFINES -DSPCA50X_ENABLE_DEBUG# Optional: Enable direct register read/write for PAC207 development#DEFINES -DSPCA5XX_ENABLE_REGISTERPLAY#### The following flags enable features that arent yet implemented, and# therefore are disabled by default.# Optional: Enable compressionDEFINES -DSPCA50X_ENABLE_COMPRESSION#### Rest of Makefile follows here. You probably wont need to touch this.# Setup definesDEFINES -DCONFIG_USB_SPCA5XX_MODULE1 -DMODULE -D__KERNEL__DEFINES -DVID_HARDWARE_SPCA5XX0xFF -DSPCA5XX_VERSION\$(VERSION)\ifneq ($(shell uname -r | cut -d. -f1,2), 2.4)ifneq ($(KERNELRELEASE),) # We were called by kbuildCFLAGS $(DEFINES)obj-m spca5xx.ospca5xx-objs : drivers/usb/spca5xx.o drivers/usb/spcadecoder.oelse # We were called from command line#KERNEL_VERSION uname -rKERNEL_VERSION 2.6.9#KERNELDIR : /lib/modules/$(KERNEL_VERSION)/buildKERNELDIR : /up-techpxa270/kernel/linux-2.6.9PWD : $(shell pwd)#MODULE_INSTALLDIR /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/MODULE_INSTALLDIR /root/modules/# Targets, dont 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) modulesinstall:mkdir -p $(MODULE_INSTALLDIR)rm -f $(MODULE_INSTALLDIR)spca50x.korm -f $(MODULE_INSTALLDIR)et61x.koinstall -c -m 0644 spca5xx.ko $(MODULE_INSTALLDIR)/sbin/depmod -aeuninstall:rm -f $(MODULE_INSTALLDIR)/spca5xx.ko/sbin/depmod -aqendifelse # kernel version test############################################################################## For Linux 2.4 users.# Change the following lines according to your system configuration.# It is important to configure your particular source tree (make dep) before# compiling this module!################################################################################# This makefile will build the spca50x driver module external to the kernel# source tree. It makes it easier to swap kernels.#KERNEL_VERSION uname -rKERNEL_VERSION 2.4.x#### Location of the header files (most importantly the config files)# for the kernel you want to build the module against.# This should be correct for the currently installed kernel on your machine.#KINCLUDE /lib/modules/$(KERNEL_VERSION)/build/includeKINCLUDE /up-techpxa270/kernel/linux2.4.xKERNEL_ACFILE $(KINCLUDE)/linux/autoconf.hKERNEL_MODVERSIONSFILE $(KINCLUDE)/linux/modversions.h#MODULE_INSTALLDIR /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/MODULE_INSTALLDIR /root/modules/# Detect module versioning supportifneq ($(strip $(shell grep define CONFIG_MODVERSIONS 1 $(KERNEL_ACFILE))),)DEFINES -DMODVERSIONS -include $(KERNEL_MODVERSIONSFILE)endif# Detect SMP supportifneq ($(strip $(shell grep define CONFIG_SMP 1 $(KERNEL_ACFILE))),)DEFINES -D__SMP__ -DSMPendif# Setup the tools#CC gcc#LD ldCC arm-linux-gccLD arm-linux-gcc# Setup compiler warningsWARNINGS -Wall -Wpointer-arithWARNINGS -Wcast-align -Wwrite-strings -Wstrict-prototypesWARNINGS -Wuninitialized -Wreturn-type -Wunused -Wparentheses# Setup compiler flagsCFLAGS -O2 -fomit-frame-pointer -fno-strict-aliasing -pipeCFLAGS -mpreferred-stack-boundary2CFLAGS -I$(KINCLUDE) -Idrivers/usb# Setup link flagsLDFLAGS --strip-debug -r# Setup the list of files to be included in a distributionDIST_FILES CHANGELOG \README \Makefile \drivers/usb/Config.in \drivers/usb/spcadecoder.c \drivers/usb/spcadecoder.h \drivers/usb/spcagamma.h \drivers/usb/spcaCompat.h \drivers/usb/spcausb.h \drivers/usb/spca500_init.h \drivers/usb/spca501_init.h \drivers/usb/sp5xxfw2.dat \drivers/usb/sp5xxfw2.h \drivers/usb/spca505_init.h \drivers/usb/spca506.h \drivers/usb/spca508_init.h \drivers/usb/spca561.h \drivers/usb/sonix.h \drivers/usb/cs2102.h \drivers/usb/hv7131b.h \drivers/usb/icm105a.h \drivers/usb/hv7131c.h \drivers/usb/hdcs2020.h \drivers/usb/pb0330.h \drivers/usb/tas5130c.h \drivers/usb/zc3xx.h\drivers/usb/tv8532.h\drivers/usb/cxlib.h\drivers/usb/sn9cxxx.h\drivers/usb/cx11646.h\drivers/usb/pac207.h\drivers/usb/spca5xx.c \drivers/usb/spca5xx.hOBJS drivers/usb/spcadecoder.o \drivers/usb/spca5xx.oBINARY spca5xx.o#### Targets follow herebinary: $(OBJS)echo Linking $(BINARY)$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS)install: binaryecho Installing.. Your root password may be required.su -c make install-rootinstall-root:echo Installing..mkdir -p /lib/modules/uname -r/kernel/drivers/usbrm -f /lib/modules/uname -r/kernel/drivers/usb/spca50x.orm -f /lib/modules/uname -r/kernel/drivers/usb/et61x.ocp spca5xx.o /lib/modules/uname -r/kernel/drivers/usb/spca5xx.o/sbin/depmoddist: clean binaryecho Making distributable archivesrm -f spca5xx-src-$(VERSION).tar.gztar zcf spca5xx-src-$(VERSION).tar.gz $(DIST_FILES)rm -f spca5xx-module-$(VERSION).tar.gzcp $(BINARY) spca5xx-$(VERSION).otar zcf spca5xx-module-$(VERSION).tar.gz spca5xx-$(VERSION).o READMErm spca5xx-$(VERSION).o.c.o: Makefile $*.cecho Compiling $*.c$(CC) $(CFLAGS) $(WARNINGS) $(DEFINES) -c $*.c -o $*.o#### Dependencies follow heredrivers/usb/spca5xx.o: drivers/usb/spca5xx.h \drivers/usb/spcaCompat.h \drivers/usb/spcausb.h \drivers/usb/sonix.h \drivers/usb/spca500_init.h \drivers/usb/spca501_init.h \drivers/usb/sp5xxfw2.h \drivers/usb/spca505_init.h \drivers/usb/spca506.h \drivers/usb/spca508_init.h \drivers/usb/spca561.h \drivers/usb/zc3xx.h\drivers/usb/tv8532.h\drivers/usb/cx11646.h\drivers/usb/mr97311.h\drivers/usb/sn9cxxx.h\drivers/usb/pac207.h\drivers/usb/spcadecoder.o: drivers/usb/spcadecoder.h \drivers/usb/spcagamma.h \endif # End kernel version test############################################################################### OTHER TARGETS##############################################################################clean:rm -r -f drivers/usb/*.o drivers/usb/.spcadecoder.o.cmd \drivers/usb/.spca5xx.o.cmd *.o *.ko *.mod.* .[a-z]* core *.i##############################################################################关于修改Makefile文件做几点说明1Makefile文件针对不同内核回编译成不同的目标文件该Makefile前部分是针对2.6的内核后部分针对2.4的内核用户根据自己的内核进行修改我修改的是2.6.9的内核关于2.4.x是表示2.4的某个版本只是一个代号用户自己根据实际修改。2修改的东西主要有两个一是gcc变成arm-linux-gcc二是内核路径注意这是交叉编译环境的内核路径即arm-linux的内核路径非pc上linux系统的内核。3 在Makefile文件修改之后如果你的arm-linux从未编译需要先编译内核然后在make。MODULE_INSTALLDIR 这个是你编译生成的模块放在哪个路径可以不用改当然为了方便最好改成你想要的文件夹下文件夹权限要改成可读写的。第三步 make编译成功后会在模块MODULE_INSTALLDIR 路径生成spca5xx.ko,spca5xx.o等目标文件。第四步将你的目标文件spca5xx.ko(2.6内核)或者spca5xx.o(2.4内核)挂载到arm开发板上第五步在开发板上进入挂载的文件夹下 insmod spca5xx.ko第六步 插上摄像头测试摄像头不出意外情况下在/dev/下会有video0设备符或者是/dev/v4l/video0第七步 cat /dev/video0 a.jpg 看看是否有文件a.jpg按 ctrlC 退出将a.jpg拷贝到pc linux下通过gqview软件进行查看也可以编一个图像采集小程序抓取一帧保存成文件然后到pclinux下进行查看。gqview软件下得麻烦我是写了个小程序将jpg文件保存下来到pc linux下直接看的很方便。当然也有意外摄像头驱动加载之后不能使用摄像头下一篇文章将会介绍一个特殊情况。我也是被这个问题卡了一两天问了一个技术达人才解决的。前面过程网上很多我是将过程再细化一些供初学者参考共同进步。