tijin
tijin

Reputation: 757

Device Driver Development in Linux

I plan to learn embedded linux and writing linux device drivers. After reading about device drivers and walking through some tutorials, I'm a little confused about the kernel-source that to be used for compilation.

I am using ubuntu 11.04 and in my /usr/src/ me find the following:

tijin@tijin-Vostro-460:/usr/src$ ls

gcc-4.4 linux-headers-2.6.38-10-generic-pae linux-headers-2.6.38-10 linux-headers-2.6.38-8

my questions:

1)do I need a kernel-source to compile the driver code or the headers are enough?

2)where can I get the kernel source code and what is the procedure to install the source code. Please let me know the details.

Upvotes: 1

Views: 1016

Answers (3)

tijin
tijin

Reputation: 757

For a fresher to device driver coding the "hello world" driver code reference is here :

http://www.linuxquestions.org/questions/linux-kernel-70/simple-makefile-error-all-nothing-need-to-be-done-600403/ . This link also discussing the issues related to the Makefile. Important idea that i got from the reference is: Never ever copy-paste the content of a document for creating Makefile.

If you are getting trouble with seeing logs then please refer the link :

http://www.cyberciti.biz/faq/linux-log-files-location-and-how-do-i-view-logs-files/

thanks.

Upvotes: 0

Kimvais
Kimvais

Reputation: 39548

  1. Headers is enough
  2. from kernel.org - or for Ubuntu specific kernels, follow the documentation

For module compilation instructions, see this question

Upvotes: 1

DallaRosa
DallaRosa

Reputation: 5815

  1. Yes. You need not only the source but a "make"d source (a compiled kernel source).

  2. The main location to get the kernel source is: http://www.kernel.org

As you're using Ubuntu you can just download the source from the repositories. Here's the page indicated at Ubuntu's help as a guide for compiling a kernel from source on Natty (11.04): http://blog.avirtualhome.com/2011/08/03/how-to-compile-a-new-ubuntu-11-04-natty-kernel/

Upvotes: 0

Related Questions