Device Driver Tutorial

Driver Directory Organization

Device drivers and other kernel modules are organized into the following directories in the Solaris OS. See the kernel(1M) and system(4) man pages for more information about kernel organization and how to add directories to your kernel module search path.


These modules are common across most platforms. Modules that are required for booting or for system initialization belong in this directory.

/platform/`uname -i`/kernel

These modules are specific to the platform identified by the command uname -i.

/platform/`uname -m`/kernel

These modules are specific to the platform identified by the command uname -m. These modules are specific to a hardware class but more generic than modules in the uname -i kernel directory.


These are user modules. Modules that are not essential to booting belong in this directory. This tutorial instructs you to put all your drivers in the /usr/kernel directory.

One benefit of organizing drivers into different directories is that you can selectively load different groups of drivers on startup when you boot interactively at the boot prompt as shown in the following example. See the boot(1M) man page for more information.

Type    b [file-name] [boot-flags] <ENTER>      to boot with options
or      i <ENTER>                               to enter boot interpreter
or      <ENTER>                                 to boot with defaults

                  <<< timeout in 5 seconds >>>

Select (b)oot or (i)nterpreter: b -a
bootpath: /pci@0,0/pci8086,2545@3/pci8086,
Enter default directory for modules [/platform/i86pc/kernel /kernel 
/usr/kernel]: /platform/i86pc/kernel /kernel

In this example, the /usr/kernel location is omitted from the list of directories to search for modules to load. You might want to do this if you have a driver in /usr/kernel that causes the kernel to panic during startup or on attach. Instead of omitting all /usr/kernel modules, a better method for testing drivers is to put them in their own directory. Use the moddir kernel variable to add this test directory to your kernel modules search path. The moddir kernel variable is described in kernel(1M) and system(4). Another method for working with drivers that might have startup problems is described in Device Driver Testing Tips.