Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Configuring HP-UX For Peripherals: HP 9000 Computers > Appendix C Major and Minor Numbers

Associating a Custom Driver with a Peripheral

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

If you are configuring HP peripherals and standard HP drivers, HP-UX configures the elements automatically, provided the drivers have been included in the kernel input file.

Consider, however, the scenario of having a peripheral device for which you need to use a custom driver. Perhaps you have received the driver on a tape, which you have loaded onto your system. If you want to associate a driver with only a specific hardware path, you must include the driver and the peripheral address in a "driver statement" of the /stand/system file. You must make sure the driver can be found by the kernel-build utility, and you must rebuild the kernel.

NOTE: You can use this technique to load any sio-style driver or wsio-style device driver. You cannot force-configure wsio-style interface drivers at a specific address using this technique. However, you can configure wsio-style interface drivers as long as the driver is included in the system file and no other interface driver in the /stand/system file can claim the card in question. For further information, refer to the Driver Development Guide.
  1. Rebuild the kernel to include the added device driver, by following these steps:

    1. Change directory to the build environment (/stand/build). There, execute a system preparation script, system_prep. system_prep writes a system file based on your current kernel in the current directory. (That is, it creates /stand/build/system.) The -v provides verbose explanation as the script executes.

      cd /stand/build
      /usr/lbin/sysadm/system_prep -v -s system
    2. Manually edit the /stand/build/system file in two places to add the custom driver:

      NOTE: Do not use the kmsystem command to perform this step; edit the file directly.
      1. List the driver in the upper portion of the system file, with other similar drivers. For example, the following figure shows the upper portion of a system file with a custom SCSI driver, disco added.

        **********************************************************************
        * Bus-Dependent subsystems
        **********************************************************************
        * ccio = Cache Coherent I/O
        ccio
        **********************************************************************
        * SCSI drivers
        **********************************************************************
        disco
        sdisk
        sflop
        stape
        ...
      2. Add a driver statement at the end of the file, if you intend to force-load the driver at only a certain hardware path.

        The driver statement tells HP-UX to associate the driver at a specified hardware address and has the following format:

        driver <hardware_path> <driver_name>

        For example, a driver statement to associate a custom driver named disco with an interface card at address 2/0/7.6.0 on a Model 755 resembles this:

        driver  2/0/7.6.0 disco

        Note, although an HP-UX disk device driver (such as sdisk) may be present in the kernel, this driver statement instructs HP-UX to use disco for the disk at address 2/0/7.6.0, only. HP-UX continues to use its standard disk device drivers for any other disks. If disco should replace all instances of sdisk in the kernel, you could simply remove sdisk from the system file and replace it with disco. You only need to add a driver statement if you want to force-configure the driver to a specific path(s).

    3. Create a small file in the /usr/conf/master.d directory to be cross-referenced by the /stand/system file entry when the kernel is rebuilt. The file can be given any name, but should have the following format (which resembles that of the DRIVER_INSTALL portion of /usr/conf/master.d/core-hpux):

      $DRIVER_INSTALL
      <driver_name> -1 -1
      $$$

      For example, here is a file for the disco driver.

      $DRIVER_INSTALL
      disco -1 -1
      $$$
    4. Verify that the driver you are installing has been built into a library that can be found by the mk_kernel utility.

      If you have been provided this driver from a third-party company, their engineers are likely to have compiled the driver into a library which you will have loaded into /usr/conf/lib when you loaded their tape onto your system.

      To examine an archive, run the ar command with the -t option, giving the library as an argument. Hopefully, you will see the file (such as disco.o, or whatever file name the driver is stored in) among the files included in the output from the command.

      /usr/ccs/bin/ar -t /usr/conf/lib/libdisco.a

      If you do not find the file, you will need to add the driver into a library in /usr/conf/lib. Do this with the -r option of the ar command. For example, to add disco.o to /usr/conf/lib/libhp-ux.a, execute the following:

      /usr/ccs/bin/ar -r /usr/conf/lib/libhp-ux.a disco.o

      Once you have verified that the .o file is present in a library accessible to mk_kernel, you are ready to build your kernel to include the new driver.

    5. Make sure you returned to the /stand/build directory. Build the kernel by invoking the mk_kernel command. This action creates /stand/build/vmunix_test, a kernel ready for testing.

      /usr/sbin/mk_kernel -s system
    6. Verify that everything built correctly by executing the nm command and greping for the driver name. The command string should return at least one entry, such as that shown below.

      /usr/ccs/bin/nm vmunix_test | grep disco
          disco_install |   524264|extern|entry      |$CODE$
    7. Save the old system file by moving it. Then move the new system file into place.

      mv /stand/system /stand/system.prev
      mv /stand/build/system /stand/system
    8. Prepare for rebooting by invoking the kmupdate command. This action sets a flag that tells the system to use the new kernel when it restarts.

      /usr/sbin/kmupdate
  2. Notify users that the system must be rebooted.

  3. Shut down and halt the system using the /usr/sbin/shutdown -h command.

  4. Turn off power to the SPU.

  5. Install the peripheral device. Make sure the peripheral's hardware address is set to the hardware path specified in the driver statement of the /stand/system file.

  6. Power up the peripheral device and then the SPU.

    When the kernel reboots, you can verify that the custom driver was configured into the kernel by executing /usr/sbin/ioscan -f. You should see the driver associated with its intended device at the hardware path you specified in step 2.

For further information on driver statements and other customizations of the /stand/system file, consult the config(1M) manpage. The config program is used by mk_kernel when you build a kernel.

Under most circumstances, insf creates useful device special files when the system boots up. However, for some special circumstances, it may be necessary to create these files using mknod.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2000 Hewlett-Packard Development Company, L.P.