0

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?

2

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.

  • 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

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.