v4l2的input/output 错误问题

jack0017 2010-07-21 11:14:12
我将ZC301PLH摄像头用在S3C2440上,内核版本为2.6.33,以前使用ZC301PL的摄像头,工作正常,但是换上ZC301PLH摄像头后,在调用ioctl (fd, VIDIOC_DQBUF, &buf)读取帧缓冲的时候出现了 input/output 错误,不知道什么原因,其他配置没有报错,并读出来对比过,和写入配置相同。代码如下:

这段代码是网上一位朋友提供的,我的程序就是用这段代码改的,代码太多,贴出来很不方便,就先贴这位朋友的代码给大家做参考,里面有一些小错误,请忽略,大致流程是一样的。

#define VIDEO_DEVICE "/dev/video0"
#define pictureNumber 4
#define SIZE 32768


typedef struct VideoBuffer
{
void *start;
int offset;
size_t length;
}VideoBuffer;


extern char testbuf[SIZE];//SIZE大小有下面的设置决定,此处为32768,所有图像相同大小
extern VideoBuffer *buffers;//描述帧缓冲的映射地址
extern int SocketFd;//基于udp协议
extern int videofd;//摄像头文件描述符(本实验中为open /dev/video1的返回值)

void cap_pic(char *start, unsigned int length,char *filename)
{
FILE * file_fd;



if((file_fd = fopen(filename,"wb"))<0)

{
perror("Open file error\n");

exit(1);

}

if(length==0)
{
DebugPrintf("error:pic length = 0\n");
}
else
{
fwrite(start, length, 1, file_fd);
}

DebugPrintf("pic %s capture over!\n",filename);

fclose(file_fd);

}

int VideoInit(void)

{
struct v4l2_requestbuffers req;
struct v4l2_buffer buf;
videofd=open(VIDEO_DEVICE,O_RDWR);
if (videofd==-1){
printf("open the file of video1 ** failed\n");
return -1;
}
if(set_attribute(videofd) < 0)//设置视频格式

return -1;
if( (buffer_request(videofd,&req)) < 0) //申请桢缓冲

return -1;
CatBegin(videofd);//开始采集
buffers = calloc(req.count,sizeof(VideoBuffer));
AddrReverse(&buffers,req.count,videofd); //从内核地址到用户地址的映射
}

int set_attribute(int fd)
{
int ret;
struct v4l2_format fmt;
memset(&fmt,0,sizeof(struct v4l2_format));
fmt.type=V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = 320;
fmt.fmt.pix.height = 240;//320*240(图像大小与此有关,此处为32768)
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG;//得到jpeg格式图像
ret=ioctl(fd, VIDIOC_S_FMT, &fmt);
if(ret<0){
printf("in set_attribute ,ioctl error !\n");
return -1;
}
}

int buffer_request(int fd,struct v4l2_requestbuffers *req)//
{
int ret;
memset(req, 0, sizeof (struct v4l2_requestbuffers));
req->count = pictureNumber;//一般为4,申请4个帧缓冲,pictureNumber为头文件里的宏定义
req->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
req->memory = V4L2_MEMORY_MMAP;
ret=ioctl(fd, VIDIOC_REQBUFS,req);
if(ret<0){
printf("set buffer failed\n");
return -1;
}
return 0;
}


int PictureGet(int fd)
{
static int index = 0;//用static修饰,为的是每调用一次,index保留上次值,进而可以依次读取四个桢缓冲

struct v4l2_buffer buf;
int ret;
char *ptcur = buffers[index].start;//读帧缓冲通过映射到用户空间来读,buffers [index].start中存放的是四个映射到用户空间地址的指针,指针分别间接指向四个帧缓冲
printf("......................frame %d\n",index);
buf.index = index;//本次调用读标志为index的帧缓冲,与用户空间相对应
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;

出错的地方
if (ioctl(fd, VIDIOC_DQBUF, &buf) < 0)//出队列
{
perror("VIDIOC_DQBUF failed.\n");
printf("fd = %d\n",fd);
}


memcpy(testbuf,ptcur,sizeof(testbuf));//将该帧数据复制到全局的缓冲区testbuf中,testbuf大小32768
cap_pic(testbuf,sizeof(testbuf),"pic.jpg");
ret=ioctl(fd, VIDIOC_QBUF, &buf);//入队列,此时标志为index的帧缓冲数据被刷新,如不入队,得不到新数据
if(ret< 0) {
perror("ioctl");
printf("VIDIOC_QBUF error\n");
}
index++;
if (index == pictureNumber)
index = 0;

}

