source: BOOK/bootable/x86/kernel.xml @ f4daf82

Last change on this file since f4daf82 was f4daf82, checked in by Chris Staub <chris@…>, 6 years ago

Reworded note on kernel page

  • Property mode set to 100644
File size: 10.7 KB
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3  "" [
4  <!ENTITY % general-entities SYSTEM "../../general.ent">
5  %general-entities;
8<sect1 id="ch-bootable-kernel" role="wrap">
9  <?dbhtml filename="kernel.html"?>
11  <title>Linux-&linux-version2;</title>
13  <indexterm zone="ch-bootable-kernel">
14    <primary sortas="a-Linux">Linux</primary>
15  </indexterm>
17  <sect2 role="package"><title/>
18    <para>The Linux package contains the Linux kernel.</para>
20  </sect2>
22  <sect2 role="installation">
23    <title>Installation of the kernel</title>
25    <para os="a">Building the kernel involves a few steps&mdash;configuration,
26    compilation, and installation. Read the <filename>README</filename>
27    file in the kernel source tree for alternative methods to the way this
28    book configures the kernel.</para>
30    <para os="p1">Apply the latest Linux sublevel patch:</para>
32<screen os="p2"><userinput>xzcat ../&linux-sublevel-patch; | patch -Np1 -i -</userinput></screen>
34    <para os="b">Prepare for compilation by running the following command:</para>
36<screen os="c"><userinput>make mrproper</userinput></screen>
38    <para os="d">This ensures that the kernel tree is absolutely clean. The
39    kernel team recommends that this command be issued prior to each
40    kernel compilation. Do not rely on the source tree being clean after
41    un-tarring.</para>
43    <note os="kc"><para>A good starting place for setting up the kernel
44    configuration is to run <command>make defconfig</command>. This will set the    base configuration to a good state that takes your current system
45    architecture into account.</para>
47    <para>Be sure that the following features are enabled or disabled
48    as shown below, or the system might not work correctly or boot at all.
49    Refer to <filename>/usr/share/doc/systemd-&systemd-version;/README</filename>:</para>
51    <screen role="nodump">General setup  ---&gt;
52  [*] open by fhandle syscalls (CONFIG_FHANDLE)
53  [ ] Auditing support (CONFIG_AUDIT)
54  [*] Control Group support (CONFIG_CGROUPS)
55Processor type and features  ---&gt;
56  [*] Enable seccomp to safely compute untrusted bytecode (CONFIG_SECCOMP)
57Networking support  ---&gt;
58  Networking options  ---&gt;
59    &lt;*&gt; The IPv6 protocol (CONFIG_IPV6)
60Device Drivers  ---&gt;
61  Generic Driver Options  ---&gt;
62    ()  path to uevent helper (CONFIG_UEVENT_HELPER_PATH)
63    [*] Maintain a devtmpfs filesystem to mount at /dev (CONFIG_DEVTMPFS)
64    [ ] Fallback user-helper invocation for firmware loading (CONFIG_FW_LOADER_USER_HELPER)
65File systems  ---&gt;
66  [*] Inotify support for userspace (CONFIG_FSNOTIFY)
67  &lt;*&gt; Kernel automounter version 4 support (also supports v3) (CONFIG_AUTOFS4_FS)
68  Pseudo filesystems  ---&gt;
69    [*] Tmpfs POSIX Access Control Lists (CONFIG_TMPFS_POSIX_ACL)
70    [*] Tmpfs extended attributes (CONFIG_TMPFS_XATTR)
71Firmware Drivers ---&gt;
72  EFI (Extensible Firmware Interface) Support ---&gt;
73    &lt;*&gt; EFI Variable Support via sysfs (CONFIG_EFI_VARS)
74-*- Enable the block layer ---&gt; (CONFIG_BLOCK)
75  Partition Types ---&gt;
76    [*] Advanced partition selection (CONFIG_PARTITION_ADVANCED)
77    [*]   EFI GUID Partition support (CONFIG_EFI_PARTITION)
78Kernel Hacking ---&gt;
79  [*] Collect scheduler debugging info (CONFIG_SCHED_DEBUG)
80  [*] Collect scheduler statistics (CONFIG_SCHEDSTATS)</screen></note>
82    <note os="kd"><para>While "The IPv6 Protocol" is not strictly required, it
83    is highly recommended by the Systemd developers. "EFI Variable support" and
84    "EFI GUID Partition support" are for UEFI systems. "Collect scheduler
85    debugging info" and "Collect scheduler statistics" is for systemd-bootchart.
86    </para></note>
88    <para os="h">Configure the kernel via a menu-driven interface.
89    CBLFS has some information regarding particular kernel configuration
90    requirements of packages outside of CLFS at <ulink
91    url="&cblfs-root;"/>:</para>
93<screen os="i"><userinput>make menuconfig</userinput></screen>
95    <para os="j">Alternatively, <command>make oldconfig</command> may be more
96    appropriate in some situations. See the <filename>README</filename>
97    file for more information.</para>
99    <para os="k">If desired, skip kernel configuration by copying the kernel
100    config file, <filename>.config</filename>, from the host system
101    (assuming it is available) to the root directory of the unpacked kernel
102    sources. However, we do not recommend this option. It is often better
103    to explore all the configuration menus and create the kernel configuration
104    from scratch.</para>
106    <para os="m">Compile the kernel image and modules:</para>
108<screen os="n"><userinput>make</userinput></screen>
110    <para os="o">If using kernel modules, a configuration file in
111    <filename class="directory">/etc/modprobe.d</filename> file may be needed.
112    Information pertaining to modules and kernel configuration is
113    located in the kernel documentation in the <filename
114    class="directory">Documentation</filename> directory of the kernel
115    sources tree. Also, <filename>modprobe.d(5)</filename> may
116    be of interest.</para>
118    <para os="s">Install the modules, if the kernel configuration uses
119    them:</para>
121<screen os="t"><userinput>make modules_install</userinput></screen>
123    <para os="s2">Install the firmware, if the kernel configuration uses
124    them:</para>
126<screen os="t2"><userinput>make firmware_install</userinput></screen>
128    <para os="u">After kernel compilation is complete, additional steps are
129    required to complete the installation. Some files need to be copied to
130    the <filename class="directory">/boot</filename> directory.</para>
132    <para os="v">Issue the following command to install the kernel:</para>
134<screen><userinput>cp -v arch/i386/boot/bzImage /boot/vmlinuz-clfs-&linux-version2;</userinput></screen>
136    <para os="w"><filename></filename> is a symbol file for the kernel.
137    It maps the function entry points of every function in the kernel API,
138    as well as the addresses of the kernel data structures for the running
139    kernel. Issue the following command to install the map file:</para>
141<screen os="w1"><userinput>cp -v /boot/;</userinput></screen>
143    <para os="x">The kernel configuration file <filename>.config</filename>
144    produced by the <command>make menuconfig</command> step above contains
145    all the configuration selections for the kernel that was just compiled.
146    It is a good idea to keep this file for future reference:</para>
148<screen os="x1"><userinput>cp -v .config /boot/config-&linux-version2;</userinput></screen>
150    <para os="y">It is important to note that the files in the kernel source
151    directory are not owned by <systemitem class="username">root</systemitem>.
152    Whenever a package is unpacked as user <systemitem
153    class="username">root</systemitem> (like we do inside the final-system
154    build environment), the files have the user and group IDs of whatever
155    they were on the packager's computer. This is usually not a problem
156    for any other package to be installed because the source tree is
157    removed after the installation. However, the Linux source tree is
158    often retained for a long time. Because of this, there is a chance
159    that whatever user ID the packager used will be assigned to somebody
160    on the machine. That person would then have write access to the kernel
161    source.</para>
163    <para os="y1">If the kernel source tree is going to retained, run
164    <command>chown -R 0:0</command> on the <filename
165    class="directory">linux-&linux-version;</filename> directory to
166    ensure all files are owned by user <systemitem
167    class="username">root</systemitem>.</para>
169    <warning os="z">
170      <para>Some kernel documentation recommends creating a symlink from
171      <filename class="symlink">/usr/src/linux</filename> pointing to the
172      kernel source directory. This is specific to kernels prior to the
173      2.6 series and <emphasis>must not</emphasis> be created on a CLFS
174      system as it can cause problems for packages you may wish to build
175      once your base CLFS system is complete.</para>
177      <para>Also, the headers in the system's <filename
178      class="directory">include</filename> directory should
179      <emphasis>always</emphasis> be the ones against which Glibc was
180      compiled and should <emphasis>never</emphasis> be replaced by headers
181      from a different kernel version.</para>
182    </warning>
184  </sect2>
186  <sect2 id="contents-kernel" role="content">
187    <title>Contents of Linux</title>
189    <segmentedlist>
190      <segtitle>Installed files</segtitle>
191      <segtitle>Installed directory</segtitle>
193      <seglistitem>
194        <seg>config-[linux-version], clfskernel-[linux-version],
195        and[linux-version]</seg>
196        <seg>/lib/modules</seg>
197      </seglistitem>
198    </segmentedlist>
200    <variablelist>
201      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
202      <?dbfo list-presentation="list"?>
203      <?dbhtml list-presentation="table"?>
205      <varlistentry id="config">
206        <term><filename>config-[linux-version]</filename></term>
207        <listitem>
208          <para>Contains all the configuration selections for the kernel</para>
209          <indexterm zone="ch-bootable-kernel config">
210            <primary sortas="e-/boot/config">/boot/config-[linux-version]</primary>
211          </indexterm>
212        </listitem>
213      </varlistentry>
215      <varlistentry id="clfskernel">
216        <term><filename>clfskernel-[linux-version]</filename></term>
217        <listitem>
218          <para>The engine of the Linux system. When turning on the
219          computer, the kernel is the first part of the operating system
220          that gets loaded. It detects and initializes all components of
221          the computer's hardware, then makes these components available
222          as a tree of files to the software and turns a single CPU into
223          a multitasking machine capable of running scores of programs
224          seemingly at the same time.</para>
225          <indexterm zone="ch-bootable-kernel clfskernel">
226            <primary sortas="b-clfskernel">clfskernel-[linux-version]</primary>
227          </indexterm>
228        </listitem>
229      </varlistentry>
231      <varlistentry id="">
232        <term><filename>[linux-version]</filename></term>
233        <listitem>
234          <para>A list of addresses and symbols; it maps the entry points
235          and addresses of all the functions and data structures in the
236          kernel</para>
237          <indexterm zone="ch-bootable-kernel">
238            <primary sortas="e-/boot/">/boot/[linux-version]</primary>
239          </indexterm>
240        </listitem>
241      </varlistentry>
243    </variablelist>
245  </sect2>
Note: See TracBrowser for help on using the repository browser.