FreeBSD Device Driver Writer's Guide : Linking Into the Kernel. : Standard Model : Adding to the driver list.
Previous: Standard Model
Next: Make room in conf.c

4.1.1. Adding to the driver list.

The standard model for adding a device driver to the Berkeley kernel is to add your driver to the list of known devices. This list is dependent on the CPU architecture. If the device is not i386 specific (PCCARD, PCI, SCSI), the file is in ``/usr/src/sys/conf/files''. If the device is i386 specific, use ``/usr/src/sys/i386/conf/files.i386''. A typical line looks like:


i386/isa/joy.c                  optional        joy     device-driver

The first field is the pathname of the driver module relative to /usr/src/sys. For the case of a binary driver the path would be something like ``i386/OBJ/joy.o''.

The second field tells config(8) that this is an optional driver. Some devices are required for the kernel to even be built.

The third field is the name of the device.

The fourth field tells config that it's a device driver (as opposed to just optional). This causes config to create entries for the device in some structures in /usr/src/sys/compile/KERNEL/ioconf.c.

It is also possible to create a file ``/usr/src/sys/i386/conf/files.KERNEL'' whose contents will override the default files.i386, but only for the kernel ``KERNEL''.


FreeBSD Device Driver Writer's Guide : Linking Into the Kernel. : Standard Model : Adding to the driver list.
Previous: Standard Model
Next: Make room in conf.c
freebsd-questions@freebsd.org