kernel.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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>If you have a lot of modules and very little space, you may want to
  54. consider stripping and compressing the modules. For most people such compression
  55. isn't worth the trouble, but if you're really pressed for space, then have a look at
  56. <ulink url="http://www.linux-mips.org/archives/linux-mips/2002-04/msg00031.html"/>.</para>
  57. <para>As nothing is complete without documentation, build the manual pages
  58. that come with the kernel:</para>
  59. <screen><userinput>make mandocs</userinput></screen>
  60. <para>And install these pages:</para>
  61. <screen><userinput>cp -a Documentation/man /usr/share/man/man9</userinput></screen>
  62. <para>Kernel compilation has finished but more steps are required to complete
  63. the installation. Some files need to be copied to the <filename>/boot</filename>
  64. directory.</para>
  65. <para>The path to the kernel image may vary depending on the platform you're
  66. using. Issue the following command to install the kernel:</para>
  67. <screen><userinput>cp arch/i386/boot/bzImage /boot/lfskernel</userinput></screen>
  68. <para><filename>System.map</filename> is a symbol file for the kernel. It maps
  69. the function entrypoints of every function in the kernel API, as well as the
  70. addresses of the kernel data structures for the running kernel. Issue the
  71. following command to install the map file:</para>
  72. <screen><userinput>cp System.map /boot</userinput></screen>
  73. <para><filename>.config</filename> is the kernel configuration file that was
  74. produced by the <command>make menuconfig</command> step above. It contains all
  75. the config selections for the kernel that was just compiled. It's a good idea
  76. to keep this file for future reference:</para>
  77. <screen><userinput>cp .config /boot/config-lfskernel</userinput></screen>
  78. <para>It is important to note that the files in the kernel source directory are
  79. not owned by <emphasis>root</emphasis>. Whenever you unpack a package as user
  80. <emphasis>root</emphasis> (like we did here inside chroot), the files end up
  81. having the user and group IDs of whatever they were on the packager's computer.
  82. This is usually not a problem for any other package you install because you
  83. remove the source tree after the installation. But the Linux source tree is
  84. often kept around for a long time, so there's a chance that whatever user ID
  85. the packager used will be assigned to somebody on your machine and then that
  86. person would have write access to the kernel source.</para>
  87. <para>If you are going to keep the kernel source tree around, you may want to
  88. run <userinput>chown -R 0:0</userinput> on the
  89. <filename>linux-&kernel-version;</filename> directory to ensure all files are
  90. owned by user <emphasis>root</emphasis>.</para>
  91. </sect2>
  92. &aa-kernel-shortdesc;
  93. &aa-kernel-desc;
  94. </sect1>