我正在尝试在 Ubuntu 10.04 LTS 上编译视频驱动程序,这是错误:
**************************************************************************
* Building Techwell TW686x driver... *
* Type "make help" for a list of available targets. *
**************************************************************************
make -C /lib/modules/`uname -r`/build M="/home/v4/driver-686x-0.1.1" clean
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-43-generic'
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-43-generic'
make -C /lib/modules/`uname -r`/build M="/home/v4/driver-686x-0.1.1" modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-43-generic'
CC [M] /home/v4/driver-686x-0.1.1/tw686x-core.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-video.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-i2c.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-device.o
CC [M] /home/v4/driver-686x-0.1.1/i2c-sw.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-alsa.o
CC [M] /home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.o
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:341: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:343: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: excess elements in struct initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: (near initialization for ‘qops’)
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c: In function ‘videobuf_queue_dma_contig_init_tw’:
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:357: warning: passing argument 2 of ‘videobuf_queue_core_init’ discards qualifiers from pointer target type
include/media/videobuf-core.h:197: note: expected ‘struct videobuf_queue_ops *’ but argument is of type ‘const struct videobuf_queue_ops *’
make[2]: *** [/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.o] Error 1
make[1]: *** [_module_/home/v4/driver-686x-0.1.1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-43-generic'
make: *** [modules] Error 2
我的内核是 2.6.32-43。我的C很生锈,所以我问大师。据我所知,问题是指文件 videobuf-core.h 中的变量 videobuf_queue_ops,我在这些位置找到了它:
/usr/src/linux-headers-2.6.24-24/include/media/videobuf-core.h
/usr/src/linux-headers-2.6.32-43/include/media/videobuf-core.h
/usr/src/linux-headers-2.6.24-32/include/media/videobuf-core.h
这是有问题的文件(提取)videobuf-dma-contig-tw.c:
static struct videobuf_qtype_ops qops = {
.magic = MAGIC_QTYPE_OPS,
.alloc = __videobuf_alloc,
.iolock = __videobuf_iolock,
.mmap_mapper = __videobuf_mmap_mapper,
.vaddr = __videobuf_to_vaddr,
};
头文件中 videobuf_qtype_ops 的定义如下所示:
struct videobuf_queue_ops {
int (*buf_setup)(struct videobuf_queue *q,
unsigned int *count, unsigned int *size);
int (*buf_prepare)(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field);
void (*buf_queue)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
void (*buf_release)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
};
#define MAGIC_QTYPE_OPS 0x12261003
/* Helper operations - device type dependent */
struct videobuf_qtype_ops {
u32 magic;
void *(*alloc) (size_t size);
void *(*vmalloc) (struct videobuf_buffer *buf);
int (*iolock) (struct videobuf_queue* q,
struct videobuf_buffer *vb,
struct v4l2_framebuffer *fbuf);
int (*mmap) (struct videobuf_queue *q,
unsigned int *count,
unsigned int *size,
enum v4l2_memory memory);
int (*sync) (struct videobuf_queue* q,
struct videobuf_buffer *buf);
int (*video_copy_to_user)(struct videobuf_queue *q,
char __user *data,
size_t count,
int nonblocking);
int (*copy_stream) (struct videobuf_queue *q,
char __user *data,
size_t count,
size_t pos,
int vbihack,
int nonblocking);
int (*mmap_free) (struct videobuf_queue *q);
int (*mmap_mapper) (struct videobuf_queue *q,
struct vm_area_struct *vma);
};
我应该更改此头文件吗?我不确定修复是什么,或者我是否应该更改 Linux 文件 - 可怕的东西!
谢谢你的帮助。