This chapter provides a brief introduction to writing device drivers for FreeBSD. A
device in this context is a term used mostly for hardware-related stuff that belongs to
the system, like disks, printers, or a graphics display with its keyboard. A device
driver is the software component of the operating system that controls a specific device.
There are also so-called pseudo-devices where a device driver emulates the behavior of a
device in software without any particular underlying hardware. Device drivers can be
compiled into the system statically or loaded on demand through the dynamic kernel linker
facility `kld'.
Most devices in a Unix-like operating system are accessed through device-nodes,
sometimes also called special files. These files are usually located under the directory
/dev in the filesystem hierarchy. In releases of FreeBSD older
than 5.0-RELEASE, where
devfs(5) support
is not integrated into FreeBSD, each device node must be created statically and
independent of the existence of the associated device driver. Most device nodes on the
system are created by running MAKEDEV.
Device drivers can roughly be broken down into two categories; character and network
device drivers.