devices.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-devices">
  7. <title>Populating /dev</title>
  8. <?dbhtml filename="devices.html"?>
  9. <indexterm zone="ch-system-devices"><primary sortas="e-/dev/">/dev/*</primary></indexterm>
  10. <sect2>
  11. <title>Creating Initial Device Nodes</title>
  12. <para>When the kernel boots the system, it requires the presence of a few device
  13. nodes, in particular the <filename class="devicefile">console</filename> and
  14. <filename class="devicefile">null</filename> devices. Create these by
  15. running the following commands:</para>
  16. <screen><userinput>mknod -m 600 /dev/console c 5 1
  17. mknod -m 666 /dev/null c 1 3</userinput></screen>
  18. </sect2>
  19. <sect2>
  20. <title>Mounting ramfs and Populating /dev</title>
  21. <para>The ideal way to populate <filename
  22. class="directory">/dev</filename> is to mount a <systemitem
  23. class="filesystem">ramfs</systemitem> onto <filename
  24. class="directory">/dev</filename>, like <systemitem
  25. class="filesystem">tmpfs</systemitem>, and create the devices on there
  26. during each bootup. Since the system has not been booted, it is
  27. necessary to do what the bootscripts would otherwise do and populate
  28. <filename class="directory">/dev</filename>. Begin by mounting
  29. <filename class="directory">/dev</filename>:</para>
  30. <screen><userinput>mount -n -t ramfs none /dev</userinput></screen>
  31. <!-- Edit Me -->
  32. <para>Since the Udev package will not be installed until later on in the
  33. process, create a minimal set of device nodes used for building:</para>
  34. <screen><userinput>mknod -m 622 /dev/console c 5 1
  35. mknod -m 666 /dev/null c 1 3
  36. mknod -m 666 /dev/zero c 1 5
  37. mknod -m 666 /dev/ptmx c 5 2
  38. mknod -m 666 /dev/tty c 5 0
  39. mknod -m 444 /dev/random c 1 8
  40. mknod -m 444 /dev/urandom c 1 9
  41. chown root:tty /dev/{console,ptmx,tty}</userinput></screen>
  42. <!-- -->
  43. <para>There are some symlinks and directories required by LFS that are
  44. not created by Udev, so create those here:</para>
  45. <screen><userinput>ln -s /proc/self/fd /dev/fd
  46. ln -s /proc/self/fd/0 /dev/stdin
  47. ln -s /proc/self/fd/1 /dev/stdout
  48. ln -s /proc/self/fd/2 /dev/stderr
  49. ln -s /proc/kcore /dev/core
  50. mkdir /dev/pts
  51. mkdir /dev/shm</userinput></screen>
  52. <para>Finally, mount the proper virtual (kernel) file systems on the
  53. newly-created directories:</para>
  54. <screen><userinput>mount -t devpts -o gid=4,mode=620 none /dev/pts
  55. mount -t tmpfs none /dev/shm</userinput></screen>
  56. <para>The <command>mount</command> commands executed above may result
  57. in the following warning message:</para>
  58. <screen><computeroutput>can't open /etc/fstab: No such file or directory.</computeroutput></screen>
  59. <para>This file&mdash;<filename>/etc/fstab</filename>&mdash;has not
  60. been created yet but is also not required for the file systems to be
  61. properly mounted. As such, the warning can be safely ignored.</para>
  62. </sect2>
  63. </sect1>