Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (9905 KB)
add_drv(1M)Name | Synopsis | Description | Options | Examples | Exit Status | Files | Attributes | See Also | Notes | Bugs Name
Synopsis
add_drv [-b basedir] [-c class_name]
[-i 'identify_name...'] [-m 'permission','...']
[-p 'policy'] [-P privilege] [-n] [-f] [-u] [-v] device_driver
DescriptionThe 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 device. 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 property 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 reconfiguration boot. See the NOTES section. Aliases might require quoting (with double-quotes) if they contain numbers. See EXAMPLES. The /etc/minor_perm Fileadd_drv and update_drv(1M) read the /etc/minor_perm file to obtain permission information. The permission specified is applied to matching minor nodes created when a device bound to the driver is attached. A minor node's permission may be manually changed by chmod(1). For such nodes, the specified permissions apply, overriding the default permissions specified via add_drv or update_drv(1M). The format of the /etc/minor_perm file is as follows:
minor_name may be the actual name of the minor node, or contain shell metacharacters to represent several minor nodes (see sh(1)). For example:
The first line sets all devices exported by the sd node to 0640 permissions, owned by root, with group sys. In the second line, devices such as a,cu and z,cu exported by the zs driver are set to 0600 permission, owned by uucp, with group uucp. In the third line the kmem device exported by the mm driver is set to 0640 permission, owned by root, with group bin. Running add_drv from a postinstall ScriptWhen running add_drv from within the context of a package's postinstall script, you must consider whether the package is being added to a system image or to a running system. When a package is being installed on a system image, such as occurs with the Live Upgrade or flash features (see live_upgrade(5) and flarcreate(1M)), the BASEDIR variable refers to the image's base directory. In this situation, add_drv should be invoked with -b $BASEDIR. This causes add_drv only to update the image's system files; a reboot of the system or client would be required to make the driver operational. When a package is being installed on the running system itself, the system files need to be updated, as in the case above. However, the running kernel can be informed of the existence of the new driver without requiring a reboot. To accomplish this, the postinstall script must invoke add_drv without the -b option. Accordingly, postinstall scripts invoking add_drv should be written thusly:
...or, alternatively:
The -b option is described below. Options
ExamplesExample 1 Adding SUNW Example Driver to the SystemThe following example adds the SUNW,example driver to a 32–bit system, with an alias name of SUNW,alias. It assumes the driver has already been copied to /usr/kernel/drv.
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. The specified device policy requires no additional privileges to open all minor nodes, except minor device a, which requires the sys_config privilege when opening the device for writing. Example 2 Adding Driver to the Client /export/root/sun1The 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.
See the note in the description of the -b option, above, specifying the caveat regarding the use of this option with the Solaris zones feature. Example 3 Adding Driver for a Device Already Managed by an Existing DriverThe 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:
If add_drv is used to add the whizzy_framebuffer driver, the following will result.
If the -v flag is specified, the following will result.
If the -v and -f flags are specified, the driver will be added resulting in the following.
The above example is currently only relevant to devices exporting a generic device name. Example 4 Use of Double Quotes in Specifying Driver AliasThe following example shows the use of double quotes in specifying a driver alias that contains numbers.
Exit Statusadd_drv returns 0 on success and 1 on failure. Files
AttributesSee attributes(5) for descriptions of the following attributes:
See Alsoboot(1M), chmod(1), devfsadm(1M), flarcreate(1M), kernel(1M), modinfo(1M), rem_drv(1M), update_drv(1M), driver.conf(4), system(4), attributes(5), live_upgrade(5), privileges(5), devfs(7FS), ddi_create_minor_node(9F) NotesIt 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 links in /dev and references to these files may no longer be valid (see the -v flag). If a reconfiguration boot would be required to complete the driver installation, add_drv will fail unless the -f option is specified. See Example 3 in the EXAMPLES section. With the introduction of the device policy several drivers have had their minor permissions changed and a device policy instated. The typical network driver should use the following device policy:
This document does not constitute an API. /etc/minor_perm, /etc/name_to_major, /etc/driver_classes, and /devices may not exist or may have different contents or interpretations in a future release. The existence of this notice does not imply that any other documentation that lacks this notice constitutes an API. /etc/minor_perm can only be updated by add_drv(1M), rem_drv(1M) or update_drv(1M). In the current version of add_drv, the use of double quotes to specify an alias is optional when used from the command line. However, when using add_drv from packaging scripts, you should continue to use double quotes to specify an alias. Some drivers should not be added and configured on the system directly, but should only be configured as the system boots. The reasons for this restriction include, but are not limited to, a driver dependency on configuration early during boot or a dependency on some kernel component being installed or updated at the same time as the driver is being added. Such drivers should only be added to the system with the -n flag, so the driver is only loaded and configured when the system is rebooted, thus assuring an environment in which the driver can be configured properly. BugsPrevious versions of add_drv accepted a pathname for device_driver. This feature is no longer supported and results in failure. Name | Synopsis | Description | Options | Examples | Exit Status | Files | Attributes | See Also | Notes | Bugs |
|||||||||||||||||