source: chapter06/kernel.xml@ 4f2d91dc

xry111/clfs-ng
Last change on this file since 4f2d91dc was 4f2d91dc, checked in by Xi Ruoyao <xry111@…>, 10 months ago

cross-ng: linux and linux-headers: specify ARCH for cross build

  • Property mode set to 100644
File size: 5.5 KB
Line 
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&mdash;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=<replaceable>x86</replaceable> 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.
70 Replace <replaceable>x86</replaceable> with a value suitable
71 for your target machine if it's not a 32-bit or 64-bit x86.</para>
72 </listitem>
73 </varlistentry>
74
75 <varlistentry>
76 <term><command>CROSS_COMPILE=$LFS_TGT-</command></term>
77 <listitem>
78 <para>Build the kernel with Binutils and GCC built in
79 <xref linkend='chapter-cross-tools'/>.</para>
80 </listitem>
81 </varlistentry>
82
83 <varlistentry>
84 <term><command>menuconfig</command></term>
85 <listitem>
86 <para>This launches an ncurses menu-driven interface. For other
87 (graphical) interfaces, type <command>make help</command>.</para>
88 </listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term>(optional) <parameter>LANG=&lt;host_LANG_value&gt; LC_ALL=</parameter></term>
93 <listitem>
94 <para>This establishes the locale setting to the one used on the
95 host. This may be needed for a proper menuconfig ncurses interface
96 line drawing on a UTF-8 linux text console.</para>
97
98 <para>If used, be sure to replace
99 <replaceable>&lt;host_LANG_value&gt;</replaceable> by the value of
100 the <envar>$LANG</envar> variable from your host. You can
101 alternatively use instead the host's value of <envar>$LC_ALL</envar>
102 or <envar>$LC_CTYPE</envar>.</para>
103 </listitem>
104 </varlistentry>
105
106 </variablelist>
107
108 <note>
109
110 <para>A good starting place for setting up the kernel configuration is to
111 run <command>make ARCH=x86 CROSS_COMPILE=$LFS_TGT- defconfig</command>. This will set the base
112 configuration to a good state that takes your target system architecture
113 into account.</para>
114
115 </note>
116
117 <para>Read <xref linkend='ch-bootable-kernel'/> for more information
118 about kernel configuration. You should enable or disable some kernel
119 configuration options now:</para>
120
121 <variablelist>
122 <title>Kernel configuration options and explanation:</title>
123
124 <varlistentry>
125 <term>Set <parameter>CONFIG_MODULES=n</parameter></term>
126 <listitem>
127 <para>Modular kernel needs <command>modprobe</command> tool from
128 <application>Kmod</application> to load modules, which is not
129 installed in the temporary system.</para>
130 </listitem>
131 </varlistentry>
132
133 <varlistentry>
134 <term>Enable <parameter>CONFIG_EXT2</parameter>,
135 <parameter>CONFIG_EXT4</parameter>,
136 and <parameter>CONFIG_VFAT_FS</parameter></term>
137 <listitem>
138 <para>They are needed to access the filesystems we'll make for the
139 target system.</para>
140 </listitem>
141 </varlistentry>
142 </variablelist>
143
144 <para>Compile the kernel image:</para>
145
146<screen><userinput remap="make">make ARCH=x86 CROSS_COMPILE=$LFS_TGT-</userinput></screen>
147
148 <para>Install the kernel image into the
149 <filename class="directory">$LFS/boot</filename> directory:</para>
150
151 <screen><userinput remap="install">install -vm644 arch/x86/boot/bzImage $LFS/boot/vmlinuz</userinput></screen>
152
153 </sect2>
154
155 <sect2 role="content">
156 <title/>
157
158 <para>Details on this package are located in
159 <xref linkend="contents-kernel" role="."/></para>
160
161 </sect2>
162
163</sect1>
Note: See TracBrowser for help on using the repository browser.