int AddrReverse(VideoBuffer **buffers,int reqcount,int fd)
{
int numBufs;
struct v4l2_buffer buf;
int ret;
for (numBufs = 0; numBufs < reqcount; numBufs++)//循环reqcount次,分别对reqcount个帧缓冲映射
{
memset( &buf, 0, sizeof(buf) );
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = numBufs;//

if (ioctl(fd, VIDIOC_QUERYBUF, &buf) < 0){
printf("VIDIOC_QUERYBUF error\n");
return -1;
}
(*buffers + numBufs)->length = buf.length;
(*buffers +numBufs)->offset = (size_t)(buf.m.offset);
(*buffers + numBufs)->start = mmap((*buffers + numBufs)->start, buf.length,PROT_READ | PROT_WRITE, MAP_SHARED, fd,(*buffers + numBufs)->offset);

if ((*buffers + numBufs)->start == MAP_FAILED){
perror("buffers error\n");
return -1;
}
ret=ioctl(fd, VIDIOC_QBUF, &buf);//将帧缓冲入队
if(ret< 0) {
printf("ret3=%d\n",ret);
printf("VIDIOC_QBUF error\n");
return -1;
}

}
return 0;
}

int CatBegin(int fd)

{
int ret;
enum v4l2_buf_type type;
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ret=ioctl (fd, VIDIOC_STREAMON, &type); //程序运行到这里四个缓冲区里面就有数据了
perror("ioctl");

if(ret<0){
printf("VIDIOC_STREAMON error\n");
return -1;
}

}

int main(int argc,char **argv)
{
VideoInit();
PictureGet(videofd);
usleep(1000);
return 0;
}
...全文
1572 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
tumblerman 2010-10-25
  • 打赏
  • 举报
回复
个人觉得,在2440中用usb的摄像头就是一个天大的错误。用YUV格式,2440是USB1.1,传输带宽不够;用MJPG格式,解压耗费的时间又多得出奇。
yuziqiang524 2010-09-02
  • 打赏
  • 举报
回复
主楼的问题解决没有啊,我也遇到这样的问题
jack0017 2010-08-08
  • 打赏
  • 举报
回复
在网上另外找了一个GSPCA的驱动,编译成模块,加载后,摄像头工作正常了
jack0017 2010-08-08
  • 打赏
  • 举报
回复
谢谢回帖的朋友,问题已经解决
wwwunix 2010-07-28
  • 打赏
  • 举报
回复
是不是小型号不同,或者使用了其他的接口或控制芯片?
jack0017 2010-07-28
  • 打赏
  • 举报
回复
呵呵,前几天比较忙,没来看帖子,原因暂时没找到,但是发现一个奇怪的问题,我把两个摄像头都拆开了,两个摄像头的芯片居然是相同的,都是ZC301PLH,开始的时候怀疑是晶振不同(那个烂晶振没有标注频率值,郁闷),造成时钟不同引起的,用示波器测试又是相同的,现在还在郁闷之中。。。。。。
xiao888lin 2010-07-22
  • 打赏
  • 举报
回复
我用的测试程序是网上的一个高手写的:http://hi.baidu.com/aokikyon/blog/item/258ffdfc0c67f7f0fd037f30.html,测试程序可以用,但是android上自带的Camera能用,出错跟你的一样
xiao888lin 2010-07-22
  • 打赏
  • 举报
回复
hi,你好,我也遇到了这种错误,我用的是ov7670摄像头,也是执行到这一步出的错。我都搞了好长时间了,还是没有搞定,不知道你找到什么好的办法了没,如果解决了的话,分享分享
wwwunix 2010-07-21
  • 打赏
  • 举报
