Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am wondering how a driver functions under Linux. Are drivers a single file that can be edited? Is there a list of current drivers in use or is there a different place to find them for each device?

I am especially interested in learning about my network adapter's driver.

If you know where some good documentation is, I would love to read that too.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Drivers are very similar to any other program, they can be comprised of multiple source files. Linux devices drivers can be directly compiled into the kernel or a kernel module. Kernel modules have the benefit of being able to be loaded dynamically (i.e. you don't need to compile a new kernel to use them).

You can obviously always look at the Linux source code, but that can be a daunting task at first. However, as with anything in Linux drivers are files. That means other programs access them via the VFS interface. For example, you can control the CDROM via ioctl() calls using its device file.

I would highly recommend checking out Linux Device Drivers. It's freely available and will answer your questions. In particular, you can read through chapter 2 which shows you how to create a simple "Hello, Kernel" module. It may be far more than you are asking for, but you can read the bits and pieces you are interested in. And its free. ;P

share|improve this answer

Linux drivers are built with the kernel, compiled in or as a module. Alternatively, drivers can be built against the kernel headers in a source tree. You can see a list of currently installed kernel modules by typing lsmod and, if installed, take a look at most devices connected through the bus by using lspci.

If the current kernel version does not have driver support for your NIC, you'll need to find drivers at the vendor and you'll need to compile a kernel module from source (against your kernel's headers).

share|improve this answer

Most of the time if something like your NIC is not showing up automatically you need to go to the hardware manufacturer's site, and look to see if they have a linux version.

In more general terms, linux drivers tend to take the form of libraries or modules.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.