DEVATTACH(8) — UNIX Programmer’s Manual
NAME
devattach − attach device to the Unix kernel
SYNOPSIS
/usr/sony/etc/devattach [ −av ] [ xx [ b bdev_major ] [ c cdev_major ] file ]
DESCRIPTION
Devattach adds (incremental load) the new device driver function by loading the object file, file of the device driver into the kernel which is being currently executed. The parameters for the device driver name will be xx, the block device major number will be bdev_major, and the character device major number will be cdev_major. Devattach allows the main memory to be used effectively, since the device driver, which is not used most of the time, need not be attached to the kernel, thus making the kernel size smaller. Moreover, the new device driver can be added to the system without having to generate the kernel each time. An example for attaching the md device driver to the kernel is given below:
/usr/sony/etc/devattach md b 2 c 10 When the above command is executed, the block device process routine of the /sys/OBJ/md.o is connected to the block device number 2 (see devtab(5)), and the character device process routine of /sys/OBJ/md.o is connected to the character device number 10. Next, the special files for block device and character device are created using mknod command. (The /dev/MAKEDEV script makes it easy to create a special file which is the standard supply of NEWS-OS.)
/etc/mknod /dev/md0a b 2 0
/etc/mknod /dev/rmd0a c 10 0
or
cd /dev
sh MAKEDEV md The md device driver can be operated using the above procedure. (However, the device needs to be initialized.) The structure which sets each process routine must be declared in advance as the global variable in the object file, as indicates below:
#include <sys/conf.h> struct bdevsw xxbdevsw ;
struct cdevsw xxcdevsw ; The xx is the name of the device driver. For the md device driver, the structure name will be mdbdevsw for xxbdevsw; and mdcdevsw for xxcdevsw.
−a An option that executes the incremental load of all the device drivers indicated in /etc/devtab.
−v An option that displays the information given below during verbose, incremental load:
device driver name, object file name, character device name, block device name, load address, and size.
FILES
/etc/devtab
The table for the device driver to which the incremental load is executed when −a option is specified.
/vmunix
The Unix kernel.
SEE ALSO
devtab(5), mknod(8)
Building Kernels with Config
BUG
Devattach fails if the system is started up from a kernel other than /vmunix.
NEWS-OSRelease 3.3