回复
从加载信息看起来,里面用的传感器不一样。这样有可能造成读取帧缓冲的方法不同(驱动层面的)。而你们的驱动有可能对这个传感器不支持或支持得不好(也有可能存在Bug)。你先查查你们的驱动支持哪些摄像头?最好是查到芯片层面的。
jack0017 2010-07-21
  • 打赏
  • 举报
回复
ZC301PL的加载信息
usb 1-1: new full speed USB device using s3c2410-ohci and address 3
gspca: probing 0ac8:303b
zc3xx: probe 2wr ov vga 0x0000
zc3xx: probe sensor -> 0011
zc3xx: Find Sensor HV7131R(c)
gspca: video0 created

ZC301PLH的加载信息
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
gspca: probing 0ac8:303b
zc3xx: probe 2wr ov vga 0x0000
zc3xx: probe 3wr vga 1 0x8001
zc3xx: probe sensor -> 0013
zc3xx: Find Sensor MI0360SOC. Chip revision 8001
jack0017 2010-07-21
  • 打赏
  • 举报
回复
是一个系列的,一个ZC301PL,一个是ZC301PLH,查上摄像头后,内核检查出来的设备是相同的,都是ZC3XX
错误输出是:VIDIOC_DQBUF failed. error input/output
id=3
wwwunix 2010-07-21
  • 打赏
  • 举报
回复
错误代码是什么?
这两个摄像头里面用的芯片型号是一样的吗?
wwwunix 2010-07-21
  • 打赏
  • 举报
回复
如果是这样,那你就要到驱动里面看看关于VIDIOC_DQBUF ioctl命令的实现代码了,最好是跟一下,看看是什么原因造成了I/O error.
在驱动源代码中找“VIDIOC_DQBUF failed”这个字符串。
jack0017 2010-07-21
  • 打赏
  • 举报
