E-Mail:

Creating Devices

  • No Related Post

Creating Devices

Like any other operating system, devices are critical in Linux - that is if you want to be able to do anything with your computer other than use it for a desktop decoration. Devices are the means by which you interface with the computer and the computer interfaces with you.

Linux uses a system of device files. These are actually mount points created with two-way device communication in mind. Most of the devices critical to your system’s operation are created during the install process. But not all. Occasionally, you still need to add a device to your system. I, for example, recently added a device file for my Handspring Visor Pro. Two, in fact, but that’s a story for another day. Fortunately, all the tools you need to create these device files exist on your Linux system.

The most useful tool resides in the /dev directory itself. MAKEDEV (yes, it’s all caps) shortens the task of creating devices by intuitively understanding the major and minor device numbers necessary to creating a device. Whereas it used to be necessary to know these numbers, or to know where to find them, MAKEDEV finds and uses the proper major and minor device numbers when creating the device.

To add a device to your system, you’ll first need to understand what type of device you’re adding. Character devices and block devices are the most common. Remeber that character devices process input and output in streams, while block devices handle data in chunks. Serial devices are good examples of character devices, while hard drives represent the best known block devices.

To add a device to your Linux system, enter the following command as root:

    cd /dev
    ./MAKEDEV [device name]

For example, if you needed to add a fifth serial port (a character device) to your system, the command is:

    ./MAKEDEV ttyS4

Remember, zero is significant.

MAKEDEV will look up and add the appropriate major and minor device numbers as well as the proper permissions for your newly created device.

You’ll never have to worry about majors and minors when you choose to use MAKEDEV in Linux.

What Do You Think?

 
53 queries / 0.174 seconds.