2    Creating the Kit Directory Structure

When engineers finish developing a product, they give the product files to you, the kit developer, for packaging and processing into a kit. Your first task is to organize these files by function and use, then to place them in a kit-building directory structure. When designing the kit-building directory structure, you must consider where you want to place the product files on the customer's system. You then create a kit directory structure on the development system that closely mirrors the customer's directory structure.

This chapter describes the standard directory structure and how to create a kit-building directory structure to fit within the standard directory structure for user, kernel, and hardware product kits.

2.1    Creating a Kit Building Directory Structure

To create a kit, you need three separate directory hierarchies on the kit development system, as shown in Figure 2-1.

Figure 2-1:  Kit Directory Hierarchy

The following describes each directory hierarchy:

Follow these steps to create the kit-building directory structure:

  1. Issue the appropriate mkdir commands for each of the directories and subdirectories that you need. Refer to the mkdir(1) reference page if you need more information.

  2. Populate the src directory with all the files that are to be part of the finished kit.

    You can choose any appropriate method for populating the source hierarchy. For example, you could create a Makefile file for use with the make command.

Caution

File attributes (ownership and permissions) for files and directories in the kit's source hierarchy must be set exactly as they should be on the customer's system. This means that you must be 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 their original values in the kit's master inventory files.

2.2    Populating the Source Directory

It is possible to install the components of a kit in any directory on the customer's system. However, guidelines exist for deciding where to place kit files. The standard system directory structure is set up for efficient organization. It separates files by function and use.

You should install product files in subdirectories of /opt, /usr/opt, and /usr/var/opt, as follows:

The first thing you will need to get is a three letter product code from Compaq Computer Corporation for your product kit name. To obtain a product code, send mail to the Product@DSSR.enet.dec.com electronic mail address. You use this product code and a product version number that you assign to name the product-specific subdirectories of your product.

Examples in this book use OAT as the prefix for the product-specific subdirectory names for the Orpheus Document Builder (ODB) product kit. Assuming this is the first release of the product, the kit developer chose 100 as the version number. As such, directories are named /opt/OAT100, /usr/opt/OAT100, and /usr/var/opt/OAT100. OAT is the code assigned to Orpheus Authoring Tools, Inc., the ficticious company who developed the ODB product, and 100 is the product version number.

Using a standard directory structure has the following advantages:

For users to make effective use of your product after it is installed, they should add the directories that contain your product commands to the normal search path in their .profile or .login files. For example, the Orpheus Document Builder (ODB) product is installed in the standard directory structure under /opt, /usr/opt and /usr/var/opt. The commands for the product are located in the /opt/OAT100/bin and /usr/opt/OAT100/bin directories. To be able to use ODB commands without specifying the full path on the command line, the user can add the product path to the PATH environment variable.

It is possible to ship a symbolic link to make commands accessible through the standard directories. For example, the ODB kit contains the command /usr/opt/OAT100/bin/attr. A symbolic link can be created from /usr/bin/attr to /usr/opt/OAT100/bin/attr. This would also make the attr command available to the user as a part of their normal search path, since /usr/bin is part of the standard path.

Shipping a symbolic link can be done if:

Figure 2-2 shows how the Orpheus Document Builder (ODB) product is installed in the standard directory structure, under /opt, /usr/opt, and /usr/var/opt. The directories shown above the OAT* directories are the existing directories on the customer's system. All directories and files created by the layered product ship under the OAT* directories. In this example, directory names begin with OAT because OAT is the three letter product code assigned to Orpheus Authoring Tools, Inc..

Figure 2-2:  Layered Product Standard Directories

Caution

Shipping any file outside of the /opt, /usr/opt, and /usr/var/opt directories is not recommended and could cause a name space conflict with the base operating system or another layered product.

Overwriting base operating system files can cause the following problems:

2.2.1    Directory Structure for a User Product Kit

The files are installed in directories under /opt, /usr/opt, and /usr/var/opt so that the files are centrally located and easy to find. 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 top level directory (drawn with dashed lines), dcb_tools, represents an existing directory under which a kit developer created the hierarchy directories.

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 three-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. Version numbers cannot be lower than 100.

If the ODB kit included user-writable files, they would be placed under the /usr/var/opt/OAT100 directory. It is recommended that this convention be used for consistency among user products.

Figure 2-3:  Directory Hierarchy for the ODB Kit

2.2.2    Directory Structure for Kernel Product and Hardware Product Kits

You set up a kit directory structure for a kernel product and hardware product in the same way as you would for a user product. You create three directory hierarchies -- src, data, and output -- and populate the source hierarchy with the product files. Under the src directory, create a directory structure similar to the one on the customer's system and place the product files in /opt, /usr/opt, and /usr/var/opt as appropriate. Unlike a user product, the kit for a kernel product or hardware product (such as a device driver) requires certain files to be present in specific directory locations.

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 first introduced in Writing Device Drivers: Tutorial.

Figure 2-4:  Directory Structure for the /dev/none Driver Kit

The top-level directory (which is drawn with dashed lines) 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:

Note:

A module that is capable of being loaded dynamically also can be linked statically. The only difference is the call to configure the driver (for more information on static or dynamic drivers, see Writing Device Drivers: Tutorial).

The following list describes the files that go into a kernel or hardware kit for a device driver, the directories where they reside, and the types of drivers that use them: