Questions tagged [linux-device-driver]

Device drivers take on a special role in the Linux kernel. They are distinct programmatically abstracted “black boxes” that make a particular piece of hardware respond to a well-defined internal programming interface; they hide completely the details of how the device works.

User activities are performed by means of a set of standardized calls that are independent of the specific driver. Mapping those calls to device-specific operations that act on real hardware is the role of the device driver. This programming interface is such that drivers can be built separately from the rest of the kernel and “plugged in” at runtime when needed. This modularity makes Linux device drivers easy to write, to the point that there are now thousands of them available.

There are a number of reasons to be interested in the writing of Linux device drivers.

  • The rate at which new hardware becomes available (and obsolete!) alone guarantees that driver writers will be busy for the foreseeable future.

  • Individuals may need to know about drivers in order to gain access to a particular device that is of interest to them.

  • Hardware vendors, by making a Linux device driver available for their products, can add the large and growing Linux user-base to their potential markets.

The open-source nature of the Linux system means that if the driver writer wishes, the source to a driver can be quickly disseminated to millions of users.

Source -

  1. Linux Device Drivers 3rd edition

  2. Linux module programming guide

4991 questions
150
votes
2 answers

IOCTL Linux device driver

Can anyone explain me, What is IOCTL? What is it used for? How can I use it? Why can't I define new function that does the same work as IOCTL?
flashdisk
  • 3,652
  • 3
  • 16
  • 22
69
votes
1 answer

Difference between arm-eabi arm-gnueabi and gnueabi-hf compilers

What is the difference between arm-eabi, gnueabi and gnueabi-hf cross compilers?
preetam
  • 1,451
  • 1
  • 17
  • 43
67
votes
2 answers

What is the difference between a Linux platform driver and normal device driver?

Earlier I had assumed that : Platform driver is for those devices that are on chip. Normal device driver are for those that are interfaced to the processor chip. Before coming across one i2c driver... But here, I am reading through multi function…
kzs
  • 1,793
  • 3
  • 24
  • 44
65
votes
3 answers

Difference between .o and .ko file

I am writing simple Linux module mod.c. When I compile mod.c file, it creates two output file mod.o and mod.ko. So I just want to know, What is the difference between mod.o and mod.ko file?
beparas
  • 1,927
  • 7
  • 24
  • 30
57
votes
4 answers

How does Linux Kernel know where to look for driver firmware?

I'm compiling a custom kernel under Ubuntu and I'm running into the problem that my kernel doesn't seem to know where to look for firmware. Under Ubuntu 8.04, firmware is tied to kernel version the same way driver modules are. For example, kernel…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
57
votes
7 answers

How to get page size programmatically within Linux kernel module code

I am working on a Linux module for IA64. My current problem is that the driver uses the PAGE_SIZE and PAGE_SHIFT macros for dma page allocation. The problem I am having is that the machine compiling the driver is not the ones that needed to run…
Freddy
  • 3,064
  • 3
  • 26
  • 27
56
votes
7 answers

Learning Kernel Programming

I want to learn lLinux Kernel programming. What would be the starting points for that? What could be some of the simpler problems to target?
Geek
  • 23,089
  • 20
  • 71
  • 85
55
votes
4 answers

How to write a simple Linux device driver?

I need to write an SPI Linux character device driver for omap4 from scratch. I know some basics of writing device drivers. But, I don't know how to start writing platform specific device driver from scratch. I've written some basic char drivers, and…
Sagar Jain
  • 7,475
  • 12
  • 47
  • 83
52
votes
5 answers

How does the linux kernel manage less than 1GB physical memory?

I'm learning the linux kernel internals and while reading "Understanding Linux Kernel", quite a few memory related questions struck me. One of them is, how the Linux kernel handles the memory mapping if the physical memory of say only 512 MB is…
TheLoneJoker
  • 1,589
  • 1
  • 23
  • 36
52
votes
4 answers

How to use netlink socket to communicate with a kernel module?

I am trying to write a linux kernel module that communicates with user process using netlink. I am using netlink because the user program I want to communicate to communicates only using sockets and I can't change that to add ioctl() or anything. I…
binW
  • 13,220
  • 11
  • 56
  • 69
51
votes
2 answers

What is the opposite of `mknod`?

I am learning to write character device drivers from the Kernel Module Programming Guide, and used mknod to create a node in /dev to talk to my driver. However, I cannot find any obvious way to remove it, after checking the manpage and observing…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
50
votes
4 answers

How do the nl80211 library & cfg80211 work?

I want to learn about how nl80211 and cfg80211 work in detail, such as: function flow and how nl80211 interacts with network tools like wpa_supplicant and iw.
Rafal
  • 1,120
  • 3
  • 15
  • 23
42
votes
7 answers

Who calls the probe() of driver

How does probe() call gets called? Who calls it? As per my understanding, __init() registers driver and then somehow probe() is called to register the device data and irq etc. How exactly it happens? I am working on touchscreen driver and its…
iSegFault
  • 947
  • 2
  • 9
  • 18
42
votes
3 answers

Linux Stack Sizes

I'm looking for a good description of stacks within the linux kernel, but I'm finding it surprisingly difficult to find anything useful. I know that stacks are limited to 4k for most systems, and 8k for others. I'm assuming that each kernel thread…
John Ulvr
  • 636
  • 1
  • 8
  • 8
36
votes
6 answers

Linux kernel device driver to DMA from a device into user-space memory

I want to get data from a DMA enabled, PCIe hardware device into user-space as quickly as possible. Q: How do I combine "direct I/O to user-space with/and/via a DMA transfer" Reading through LDD3, it seems that I need to perform a few different…
Ian Vaughan
  • 20,211
  • 13
  • 59
  • 79
1
2 3
99 100