Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Ubuntu 10.10 and the installed kernel for driver programming. In rubini's book it is mentioned to create a .o file from a .c file, but I'm not getting it. it uses obj-m := eg_drv1.o, but when I try and build the .c file I get this:

error: make: *** No targets. Stop.

I'm completely confused. First question I have is how do I convert a .c file to .o file and then to .ko file to use the module?

share|improve this question

Here is a nice article about 'Compile Linux kernel modules' http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html

Just go through it. It contains an example just give it a try.

Hope this helps

UPDATE: I have just tried and found that copy and paste is not working. I have to manually enter the contents of Makefile to work it out. Anyway it works fine. Just try and let us know the result.

share|improve this answer
1  
The issue with copy/paste and Makefiles is that makefile rules lines must start with \t (tabs), when you use copy/paste from the web those tabs are pasted as spaces breaking the syntax. – João Pinto Dec 1 '10 at 15:36
    
@João Pinto: Yes you are absolutely right. – aneeshep Dec 2 '10 at 4:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.