Saltar al contenido ForoHackers

Device drivers: start here

Controladores de dispositivos
#3377 · · Citar · Denunciar

A device driver is the kernel code that knows how to talk to one kind of hardware and presents it to the rest of the system through a common interface. Drivers make a disk, a network card or a camera look like something programs can use. They run with full privilege, so a driver's bug can bring down the whole machine.

Key concepts

  • Driver model: the kernel defines how drivers register, find their devices and are told to start and stop.
  • Device access: registers and buffers reached through memory-mapped or port I/O, with DMA moving data without the CPU.
  • Interrupts: the device signals completion or events, and the driver handles them quickly, deferring heavy work.
  • Interfaces to user space: character and block devices, network interfaces and files that expose controls.
  • Power and hot-plug: devices appear, disappear and sleep, and the driver has to cope at any moment.

Vocabulary

  • DMA: direct memory access, a device reading or writing memory on its own.
  • MMIO: memory-mapped I/O, device registers that look like memory addresses.
  • Bus: the connection a device sits on, such as PCI or USB, which lets the kernel discover it.
  • Firmware blob: code the driver loads onto the device itself.

What to study, in order

  1. Operating-system basics and C, with attention to pointers, bit operations and concurrency.
  2. Write a trivial loadable module that logs when it loads and unloads, in a virtual machine.
  3. Add a character device with read and write operations backed by a buffer.
  4. Write a driver for a simple real or emulated device, using interrupts.
  5. Learn locking and memory rules for code that runs in interrupt context.

Related tags

#kernels #linux #embedded-linux #c #firmware

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder