Device Driver Tutorial

Exit Print View

Updated: July 2014
 
 

Development Environment and Tools

This section summarizes the driver development process and provides some pointers to resources. For more information on the development process, see Driver Development Summary in Writing Device Drivers for Oracle Solaris 11.2 .

Oracle offers training courses in Oracle Solaris OS internals, crash dump analysis, writing device drivers, DTrace, Oracle Solaris Studio, and other topics useful to Oracle Solaris developers. See http://education.oracle.com/ for more information.

    The general steps in writing a device driver are as follows:

  1. Write a .c source file using the interfaces and structures defined in man page sections 9E, 9F, and 9S. Most of the include files you need are in /usr/include/sys. The function and structure man pages show which include files you need.

  2. Write a .conf hardware configuration file to define property values for your driver.

  3. Compile and link your driver. Always use the –D_KERNEL option when you compile a driver for the Oracle Solaris OS. The default compile result is 32-bit. To get a 64-bit result on a 64-bit platform, specify the appropriate 64-bit option as described in Building a Driver.

  4. Copy your driver binary file and your driver configuration file to the appropriate [platform]/kernel directories. See Driver Directory Organization for descriptions of driver directories.

  5. Use the add_drv(1M) command to load your driver. When your driver is loaded, you can see your driver in /dev and /devices. You can also see an entry for your driver in the /etc/name_to_major file.