This chapter describes the standard directory structure of Digital UNIX systems and how to create a kit-building directory structure to fit within the standard directory structure.
Files that are nominally read-only, such as commands, startup files (which can be modified, but not by individual users), or data files are installed in a product-specific subdirectory of /usr/opt.
Files that users can read and write, such as lists of employee telephone numbers, are installed in a product-specific subdirectory of /var/opt.
Files that are required at bootstrap time, such as device drivers, are installed in a product-specific subdirectory of /opt.
The name of the product-specific subdirectory should consist of a 3-character product or company code and a 3-digit version code, as specified in the key file (see Chapter 4). For example, the product-specific subdirectory names for the ODB product kit are /opt/OAT100, /usr/opt/OAT100, and /usr/var/opt/OAT100.
Using this standard directory structure has the following advantages:
Figure 2-1 shows how the Orpheus Document Builder (ODB) product is installed in the standard directory structure, under /opt, /usr/opt, and /var/opt. A symbolic link makes each file accessible through the standard directories. For example, the ODB kit's /usr/bin/attr command is a symbolic link to /usr/opt/OAT100/bin/attr.
The following list describes each directory hierarchy:
The data hierarchy is a directory structure that contains the following files to specify the contents of the kit and how it is organized:
The output hierarchy is a directory structure that contains the subsets that are placed on the kit. The subset control files that are needed during installation are stored in the instctrl subdirectory. There is no specific requirement for the location of the output hierarchy, but it is good practice to place it under the same directory as the source and data hierarchies.
Create the kit-building directory structure as follows:
File attributes, such as ownership and permissions, for all the files and directories in the source hierarchy must be exactly as they should be on the customer's system. Usually, this requirement means that you must be a superuser when populating the source hierarchy so that you can change these file attributes. Do not attempt to circumvent this requirement by setting file attributes in your subset control programs. If a superuser on the customer's system runs the fverify command on your subsets, attributes that the subset control programs have modified are reset to the values they have in the kit's master inventory files. Caution
Under most circumstances, your kit should not include any files whose pathnames exactly match those of existing system files. If you do, the kit's files are installed in place of the existing files.
The example ODB kit places command files in the standard system directory (/usr/bin), the product's documentation in a directory created by another user product (/usr/lib/br), and template files for users employing the product in a directory unique to the ODB product (/usr/share/doclib/templates).
The ODB kit contains files to be installed in the following directories:
Figure 2-3 illustrates the complete directory structure for the ODB kit. In this figure, the dashed directory, dcb_tools, represents the existing directory under which you would create the source hierarchy's directories as shown.
The src directory represents the root directory on the customer's system; the usr directory represents /usr on the customer's system. All the other directories in the source hierarchy are mapped to the customer's system in the same way.
The name of the top-level product-specific directory, under the source hierarchy's opt directory, is made up of the product code and a 3-digit version number, where the first digit identifies the major version number, the second digit identifies the minor version number, and the third digit identifies the update level. For example, the product code for the ODB kit is OAT and its version number is 100, indicating major version 1, minor version 0, update 0.
File names in the standard directory structure, where users would usually expect the files to appear, are linked symbolically to the actual files installed on the customer's system. For example, the command named /usr/bin/attr exists as a link to /usr/opt/OAT100/bin/attr.
If the ODB kit included user-writable files, they would be placed under /var, and there would also be a /var/opt/OAT100 directory to contain those files. Digital recommends this convention for consistency among user products.
Figure 2-4 shows the directory structure of a device driver product as it would appear in the kit development area. The driver shown here is the /dev/none driver produced by the fictitious company called EasyDriver, Inc. This driver is introduced in Writing Device Drivers: Tutorial.
The top-level directory (easy) represents the working area for all kit development at EasyDriver, Inc. The src directory corresponds to the customer's root directory (/). Directories under src have a one-to-one relationship to directories on the customer's system. The ESA100 directory represents the top-level product directory for the /dev/none driver.
The files needed for building a kit depend on whether the driver product will be statically or dynamically configured on the customer's system. For example:
Contains information about the location of the source code and modules associated with the driver, tags indicating when the driver is loaded into the kernel, and whether the source or binary form of the driver is supplied to the customer. For both statically and dynamically configured drivers, place this file in the product directory, such as ESA100. You need to edit this file if the kit development directory structure differs from the driver development directory structure or if you must change the driver name for any reason. Figure 2-5 shows which fields within the files file fragment need to change.
Contains device special file information, bus option data information, and information on contiguous memory usage for statically and dynamically configured drivers. When the user installs a kernel product kit, the driver's sysconfigtab file fragment gets appended to the /etc/sysconfigtab database. You should place this file fragment in the product directory, such as ESA100. You do not need to change the sysconfigtab file fragment unless you change the driver (subsystem) name. The driver name appears in three places within the file, as shown in Figure 2-6. In the example, the driver runs on a TURBOchannel bus (indicated by the TC_Option entry), but a similar set of bus options would be specified for other bus types.
Contains the single binary module for both statically and dynamically configured drivers. You should include this file in the product directory, such as ESA100. The subset control program references or copies this file into the customer's BINARY and subsys directories when the driver is installed.
Contain the source code for the device driver. You should include these files in the product directory, such as ESA100, when the driver is statically configured and distributed in source form.
Contain driver methods that are called during autoconfiguration to create device special files for dynamically configured drivers. These files do not appear on the driver kit. The subset control program creates links to these files in the customer's subsys directory when the driver is installed. The device driver writer can tell you which method files the subset control program should link to, typically /subsys/device.mth. You need to link the method in a device driver kernel kit only if the driver needs to have device special files created for its devices.
Foreign device kits require several files that are not part of the kit directory structure. These files are not installed on the customer's system, but are used by the osfboot utility. Note
Neither the name.kit file, the kitname.kk file, the /etc/sysconfigtab database, nor the links are placed on the customer's system when setld runs; the osfboot utility and the Remote Installation Services (RIS) procedure use them at installation time.
Figure 2-7 shows the directory structure for the /dev/edgd graphics device driver product.
The following sections describe the contents of the name.kit and kitname.kk files.
Commands in the name.kit file have the following form:
+[device:] [/path/]file.mod
Adds file.mod from the
root or the specified device. You can specify a full path or accept the default.
-file.mod
Deletes file.mod from
the module list on the default path for file.mod.
file.mod=[device:][/path/]new.mod
Replaces file.mod on
the default path with the module you specify.
The foreign device kit for the /dev/edgd driver supplies one name.kit file, which adds the edgd.mod single binary module to the kernel. In the following example, /sys/BINARY refers to the directory on the kit, not the system disk:
+/sys/BINARY/edgd.mod
Figure 2-8 shows how the name.kit file works with the osfboot software during installation of a foreign device kit.
In the figure, the driver kit contains a name.kit file called edgd.kit. The edgd.kit file instructs the osfboot utility to build and configure a temporary /vmunix kernel that includes the /dev/edgd driver. Upon completion, this temporary /vmunix kernel makes the /dev/edgd driver available to handle user and system requests of a specific hardware device during the installation of Digital UNIX.
If you want to allow the device driver product to use this feature, create a kitname.kk file in the instctrl directory. The file may be empty, but it must exist. It indicates to RIS that a foreign device kit exists.