[f58cbc1] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-tools-kernel" role="wrap">
|
---|
| 9 | <?dbhtml filename="kernel.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info condition="script">
|
---|
| 12 | <productname>kernel</productname>
|
---|
| 13 | <productnumber>&linux-version;</productnumber>
|
---|
| 14 | <address>&linux-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
| 17 | <title>Linux-&linux-version;</title>
|
---|
| 18 |
|
---|
| 19 | <indexterm zone="ch-tools-kernel">
|
---|
| 20 | <primary sortas="a-Linux">Linux</primary>
|
---|
| 21 | <secondary>tools</secondary>
|
---|
| 22 | </indexterm>
|
---|
| 23 |
|
---|
| 24 | <sect2 role="package">
|
---|
| 25 | <title/>
|
---|
| 26 |
|
---|
| 27 | <para>The Linux package contains the Linux kernel.</para>
|
---|
| 28 |
|
---|
| 29 | <segmentedlist>
|
---|
| 30 | <segtitle>&buildtime;</segtitle>
|
---|
| 31 | <segtitle>&diskspace;</segtitle>
|
---|
| 32 |
|
---|
| 33 | <seglistitem>
|
---|
| 34 | <seg>&linux-tmp-sbu;</seg>
|
---|
| 35 | <seg>&linux-tmp-du;</seg>
|
---|
| 36 | </seglistitem>
|
---|
| 37 | </segmentedlist>
|
---|
| 38 |
|
---|
| 39 | </sect2>
|
---|
| 40 |
|
---|
| 41 | <sect2 role="installation">
|
---|
| 42 | <title>Installation of the kernel</title>
|
---|
| 43 |
|
---|
| 44 | <para>Building the kernel involves a few steps—configuration,
|
---|
| 45 | compilation, and installation. Read the <filename>README</filename> file
|
---|
| 46 | in the kernel source tree for alternative methods to the way this book
|
---|
| 47 | configures the kernel.</para>
|
---|
| 48 |
|
---|
| 49 | <para>Prepare for compilation by running the following command:</para>
|
---|
| 50 |
|
---|
| 51 | <screen><userinput remap="pre">make mrproper</userinput></screen>
|
---|
| 52 |
|
---|
| 53 | <para>This ensures that the kernel tree is absolutely clean. The
|
---|
| 54 | kernel team recommends that this command be issued prior to each
|
---|
| 55 | kernel compilation. Do not rely on the source tree being clean after
|
---|
| 56 | un-tarring.</para>
|
---|
| 57 |
|
---|
| 58 | <para>There are several ways to configure the kernel options. Usually,
|
---|
| 59 | This is done through a menu-driven interface, for example:</para>
|
---|
| 60 |
|
---|
| 61 | <screen role="nodump"><userinput>make ARCH=x86 CROSS_COMPILE=$LFS_TGT- menuconfig</userinput></screen>
|
---|
| 62 |
|
---|
| 63 | <variablelist>
|
---|
| 64 | <title>The meaning of make environment variables:</title>
|
---|
| 65 |
|
---|
| 66 | <varlistentry>
|
---|
| 67 | <term><command>ARCH=x86</command></term>
|
---|
| 68 | <listitem>
|
---|
| 69 | <para>Configure the kernel for running on the target machine.</para>
|
---|
| 70 | </listitem>
|
---|
| 71 | </varlistentry>
|
---|
| 72 |
|
---|
| 73 | <varlistentry>
|
---|
| 74 | <term><command>CROSS_COMPILE=$LFS_TGT-</command></term>
|
---|
| 75 | <listitem>
|
---|
| 76 | <para>Build the kernel with Binutils and GCC built in
|
---|
| 77 | <xref linkend='chapter-cross-tools'/>.</para>
|
---|
| 78 | </listitem>
|
---|
| 79 | </varlistentry>
|
---|
| 80 |
|
---|
| 81 | <varlistentry>
|
---|
| 82 | <term><command>menuconfig</command></term>
|
---|
| 83 | <listitem>
|
---|
| 84 | <para>This launches an ncurses menu-driven interface. For other
|
---|
| 85 | (graphical) interfaces, type <command>make help</command>.</para>
|
---|
| 86 | </listitem>
|
---|
| 87 | </varlistentry>
|
---|
| 88 |
|
---|
| 89 | <varlistentry>
|
---|
| 90 | <term>(optional) <parameter>LANG=<host_LANG_value> LC_ALL=</parameter></term>
|
---|
| 91 | <listitem>
|
---|
| 92 | <para>This establishes the locale setting to the one used on the
|
---|
| 93 | host. This may be needed for a proper menuconfig ncurses interface
|
---|
| 94 | line drawing on a UTF-8 linux text console.</para>
|
---|
| 95 |
|
---|
| 96 | <para>If used, be sure to replace
|
---|
| 97 | <replaceable><host_LANG_value></replaceable> by the value of
|
---|
| 98 | the <envar>$LANG</envar> variable from your host. You can
|
---|
| 99 | alternatively use instead the host's value of <envar>$LC_ALL</envar>
|
---|
| 100 | or <envar>$LC_CTYPE</envar>.</para>
|
---|
| 101 | </listitem>
|
---|
| 102 | </varlistentry>
|
---|
| 103 |
|
---|
| 104 | </variablelist>
|
---|
| 105 |
|
---|
| 106 | <note>
|
---|
| 107 |
|
---|
| 108 | <para>A good starting place for setting up the kernel configuration is to
|
---|
| 109 | run <command>make ARCH=x86 CROSS_COMPILE=$LFS_TGT- defconfig</command>. This will set the base
|
---|
| 110 | configuration to a good state that takes your target system architecture
|
---|
| 111 | into account.</para>
|
---|
| 112 |
|
---|
| 113 | </note>
|
---|
| 114 |
|
---|
| 115 | <para>Read <xref linkend='ch-bootable-kernel'/> for more information
|
---|
| 116 | about kernel configuration. You should enable or disable some kernel
|
---|
| 117 | configuration options now:</para>
|
---|
| 118 |
|
---|
| 119 | <variablelist>
|
---|
| 120 | <title>Kernel configuration options and explanation:</title>
|
---|
| 121 |
|
---|
| 122 | <varlistentry>
|
---|
| 123 | <term>Set <parameter>CONFIG_MODULES=n</parameter></term>
|
---|
| 124 | <listitem>
|
---|
| 125 | <para>Modular kernel needs <command>modprobe</command> tool from
|
---|
| 126 | <application>Kmod</application> to load modules, which is not
|
---|
| 127 | installed in the temporary system.</para>
|
---|
| 128 | </listitem>
|
---|
| 129 | </varlistentry>
|
---|
| 130 |
|
---|
| 131 | <varlistentry>
|
---|
| 132 | <term>Enable <parameter>CONFIG_EXT2</parameter>,
|
---|
| 133 | <parameter>CONFIG_EXT4</parameter>,
|
---|
| 134 | and <parameter>CONFIG_VFAT_FS</parameter></term>
|
---|
| 135 | <listitem>
|
---|
| 136 | <para>They are needed to access the filesystems we'll make for the
|
---|
| 137 | target system.</para>
|
---|
| 138 | </listitem>
|
---|
| 139 | </varlistentry>
|
---|
| 140 | </variablelist>
|
---|
| 141 |
|
---|
| 142 | <para>Compile the kernel image:</para>
|
---|
| 143 |
|
---|
| 144 | <screen><userinput remap="make">make ARCH=x86 CROSS_COMPILE=$LFS_TGT-</userinput></screen>
|
---|
| 145 |
|
---|
| 146 | <para>Install the kernel image into the
|
---|
| 147 | <filename class="directory">$LFS/boot</filename> directory:</para>
|
---|
| 148 |
|
---|
| 149 | <screen><userinput remap="install">install -vm644 arch/x86/boot/bzImage $LFS/boot/vmlinuz</userinput></screen>
|
---|
| 150 |
|
---|
| 151 | </sect2>
|
---|
| 152 |
|
---|
| 153 | <sect2 role="content">
|
---|
| 154 | <title/>
|
---|
| 155 |
|
---|
| 156 | <para>Details on this package are located in
|
---|
| 157 | <xref linkend="contents-kernel" role="."/></para>
|
---|
| 158 |
|
---|
| 159 | </sect2>
|
---|
| 160 |
|
---|
| 161 | </sect1>
|
---|