回复
我查了zc3xx的驱动,对这两种摄像头的传感器都是支持的,这是驱动里面的代码,驱动能够识别这两种传感器,而且sensor是驱动通过USB读出来的信息,这个不应该有错吧。
which(sensor)
case 0x11:
PDEBUG(D_PROBE, "Find Sensor HV7131R(c)");
sd->sensor = SENSOR_HV7131C;
break;
case 0x13:
PDEBUG(D_PROBE,
"Find Sensor MI0360SOC. Chip revision %x",
sd->chip_revision);
sd->sensor = SENSOR_MI0360SOC;
获取USB摄像头的1080p的JPEG格式的图片20180608_1806.7z 电脑上的系统:ubuntu14.04 // http://www.linuxidc.com/Linux/2011-03/33020.htm // V4L2摄像头获取单幅图片测试程序(MMAP模式) // [日期:2011-03-06] 来源:Linux社区 作者:aokikyon [字体:大 中 小] // // #加了点注释 // // #Rockie Cheng // printf #include #include // memset #include #include #include #include // close write usleep read #include #include #include #include #include #include // mmap #include #include #include #include // pthread_create pthread_join #include #define CLEAR(x) memset (&(x), 0, sizeof (x)) #define REQ_COUNT 6 #define uchar unsigned char struct buffer { void * start; size_t length; }; static char * dev_name = "/dev/video0";//摄像头设备名 static int fd = -1; struct buffer * buffers = NULL; // static unsigned int n_buffers = 0; // 2012-7-13 11:33 camera flag // static int iFlagCamera = 0; volatile int iFlagCamera = 0; // 函数名称:thread1 // 函数功能:用于接受键盘的输入,之后通知thread2抓图 // 参数列表: // 返回值 : void thread1(void) { char ch; printf("\n !!!!Warning!!!!\n Max 1000 color bmp\n Input the char: \n"); printf("\n !!!!press o an capture 1 frame picture! \n"); printf("\n !!!!press t an capture 10 frame picture! \n"); printf("\n !!!!press h an capture 100 frame picture! \n"); while(1) { while((ch=getchar()) != '\n') { printf("%c\n", ch); if('o'==ch) { iFlagCamera = 1; printf("thread1=%d\n", iFlagCamera); } else if('t'==ch) { iFlagCamera = 10; printf("thread1=%d\n", iFlagCamera); } else if('h'==ch) { iFlagCamera = 101; printf("thread1=%d\n", iFlagCamera); } else if('q'==ch) { iFlagCamera = 10001; printf("thread1=%d\n", iFlagCamera
索智的SC5806开发板的BSP编译手册v1.2.txt 开始时间2016/8/12 18:46 结束时间2016/8/16 10:47 1、下载索智的SC5806的BSP。通过ftp下载。 地址:ftp://sochip.com.cn 账号:SC5806 密码:SC5806201601081633 Xftp 5使用自动传输BSP有点问题。ftp的传输模式有ASCII和 二进制模式。 BSP需要设置为 二进制模式。LeapFTP3.0.1.46_yfy 自动设置为二进制模式了。 估计 Xftp 5 因为设置为ASCII模式最后老是下载不完整。 2、BSP的android包的分块合并 及 解压缩: cat SC5806.android.aa SC5806.android.ab > r58_android_sc5806_20160811.tar.gz rootroot@rootroot-E400:~/wyb/r58_evb_sc5806$ tar zxvf r58_android_sc5806_20160811.tar.gz tar zxvf SC5806.lichee.tar.gz 3、编译lichee内核的时候出现modules中的软链接失效的问题的解决: cp sunxi_schw.ko /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/output/lib/modules/3.4.39/ make:离开目录“/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/aw_schw” build gpu module for sun8iw6 android /bin/sh: 1: arm-linux-gnueabi-arm-linux-gnueabi-gcc: not found make:进入目录'/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/build/linux2/sunxi_android' CC [M] /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/osfunc.o CC [M] /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/mutils.o 没有那个文件或目录 CC [M] /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/mmap.o arm-linux-gnueabi-gcc: fatal error: no input files compilation terminated. 没有那个文件或目录 make[3]: *** [/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/osfunc.o] 错误 1 make[3]: *** 正在等待未完成的任务.... arm-linux-gnueabi-gcc: fatal error: no input files compilation terminated. make[3]: *** [/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/mutils.o] 错误 1 有那个文件或目录 arm-linux-gnueabi-gcc: fatal error: no input files compilation terminated. make[3]: *** [/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/mmap.o] 错误 1 make[2]: *** [_module_/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild] 错误 2 make[1]: *** [kbuild] 错误 2 make: *** [build] 错误 2 make:离开目录“/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/build/linux2/sunxi_android” ERROR: build kernel Failed rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ cd .. rootroot@rootroot-E400:~/wyb/r58_evb_sc5806$ 进入到文件osfunc.c所在的目录: rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ cd /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4$ ll 总用量 16 drwxr-xr-x 4 rootroot rootroot 4096 7月 28 15:33 ./ drwxr-xr-x 4 rootroot rootroot 4096 7月 28 16:06 ../ drwxr-xr-x 6 rootroot rootroot 4096 7月 28 15:33 srvkm/ drwxr-xr-x 3 rootroot rootroot 4096 7月 28 15:33 system/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4$ cd srvkm/env/linux/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux$ ll 总用量 64 drwxr-xr-x 2 rootroot rootroot 4096 7月 28 16:06 ./ drwxr-xr-x 3 rootroot rootroot 4096 7月 28 15:33 ../ lrwxrwxrwx 1 rootroot rootroot 106 7月 28 15:33 event.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/event.c lrwxrwxrwx 1 rootroot rootroot 104 7月 28 15:33 ion.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/ion.c lrwxrwxrwx 1 rootroot rootroot 105 7月 28 15:33 mmap.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/mmap.c lrwxrwxrwx 1 rootroot rootroot 103 7月 28 15:33 mm.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/mm.c lrwxrwxrwx 1 rootroot rootroot 107 7月 28 15:33 module.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/module.c lrwxrwxrwx 1 rootroot rootroot 106 7月 28 15:33 mutex.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/mutex.c lrwxrwxrwx 1 rootroot rootroot 107 7月 28 15:33 mutils.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/mutils.c lrwxrwxrwx 1 rootroot rootroot 107 7月 28 15:33 osfunc.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/osfunc.c lrwxrwxrwx 1 rootroot rootroot 110 7月 28 15:33 osperproc.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/osperproc.c lrwxrwxrwx 1 rootroot rootroot 106 7月 28 15:33 pdump.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/pdump.c lrwxrwxrwx 1 rootroot rootroot 105 7月 28 15:33 proc.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/proc.c lrwxrwxrwx 1 rootroot rootroot 113 7月 28 15:33 pvr_bridge_k.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.c lrwxrwxrwx 1 rootroot rootroot 110 7月 28 15:33 pvr_debug.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/pvr_debug.c lrwxrwxrwx 1 rootroot rootroot 109 7月 28 15:33 pvr_sync.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/pvr_sync.c rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux$ 既可以发现这里文件都是红色标示的:软链接失败。 event.c -> /mnt/king_folder/studio/sdkbuild/R58/lichee/linux-3.4/modules/eurasia_km/services4/srvkm/env/linux/event.c 很显然,这是索智的一个叫king的工程师连接到了他自己的目录了。 我们自己在编译系统的时候,在本机不可能有他的目录,100%就出错了。 给出一种解决方法: rm ~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4 -rf ln -s /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/services4 /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4 设想1(扩展,经过验证出错!!!!):直接删除软连接的services4,然后拷贝过来链接源的services4,理论上应该也是可以的! 这样就不用每次都删除链接,然后再新建链接了!!!! rm ~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/services4 -rf rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ cd /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km$ tar zcvf services4_bak.tar.gz services4/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km$ cp services4_bak.tar.gz /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km$ cd /home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/binary2_sunxi_android_release/target/kbuild$ tar zxvf services4_bak.tar.gz build gpu module for sun8iw6 android /bin/sh: 1: arm-linux-gnueabi-arm-linux-gnueabi-gcc: not found make:进入目录'/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/build/linux2/sunxi_android' eurasiacon/build/linux2/modules.mk:47: *** In makefile services4/srvkm/env/linux/Linux.mk: Duplicate module srvkm (first seen in eurasiacon/binary2_sunxi_android_release/target/kbuild/services4/srvkm/env/linux/Linux.mk) listed in $(modules)。 停止。 make: *** [build] 错误 2 make:离开目录“/home/rootroot/wyb/r58_evb_sc5806/lichee/linux-3.4/modules/eurasia_km/eurasiacon/build/linux2/sunxi_android” ERROR: build kernel Failed rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ 只能每次都软链接目录(使用绝对路径) 或者一次性解决问题(挨个文件使用相对路径链接好之后打包/有能力的同学可以使用脚本来完成) 设想2(未经验证):比对两个services4中的C文件,使用比对工具拷贝过来覆盖!!!! rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun50iw1p1 1. sun8iw1p1 2. sun8iw3p1 3. sun8iw5p1 4. sun8iw6p1 5. sun8iw7p1 6. sun8iw8p1 7. sun8iw9p1 8. sun9iw1p1 Choice: 4 All available platforms: 0. android 1. dragonboard 2. linux 3. camdroid Choice: 0 All available kernel: 0. linux-3.4 Choice: 0 All available boards: 0. f1 1. fpga 2. n1 3. perf1_v1_0 4. perf2_v1_0 5. perf3_v1_0 6. qc 7. sc5806 Choice: 7 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ ./build.sh rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ cd ../android/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ source build/envsetup.sh rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ lunch 14. octopus_sc5806-eng Which would you like? [aosp_arm-eng] 14 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ extract-bsp rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ make -j8 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ pack 这样编译的系统LCD可以显示。TP不能用。 注意:加载TP的方法。 由于索智SC5806给过来的IMG是可以支持TP的,不过lsmod的时候并没有发现加载的触摸屏ko:gslX8600new.ko (r58_sochip_sc5806_1.4_1.0_v4.zip:r58_sochip_sc5806_1.4_1.0_v4.img) shell@octopus-sc5806:/ $ su shell@octopus-sc5806:/ # lsmod sunxi_schw 13015 0 - Live 0x00000000 (O) sunxi_gmac 21580 0 - Live 0x00000000 cdc_ether 3163 0 - Live 0x00000000 rtl8150 9023 0 - Live 0x00000000 mcs7830 5644 0 - Live 0x00000000 qf9700 5904 0 - Live 0x00000000 asix 13590 0 - Live 0x00000000 usbnet 14128 4 cdc_ether,mcs7830,qf9700,asix, Live 0x00000000 sunxi_keyboard 3293 0 - Live 0x00000000 bma250 7848 0 - Live 0x00000000 vfe_v4l2 1197152 0 - Live 0x00000000 imx179 8639 0 - Live 0x00000000 ov8865_4lane 13556 0 - Live 0x00000000 ad5820_act 4578 0 - Live 0x00000000 dw9714_act 4077 0 - Live 0x00000000 vfe_subdev 4691 3 vfe_v4l2,imx179,ov8865_4lane, Live 0x00000000 vfe_os 4113 2 vfe_v4l2,vfe_subdev, Live 0x00000000 actuator 944 2 ad5820_act,dw9714_act, Live 0x00000000 cci 23760 5 vfe_v4l2,imx179,ov8865_4lane,ad5820_act,dw9714_act, Live 0x00000000 videobuf_dma_contig 4165 1 vfe_v4l2, Live 0x00000000 videobuf_core 16528 2 vfe_v4l2,videobuf_dma_contig, Live 0x00000000 pvrsrvkm 279395 33 - Live 0x00000000 (O) bcmdhd 630372 0 - Live 0x00000000 hdmi 38647 0 - Live 0x00000000 disp 1039537 6 hdmi, Live 0x00000000 sunxi_tr 9348 1 disp, Live 0x00000000 nand 299831 0 - Live 0x00000000 (O) shell@octopus-sc5806:/ # R:\wyb\r58_evb_sc5806\lichee\tools\pack\chips\sun8iw6p1\configs\sc5806\sys_config.fex ;---------------------------------------------------------------------------------- ;capacitor tp configuration ;external int function ;wakeup output function ;notice --- tp_int_port & tp_io_port use the same port ;---------------------------------------------------------------------------------- [ctp_para] ctp_used = 1 ctp_name = "gsl1688_r58h720" ctp_gesture_wakeup = 0 ctp_twi_id = 0 ctp_twi_addr = 0x40 ;ctp_name = "gsl1688_r58h720" ctp_screen_max_x = 720 ctp_screen_max_y = 1280 ctp_revert_x_flag = 0 ctp_revert_y_flag = 0 ctp_exchange_x_y_flag = 0 ctp_int_port = port:PL07<6><3> ctp_wakeup = port:PL06<1><3><1> ctp_power_ldo = "vcc-ctp" ctp_power_ldo_vol = 3000 ctp_power_io = shell@octopus-sc5806:/ # shell@octopus-sc5806:/ # cd /sys/class/i2c-adapter/i2 i2c-0/ i2c-1/ sys/class/i2c-adapter/i2c-0 < shell@octopus-sc5806:/sys/class/i2c-adapter/i2c-0 # ll drwxr-xr-x root root 1970-01-02 08:08 0-001a drwxr-xr-x root root 1970-01-02 08:08 0-0040 --w------- root root 4096 1970-01-02 08:08 delete_device lrwxrwxrwx root root 1970-01-02 08:08 device -> ../../twi.0 -r--r--r-- root root 4096 1970-01-02 08:08 name --w------- root root 4096 1970-01-02 08:08 new_device drwxr-xr-x root root 1970-01-02 08:08 power lrwxrwxrwx root root 1970-01-02 08:08 subsystem -> ../../../../bus/i2c -rw-r--r-- root root 4096 1970-01-02 08:08 uevent shell@octopus-sc5806:/sys/class/i2c-adapter/i2c-0 # cd 0-0040 shell@octopus-sc5806:/sys/class/i2c-adapter/i2c-0/0-0040 # ll lrwxrwxrwx root root 1970-01-02 08:08 driver -> ../../../../../bus/i2c/drivers/gslX680 drwxr-xr-x root root 1970-01-02 08:08 input -r--r--r-- root root 4096 1970-01-02 08:08 modalias -r--r--r-- root root 4096 1970-01-02 08:08 name drwxr-xr-x root root 1970-01-02 08:08 power lrwxrwxrwx root root 1970-01-02 08:08 subsystem -> ../../../../../bus/i2c -rw-r--r-- root root 4096 1970-01-02 08:08 uevent shell@octopus-sc5806:/sys/class/i2c-adapter/i2c-0/0-0040 # cat name gslX680 shell@octopus-sc5806:/sys/class/i2c-adapter/i2c-0/0-0040 # shell@octopus-sc5806:/sys/class/i2c-adapter/i2c-0/0-0040 # 判断触摸屏的驱动应该是硬件编译进去的。 思路1: 系统刷机之后,在串口在执行: shell@octopus-sc5806:/system/vendor/modules # su 255|shell@octopus-sc5806:/system/vendor/modules # insmod gslX680new.ko insmod: init_module 'gslX680new.ko' failed (Exec format error) 255|shell@octopus-sc5806:/system/vendor/modules # 出错了。 思路2: R:\wyb\r58_evb_sc5806\android\device\softwinner\octopus-sc5806\init.sun8i.rc # use automatic detecttion insmod ctp & gsensor driver #insmod /system/vendor/modules/sw-device.ko #insmod /system/vendor/modules/gslX680new.ko(打开这里还是有问题) insmod /system/vendor/modules/bma250.ko 在init.rc中直接挂载gslX8600new.ko不可行。 思路3: 直接在menuconfig中设置选中编译:gslX8600new.ko。 编译android的时候报错误。extract-bsp需要拷贝这个ko文件。也许可以通过修改配置文件来解决。 思路4: 正常编译后,在menuconfig中设置选中编译:gslX8600new.ko,然后编译内核,在android中make bootimage。还是有问题。 思路5: 正常编译后,在menuconfig中设置选中编译:gslX8600new.ko,然后重新编译内核(make clean),在android中make bootimage。 当然,只需要保存R:\wyb\r58_evb_sc5806\lichee\linux-3.4\.config,下次编译的时候直接把.config这个文件拷贝过去就可以了。 这样只需要编译一次内核就好!!!! rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4$ make clean rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4$ cd .. rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun50iw1p1 1. sun8iw1p1 2. sun8iw3p1 3. sun8iw5p1 4. sun8iw6p1 5. sun8iw7p1 6. sun8iw8p1 7. sun8iw9p1 8. sun9iw1p1 Choice: 4 All available platforms: 0. android 1. dragonboard 2. linux 3. camdroid Choice: 0 All available kernel: 0. linux-3.4 Choice: 0 All available boards: 0. f1 1. fpga 2. n1 3. perf1_v1_0 4. perf2_v1_0 5. perf3_v1_0 6. qc 7. sc5806 Choice: 7 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ cd linux-3.4/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4$ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4$ make ARCH=arm menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/lxdialog/checklist.o HOSTCC scripts/kconfig/lxdialog/inputbox.o HOSTCC scripts/kconfig/lxdialog/menubox.o HOSTCC scripts/kconfig/lxdialog/textbox.o HOSTCC scripts/kconfig/lxdialog/util.o HOSTCC scripts/kconfig/lxdialog/yesno.o HOSTCC scripts/kconfig/mconf.o HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/mconf scripts/kconfig/mconf Kconfig drivers/net/wireless/bcmdhd/Kconfig:50:warning: defaults for choice values not supported # # configuration written to .config # *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee/linux-3.4$ 修改步骤: Device Drivers ---> Input device support ---> [*] Touchscreens ---> gslX680NEW touchscreen driver 请将: gslX680NEW touchscreen driver 修改为: <*> gslX680NEW touchscreen driver 即可。 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ ./build.sh rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/lichee$ cd ../android/ rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ source build/envsetup.sh rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ lunch 14. octopus_sc5806-eng Which would you like? [aosp_arm-eng] 14 rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ extract-bsp rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ make bootimage rootroot@rootroot-E400:~/wyb/r58_evb_sc5806/android$ pack 重新刷机,这样就可以了。

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