teknotus / depthview

intel RealSense 3D camera viewer for Linux
GNU Lesser General Public License v2.1
98 stars 38 forks source link

Problem with instructions for applying kernel patch #6

Open mirzashah opened 9 years ago

mirzashah commented 9 years ago

Hi @teknotus

I had problems applying the patch to any kernel in Ubuntu 14.04 LTS. Perhaps you can see the mistake I'm making and can point me in the right direction:

1) Patch fails to automatically apply with git apply -- the patch failed to apply to 3.13, 3.16, and 4.0 kernel sources, both from Ubuntu sources as well as vanilla kernels from github.com/torvalds. The patch isn't that large so I was able to apply all the diffs by hand.

2) When I went to compile as it was looking at headers in /usr/source/uname-r versus the headers in the downloaded source where modified videodev2.h and uvc_camera.h reside. This results in compile errors because all the new macros in videodev2.h are not found.

Now based on the step:

sudo cp include/uapi/linux/videodev2.h /usr/include/linux/videodev2.h

I'm guessing that that step was intended so that the code would build against /usr/include/linux/videodev2.h. So I tried taking the modified videodev2.h and copying it to /usr/source/uname-r/include/linux/videodev2.h as well. Once I did this I was able to compile the module

3) Once I installed the module, then I attempt to load it and I got tons of missing symbol errors. Here's the output of dmesg:

[ 3790.016461] uvcvideo: Unknown symbol vb2_queue_init (err 0)
[ 3790.016498] uvcvideo: Unknown symbol v4l2_fh_exit (err 0)
[ 3790.016535] uvcvideo: Unknown symbol vb2_streamoff (err 0)
[ 3790.016561] uvcvideo: Unknown symbol vb2_queue_release (err 0)
[ 3790.016585] uvcvideo: Unknown symbol vb2_poll (err 0)
[ 3790.016607] uvcvideo: Unknown symbol v4l2_prio_max (err 0)
[ 3790.016625] uvcvideo: Unknown symbol v4l2_fh_del (err 0)
[ 3790.016642] uvcvideo: Unknown symbol v4l2_fh_add (err 0)
[ 3790.016665] uvcvideo: Unknown symbol v4l2_prio_change (err 0)
[ 3790.016693] uvcvideo: Unknown symbol vb2_dqbuf (err 0)
[ 3790.016720] uvcvideo: Unknown symbol vb2_reqbufs (err 0)
[ 3790.016749] uvcvideo: Unknown symbol video_devdata (err 0)
[ 3790.016766] uvcvideo: Unknown symbol vb2_streamon (err 0)
[ 3790.016786] uvcvideo: Unknown symbol v4l2_ctrl_replace (err 0)
[ 3790.016817] uvcvideo: Unknown symbol v4l2_prio_check (err 0)
[ 3790.016844] uvcvideo: Unknown symbol v4l_printk_ioctl (err 0)
[ 3790.016868] uvcvideo: Unknown symbol vb2_querybuf (err 0)
[ 3790.016885] uvcvideo: Unknown symbol vb2_qbuf (err 0)
[ 3790.016910] uvcvideo: Unknown symbol vb2_buffer_done (err 0)
[ 3790.016924] uvcvideo: Unknown symbol vb2_plane_vaddr (err 0)
[ 3790.016938] uvcvideo: Unknown symbol v4l2_fh_init (err 0)
[ 3790.016956] uvcvideo: Unknown symbol video_unregister_device (err 0)
[ 3790.016972] uvcvideo: Unknown symbol v4l2_prio_init (err 0)
[ 3790.016990] uvcvideo: Unknown symbol v4l2_event_subscribe (err 0)
[ 3790.017008] uvcvideo: Unknown symbol video_device_alloc (err 0)
[ 3790.017024] uvcvideo: Unknown symbol vb2_vmalloc_memops (err 0)
[ 3790.017044] uvcvideo: Unknown symbol v4l2_device_register (err 0)
[ 3790.017063] uvcvideo: Unknown symbol v4l2_ctrl_merge (err 0)
[ 3790.017090] uvcvideo: Unknown symbol __video_register_device (err 0)
[ 3790.017109] uvcvideo: Unknown symbol v4l2_event_dequeue (err 0)
[ 3790.017124] uvcvideo: Unknown symbol v4l2_device_unregister (err 0)
[ 3790.017140] uvcvideo: Unknown symbol video_usercopy (err 0)
[ 3790.017153] uvcvideo: Unknown symbol video_device_release (err 0)
[ 3790.017168] uvcvideo: Unknown symbol vb2_mmap (err 0)
[ 3790.017183] uvcvideo: Unknown symbol v4l2_event_queue_fh (err 0)
[ 3790.017206] uvcvideo: Unknown symbol v4l2_event_unsubscribe (err 0)

Looks like a lot of v4l2 calls weren't linked into the module. If you have any insights into what I"m doing wrong, please let me know. Thanks!

teknotus commented 9 years ago

If you want to go the easy route the ubuntu ppa also has a kernel for 14.04, but I think it was last updated in May, so the package installer won't think it's the latest any more, and you'll probably have to pick it manually. It's due for an update, but that usually takes hours, and I unfortunately don't have that much time right now. As of right now you probably want linux-image-extra-3.13.0-53-generic and linux-libc-dev which has the include file.

