Problems building with kernel 2.6.27

2012-04-12
2013-04-29
  • biolizard89
    biolizard89
    2012-04-12

    I'm trying to build v4l2vd for kernel 2.6.27, and I'm getting the following errors:

    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c: In function 'vloopback_ioctl':
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1036: warning: unused variable 'ret'
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c: At top level:
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1530: error: variable 'fileops_template' has initializer but incomplete type
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1534: error: unknown field 'owner' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1534: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1534: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1535: error: unknown field 'open' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1535: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1535: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1536: error: unknown field 'release' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1536: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1536: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1537: error: unknown field 'read' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1537: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1537: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1538: error: unknown field 'write' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1538: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1538: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1539: error: unknown field 'poll' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1539: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1539: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1540: error: unknown field 'ioctl' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1540: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1540: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1541: error: unknown field 'mmap' specified in initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1541: warning: excess elements in struct initializer
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1541: warning: (near initialization for 'fileops_template')
    /home/diaspora/Downloads/DroneHacking/v4l2vd-0.2/v4l2vd.c:1552: warning: initialization from incompatible pointer type
    make: ***  Error 1
    make: ***  Error 2

    I'm cross-compiling for an embedded ARM Linux system, if this matters.  Any idea how I might go about fixing this?  I don't have the ability to use a different kernel version, unfortunately.

    Thanks!

     
  • biolizard89
    biolizard89
    2012-04-12

    Forgot to say, I'm using the latest CVS code.

     
  • biolizard89
    biolizard89
    2012-04-13

    I found a way to make it build on this kernel version.  Find the following code snippet at line 1529:

    #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
    static struct v4l2_file_operations fileops_template = {
    #else
    static struct file_operations fileops_template = {
    #endif

    Then remove all of those lines except the 4th one, so it should just be:

    static struct file_operations fileops_template = {

    My guess is that this will break on newer kernel versions, so the proper solution is to find exactly what kernel versions need those lines and which don't… and then change the kernel version in the #if .  Hope this helps some people out.