- online man pages   

SunOS man pages : add_drv (1)

Maintenance Commands                                  add_drv(1M)


add_drv - add a new device driver to the system


add_drv [ -b basedir ] [ -c class_name ] [ -i 'identify_name...' ] [ -m 'permission','...' ] [ -n ] [ -f ] [ -v ] device_driver


The add_drv command is used to inform the system about newly installed device drivers. Each device on the system has a name associated with it. This name is represented by the name property for the dev- ice. Similarly, the device may also have a list of driver names associated with it. This list is represented by the compatible property for the device. The system determines which devices will be managed by the driver being added by examining the contents of the name property and the compatible property (if it exists) on each device. If the value in the name property does not match the driver being added, each entry in the compatible pro- perty is tried, in order, until either a match occurs or there are no more entries in the compatible property. In some cases, adding a new driver may require a reconfi- guration boot. See the NOTES section.


-b basedir Installs the driver on the system with a root direc- tory of basedir rather than installing on the system executing add_drv. This option is typically used in package post-installation scripts when the package is not being installed on the system executing the pkgadd command. The system using basedir as its root direc- tory must reboot to complete the driver installation. -c class_name The driver being added to the system exports the class class_name. -i 'identify_name' A white-space separated list of aliases for the driver device_driver. -m 'permission' Specify the file system permissions for device nodes created by the system on behalf of device_driver. -n Do not try to load and attach device_driver, just SunOS 5.8 Last change: 5 Aug 1998 1 Maintenance Commands add_drv(1M) modify the system configuration files for the device_driver. -f Normally if a reconfiguration boot is required to com- plete the configuration of the driver into the system, add_drv will not add the driver. The force flag forces add_drv to add the driver even if a reconfi- guration boot is required. See the -v flag. -v The verbose flag causes add_drv to provide additional information regarding the success or failure of a driver's configuration into the system. See the EXAM- PLES section.


Example 1: Adding The SUNW, Example Driver to the System The following example adds the SUNW,example driver to the system, with an alias name of SUNW,alias. It assumes the driver has already been copied to /usr/kernel/drv. example# add_drv -m '* 0666 bin bin','a 0644 root sys' \ -i 'SUNW,alias' SUNW,example Every minor node created by the system for the SUNW,example driver will have the permission 0666, and be owned by user bin in the group bin, except for the minor device a, which will be owned by root, group sys, and have a permission of 0644. Example 2: Adding The Driver To The Client /export/root/sun1 The following example adds the driver to the client /export/root/sun1. The driver is installed and loaded when the client machine, sun1, is rebooted. This second example produces the same result as the first, except the changes are on the diskless client, sun1, and the client must be rebooted for the driver to be installed. example# add_drv -m '* 0666 bin bin','a 0644 root sys' \ -i 'SUNW,alias' -b /export/root/sun1 \ SUNW,example Example 3: Adding A Driver For A Device That Is Already Managed By An Existing Driver The following example illustrates the case where a new driver is added for a device that is already managed by an existing driver. Consider a device that is currently managed by the driver dumb_framebuffer. The name and compatible properties for this device are as follows: SunOS 5.8 Last change: 5 Aug 1998 2 Maintenance Commands add_drv(1M) name="display" compatible="whizzy_framebuffer", "dumb_framebuffer" If add_drv is used to add the whizzy_framebuffer driver, the following will result. example# add_drv whizzy_framebuffer Error: Could not install driver (whizzy_framebuffer) Device managed by another driver. If the -v flag is specified, the following will result. example# add_drv -v whizzy_framebuffer Error: Could not install driver (whizzy_framebuffer) Device managed by another driver. Driver installation failed because the following entries in /devices would be affected: /devices/iommu@f,e0000000/sbus@f,e0001000/display[:*] (Device currently managed by driver "dumb_framebuffer") The following entries in /dev would be affected: /dev/fbs/dumb_framebuffer0 If the -v and -f flags are specified, the driver will be added resulting in the following. example# add_drv -vf whizzy_framebuffer A reconfiguration boot must be performed to complete the installation of this driver. The following entries in /devices will be affected: /devices/iommu@f,e0000000/sbus@f,e0001000/display[:*] (Device currently managed by driver "dumb_framebuffer" The following entries in /dev will be affected: /dev/fbs/dumb_framebuffer0 The above example is currently only relevant to devices exporting a generic device name.


add_drv returns 0 on success and 1 on failure.


/kernel/drv boot device drivers /usr/kernel/drv other drivers that could potentially be shared between platforms /platform/`uname -i`/kernel/drv SunOS 5.8 Last change: 5 Aug 1998 3 Maintenance Commands add_drv(1M) platform-dependent drivers /etc/driver_aliases driver aliases file /etc/driver_classes driver classes file /etc/minor_perm minor node permissions /etc/name_to_major major number binding


See attributes(5) for descriptions of the following attri- butes: ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Availability | SUNWcsu | |_____________________________|_____________________________|


boot(1M), devlinks(1M), disks(1M), drvconfig(1M), kernel(1M), modinfo(1M), ports(1M), rem_drv(1M), tapes(1M), driver.conf(4), system(4), attributes(5), ddi_create_minor_node(9F) Writing Device Drivers


Aliases may require quoting (with double-quotes) if they contain numbers. It is possible to add a driver for a device already being managed by a different driver, where the driver being added appears in the device's compatible list before the current driver. In such cases, a reconfiguration boot is required (see boot(1M) and kernel(1M)). After the reconfiguration boot, device nodes in /devices, entries in /dev, and references to these files may no longer be valid (see the -v flag). If a reconfiguration boot would be required to com- plete the driver installation, add_drv will fail unless the -f option is specified. See Example 3 in the EXAMPLES sec- tion.


add_drv will accept a full pathname for device_driver. How- ever, the kernel does not use the full pathname; it only SunOS 5.8 Last change: 5 Aug 1998 4 Maintenance Commands add_drv(1M) uses the final component and searches the internal driver search path for the driver. This can lead to the kernel loading a different driver than expected. For this reason, it is not recommended that you use add_drv with a full pathname. See kernel(1M) for more infor- mation on the driver search path. SunOS 5.8 Last change: 5 Aug 1998 5