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 ...
- 03-30-2010 #1Just 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.
- 03-31-2010 #2Linux Guru
- 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!
- 04-02-2010 #3Just 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?
- 04-02-2010 #4Linux Guru
- 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!
- 04-02-2010 #5Just 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.
- 04-02-2010 #6Linux Guru
- 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!
- 04-02-2010 #7Just 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.
- 04-02-2010 #8Linux Guru
- 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!
- 04-02-2010 #9Just 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
- 04-02-2010 #10Linux Guru
- 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!


Reply With Quote