Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Do i need kernel header files to compile a driver?

  • 06-12-2010 03:22PM
    #1
    Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭


    Hi guys,


    I need to install a camera that is not already supported on the existing kernel, so was attempting to compile a UVC drivers but i dont think ive access to the kernel files on this kernel version (uname -r) of a privately developed spin off of ubuntu 9.04

    The kernel version however is.....2.6.31.4-DevonIT i686/GNU / Linux


    Any input, advice and comments greatly appreciated as to get camera working or how to go about getting it compiled?


Comments

  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    You need the kernel headers to compile a driver usually alright. The generic 2.6.31 headers should work fine for what you need.

    edit: Upon further reflection, there may be some fluting involved with the makefile and so on. What happens if you do this:

    sudo apt-get install linux-kernel-headers

    ?


  • Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭Galway K9


    Khannie wrote: »
    edit: Upon further reflection, there may be some fluting involved with the makefile and so on. What happens if you do this:

    sudo apt-get install linux-kernel-headers

    ?

    Package linux-kernel-headers is a virtual package provided by:
    linux-libc-dev 2.6.28-19.66
    You should explicitly select one to install.
    E: Package linux-kernel-headers has no installation candidate


    it has top be ubuntu 9.04 and kernel header file 2.6.31


  • Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭Galway K9


    Im gonna use

    linux-headers-2.6.31-14


    for linux-headers-2.6.31.4 i hope it works.....


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Should be fine. You may need to create a softlink under /usr/src that points from the .14 version to a .4 equivalently named one.

    i.e. do this:

    ln -s /usr/src/linux-headers-2.6.31.14 /usr/src/linux-headers-2.6.31.4


  • Closed Accounts Posts: 238 ✭✭eightcell


    I use uname when fetching kernel headers:
    apt-get install linux-headers-$[COLOR=#66cc66]([/COLOR]uname -r[COLOR=#66cc66])[/COLOR]
    


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭Galway K9


    Guys, after buildign driver on another machine of same kernel version, how could i bring that compiled driver to another machine or does it have to be compiled to the kernel on that machine.....like could i just copy over .ko files????


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Galway K9 wrote: »
    Guys, after buildign driver on another machine of same kernel version, how could i bring that compiled driver to another machine or does it have to be compiled to the kernel on that machine.....like could i just copy over .ko files????

    You have to recompile the driver. The driver module is compiled only for your running kernel, as Linux has no stable ABI for binary modules. The benefit of using OSS drivers is that generally, you won't need to recompile drivers outside of the main kernel compilation process. Even better if you use a canned distro with a generic kernel.


Advertisement