| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [  <!ENTITY % general-entities SYSTEM "../general.ent">  %general-entities;]><sect1 id="ch-system-MAKEDEV" xreflabel="Make_devices"><title>Creating devices with Make_devices-&makedev-version;</title><?dbhtml filename="makedevices.html"?><indexterm zone="ch-system-MAKEDEV"><primary sortas="a-Make_devices">Make_devices</primary></indexterm><para>The Make_devices package contains a script for creating devicenodes.</para><screen>&buildtime; 1 SBU&diskspace; 160 KB</screen><para>For its installation Make_devices depends on: Bash, Bzip2,Coreutils.</para><sect2><title>Making devices</title><para>Note that unpacking the<filename>make_devices-&makedev-version;.bz2</filename> file doesn'tcreate a directory for you to <command>cd</command> into, as the filecontains only a shell script.</para><para>Install the <filename>make_devices</filename> script:</para><screen><userinput>bzcat make_devices-&makedev-version;.bz2 > /dev/make_deviceschmod 754 /dev/make_devices</userinput></screen><para>Device nodes are special files: things that can generate or receive data.They usually correspond to physical pieces of hardware. Device nodes can becreated by issuing commands of the form: <command>mknod -m mode name type majorminor</command>. In such a command, <emphasis>mode</emphasis> is the usualoctal read/write/execute permissions triplet, and <emphasis>name</emphasis> isthe name of the device file to be created. It may seem surprising, but thedevice name is actually arbitrary, except that most programs rely on devicessuch as <filename>/dev/null</filename> having their usual names. The remainingthree parameters tell the kernel what device the nodeactually refers to. The <emphasis>type</emphasis> is a letter, either b or c,indicating whether the device is accessed in blocks (such as a hard disk) orcharacter by character (such as the console). And <emphasis>major</emphasis>and <emphasis>minor</emphasis> are numbers, together forming a code thatidentifies the device to the kernel. A list of the currently assigned devicenumbers for Linux can be found in the file <filename>devices.txt</filename> inthe <filename class="directory">Documentation</filename> subdirectory of thekernel sources.</para><para>Note that the same major/minor combination is usually assigned to both ablock and a character device. These are, however, completely unrelated devicesthat cannot be interchanged. A device is identified by the type/major/minortriple, not just the major/minor pair, so when creating a device node it isimportant to choose the correct <emphasis>type</emphasis> of device.</para><para>Because looking up the type/major/minor triples and using<command>mknod</command> manually is tedious and error-prone, the<filename>make_devices</filename> script has been created. It contains a wholeseries of <command>mknod</command> commands, one for each device, complete withrecommended name, permissions and group assignment. It has been set up so thatonly a minimal set of commonly used devices is enabled and the other lines arecommented out. You should open <filename>make_devices</filename> in an editorand customize it to your needs. This takes some time, but is very simple. Whenyou are satisfied, run the script to create the device files:</para><screen><userinput>cd /dev./make_devices</userinput></screen><para>If you had success with mounting the devpts file system earlier in <xref linkend="ch-system-proc"/>, you can continue with the next section. If you wereunable to mount devpts, you will have to create a few static ptyXX and ttyXXdevice nodes instead. To do this, open <filename>make_devices</filename> inyour editor, go to the section <quote>Pseudo-TTY masters</quote> and enable afew ptyXX devices -- a handful are enough to enable the test suites to run, butif you plan to run a kernel without devpts support you will probably need manymore (every xterm, ssh connection, telnet connection, and the like, uses one ofthese pseudo terminals). In the immediately following section <quote>Pseudo-TTYslaves</quote>, enable the corresponding ttyXX devices. When you are done, rerun<command>./make_devices</command> from inside <filename>/dev</filename> tohave it create the new devices.</para></sect2><sect2 id="contents-makedev"><title>Contents of Make_devices</title><para><emphasis>Installed script</emphasis>: make_devices</para></sect2><sect2><title>Short description</title><indexterm zone="ch-system-MAKEDEV make_devices"><primary sortas="d-make_devices">make_devices</primary></indexterm><para id="make_devices"><command>make_devices</command> is a script for creating a basic set ofstatic device nodes, usually residing in the <filename class="directory">/dev</filename> directory.</para></sect2></sect1>
 |