makedev.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-MAKEDEV" xreflabel="Make_devices">
  7. <title>Creating devices with Make_devices-&makedev-version;</title>
  8. <?dbhtml filename="makedevices.html"?>
  9. <indexterm zone="ch-system-MAKEDEV"><primary sortas="a-Make_devices">Make_devices</primary></indexterm>
  10. <para>The Make_devices package contains a script for creating device
  11. nodes.</para>
  12. <screen>&buildtime; 1 SBU
  13. &diskspace; 160 KB</screen>
  14. <para>For its installation Make_devices depends on: Bash, Bzip2,
  15. Coreutils.</para>
  16. <sect2>
  17. <title>Making devices</title>
  18. <para>Note that unpacking the
  19. <filename>make_devices-&makedev-version;.bz2</filename> file doesn't
  20. create a directory for you to <command>cd</command> into, as the file
  21. contains only a shell script.</para>
  22. <para>Install the <filename>make_devices</filename> script:</para>
  23. <screen><userinput>bzcat make_devices-&makedev-version;.bz2 &gt; /dev/make_devices
  24. chmod 754 /dev/make_devices</userinput></screen>
  25. <para>Device nodes are special files: things that can generate or receive data.
  26. They usually correspond to physical pieces of hardware. Device nodes can be
  27. created by issuing commands of the form: <command>mknod -m mode name type major
  28. minor</command>. In such a command, <emphasis>mode</emphasis> is the usual
  29. octal read/write/execute permissions triplet, and <emphasis>name</emphasis> is
  30. the name of the device file to be created. It may seem surprising, but the
  31. device name is actually arbitrary, except that most programs rely on devices
  32. such as <filename>/dev/null</filename> having their usual names. The remaining
  33. three parameters tell the kernel what device the node
  34. actually refers to. The <emphasis>type</emphasis> is a letter, either b or c,
  35. indicating whether the device is accessed in blocks (such as a hard disk) or
  36. character by character (such as the console). And <emphasis>major</emphasis>
  37. and <emphasis>minor</emphasis> are numbers, together forming a code that
  38. identifies the device to the kernel. A list of the currently assigned device
  39. numbers for Linux can be found in the file <filename>devices.txt</filename> in
  40. the <filename class="directory">Documentation</filename> subdirectory of the
  41. kernel sources.</para>
  42. <para>Note that the same major/minor combination is usually assigned to both a
  43. block and a character device. These are, however, completely unrelated devices
  44. that cannot be interchanged. A device is identified by the type/major/minor
  45. triple, not just the major/minor pair, so when creating a device node it is
  46. important to choose the correct <emphasis>type</emphasis> of device.</para>
  47. <para>Because looking up the type/major/minor triples and using
  48. <command>mknod</command> manually is tedious and error-prone, the
  49. <filename>make_devices</filename> script has been created. It contains a whole
  50. series of <command>mknod</command> commands, one for each device, complete with
  51. recommended name, permissions and group assignment. It has been set up so that
  52. only a minimal set of commonly used devices is enabled and the other lines are
  53. commented out. You should open <filename>make_devices</filename> in an editor
  54. and customize it to your needs. This takes some time, but is very simple. When
  55. you are satisfied, run the script to create the device files:</para>
  56. <screen><userinput>cd /dev
  57. ./make_devices</userinput></screen>
  58. <para>If you had success with mounting the devpts file system earlier in
  59. <xref linkend="ch-system-proc"/>, you can continue with the next section. If you were
  60. unable to mount devpts, you will have to create a few static ptyXX and ttyXX
  61. device nodes instead. To do this, open <filename>make_devices</filename> in
  62. your editor, go to the section <quote>Pseudo-TTY masters</quote> and enable a
  63. few ptyXX devices -- a handful are enough to enable the test suites to run, but
  64. if you plan to run a kernel without devpts support you will probably need many
  65. more (every xterm, ssh connection, telnet connection, and the like, uses one of
  66. these pseudo terminals). In the immediately following section <quote>Pseudo-TTY
  67. slaves</quote>, enable the corresponding ttyXX devices. When you are done, rerun
  68. <command>./make_devices</command> from inside <filename>/dev</filename> to
  69. have it create the new devices.</para>
  70. </sect2>
  71. <sect2 id="contents-makedev"><title>Contents of Make_devices</title>
  72. <para><emphasis>Installed script</emphasis>: make_devices</para>
  73. </sect2>
  74. <sect2><title>Short description</title>
  75. <indexterm zone="ch-system-MAKEDEV make_devices"><primary sortas="d-make_devices">make_devices</primary></indexterm>
  76. <para id="make_devices"><command>make_devices</command> is a script for creating a basic set of
  77. static device nodes, usually residing in the <filename class="directory">/dev</filename> directory.</para>
  78. </sect2>
  79. </sect1>