It also has in the linux source package the already patched files. I had to change the patches slightly to build the 3.13 kernel.

I think I copied and pasted from my terminal everything I did to compile just the module, but I may have missed something. I tried to follow my own instructions, and it had similar errors. Compiling the full kernel might be a better option, but it takes hours with the config that Ubuntu uses.

mirzashah commented 9 years ago

@teknotus thanks, appreciate the help! i think compiling the whole kernel maybe easiest. Will try someday soon.

floe commented 9 years ago

Just a question, have you submitted the patch for inclusion into the kernel?

teknotus commented 9 years ago

@floe nope sorry I haven't gotten to that yet. I got pulled in a bunch of different directions with do I work on a userspace library, a point cloud module, calibration tools, etc. I usually ended up going with whatever someone would pay me to do, and I got too burned out with that to get through the somewhat intimidating task of upstreaming to the Linux kernel. I'm tired of maintaining patches for various kernel versions, and ubuntu kernel packages so it's now the thing I want to get done the most.

floe commented 9 years ago

Actually, I think it should be pretty straightforward, your patch already meets the style guidelines; I think linux-media is the list to submit to.

floe commented 8 years ago

I'm getting back to working on the F200, would you mind if I just submit your patch to linux-media?

teknotus commented 8 years ago

Oh I finally got involved in the conversation on linux-media a few days ago. Intel submitted a patch for the R200 that looks almost exactly like mine, but with different formats. It got rejected, and thus mine would probably also be rejected at the moment. They are having some argument about if depth cameras should be treated differently than regular cameras, and having many specialty image formats for depth cameras.

I've been a bit distracted figuring out the R200. I got a HP Spectre X2 which has a built in R200. It has a few bits of hardware that don't work in Linux yet, so I might end up sending multiple patches to the kernel. I got the LTE modem working well enough to get GPS data out of it from Linux. I also really want the IMU working so that I can use it with 3d reconstruction.

dee101k commented 8 years ago

Hi @mirzashah @teknotus Currently i am working on following kernel in Beaglebone Black. 4.1.10-ti-r21 I am trying to insert my usbtv module in this kernel version.I am using driver from following link https://github.com/simon3z/usbtv So i am able to successfully compile my usbtv driver with my linux headers linux-headers-4.1.10-ti-r21 But when i am inserting my module using insmod. Then I am getting following errors on dmesg

[  208.683602] usbtv: Unknown symbol vb2_queue_init (err 0)
[  208.683744] usbtv: Unknown symbol video_ioctl2 (err 0)
[  208.683824] usbtv: Unknown symbol v4l2_device_put (err 0)
[  208.683885] usbtv: Unknown symbol vb2_queue_release (err 0)
[  208.684039] usbtv: Unknown symbol vb2_ioctl_streamoff (err 0)
[  208.684282] usbtv: Unknown symbol vb2_ioctl_querybuf (err 0)
[  208.684348] usbtv: Unknown symbol v4l2_fh_open (err 0)
[  208.684447] usbtv: Unknown symbol video_devdata (err 0)
[  208.684508] usbtv: Unknown symbol vb2_fop_release (err 0)
[  208.684610] usbtv: Unknown symbol vb2_ioctl_dqbuf (err 0)
[  208.684669] usbtv: Unknown symbol vb2_ioctl_create_bufs (err 0)
[  208.684729] usbtv: Unknown symbol vb2_ioctl_prepare_buf (err 0)
[  208.684845] usbtv: Unknown symbol vb2_buffer_done (err 0)
[  208.684905] usbtv: Unknown symbol vb2_plane_vaddr (err 0)
[  208.684978] usbtv: Unknown symbol video_unregister_device (err 0)
[  208.685059] usbtv: Unknown symbol vb2_ioctl_qbuf (err 0)
[  208.685118] usbtv: Unknown symbol vb2_fop_mmap (err 0)
[  208.685188] usbtv: Unknown symbol vb2_vmalloc_memops (err 0)
[  208.685246] usbtv: Unknown symbol v4l2_device_disconnect (err 0)
[  208.685305] usbtv: Unknown symbol vb2_fop_read (err 0)
[  208.685363] usbtv: Unknown symbol v4l2_device_register (err 0)
[  208.685449] usbtv: Unknown symbol __video_register_device (err 0)
[  208.685530] usbtv: Unknown symbol vb2_ioctl_streamon (err 0)
[  208.685589] usbtv: Unknown symbol vb2_fop_poll (err 0)
[  208.685649] usbtv: Unknown symbol v4l2_device_unregister (err 0)
[  208.685718] usbtv: Unknown symbol video_device_release_empty (err 0)
[  208.685794] usbtv: Unknown symbol vb2_ioctl_reqbufs (err 0)

So as i have seen in your previous comments that you are also encountering with same problems.So can you please suggest some solution for above problem

teknotus commented 8 years ago

Hi @mirzashah https://github.com/mirzashah Currently i am working on following kernel in Beaglebone Black. 4.1.10-ti-r21 I am trying to insert my usbtv module in this kernel version.I am using driver from following link https://github.com/simon3z/usbtv

This is the bug tracker for depthview which is unrelated to usbtv.

The usbtv tracker is here. https://github.com/simon3z/usbtv/issues