Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
Hi, I'm pretty new to Linux and I was reading this tutorial on creating a Linux driver: freesoftwaremagazine.com/articles/drivers_linux. I'm having a bit of trouble with the "make" command, though, on ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    18

    Device Driver Problem

    Hi, I'm pretty new to Linux and I was reading this tutorial on creating a Linux driver: freesoftwaremagazine.com/articles/drivers_linux. I'm having a bit of trouble with the "make" command, though, on the second page (freesoftwaremagazine.com/articles/drivers_linux?page=0%2C1). One problem may be that I don't know how to get a full compiled kernel source code tree, I'm using the headers at the path "/usr/src/linux-headers-2.6.31-20-generic". So I made nothing.c and Makefile like it said in the tutorial and did the command "make -C /lib/modules/2.6.31-20-generic M=pwd modules". The result I get is the following:

    make: Entering directory `/usr/src/linux-headers-2.6.31-20-generic'
    make: *** No rule to make target `modules'. Stop.
    make: Leaving directory `/usr/src/linux-headers-2.6.31-20-generic'

    Any help will be greatly appreciated.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    First, get some online tutorials on how to configure and build a kernel and kernel modules for your distribution. Most distributions' web sites have HowTos for this. In any case, you will need the kernel source since that is a requirement even to build loadable kernel modules in recent distributions (2.6 and later kernels).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    18
    Thanks for your reply, I found a tutorial like you said. So now I have a compiled source code tree, but when I use the make command like it is used in the device driver tutorial, I get this:

    make: Entering directory `/home/user/ubuntu-karmic'

    WARNING: Symbol version dump /home/user/ubuntu-karmic/Module.symvers
    is missing; modules will have no dependencies and modversions.

    scripts/Makefile.build:44: /home/user/ubuntu-karmic/pwd/Makefile: No such file or directory
    make[1]: *** No rule to make target `/home/user/ubuntu-karmic/pwd/Makefile'. Stop.
    make: *** [_module_pwd] Error 2
    make: Leaving directory `/home/user/ubuntu-karmic'

    Should I be putting nothing.c and Makefile somewhere inside the source code tree?

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Did you first run make menuconfig?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Mar 2010
    Posts
    18
    I hadn't before, but I just tried it now and got this message:

    user@MyComputer:~/Driver$ make menuconfig
    make: *** No rule to make target `menuconfig'. Stop.

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    You need to do this as the root of your kernel source tree, usually found in /usr/src/kernel, which is a link to one of the installed kernels in /usr/src/kernels.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Just Joined!
    Join Date
    Mar 2010
    Posts
    18
    I don't have /usr/src/kernel, just some headers such as linux-headers-2.6.31-20.
    When I compiled my kernel, I put the source at /home/user/ubuntu-karmic.

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Ok. Go to that directory and as a normal (not root) user, execute the command "make menuconfig". Save the configuration, then issue the command "make" without arguments. You just want to build the kernel object files, not install it or anything.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    Mar 2010
    Posts
    18
    I tried that, but again got an error message:

    user@MyComputer:~/ubuntu-karmic$ make menuconfig
    *** Unable to find the ncurses libraries or the
    *** required header files.
    *** 'make menuconfig' requires the ncurses libraries.
    ***
    *** Install ncurses (ncurses-devel) and try again.
    ***
    make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
    make: *** [menuconfig] Error 2

  10. #10
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Then you need to install the ncurses package first. If you want to, you can just run make config and answer all the questions instead. It will do the same thing without a simple "exit->save" to get a default kernel configuration.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...