10moons ut340linux驱动编译安装方法

http://linuxtv.org/downloads/drivers/

下载源代码,里面按时间分了版本,一般选最新的,我选择的是2012-7-25版本的,地址为

http://linuxtv.org/downloads/drivers/linux-media-2012-07-25.tar.bz2

放到/home/musictom/Downloads/driver目录下

tar -xvf /home/musictom/Downloads/driver/linux-media-2012-07-25.tar.bz2

打开terminal,cd /home/musictom

make -C /lib/modules/3.2.0-23-generic/build M=/home/musictom/Downloads/driver/drivers/media/video/tm6000/ modules

其中tm6000目录里放的是的我电视卡的驱动的源代码,

-C=/lib/modules/3.2.0-23-generic/build表示编译时进入系统驱动所在目录,

M=表示编译的驱动的源代码目录

执行编译的时候会报错,是因为找不到头文件,打开/home/musictom/Downloads/driver/drivers/media/video/tm6000/Makefile文件,修改

ccflags-y := -Idriver/drivers/media/video字样为

ccflags-y := -I/home/musictom/driver/drivers/media/video

因为原来是用的相对路径,现在改为绝对路径,

如下:

ccflags-y := -I/home/musictom/driver/drivers/media/video
ccflags-y += -I/home/musictom/driver/drivers/media/common/tuners
ccflags-y += -I/home/musictom/driver/drivers/media/dvb/dvb-core
ccflags-y += -I/home/musictom/driver/drivers/media/dvb/frontends
ccflags-y += -I/home/musictom/Downloads/driver/drivers/media/dvb/dvb-core/

ccflags-y += -I/home/musictom/Downloads/driver/drivers/media/common/tuners

ccflags-y += -I/home/musictom/Downloads/driver/drivers/include/
ccflags-y += -I/home/musictom/Downloads/driver/include/media/
ccflags-y += -I/home/musictom/Downloads/driver/drivers/media/dvb/frontends/

tm6000-video.c

#include </home/musictom/Downloads/driver/include/media/v4l2-dev.h>
 

再make,加载驱动可以用

insmod hello.ko

卸载驱动

rmmod hello

你可能感兴趣的:(linux)