14.8. Peripheral DevicesLet's assume that you've just bought a new device and you wish to connect it to your system. For the system to be able to "talk to" a new device the hardware must be connected and the software must be installed or activated. If the device is already recognized by Linux (as is most common PC hardware), this may be simple. Some devices require that new drivers be loaded into the kernel and the kernel rebuilt, others may use dynamically loadable device drivers where the driver will be loaded into the kernel when the device is accessed. The basic steps of device installation are as follows:
Once the device driver is installed and the major and minor numbers are known, you must use mknod to create the special file (Figure 14-12).
In the following example, I installed the thirteenth instance of a terminal whose major number was 1: $ mknod /dev/tty12 c 1 12 ...note the 13th instance is index 12. $ _ The "c" indicated that the terminal was a character-oriented device. In the next example, I installed the first instance of a disk drive whose major number was 2: $ mknod /dev/dk1 b 2 0 ...note the 1st instance is index 0. $ _ The "b" indicated that the terminal was a block-oriented device. Major and minor numbers are the fourth and fifth fields, respectively, in an "ls -lG" listing. In the following example, I obtained a long listing of the "/dev" directory: $ ls -lG /dev ...get a long listing of the device directory. crw--w--w- 1 root 1, 0 Feb 13 14:21 /dev/tty0 crw--w--w- 1 root 1, 1 Feb 13 14:27 /dev/tty1 brw--w--w- 1 root 2, 0 Feb 13 14:29 /dev/dk0 crw--w--w- 1 root 3, 0 Feb 13 14:27 /dev/rmt0 ... $ _ |