xref: /freebsd/share/examples/drivers/README (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1
2Author: Julian Elischer
3
4The files in this directory are shell scripts.
5
6They will, when run, create an example skeleton driver
7for you. You can use this driver as a starting point for
8writing drivers for your own devices. They have all the hooks needed
9for initialization, probing, attaching, as well as DEVFS
10node creation. They also create sample ioctl commands and a sample
11ioctl definition .h file in /sys/sys. In other words they are fully
12functional in a 'skeleton' sort of a way. They support multiple devices
13so that you may have several of your 'foobar' devices probed and attached
14at once.
15
16I expect that these scripts will improve with time.
17
18At present these scripts also link the newly created driver into
19the kernel sources in /sys. Possibly a better way would be
20to make them interactive. (and ask what kernel tree to use as well as
21a name for the driver.).
22
23There are presently two scripts.
24One for making a real device driver for ISA devices, and
25one for making a device driver for pseudo devices (e.g. /dev/null).
26Hopefully they will be joined by similar scripts for creating
27skeletons for PCI devices as well.
28
29Give them a single argument: the name of the driver.
30They will use this given name in many places within the driver,
31both in lower and upper case form.  (conforming to normal usage).
32
33The skeleton driver should already link with the kernel
34and in fact the shell script will compile a kernel with the new
35drive linked in..  The new kernel should still be
36runnable and the new driver should be
37fully callable (once you get your device to probe).
38You should simply edit the driver and continue to use
39'make' (as done in the script) until your driver does what you want.
40
41The driver will end up in /sys/i386/isa for the device driver script,
42and in /sys/dev for the pseudo driver script.
43