Menu

#43 Can't complie kernel module for kernel 3.14(.18) x86_64

v1.0 (example)
open
nobody
None
5
2015-05-03
2014-09-14
pczolee
No

Dear All.

A tried all version of smartcam (what I could find on the internet) without luck :(. The better one (this have the least problem) is this one: https://github.com/kripton/smartcam_linux
So I downloaded and tried to complie in ubuntu lucid x86_64 with kernel 3.14.18 (stable). Befere this I used it with kernel 2.6.35 without any problem..

So when I tried the make I've got:

$ make -C /lib/modules/uname -r/build M=pwd
make: Entering directory /usr/src/linux-3.14.18' LD /tmp/smartcam_linux-master/driver_src/built-in.o CC [M] /tmp/smartcam_linux-master/driver_src/smartcam.o /tmp/smartcam_linux-master/driver_src/smartcam.c:585: warning: initialization from incompatible pointer type /tmp/smartcam_linux-master/driver_src/smartcam.c:594: warning: initialization from incompatible pointer type /tmp/smartcam_linux-master/driver_src/smartcam.c:612: error: unknown field ‘current_norm’ specified in initializer /tmp/smartcam_linux-master/driver_src/smartcam.c:612: warning: initialization makes pointer from integer without a cast make[1]: *** [/tmp/smartcam_linux-master/driver_src/smartcam.o] Error 1 make: *** [_module_/tmp/smartcam_linux-master/driver_src] Error 2 make: Leaving directory/usr/src/linux-3.14.18'

As far as I know "current_norm" is not supported in this kernel, so I commented it out, and tried again:

$ make -C /lib/modules/uname -r/build M=pwd
make: Entering directory /usr/src/linux-3.14.18' CC [M] /tmp/smartcam_linux-master/driver_src/smartcam.o /tmp/smartcam_linux-master/driver_src/smartcam.c:585: warning: initialization from incompatible pointer type /tmp/smartcam_linux-master/driver_src/smartcam.c:594: warning: initialization from incompatible pointer type Building modules, stage 2. MODPOST 1 modules CC /tmp/smartcam_linux-master/driver_src/smartcam.mod.o LD [M] /tmp/smartcam_linux-master/driver_src/smartcam.ko make: Leaving directory/usr/src/linux-3.14.18'

Now it is built, here is the modinfo:

$ modinfo ./smartcam.ko
filename: ./smartcam.ko
license: Dual BSD/GPL
author: Ionut Dediu
description: Smartphone Webcam
srcversion: 9C88B7E7D9A164D69738815
depends: videodev
vermagic: 3.14.18-pcz-r2 SMP mod_unload modversions

Of course the videodev module is already loaded (I have two other video dev in the computer {/dev/video0 and /dev/video1}).
But if I try to load this module I can't do it:

$ sudo insmod ./smartcam.ko
insmod: error inserting './smartcam.ko': -1 Invalid parameters

In dmesg I can see this:

[90514.815289] ------------[ cut here ]------------
[90514.815308] WARNING: CPU: 0 PID: 3328 at drivers/media/v4l2-core/v4l2-dev.c:779 __video_register_device+0x58/0xd7a videodev
[90514.815311] Modules linked in: smartcam(O+) webcamstudio(O) droidcam(O) pl2303 usbserial nls_utf8 isofs bluetooth 6lowpan_iphc b43 usblp ppp_async crc_ccitt snd_usb_audio snd_usbmidi_lib pwc videobuf2_core v4l2_common videobuf2_vmalloc videobuf2_memops videodev media ctr ccm binfmt_misc pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) arc4 vhba(O) coretemp snd_hda_codec_conexant snd_hda_codec_generic snd_hda_intel snd_hda_codec mac80211 snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm psmouse snd_seq_dummy cfg80211 snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device lpc_ich mfd_core snd soundcore ssb sdhci_pci sdhci led_class hp_wmi serio_raw msr sparse_keymap phc_intel(O) lzo i915 fbcon tileblit font bitblit softcursor drm_kms_helper ahci e100 mii drm i2c_algo_bit libahci video intel_agp intel_gtt [last unloaded: webcamstudio]
[90514.815395] CPU: 0 PID: 3328 Comm: insmod Tainted: G W O 3.14.18-pcz-r2 #2
[90514.815398] Hardware name: Hewlett-Packard Presario V6000 (RY564EA#ABU) /30BB, BIOS F.2E 03/22/2010
[90514.815401] 000000000000030b ffff88001c07dc58 ffffffff814feab4 000000000000030b
[90514.815406] 0000000000000000 ffff88001c07dc98 ffffffff8103bca3 00000000000002d2
[90514.815411] ffffffffa0571736 ffffffffa029f7d0 00000000ffffffff 0000000000000000
[90514.815416] Call Trace:
[90514.815425] [] dump_stack+0x49/0x5d
[90514.815432] [] warn_slowpath_common+0x81/0x9b
[90514.815440] [] ? __video_register_device+0x58/0xd7a [videodev]
[90514.815444] [] warn_slowpath_null+0x1a/0x1c
[90514.815451] [] __video_register_device+0x58/0xd7a [videodev]
[90514.815458] [] ? __vmalloc_node+0x35/0x37
[90514.815464] [] smartcam_init+0x58/0x80 [smartcam]
[90514.815472] [] ? 0xffffffffa02a1fff
[90514.815477] [] do_one_initcall+0x84/0x10a
[90514.815488] [] ? __blocking_notifier_call_chain+0x5b/0x67
[90514.815494] [] load_module+0x137d/0x1645
[90514.815498] [] ? module_unload_free+0xd8/0xd8
[90514.815504] [] ? __vmalloc_node+0x35/0x37
[90514.815508] [] SyS_init_module+0xb4/0xb9
[90514.815514] [] system_call_fastpath+0x16/0x1b
[90514.815518] ---[ end trace 2ffbd8ef55355ba7 ]---
[90514.815521] smartcam:(insmod) load status: -22

In the drivers/media/v4l2-core/v4l2-dev.c file's 779 line are this:

/ the v4l2_dev pointer MUST be present /
if (WARN_ON(!vdev->v4l2_dev))
return -EINVAL;

I'm not a developer, so I don't know what is the probelm (maybe it is trivial), so please help me, how can I build a working one.

Thanks

Discussion

  • Anonymous

    Anonymous - 2014-09-29

    Please find attached my personal smartcam patch. This is working fine under Ubuntu 14.04 (kernel 3.13).

     
  • pczolee

    pczolee - 2014-09-29

    Thanks, It is complied with original 1.4.0, with sources I wrote above the patch failed,
    Anyway loaded without segfault! But there is nothin in syslog, is this normal? It seems working, but I need to make some more tests.

     
  • Philip Ashmore

    Philip Ashmore - 2015-05-03

    I got it to install on Jessie 3.16.
    It includes Stephan's patch and some changes I made in driver_src/smartcam.c to replace the removed interruptible_sleep_on_timeout() function with wait_event_interruptible_timeout().
    I can insert the module into the kernel and remove it, the Android app can even connect over TCP/IP, but the Android app crashed.

     
  • Philip Ashmore

    Philip Ashmore - 2015-05-03

    Oops - my kernel just took a dump. Definitely wait until the original developers get a chance to review the changes before proceeding.

     
    • vrishab

      vrishab - 2016-07-09

      **1. Apply latest patch.
      **
      interruptible_sleep_on_timeout() has been deprecated long back. Apply smartcam-1.4.0_v4.patch for this fix. Please note that smartcam-1.4.0_v4.patch should be applied on top of smartcam-1.4.0_v3.patch.

      make succeeds after applying patch.

      vrishab@debian:~/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src$ make -C /lib/modules/`uname -r`/build M=`pwd` 2>/dev/null
      make: Entering directory '/usr/src/linux-headers-3.16.0-4-amd64'
      make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
        LD      /home/vrishab/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src/built-in.o
        CC [M]  /home/vrishab/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src/smartcam.o
        Building modules, stage 2.
        MODPOST 1 modules
        CC      /home/vrishab/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src/smartcam.mod.o
        LD [M]  /home/vrishab/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src/smartcam.ko
      make: Leaving directory '/usr/src/linux-headers-3.16.0-4-amd64'
      
      vrishab@debian:~/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src$ ls
      built-in.o  Makefile  modules.order  Module.symvers  smartcam.c  smartcam.ko  smartcam.mod.c  smartcam.mod.o  smartcam.o
      
      vrishab@debian:~/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src$ sudo insmod smartcam.ko 
      vrishab@debian:~/Downloads/S60/SmartCam/smartcam-1.4.0/driver_src$
      

      This was tested to work on the Debian Jessie 3.16.0-4. Should work for all other distros too.

      **2. Use same / latest smartcam client sis package which is shipped with the source.
      **

      vrishab@debian:~/Downloads/S60/SmartCam/smartcam-1.4.0/data/phone_installs$ ls -l
      total 168
      -rw-r--r-- 1 vrishab vrishab 11719 Jul  9 18:25 Makefile
      -rw-r--r-- 1 vrishab vrishab   132 Jul  8  2009 Makefile.am
      -rw-r--r-- 1 vrishab vrishab  9974 Jul  8  2009 Makefile.in
      -rwxr-xr-x 1 vrishab vrishab 54502 Jan 27  2009 SmartCamS602ndEdv14.sis
      -rwxr-xr-x 1 vrishab vrishab 74572 Jan 27  2009 SmartCamS603rdEdv14.sis
      
       

      Last edit: vrishab 2016-07-09

Log in to post a comment.

MongoDB Logo MongoDB