kernel.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <sect1 id="ch-bootable-kernel" xreflabel="Linux">
  2. <title>Installing Linux-&kernel-version;</title>
  3. <?dbhtml filename="kernel.html" dir="chapter08"?>
  4. <para>The Linux package contains the kernel and the header files.</para>
  5. <screen>Estimated build time: &kernel-time;
  6. Estimated required disk space: &kernel-compsize;</screen>
  7. &aa-kernel-down;
  8. &aa-kernel-dep;
  9. <sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
  10. <sect2>
  11. <title>Installation of the kernel</title>
  12. <para>Building the kernel involves a few steps: configuration, compilation, and
  13. installation. If you don't like the way this book configures the kernel, view
  14. the <filename>README</filename> file in the kernel source tree for alternative
  15. methods.</para>
  16. <para>Prepare for compilation by running the following command:</para>
  17. <screen><userinput>make mrproper</userinput></screen>
  18. <para>This ensures that the kernel tree is absolutely clean. The kernel team
  19. recommends that this command be issued prior to <emphasis>each</emphasis>
  20. kernel compilation. You shouldn't rely on the source tree being clean after
  21. untarring.</para>
  22. <para>Configure the kernel via a menu-driven interface:</para>
  23. <screen><userinput>make menuconfig</userinput></screen>
  24. <para><userinput>make oldconfig</userinput> may be more appropriate in some
  25. situations. See the <filename>README</filename> file for more
  26. information.</para>
  27. <para>If you wish, you may skip kernel configuration by simply copying the
  28. kernel config file, <filename>.config</filename>, from your host system
  29. (assuming it is available) to the unpacked <filename
  30. class="directory">linux-&kernel-version;</filename> directory. However, we
  31. don't recommend this option. You're much better off exploring all the
  32. configuration menus and creating your own kernel configuration from
  33. scratch.</para>
  34. <para>For POSIX shared memory support, ensure that the kernel config option
  35. "Virtual memory file system support" is enabled. It resides within the
  36. "File systems" menu and is normally enabled by default.</para>
  37. <para>Verify dependencies and create dependency information files:</para>
  38. <screen><userinput>make CC=/opt/gcc-2.95.3/bin/gcc dep</userinput></screen>
  39. <para>Compile the kernel image:</para>
  40. <screen><userinput>make CC=/opt/gcc-2.95.3/bin/gcc bzImage</userinput></screen>
  41. <para>Compile the drivers which have been configured as modules:</para>
  42. <screen><userinput>make CC=/opt/gcc-2.95.3/bin/gcc modules</userinput></screen>
  43. <para>If you intend to use kernel modules, you will need an
  44. <filename>/etc/modules.conf</filename> file. Information pertaining
  45. to modules and to kernel configuration in general may be found in the
  46. kernel documentation, which is found in the
  47. <filename>linux-&kernel-version;/Documentation</filename> directory. The
  48. modules.conf man page and the kernel HOWTO at
  49. <ulink url="&tldp-root;HOWTO/Kernel-HOWTO.html"/> may also be of
  50. interest to you.</para>
  51. <para>Install the modules:</para>
  52. <screen><userinput>make CC=/opt/gcc-2.95.3/bin/gcc modules_install</userinput></screen>
  53. <para>As nothing is complete without documentation, build the manual pages
  54. that come with the kernel:</para>
  55. <screen><userinput>make mandocs</userinput></screen>
  56. <para>And install these pages:</para>
  57. <screen><userinput>cp -a Documentation/man /usr/share/man/man9</userinput></screen>
  58. <para>Kernel compilation has finished but more steps are required to complete
  59. the installation. Some files need to be copied to the <filename>/boot</filename>
  60. directory.</para>
  61. <para>The path to the kernel image may vary depending on the platform you're
  62. using. Issue the following command to install the kernel:</para>
  63. <screen><userinput>cp arch/i386/boot/bzImage /boot/lfskernel</userinput></screen>
  64. <para><filename>System.map</filename> is a symbol file for the kernel. It maps
  65. the function entrypoints of every function in the kernel API, as well as the
  66. addresses of the kernel data structures for the running kernel. Issue the
  67. following command to install the map file:</para>
  68. <screen><userinput>cp System.map /boot</userinput></screen>
  69. <para><filename>.config</filename> is the kernel configuration file that was
  70. produced by the <command>make menuconfig</command> step above. It contains all
  71. the config selections for the kernel that was just compiled. It's a good idea
  72. to keep this file for future reference:</para>
  73. <screen><userinput>cp .config /boot/config-lfskernel</userinput></screen>
  74. <para>It is important to note that the files in the kernel source directory are
  75. not owned by <emphasis>root</emphasis>. Whenever you unpack a package as user
  76. <emphasis>root</emphasis> (like we did here inside chroot), the files end up
  77. having the user and group IDs of whatever they were on the packager's computer.
  78. This is usually not a problem for any other package you install because you
  79. remove the source tree after the installation. But the Linux source tree is
  80. often kept around for a long time, so there's a chance that whatever user ID
  81. the packager used will be assigned to somebody on your machine and then that
  82. person would have write access to the kernel source.</para>
  83. <para>If you are going to keep the kernel source tree around, you may want to
  84. run <userinput>chown -R 0:0</userinput> on the
  85. <filename>linux-&kernel-version;</filename> directory to ensure all files are
  86. owned by user <emphasis>root</emphasis>.</para>
  87. </sect2>
  88. &aa-kernel-shortdesc;
  89. &aa-kernel-desc;
  90. </sect1>