aboutsummaryrefslogtreecommitdiffstats
path: root/chapter07
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2020-06-07 20:16:00 +0000
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2020-06-07 20:16:00 +0000
commitfcc027677da55c41dcaea045f5b9ff8b088e6495 (patch)
tree42500a7858959695b971e7f28f1d0bf33185db2e /chapter07
parentd53fefab5a6772fef606392a61608fc290e6a7ae (diff)
Initial commit of alternative cross LFS
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter07')
-rw-r--r--chapter07/bash.xml96
-rw-r--r--chapter07/binutils-pass1.xml156
-rw-r--r--chapter07/binutils-pass2.xml94
-rw-r--r--chapter07/bison.xml82
-rw-r--r--chapter07/bootscripts.xml331
-rw-r--r--chapter07/bzip2.xml112
-rw-r--r--chapter07/changingowner.xml41
-rw-r--r--chapter07/chapter07.xml48
-rw-r--r--chapter07/chroot.xml65
-rw-r--r--chapter07/clock.xml104
-rw-r--r--chapter07/consoled.xml139
-rw-r--r--chapter07/coreutils.xml105
-rw-r--r--chapter07/createfiles.xml204
-rw-r--r--chapter07/creatingdirs.xml59
-rw-r--r--chapter07/dejagnu.xml96
-rw-r--r--chapter07/diffutils.xml68
-rw-r--r--chapter07/etcshells.xml49
-rw-r--r--chapter07/expect.xml139
-rw-r--r--chapter07/file.xml73
-rw-r--r--chapter07/findutils.xml75
-rw-r--r--chapter07/flex.xml88
-rw-r--r--chapter07/gawk.xml74
-rw-r--r--chapter07/gcc-pass1.xml208
-rw-r--r--chapter07/gcc-pass2.xml160
-rw-r--r--chapter07/generalinstructions.xml120
-rw-r--r--chapter07/gettext.xml85
-rw-r--r--chapter07/glibc.xml230
-rw-r--r--chapter07/grep.xml70
-rw-r--r--chapter07/gzip.xml72
-rw-r--r--chapter07/inputrc.xml82
-rw-r--r--chapter07/introduction.xml224
-rw-r--r--chapter07/introductiond.xml73
-rw-r--r--chapter07/kernfs.xml115
-rw-r--r--chapter07/libstdc++-pass2.xml114
-rw-r--r--chapter07/libstdc++.xml122
-rw-r--r--chapter07/linux-headers.xml207
-rw-r--r--chapter07/locale.xml152
-rw-r--r--chapter07/m4.xml74
-rw-r--r--chapter07/make.xml83
-rw-r--r--chapter07/ncurses.xml157
-rw-r--r--chapter07/network.xml247
-rw-r--r--chapter07/networkd.xml335
-rw-r--r--chapter07/patch.xml70
-rw-r--r--chapter07/perl.xml79
-rw-r--r--chapter07/profile.xml162
-rw-r--r--chapter07/python.xml88
-rw-r--r--chapter07/sed.xml70
-rw-r--r--chapter07/stripping.xml53
-rw-r--r--chapter07/symlinks.xml256
-rw-r--r--chapter07/systemd-custom.xml313
-rw-r--r--chapter07/tar.xml71
-rw-r--r--chapter07/tcl.xml191
-rw-r--r--chapter07/texinfo.xml74
-rw-r--r--chapter07/toolchaintechnotes.xml335
-rw-r--r--chapter07/udev.xml342
-rw-r--r--chapter07/usage.xml710
-rw-r--r--chapter07/util-linux.xml113
-rw-r--r--chapter07/xz.xml77
58 files changed, 4696 insertions, 3536 deletions
diff --git a/chapter07/bash.xml b/chapter07/bash.xml
new file mode 100644
index 000000000..ee1fb574e
--- /dev/null
+++ b/chapter07/bash.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-bash" role="wrap">
+ <?dbhtml filename="bash.html"?>
+
+ <sect1info condition="script">
+ <productname>bash</productname>
+ <productnumber>&bash-version;</productnumber>
+ <address>&bash-url;</address>
+ </sect1info>
+
+ <title>Bash-&bash-version;</title>
+
+ <indexterm zone="ch-tools-bash">
+ <primary sortas="a-Bash">Bash</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/bash.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&bash-ch5-sbu;</seg>
+ <seg>&bash-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Bash</title>
+
+ <para>Prepare Bash for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --build=$(support/config.guess) \
+ --host=$LFS_TGT \
+ --without-bash-malloc</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--without-bash-malloc</parameter></term>
+ <listitem>
+ <para>This option turns off the use of Bash's memory allocation
+ (<function>malloc</function>) function which is known to cause
+ segmentation faults. By turning this option off, Bash will use
+ the <function>malloc</function> functions from Glibc which are
+ more stable.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ <para>Move the excutable to where it is expected to be:</para>
+
+<screen><userinput remap="install">mv $LFS/usr/bin/bash $LFS/bin/bash</userinput></screen>
+
+ <para>Make a link for the programs that use <command>sh</command> for
+ a shell:</para>
+
+<screen><userinput remap="install">ln -sv bash $LFS/bin/sh</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-bash" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/binutils-pass1.xml b/chapter07/binutils-pass1.xml
new file mode 100644
index 000000000..8658cfcfe
--- /dev/null
+++ b/chapter07/binutils-pass1.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-binutils-pass1" role="wrap">
+ <?dbhtml filename="binutils-pass1.html"?>
+
+ <sect1info condition="script">
+ <productname>binutils-pass1</productname>
+ <productnumber>&binutils-version;</productnumber>
+ <address>&binutils-url;</address>
+ </sect1info>
+
+ <title>Binutils-&binutils-version; - Pass 1</title>
+
+ <indexterm zone="ch-tools-binutils-pass1">
+ <primary sortas="a-Binutils">Binutils</primary>
+ <secondary>tools, pass 1</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/binutils.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&binutils-ch5p1-sbu;</seg>
+ <seg>&binutils-ch5p1-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Cross Binutils</title>
+
+ <note><para>Go back and re-read the notes in the previous section.
+ Understanding the notes labeled important will save you a lot
+ of problems later.</para></note>
+
+ <para>It is important that Binutils be the first package compiled
+ because both Glibc and GCC perform various tests on the available
+ linker and assembler to determine which of their own features to
+ enable.</para>
+
+ <para>The Binutils documentation recommends building Binutils
+ in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <note>
+ <para>In order for the SBU values listed in the rest of the book
+ to be of any use, measure the time it takes to build this package from
+ the configuration, up to and including the first install. To achieve
+ this easily, wrap the commands in a <command>time</command>
+ command like this: <userinput>time { ./configure ... &amp;&amp; ...
+ &amp;&amp; make install; }</userinput>.</para>
+ </note>
+<!--
+ <note><para>The approximate build SBU values and required disk space
+ in Chapter&nbsp;5 does not include test suite data.</para></note>
+-->
+ <para>Now prepare Binutils for compilation:</para>
+
+<screen><userinput remap="configure">../configure --prefix=$LFS/tools \
+ --with-sysroot=$LFS \
+ --target=$LFS_TGT \
+ --disable-nls \
+ --disable-werror</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--prefix=$LFS/tools</parameter></term>
+ <listitem>
+ <para>This tells the configure script to prepare to install the
+ Binutils programs in the <filename
+ class="directory">$LFS/tools</filename> directory.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--with-sysroot=$LFS</parameter></term>
+ <listitem>
+ <para>For cross compilation, this tells the build system to look in
+ $LFS for the target system libraries as needed.</para>
+ </listitem>
+ </varlistentry>
+ <!--
+ <varlistentry>
+ <term><parameter>- -with-lib-path=/tools/lib</parameter></term>
+ <listitem>
+ <para>This specifies which library path the linker should be
+ configured to use.</para>
+ </listitem>
+ </varlistentry>
+ -->
+ <varlistentry>
+ <term><envar>--target=$LFS_TGT</envar></term>
+ <listitem>
+ <para>Because the machine description in the <envar>LFS_TGT</envar>
+ variable is slightly different than the value returned by the
+ <command>config.guess</command> script, this switch will tell the
+ <command>configure</command> script to adjust Binutil's build system
+ for building a cross linker. </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-nls</parameter></term>
+ <listitem>
+ <para>This disables internationalization as i18n is not needed for the
+ temporary tools.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-werror</parameter></term>
+ <listitem>
+ <para>This prevents the build from stopping in the event that there
+ are warnings from the host's compiler.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Continue with compiling the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-binutils" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/binutils-pass2.xml b/chapter07/binutils-pass2.xml
new file mode 100644
index 000000000..5d0fd7e6d
--- /dev/null
+++ b/chapter07/binutils-pass2.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-binutils-pass2" role="wrap">
+ <?dbhtml filename="binutils-pass2.html"?>
+
+ <sect1info condition="script">
+ <productname>binutils-pass2</productname>
+ <productnumber>&binutils-version;</productnumber>
+ <address>&binutils-url;</address>
+ </sect1info>
+
+ <title>Binutils-&binutils-version; - Pass 2</title>
+
+ <indexterm zone="ch-tools-binutils-pass2">
+ <primary sortas="a-Binutils">Binutils</primary>
+ <secondary>tools, pass 2</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/binutils.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&binutils-ch5p2-sbu;</seg>
+ <seg>&binutils-ch5p2-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Binutils</title>
+
+ <para>Create a separate build directory again:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <para>Prepare Binutils for compilation:</para>
+
+<screen><userinput remap="configure">../configure \
+ --prefix=/usr \
+ --build=$(../config.guess) \
+ --host=$LFS_TGT \
+ --disable-nls \
+ --enable-shared \
+ --disable-werror</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the new configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--host=$LFS_TGT</parameter></term>
+ <listitem>
+ <para>This tells the configure script that we want to build
+ this pass of binutils for the $LFS_TGT machine, using our just
+ built cross-compiler. This prevents the linker from searching
+ through library directories on the host.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-binutils" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/bison.xml b/chapter07/bison.xml
new file mode 100644
index 000000000..3ed86713a
--- /dev/null
+++ b/chapter07/bison.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-bison" role="wrap">
+ <?dbhtml filename="bison.html"?>
+
+ <sect1info condition="script">
+ <productname>bison</productname>
+ <productnumber>&bison-version;</productnumber>
+ <address>&bison-url;</address>
+ </sect1info>
+
+ <title>Bison-&bison-version;</title>
+
+ <indexterm zone="ch-tools-bison">
+ <primary sortas="a-Bison">Bison</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/bison.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&bison-ch5-sbu;</seg>
+ <seg>&bison-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Bison</title>
+
+ <para>Prepare Bison for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the new configure option:</title>
+
+ <varlistentry>
+ <term><parameter>--docdir=/usr/share/doc/bison-&bison-version;</parameter></term>
+ <listitem>
+ <para>This tells the build system to install bison documentation
+ into a versioned directory.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-bison" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml
deleted file mode 100644
index 5c2b28d7c..000000000
--- a/chapter07/bootscripts.xml
+++ /dev/null
@@ -1,331 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-bootscripts" role="wrap" revision="sysv">
- <?dbhtml filename="bootscripts.html"?>
-
- <sect1info condition="script">
- <productname>bootscripts</productname>
- <productnumber>&lfs-bootscripts-version;</productnumber>
- <address>&lfs-bootscripts-url;</address>
- </sect1info>
-
- <title>LFS-Bootscripts-&lfs-bootscripts-version;</title>
-
- <indexterm zone="ch-config-bootscripts">
- <primary sortas="a-Bootscripts">Bootscripts</primary>
- </indexterm>
-
- <sect2 role="package">
- <title/>
-
- <para>The LFS-Bootscripts package contains a set of scripts to start/stop
- the LFS system at bootup/shutdown.
- The configuration files and procedures needed to
- customize the boot process are described in the following sections.</para>
-
- <segmentedlist>
- <segtitle>&buildtime;</segtitle>
- <segtitle>&diskspace;</segtitle>
-
- <seglistitem>
- <seg>&lfs-bootscripts-ch7-sbu;</seg>
- <seg>&lfs-bootscripts-ch7-du;</seg>
- </seglistitem>
- </segmentedlist>
-
- </sect2>
-
- <sect2 role="installation">
- <title>Installation of LFS-Bootscripts</title>
-
- <para>Install the package:</para>
-
-<screen><userinput remap="install">make install</userinput></screen>
-
- </sect2>
-
- <sect2 id="contents-bootscripts" role="content">
- <title>Contents of LFS-Bootscripts</title>
- <segmentedlist>
- <segtitle>Installed scripts</segtitle>
- <segtitle>Installed directories</segtitle>
-
- <seglistitem>
- <seg>checkfs, cleanfs, console, functions, halt, ifdown,
- ifup, localnet, modules, mountfs, mountvirtfs, network, rc, reboot,
- sendsignals, setclock, ipv4-static, swap, sysctl, sysklogd, template,
- udev, and udev_retry</seg>
- <seg>/etc/rc.d, /etc/init.d (symbolic link), /etc/sysconfig,
- /lib/services, /lib/lsb (symbolic link)</seg>
- </seglistitem>
- </segmentedlist>
-
- <variablelist>
- <bridgehead renderas="sect3">Short Descriptions</bridgehead>
- <?dbfo list-presentation="list"?>
- <?dbhtml list-presentation="table"?>
-
- <varlistentry id="checkfs-bootscripts">
- <term><command>checkfs</command></term>
- <listitem>
- <para>Checks the integrity of the file systems before they are mounted
- (with the exception of journal and network based file systems)</para>
- <indexterm zone="ch-config-bootscripts checkfs-bootscripts">
- <primary sortas="d-checkfs">checkfs</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="cleanfs-bootscripts">
- <term><command>cleanfs</command></term>
- <listitem>
- <para>Removes files that should not be preserved between reboots, such
- as those in <filename class="directory">/var/run/</filename> and
- <filename class="directory">/var/lock/</filename>; it re-creates
- <filename>/var/run/utmp</filename> and removes the possibly present
- <filename>/etc/nologin</filename>, <filename>/fastboot</filename>, and
- <filename>/forcefsck</filename> files</para>
- <indexterm zone="ch-config-bootscripts cleanfs-bootscripts">
- <primary sortas="d-cleanfs">cleanfs</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="console-bootscripts">
- <term><command>console</command></term>
- <listitem>
- <para>Loads the correct keymap table for the desired keyboard layout;
- it also sets the screen font</para>
- <indexterm zone="ch-config-bootscripts console-bootscripts">
- <primary sortas="d-console">console</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="functions-bootscripts">
- <term><command>functions</command></term>
- <listitem>
- <para>Contains common functions, such as error and status checking,
- that are used by several bootscripts</para>
- <indexterm zone="ch-config-bootscripts functions-bootscripts">
- <primary sortas="d-functions">functions</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="halt-bootscripts">
- <term><command>halt</command></term>
- <listitem>
- <para>Halts the system</para>
- <indexterm zone="ch-config-bootscripts halt-bootscripts">
- <primary sortas="d-halt">halt</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="ifdown-bootscripts">
- <term><command>ifdown</command></term>
- <listitem>
- <para>Stops a network device</para>
- <indexterm zone="ch-config-bootscripts ifdown-bootscripts">
- <primary sortas="d-ifdown">ifdown</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="ifup-bootscripts">
- <term><command>ifup</command></term>
- <listitem>
- <para>Initializes a network device</para>
- <indexterm zone="ch-config-bootscripts ifup-bootscripts">
- <primary sortas="d-ifup">ifup</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="localnet-bootscripts">
- <term><command>localnet</command></term>
- <listitem>
- <para>Sets up the system's hostname and local loopback device</para>
- <indexterm zone="ch-config-bootscripts localnet-bootscripts">
- <primary sortas="d-localnet">localnet</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="modules-bootscripts">
- <term><command>modules</command></term>
- <listitem>
- <para>Loads kernel modules listed in
- <filename>/etc/sysconfig/modules</filename>, using arguments
- that are also given there</para>
- <indexterm zone="ch-config-bootscripts modules-bootscripts">
- <primary sortas="d-modules">modules</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="mountfs-bootscripts">
- <term><command>mountfs</command></term>
- <listitem>
- <para>Mounts all file systems, except ones that are marked
- <emphasis>noauto</emphasis> or are network based</para>
- <indexterm zone="ch-config-bootscripts mountfs-bootscripts">
- <primary sortas="d-mountfs">mountfs</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="mountvirtfs-bootscripts">
- <term><command>mountvirtfs</command></term>
- <listitem>
- <para>Mounts virtual kernel file systems, such as <systemitem
- class="filesystem">proc</systemitem></para>
- <indexterm zone="ch-config-bootscripts mountvirtfs-bootscripts">
- <primary sortas="d-mountvirtfs">mountvirtfs</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="network-bootscripts">
- <term><command>network</command></term>
- <listitem>
- <para>Sets up network interfaces, such as network cards, and sets up
- the default gateway (where applicable)</para>
- <indexterm zone="ch-config-bootscripts network-bootscripts">
- <primary sortas="d-network">network</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="rc-bootscripts">
- <term><command>rc</command></term>
- <listitem>
- <para>The master run-level control script; it is responsible for
- running all the other bootscripts one-by-one, in a sequence determined
- by the name of the symbolic links being processed</para>
- <indexterm zone="ch-config-bootscripts rc-bootscripts">
- <primary sortas="d-rc">rc</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="reboot-bootscripts">
- <term><command>reboot</command></term>
- <listitem>
- <para>Reboots the system</para>
- <indexterm zone="ch-config-bootscripts reboot-bootscripts">
- <primary sortas="d-reboot">reboot</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="sendsignals-bootscripts">
- <term><command>sendsignals</command></term>
- <listitem>
- <para>Makes sure every process is terminated before the system reboots
- or halts</para>
- <indexterm zone="ch-config-bootscripts sendsignals-bootscripts">
- <primary sortas="d-sendsignals">sendsignals</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="setclock-bootscripts">
- <term><command>setclock</command></term>
- <listitem>
- <para>Resets the kernel clock to local time in case the hardware clock
- is not set to UTC time</para>
- <indexterm zone="ch-config-bootscripts setclock-bootscripts">
- <primary sortas="d-setclock">setclock</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="ipv4-static-bootscripts">
- <term><command>ipv4-static</command></term>
- <listitem>
- <para>Provides the functionality needed to assign a static Internet
- Protocol (IP) address to a network interface</para>
- <indexterm zone="ch-config-bootscripts ipv4-static-bootscripts">
- <primary sortas="d-ipv4-static">ipv4-static</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="swap-bootscripts">
- <term><command>swap</command></term>
- <listitem>
- <para>Enables and disables swap files and partitions</para>
- <indexterm zone="ch-config-bootscripts swap-bootscripts">
- <primary sortas="d-swap">swap</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="sysctl-bootscripts">
- <term><command>sysctl</command></term>
- <listitem>
- <para>Loads system configuration values from
- <filename>/etc/sysctl.conf</filename>, if that file exists,
- into the running kernel</para>
- <indexterm zone="ch-config-bootscripts sysctl-bootscripts">
- <primary sortas="d-sysctl">sysctl</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="sysklogd-bootscripts">
- <term><command>sysklogd</command></term>
- <listitem>
- <para>Starts and stops the system and kernel log daemons</para>
- <indexterm zone="ch-config-bootscripts sysklogd-bootscripts">
- <primary sortas="d-sysklogd">sysklogd</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="template-bootscripts">
- <term><command>template</command></term>
- <listitem>
- <para>A template to create custom bootscripts for other
- daemons</para>
- <indexterm zone="ch-config-bootscripts template-bootscripts">
- <primary sortas="d-template">template</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="udev-bootscripts">
- <term><command>udev</command></term>
- <listitem>
- <para>Prepares the <filename class="directory">/dev</filename>
- directory and starts Udev</para>
- <indexterm zone="ch-config-bootscripts udev-bootscripts">
- <primary sortas="d-udev">udev</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- <varlistentry id="udev-retry-bootscripts">
- <term><command>udev_retry</command></term>
- <listitem>
- <para>Retries failed udev uevents, and copies generated rules
- files from <filename class="directory">/run/udev</filename> to
- <filename class="directory">/etc/udev/rules.d</filename> if required</para>
- <indexterm zone="ch-config-bootscripts udev-retry-bootscripts">
- <primary sortas="d-udev-retry">udev_retry</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/bzip2.xml b/chapter07/bzip2.xml
new file mode 100644
index 000000000..828b7fc0f
--- /dev/null
+++ b/chapter07/bzip2.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-bzip2" role="wrap">
+ <?dbhtml filename="bzip2.html"?>
+
+ <sect1info condition="script">
+ <productname>bzip2</productname>
+ <productnumber>&bzip2-version;</productnumber>
+ <address>&bzip2-url;</address>
+ </sect1info>
+
+ <title>Bzip2-&bzip2-version;</title>
+
+ <indexterm zone="ch-tools-bzip2">
+ <primary sortas="a-Bzip2">Bzip2</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/bzip2.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&bzip2-ch5-sbu;</seg>
+ <seg>&bzip2-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Bzip2</title>
+
+ <para>Apply a patch that will install the documentation for this
+ package:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&bzip2-docs-patch;</userinput></screen>
+
+ <para>The following command ensures installation of symbolic links are
+ relative:</para>
+
+<screen><userinput remap="pre">sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile</userinput></screen>
+
+ <para>Ensure the man pages are installed into the correct location:</para>
+
+<screen><userinput remap="pre">sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile</userinput></screen>
+
+ <para>The Bzip2 package does not contain a <command>configure</command>
+ script. There are two <filename>Makefile</filename>, one for the shared
+ library, and the other for the static library. Since we need both, We
+ do the compilation in two stages. First the shared library:</para>
+
+<screen><userinput remap="make">make CC=$LFS_TGT-gcc -f Makefile-libbz2_so
+make clean</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the make parameter:</title>
+
+ <varlistentry>
+ <term><parameter>-f Makefile-libbz2_so</parameter></term>
+ <listitem>
+ <para>This will cause Bzip2 to be built using a different
+ <filename>Makefile</filename> file, in this case the
+ <filename>Makefile-libbz2_so</filename> file, which creates a dynamic
+ <filename class="libraryfile">libbz2.so</filename> library and links
+ the Bzip2 utilities against it.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile and test the package with:</para>
+
+<screen><userinput remap="make">make CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make PREFIX=$LFS/usr install</userinput></screen>
+
+ <para>Install the shared <command>bzip2</command> binary into the
+ <filename class="directory">/bin</filename> directory, make some necessary
+ symbolic links, and clean up:</para>
+
+<screen><userinput remap="install">cp -v bzip2-shared $LFS/bin/bzip2
+cp -av libbz2.so* $LFS/lib
+ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
+rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
+ln -sv bzip2 $LFS/bin/bunzip2
+ln -sv bzip2 $LFS/bin/bzcat</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+ <para>Details on this package are located in
+ <xref linkend="contents-bzip2" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml
new file mode 100644
index 000000000..43a902821
--- /dev/null
+++ b/chapter07/changingowner.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-changingowner">
+ <?dbhtml filename="changingowner.html"?>
+
+ <title>Changing Ownership</title>
+
+ <note>
+ <para>The commands in the remainder of this book must be performed while
+ logged in as user <systemitem class="username">root</systemitem> and no
+ longer as user <systemitem class="username">lfs</systemitem>. Also, double
+ check that <envar>$LFS</envar> is set in <systemitem
+ class="username">root</systemitem>'s environment.</para>
+ </note>
+
+ <para>Currently, the whole directory hierarchy in <filename
+ class="directory">$LFS</filename>
+ is owned by the user <systemitem class="username">lfs</systemitem>, a user
+ that exists only on the host system. If the directories under <filename
+ class="directory">$LFS</filename> are kept as they are, the files are
+ owned by a user ID without a corresponding account. This is dangerous because
+ a user account created later could get this same user ID and would own all
+ the files under <filename class="directory">$LFS</filename>, thus exposing
+ these files to possible malicious manipulation.</para>
+
+ <para>To avoid this issue, you could add the <systemitem
+ class="username">lfs</systemitem> user to the new LFS system later when
+ creating the <filename>/etc/passwd</filename> file, taking care to assign it
+ the same user and group IDs as on the host system. Better yet, change the
+ ownership of the <filename class="directory">$LFS/*</filename> directories to
+ user <systemitem class="username">root</systemitem> by running the following
+ command:</para>
+
+<screen><userinput>chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}</userinput></screen>
+
+</sect1>
diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml
index b745594da..df740eaa5 100644
--- a/chapter07/chapter07.xml
+++ b/chapter07/chapter07.xml
@@ -5,39 +5,25 @@
%general-entities;
]>
-<chapter id="chapter-config" xreflabel="Chapter&nbsp;7">
+<chapter id="chapter-chroot-temporary-tools" xreflabel="Chapter&nbsp;7">
<?dbhtml dir="chapter07"?>
<?dbhtml filename="chapter07.html"?>
- <title>System Configuration</title>
-
- <!-- sysv -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
-
- <!-- systemd -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introductiond.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="networkd.xml"/>
-
- <!-- common -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
-
- <!-- sysv -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
-
- <!-- systemd -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="clock.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="consoled.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/>
-
- <!-- common -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="etcshells.xml"/>
-
- <!-- systemd -->
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd-custom.xml"/>
+ <title>Entering Chroot and Building Additional Tools</title>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingdirs.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="createfiles.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++-pass2.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dejagnu.xml"/>
</chapter>
diff --git a/chapter07/chroot.xml b/chapter07/chroot.xml
new file mode 100644
index 000000000..5b6310af7
--- /dev/null
+++ b/chapter07/chroot.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-chroot">
+ <?dbhtml filename="chroot.html"?>
+
+ <title>Entering the Chroot Environment</title>
+
+ <para>Now that all the packages which depend on themselves for being built
+ are on the system, it is time to enter the chroot environment to finish
+ installing the remaining temporary tools. This environment will be in use
+ also for installing the final system. As user <systemitem
+ class="username">root</systemitem>, run the following command to enter the
+ realm that is, at the moment, populated with only the temporary tools:</para>
+
+<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
+ HOME=/root \
+ TERM="$TERM" \
+ PS1='(lfs chroot) \u:\w\$ ' \
+ PATH=/bin:/usr/bin:/sbin:/usr/sbin \
+ /bin/bash --login +h</userinput></screen>
+
+ <para>The <parameter>-i</parameter> option given to the <command>env</command>
+ command will clear all variables of the chroot environment. After that, only
+ the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
+ <envar>PATH</envar> variables are set again. The
+ <parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
+ variable inside chroot to the same value as outside chroot. This variable is
+ needed for programs like <command>vim</command> and <command>less</command>
+ to operate properly. If other variables are needed, such as
+ <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
+ them again.</para>
+
+ <para>From this point on, there is no need to use the
+ <envar>LFS</envar> variable anymore, because all work will be restricted
+ to the LFS file system. This is because the Bash shell is told that
+ <filename class="directory">$LFS</filename> is now the root
+ (<filename class="directory">/</filename>) directory.</para>
+
+ <para>Notice that <filename class="directory">/tools/bin</filename> is not
+ anymore in the <envar>PATH</envar>. This means that a temporary tool will no longer be
+ used once its final version is installed. This occurs when the shell does not
+ <quote>remember</quote> the locations of executed binaries&mdash;for this
+ reason, hashing is switched off by passing the <parameter>+h</parameter> option
+ to <command>bash</command>.</para>
+
+ <para>Note that the <command>bash</command> prompt will say
+ <computeroutput>I have no name!</computeroutput> This is normal because the
+ <filename>/etc/passwd</filename> file has not been created yet.</para>
+
+ <note>
+ <para>It is important that all the commands throughout the remainder of this
+ chapter and the following chapters are run from within the chroot
+ environment. If you leave this environment for any reason (rebooting for
+ example), ensure that the virtual kernel filesystems are mounted as
+ explained in <xref linkend="ch-system-bindmount"/> and <xref
+ linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
+ with the installation.</para>
+ </note>
+
+</sect1>
diff --git a/chapter07/clock.xml b/chapter07/clock.xml
deleted file mode 100644
index 872ba677c..000000000
--- a/chapter07/clock.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-clock" revision="systemd">
- <?dbhtml filename="clock.html"?>
-
- <title>Configuring the system clock</title>
-
- <indexterm zone="ch-config-clock">
- <primary sortas="d-clock">clock</primary>
- <secondary>configuring</secondary></indexterm>
-
- <para>This section discusses how to configure the
- <command>systemd-timedated</command> system service, which configures
- system clock and timezone.</para>
-
- <para>If you cannot remember whether or not the hardware clock is set to UTC,
- find out by running the <userinput>hwclock --localtime --show</userinput>
- command. This will display what the current time is according to the hardware
- clock. If this time matches whatever your watch says, then the hardware clock is
- set to local time. If the output from <command>hwclock</command> is not local
- time, chances are it is set to UTC time. Verify this by adding or subtracting
- the proper amount of hours for the timezone to the time shown by
- <command>hwclock</command>. For example, if you are currently in the MST
- timezone, which is also known as GMT -0700, add seven hours to the local
- time.</para>
-
- <para><command>systemd-timedated</command> reads <filename>/etc/adjtime</filename>,
- and depending on the contents of the file, it sets the clock to either UTC or
- local time.</para>
-
- <para>Create the <filename>/etc/adjtime</filename> file with the following contents
- if your hardware clock is set to local time:</para>
-
-<screen><userinput>cat &gt; /etc/adjtime &lt;&lt; "EOF"
-<literal>0.0 0 0.0
-0
-LOCAL</literal>
-EOF</userinput></screen>
-
- <para>If <filename>/etc/adjtime</filename> isn't present at first boot,
- <command>systemd-timedated</command> will assume that hardware clock is
- set to UTC and adjust the file according to that.</para>
-
- <para>You can also use the <command>timedatectl</command> utility to tell
- <command>systemd-timedated</command> if your hardware clock is set to
- UTC or local time:</para>
-
-<screen role="nodump"><userinput>timedatectl set-local-rtc 1</userinput></screen>
-
- <para><command>timedatectl</command> can also be used to change system time and
- time zone.</para>
-
- <para>To change your current system time, issue:</para>
-
-<screen role="nodump"><userinput>timedatectl set-time YYYY-MM-DD HH:MM:SS</userinput></screen>
-
- <para>Hardware clock will also be updated accordingly.</para>
-
- <para>To change your current time zone, issue:</para>
-
-<screen role="nodump"><userinput>timedatectl set-timezone TIMEZONE</userinput></screen>
-
- <para>You can get a list of available time zones by running:</para>
-
-<screen role="nodump"><userinput>timedatectl list-timezones</userinput></screen>
-
- <note><para>Please note that the <command>timedatectl</command> command can
- be used only on a system booted with systemd.</para></note>
-
- <sect2>
- <title>Network Time Synchronization</title>
-
- <para>Starting with version 213, systemd ships a daemon called
- <command>systemd-timesyncd</command> which can be used to
- synchronize the system time with remote NTP servers.</para>
-
- <para>The daemon is not intended as a replacement for the well
- established NTP daemon, but as a client only implementation
- of the SNTP protocol which can be used for less advanced
- tasks and on resource limited systems.</para>
-
- <para>Starting with systemd version 216, the
- <command>systemd-timesyncd</command> daemon is enabled by
- default. If you want to disable it, issue the following
- command:</para>
-
-<screen role="nodump"><userinput>systemctl disable systemd-timesyncd</userinput></screen>
-
- <para>The <filename>/etc/systemd/timesyncd.conf</filename> file
- can be used to change the NTP servers that
- <command>systemd-timesyncd</command> synchronizes with.</para>
-
- <para>Please note that when system clock is set to Local Time,
- <command>systemd-timesyncd</command> won't update hardware
- clock.</para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/consoled.xml b/chapter07/consoled.xml
deleted file mode 100644
index bf1fdc8e0..000000000
--- a/chapter07/consoled.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-console" revision="systemd">
- <?dbhtml filename="console.html"?>
-
- <title>Configuring the Linux Console</title>
-
- <indexterm zone="ch-config-console">
- <primary sortas="d-console">console</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <para>This section discusses how to configure the
- <command>systemd-vconsole-setup</command> system service, which configures
- the virtual console font and console keymap.</para>
-
- <para>The <command>systemd-vconsole-setup</command> service reads the
- <filename>/etc/vconsole.conf</filename> file for configuration
- information. Decide which keymap and screen font will be used. Various
- language-specific HOWTOs can also help with this, see <ulink
- url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>.
- Examine <command>localectl list-keymaps</command> output for a list of
- valid console keymaps. Look in
- <filename class="directory">/usr/share/consolefonts</filename>
- directory for valid screen fonts.</para>
-
- <para>The <filename>/etc/vconsole.conf</filename> file should contain lines
- of the form: VARIABLE="value". The following variables are recognized:</para>
-
- <variablelist>
-
- <varlistentry>
- <term>KEYMAP</term>
- <listitem>
- <para>This variable specifies the key mapping table for the keyboard. If
- unset, it defaults to <literal>us</literal>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>KEYMAP_TOGGLE</term>
- <listitem>
- <para>This variable can be used to configure a second toggle keymap and
- is unset by default.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>FONT</term>
- <listitem>
- <para>This variable specifies the font used by the virtual
- console.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>FONT_MAP</term>
- <listitem>
- <para>This variable specifies the console map to be used.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>FONT_UNIMAP</term>
- <listitem>
- <para>This variable specifies the Unicode font map.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- <para>An example for a German keyboard and console is given below:</para>
-<!-- This is what is used by jhalfs for creating the vconsole.conf file.
- Whenever you want to change the following, please inform the jhalfs
- maintainer(s). -->
-<screen><userinput>cat &gt; /etc/vconsole.conf &lt;&lt; "EOF"
-<literal>KEYMAP=de-latin1
-FONT=Lat2-Terminus16</literal>
-EOF</userinput></screen>
-
- <para>You can change KEYMAP value at runtime by using the
- <command>localectl</command> utility:</para>
-
-<screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
-
- <note><para>Please note that the <command>localectl</command> command can
- be used only on a system booted with systemd.</para></note>
-
- <para>You can also use <command>localectl</command> utility with the
- corresponding parameters to change X11 keyboard layout, model, variant
- and options:</para>
-
-<screen role="nodump"><userinput>localectl set-x11-keymap LAYOUT [MODEL] [VARIANT] [OPTIONS]</userinput></screen>
-
- <para>To list possible values for <command>localectl set-x11-keymap</command>
- parameters, run <command>localectl</command> with parameters listed below:
- </para>
-
- <variablelist>
-
- <varlistentry>
- <term>list-x11-keymap-models</term>
- <listitem>
- <para>Show known X11 keyboard mapping models.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>list-x11-keymap-layouts</term>
- <listitem>
- <para>Show known X11 keyboard mapping layouts.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>list-x11-keymap-variants</term>
- <listitem>
- <para>Show known X11 keyboard mapping variants.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>list-x11-keymap-options</term>
- <listitem>
- <para>Show known X11 keyboard mapping options.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- <note><para>Using any of the parameters listed above requires the
- XKeyboard Config package from BLFS.</para></note>
-
-</sect1>
diff --git a/chapter07/coreutils.xml b/chapter07/coreutils.xml
new file mode 100644
index 000000000..f1e380f7e
--- /dev/null
+++ b/chapter07/coreutils.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-coreutils" role="wrap">
+ <?dbhtml filename="coreutils.html"?>
+
+ <sect1info condition="script">
+ <productname>coreutils</productname>
+ <productnumber>&coreutils-version;</productnumber>
+ <address>&coreutils-url;</address>
+ </sect1info>
+
+ <title>Coreutils-&coreutils-version;</title>
+
+ <indexterm zone="ch-tools-coreutils">
+ <primary sortas="a-Coreutils">Coreutils</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/coreutils.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&coreutils-ch5-sbu;</seg>
+ <seg>&coreutils-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Coreutils</title>
+
+ <para>Prepare Coreutils for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess) \
+ --enable-install-program=hostname \
+ --enable-no-install-program=kill,uptime</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><envar>--enable-install-program=hostname</envar></term>
+ <listitem>
+ <para>This enables the <command>hostname</command> binary to be built
+ and installed &ndash; it is disabled by default but is required by the
+ Perl test suite.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+<!--
+ <para>The above command refuses to install <filename>su</filename>
+ because the program cannot be installed setuid root as a non-privileged
+ user. By manually installing it, we can use it for running tests in the
+ final system as a non-privileged user. Install it with:</para>
+
+<screen><userinput remap="install">cp -v src/su /tools/bin</userinput></screen>
+-->
+ <para>Move programs to their final expected locations. Although this is
+ not necessary in this temporary environment, we must do so because some
+ programs harcode executable locations:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin
+mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin
+mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin
+mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
+mkdir -pv $LFS/usr/share/man/man8
+mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
+sed -i s/\"1\"/\"8\"/1 $LFS/usr/share/man/man8/chroot.8
+mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-coreutils" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml
new file mode 100644
index 000000000..aed8d79da
--- /dev/null
+++ b/chapter07/createfiles.xml
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-createfiles">
+ <?dbhtml filename="createfiles.html"?>
+
+ <title>Creating Essential Files and Symlinks</title>
+
+ <indexterm zone="ch-tools-createfiles">
+ <primary sortas="e-/etc/passwd">/etc/passwd</primary>
+ </indexterm>
+
+ <indexterm zone="ch-tools-createfiles">
+ <primary sortas="e-/etc/group">/etc/group</primary>
+ </indexterm>
+
+ <indexterm zone="ch-tools-createfiles">
+ <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
+ </indexterm>
+
+ <indexterm zone="ch-tools-createfiles">
+ <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
+ </indexterm>
+
+ <indexterm zone="ch-tools-createfiles">
+ <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
+ </indexterm>
+
+ <indexterm zone="ch-tools-createfiles">
+ <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
+ </indexterm>
+
+ <para>Historically, Linux maintains a list of the mounted file systems in the
+ file <filename>/etc/mtab</filename>. Modern kernels maintain this list
+ internally and exposes it to the user via the <filename
+ class="directory">/proc</filename> filesystem. To satisfy utilities that
+ expect the presence of <filename>/etc/mtab</filename>, create the following
+ symbolic link:</para>
+
+<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
+
+ <para>In order for user <systemitem class="username">root</systemitem> to be
+ able to login and for the name <quote>root</quote> to be recognized, there
+ must be relevant entries in the <filename>/etc/passwd</filename> and
+ <filename>/etc/group</filename> files.</para>
+
+ <para>Create the <filename>/etc/passwd</filename> file by running the following
+ command:</para>
+
+<screen revision="sysv"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
+EOF</userinput></screen>
+
+<screen revision="systemd"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
+systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false
+systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false
+systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false
+systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false
+systemd-network:x:76:76:systemd Network Management:/:/bin/false
+systemd-resolve:x:77:77:systemd Resolver:/:/bin/false
+systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false
+systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
+EOF</userinput></screen>
+
+ <para>The actual password for <systemitem class="username">root</systemitem>
+ (the <quote>x</quote> used here is just a placeholder) will be set later.</para>
+
+ <para>Create the <filename>/etc/group</filename> file by running the following
+ command:</para>
+
+<screen revision="sysv"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
+<literal>root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:</literal>
+EOF</userinput></screen>
+
+<screen revision="systemd"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
+<literal>root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+systemd-journal:x:23:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+systemd-bus-proxy:x:72:
+systemd-journal-gateway:x:73:
+systemd-journal-remote:x:74:
+systemd-journal-upload:x:75:
+systemd-network:x:76:
+systemd-resolve:x:77:
+systemd-timesync:x:78:
+systemd-coredump:x:79:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:</literal>
+EOF</userinput></screen>
+
+ <para>The created groups are not part of any standard&mdash;they are groups
+ decided on in part by the requirements of the Udev configuration in the next
+ chapter, and in part by common convention employed by a number of existing
+ Linux distributions. In addition, some test suites rely on specific users
+ or groups. The Linux Standard Base (LSB, available at <ulink
+ url="http://www.linuxbase.org"/>) recommends only that, besides the group
+ <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
+ a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
+ present. All other group names and GIDs can be chosen freely by the system
+ administrator since well-written programs do not depend on GID numbers, but
+ rather use the group's name.</para>
+
+ <para>Some tests in <xref linkend="chapter-building-system"/> need a regular
+ user. We add this user here and delete this account at the end of that
+ chapter.</para>
+
+<screen><userinput>echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" &gt;&gt; /etc/passwd
+echo "tester:x:101:" &gt;&gt; /etc/group
+install -o tester -d /home/tester</userinput></screen>
+
+ <para>To remove the <quote>I have no name!</quote> prompt, start a new
+ shell. Since the
+ <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
+ files have been created, user name and group name resolution will now
+ work:</para>
+
+<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
+
+ <para>Note the use of the <parameter>+h</parameter> directive. This tells
+ <command>bash</command> not to use its internal path hashing. Without this
+ directive, <command>bash</command> would remember the paths to binaries it has
+ executed. To ensure the use of the newly compiled binaries as soon as they are
+ installed, the <parameter>+h</parameter> directive will be used for the duration
+ of this chapter.</para>
+
+ <para>The <command>login</command>, <command>agetty</command>, and
+ <command>init</command> programs (and others) use a number of log
+ files to record information such as who was logged into the system and
+ when. However, these programs will not write to the log files if they
+ do not already exist. Initialize the log files and give them
+ proper permissions:</para>
+
+<screen><userinput>touch /var/log/{btmp,lastlog,faillog,wtmp}
+chgrp -v utmp /var/log/lastlog
+chmod -v 664 /var/log/lastlog
+chmod -v 600 /var/log/btmp</userinput></screen>
+
+ <para>The <filename>/var/log/wtmp</filename> file records all logins and
+ logouts. The <filename>/var/log/lastlog</filename> file records when each
+ user last logged in. The <filename>/var/log/faillog</filename> file records
+ failed login attempts. The <filename>/var/log/btmp</filename> file records
+ the bad login attempts.</para>
+
+ <note><para>The <filename>/run/utmp</filename> file records the users that
+ are currently logged in. This file is created dynamically in the boot
+ scripts.</para></note>
+
+</sect1>
diff --git a/chapter07/creatingdirs.xml b/chapter07/creatingdirs.xml
new file mode 100644
index 000000000..359717ff7
--- /dev/null
+++ b/chapter07/creatingdirs.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-creatingdirs">
+ <?dbhtml filename="creatingdirs.html"?>
+
+ <title>Creating Directories</title>
+
+ <para>It is time to create the full structure in the LFS file system. Create
+ a standard directory tree by issuing the following commands:</para>
+
+<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
+mkdir -pv /{media/{floppy,cdrom},srv,var}
+install -dv -m 0750 /root
+install -dv -m 1777 /tmp /var/tmp
+mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
+mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
+mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
+mkdir -pv /usr/{,local/}share/man/man{1..8}
+
+mkdir -v /var/{log,mail,spool}
+ln -sv /run /var/run
+ln -sv /run/lock /var/lock
+mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
+
+ <para>Directories are, by default, created with permission mode 755, but
+ this is not desirable for all directories. In the commands above, two
+ changes are made&mdash;one to the home directory of user <systemitem
+ class="username">root</systemitem>, and another to the directories for
+ temporary files.</para>
+
+ <para>The first mode change ensures that not just anybody can enter
+ the <filename class="directory">/root</filename> directory&mdash;the
+ same as a normal user would do with his or her home directory. The
+ second mode change makes sure that any user can write to the
+ <filename class="directory">/tmp</filename> and <filename
+ class="directory">/var/tmp</filename> directories, but cannot remove
+ another user's files from them. The latter is prohibited by the so-called
+ <quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
+
+ <sect2>
+ <title>FHS Compliance Note</title>
+
+ <para>The directory tree is based on the Filesystem Hierarchy Standard
+ (FHS) (available at <ulink
+ url="https://refspecs.linuxfoundation.org/fhs.shtml"/>). The FHS also specifies
+ the optional existence of some directories such as <filename
+ class="directory">/usr/local/games</filename> and <filename
+ class="directory">/usr/share/games</filename>. We create only the
+ directories that are needed. However, feel free to create these
+ directories. </para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/dejagnu.xml b/chapter07/dejagnu.xml
new file mode 100644
index 000000000..8f1ab7648
--- /dev/null
+++ b/chapter07/dejagnu.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-dejagnu" role="wrap">
+ <?dbhtml filename="dejagnu.html"?>
+
+ <sect1info condition="script">
+ <productname>dejagnu</productname>
+ <productnumber>&dejagnu-version;</productnumber>
+ <address>&dejagnu-url;</address>
+ </sect1info>
+
+ <title>DejaGNU-&dejagnu-version;</title>
+
+ <indexterm zone="ch-tools-dejagnu">
+ <primary sortas="a-DejaGNU">DejaGNU</primary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>The <application>DejaGnu</application> package contains a framework for running test
+ suites on GNU tools. It is written in <command>expect</command>, which itself
+ uses <application>Tcl</application> (Tool Command Language).</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&dejagnu-ch5-sbu;</seg>
+ <seg>&dejagnu-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of DejaGNU</title>
+
+ <para>Prepare DejaGNU for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr
+makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi
+makeinfo --plaintext -o doc/dejagnu.txt doc/dejagnu.texi</userinput></screen>
+
+ <para>Build and install the package:</para>
+
+<screen><userinput remap="install">make install
+install -v -dm755 /usr/share/doc/dejagnu-&dejagnu-version;
+install -v -m644 doc/dejagnu.{html,txt} \
+ /usr/share/doc/dejagnu-&dejagnu-version;</userinput></screen>
+
+ <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+ </sect2>
+
+
+ <sect2 id="contents-dejagnu" role="content">
+ <title>Contents of DejaGNU</title>
+
+ <segmentedlist>
+ <segtitle>Installed program</segtitle>
+
+ <seglistitem>
+ <seg>runtest</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ <variablelist>
+ <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+ <?dbfo list-presentation="list"?>
+ <?dbhtml list-presentation="table"?>
+
+ <varlistentry id="runtest">
+ <term><command>runtest</command></term>
+ <listitem>
+ <para>A wrapper script that locates the proper
+ <command>expect</command> shell and then runs DejaGNU</para>
+ <indexterm zone="ch-tools-dejagnu runtest">
+ <primary sortas="b-runtest">runtest</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/diffutils.xml b/chapter07/diffutils.xml
new file mode 100644
index 000000000..194fe4607
--- /dev/null
+++ b/chapter07/diffutils.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-diffutils" role="wrap">
+ <?dbhtml filename="diffutils.html"?>
+
+ <sect1info condition="script">
+ <productname>diffutils</productname>
+ <productnumber>&diffutils-version;</productnumber>
+ <address>&diffutils-url;</address>
+ </sect1info>
+
+ <title>Diffutils-&diffutils-version;</title>
+
+ <indexterm zone="ch-tools-diffutils">
+ <primary sortas="a-Diffutils">Diffutils</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/diffutils.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&diffutils-ch5-sbu;</seg>
+ <seg>&diffutils-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Diffutils</title>
+
+ <para>Prepare Diffutils for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-diffutils" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/etcshells.xml b/chapter07/etcshells.xml
deleted file mode 100644
index 30961c80c..000000000
--- a/chapter07/etcshells.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-shells" xreflabel="Creating the /etc/shells File">
- <?dbhtml filename="etcshells.html"?>
-
-<!--
- <sect1info>
- <othername>$LastChangedBy$</othername>
- <date>$Date$</date>
- </sect1info>
--->
- <title>Creating the /etc/shells File</title>
-
- <indexterm zone="ch-config-shells">
- <primary sortas="e-etc-shells">/etc/shells</primary>
- </indexterm>
-
- <para>The <filename>shells</filename> file contains a list of
- login shells on the system. Applications use this file to determine
- whether a shell is valid. For each shell a single line should be
- present, consisting of the shell's path, relative to the root of the
- directory structure (/).</para>
-
- <para>For example, this file is consulted by <command>chsh</command>
- to determine whether an unprivileged user may change the login shell for her
- own account. If the command name is not listed, the user will be denied of
- change.</para>
-
- <para>It is a requirement for applications such as
- <application>GDM</application> which does not populate the
- face browser if it can't find <filename>/etc/shells</filename>, or
- FTP daemons which traditionally disallow access to users
- with shells not included in this file.</para>
-
-<screen role="root"><userinput>cat &gt; /etc/shells &lt;&lt; "EOF"
-<literal># Begin /etc/shells
-
-/bin/sh
-/bin/bash
-
-# End /etc/shells</literal>
-EOF</userinput></screen>
-
-</sect1>
diff --git a/chapter07/expect.xml b/chapter07/expect.xml
new file mode 100644
index 000000000..20b227ea5
--- /dev/null
+++ b/chapter07/expect.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-expect" role="wrap">
+ <?dbhtml filename="expect.html"?>
+
+ <sect1info condition="script">
+ <productname>expect</productname>
+ <productnumber>&expect-version;</productnumber>
+ <address>&expect-url;</address>
+ </sect1info>
+
+ <title>Expect-&expect-version;</title>
+
+ <indexterm zone="ch-tools-expect">
+ <primary sortas="a-Expect">Expect</primary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>The <application>Expect</application> package contains tools for
+ automating, via scripted dialogues, interactive applications such as
+ <command>telnet</command>, <command>ftp</command>,
+ <command>passwd</command>, <command>fsck</command>,
+ <command>rlogin</command>, and <command>tip</command>.
+ <application>Expect</application> is also useful for testing these same
+ applications as well as easing all sorts of tasks that are prohibitively
+ difficult with anything else. The <application>DejaGnu</application>
+ framework is written in <application>Expect</application>.</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&expect-ch5-sbu;</seg>
+ <seg>&expect-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Expect</title>
+
+ <para>Prepare Expect for compilation:</para>
+
+<screen><userinput remap="configure">
+./configure --prefix=/usr \
+ --with-tcl=/usr/lib \
+ --enable-shared \
+ --mandir=/usr/share/man \
+ --with-tclinclude=/usr/include</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--with-tcl=/usr/lib</parameter></term>
+ <listitem>
+ <para>This parameter is needed to tell the
+ <command>configure</command> where the
+ <command>tclConfig.sh</command> is located.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--with-tclinclude=/usr/include</parameter></term>
+ <listitem>
+ <para>This explicitly tells Expect where to find Tcl's internal
+ headers. Using this option avoids conditions where
+ <command>configure</command> fails because it cannot automatically
+ discover the location of Tcl's headers.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Build the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install
+ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>
+
+ </sect2>
+
+ <sect2 id="contents-expect" role="content">
+ <title>Contents of Expect</title>
+
+ <segmentedlist>
+ <segtitle>Installed program</segtitle>
+ <segtitle>Installed library</segtitle>
+
+ <seglistitem>
+ <seg>expect</seg>
+ <seg>libexpect-&expect-lib-version;.so</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ <variablelist>
+ <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+ <?dbfo list-presentation="list"?>
+ <?dbhtml list-presentation="table"?>
+
+ <varlistentry id="expect">
+ <term><command>expect</command></term>
+ <listitem>
+ <para>Communicates with other interactive programs according
+ to a script</para>
+ <indexterm zone="ch-tools-expect expect">
+ <primary sortas="b-expect">expect</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="libexpect">
+ <term><filename class="libraryfile">libexpect-&expect-lib-version;.so</filename></term>
+ <listitem>
+ <para>Contains functions that allow Expect to be used as a Tcl
+ extension or to be used directly from C or C++ (without Tcl)</para>
+ <indexterm zone="ch-tools-expect libexpect">
+ <primary sortas="c-libexpect-&expect-lib-version;">libexpect-&expect-lib-version;</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/file.xml b/chapter07/file.xml
new file mode 100644
index 000000000..5a821d180
--- /dev/null
+++ b/chapter07/file.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-file" role="wrap">
+ <?dbhtml filename="file.html"?>
+
+ <sect1info condition="script">
+ <productname>file</productname>
+ <productnumber>&file-version;</productnumber>
+ <address>&file-url;</address>
+ </sect1info>
+
+ <title>File-&file-version;</title>
+
+ <indexterm zone="ch-tools-file">
+ <primary sortas="a-File">File</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/file.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&file-ch5-sbu;</seg>
+ <seg>&file-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of File</title>
+
+ <para>Prepare File for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT</userinput></screen>
+
+<!-- devs: if using - -build here, the build system wants to compile
+ the signature file with "file" on the build system, but stops if it is not
+ the same version. One possibility would be to build "file" on the build
+ system first, but it is simpler to have the system think it is not
+ cross-compiling, and use the just built "file". -->
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+ <para>Details on this package are located in<!-- TODO
+ <xref linkend="contents-file" role="."/> --></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/findutils.xml b/chapter07/findutils.xml
new file mode 100644
index 000000000..073c1640c
--- /dev/null
+++ b/chapter07/findutils.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-findutils" role="wrap">
+ <?dbhtml filename="findutils.html"?>
+
+ <sect1info condition="script">
+ <productname>findutils</productname>
+ <productnumber>&findutils-version;</productnumber>
+ <address>&findutils-url;</address>
+ </sect1info>
+
+ <title>Findutils-&findutils-version;</title>
+
+ <indexterm zone="ch-tools-findutils">
+ <primary sortas="a-Findutils">Findutils</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/findutils.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&findutils-ch5-sbu;</seg>
+ <seg>&findutils-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Findutils</title>
+
+ <para>Prepare Findutils for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ <para>Move the excutable to its final expected location:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/find $LFS/bin
+sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-findutils" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/flex.xml b/chapter07/flex.xml
new file mode 100644
index 000000000..88e263413
--- /dev/null
+++ b/chapter07/flex.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-flex" role="wrap">
+ <?dbhtml filename="flex.html"?>
+
+ <sect1info condition="script">
+ <productname>flex</productname>
+ <productnumber>&flex-version;</productnumber>
+ <address>&flex-url;</address>
+ </sect1info>
+
+ <title>Flex-&flex-version;</title>
+
+ <indexterm zone="ch-tools-flex">
+ <primary sortas="a-Flex">Flex</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/flex.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&flex-ch5-sbu;</seg>
+ <seg>&flex-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Flex</title>
+
+ <para>Prepare Flex for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
+
+ <!--
+ <variablelist>
+ <title>The meaning of the new configure option:</title>
+
+ <varlistentry>
+ <term><parameter>- -disable-bootstrap</parameter></term>
+ <listitem>
+ <para>Normally, building flex is done in two stages. A first
+ programs, which is used to generate the source of a second one,
+ which is then compiled. When using cross-compilation, the first
+ program is generated on the build system. However, due to a bug
+ in configure, the presence of some function is tested only on the
+ host system. If this function is not found on the build system, the
+ build fails. This can be prevented by disabling the two stage
+ build.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ -->
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-flex" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/gawk.xml b/chapter07/gawk.xml
new file mode 100644
index 000000000..d5b5d6d8d
--- /dev/null
+++ b/chapter07/gawk.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-gawk" role="wrap">
+ <?dbhtml filename="gawk.html"?>
+
+ <sect1info condition="script">
+ <productname>gawk</productname>
+ <productnumber>&gawk-version;</productnumber>
+ <address>&gawk-url;</address>
+ </sect1info>
+
+ <title>Gawk-&gawk-version;</title>
+
+ <indexterm zone="ch-tools-gawk">
+ <primary sortas="a-Gawk">Gawk</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/gawk.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&gawk-ch5-sbu;</seg>
+ <seg>&gawk-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Gawk</title>
+
+ <para>First, ensure some unneeded files are not installed:</para>
+
+<screen><userinput remap="pre">sed -i 's/extras//' Makefile.in</userinput></screen>
+
+ <para>Prepare Gawk for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess)</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gawk" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/gcc-pass1.xml b/chapter07/gcc-pass1.xml
new file mode 100644
index 000000000..1bd308f09
--- /dev/null
+++ b/chapter07/gcc-pass1.xml
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
+ <?dbhtml filename="gcc-pass1.html"?>
+
+ <sect1info condition="script">
+ <productname>gcc-pass1</productname>
+ <productnumber>&gcc-version;</productnumber>
+ <address>&gcc-url;</address>
+ </sect1info>
+
+ <title>GCC-&gcc-version; - Pass 1</title>
+
+ <indexterm zone="ch-tools-gcc-pass1">
+ <primary sortas="a-GCC">GCC</primary>
+ <secondary>tools, pass 1</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/gcc.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&gcc-ch5p1-sbu;</seg>
+ <seg>&gcc-ch5p1-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Cross GCC</title>
+
+ <para>GCC requires the GMP, MPFR and MPC packages. As these packages may
+ not be included in your host distribution, they will be built with
+ GCC. Unpack each package into the GCC source directory and rename the
+ resulting directories so the GCC build procedures will automatically
+ use them:</para>
+
+ <note><para>There are frequent misunderstandings about this chapter. The
+ procedures are the same as every other chapter as explained earlier (<xref
+ linkend='buildinstr'/>). First extract the gcc tarball from the sources
+ directory and then change to the directory created. Only then should you
+ proceed with the instructions below.</para></note>
+
+<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc</userinput></screen>
+
+ <para>On x86_64 hosts, set the default directory name for
+ 64-bit libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+ x86_64)
+ sed -e '/m64=/s/lib64/lib/' \
+ -i.orig gcc/config/i386/t-linux64
+ ;;
+esac</userinput></screen>
+
+ <para>The GCC documentation recommends building GCC
+ in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <para>Prepare GCC for compilation:</para>
+
+<screen><userinput remap="configure">../configure \
+ --target=$LFS_TGT \
+ --prefix=$LFS/tools \
+ --with-glibc-version=2.11 \
+ --with-sysroot=$LFS \
+ --with-newlib \
+ --without-headers \
+ --enable-initfini-array \
+ --disable-nls \
+ --disable-shared \
+ --disable-multilib \
+ --disable-decimal-float \
+ --disable-threads \
+ --disable-libatomic \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --disable-libssp \
+ --disable-libvtv \
+ --disable-libstdcxx \
+ --enable-languages=c,c++</userinput></screen>
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--with-glibc-version=2.11</parameter></term>
+ <listitem>
+ <para>This option ensures the package will be compatible with the host's
+ version of glibc. It is set to the minimum glibc requirement
+ specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--with-newlib</parameter></term>
+ <listitem>
+ <para>Since a working C library is not yet available, this ensures
+ that the inhibit_libc constant is defined when building libgcc. This prevents
+ the compiling of any code that requires libc support.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--without-headers</parameter></term>
+ <listitem>
+ <para>When creating a complete cross-compiler, GCC requires
+ standard headers compatible with the target system. For our
+ purposes these headers will not be needed. This switch prevents
+ GCC from looking for them.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-shared</parameter></term>
+ <listitem>
+ <para>This switch forces GCC to link its internal libraries
+ statically. We need this because the shared libraries require glibc,
+ which is not yet installed on the target system.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-decimal-float, --disable-threads,
+ --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
+ --disable-libquadmath, --disable-libssp, --disable-libvtv,
+ --disable-libstdcxx</parameter></term>
+ <listitem>
+ <para>These switches disable support for the decimal floating point
+ extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
+ libvtv, and the C++ standard library respectively. These features
+ will fail to compile when building a cross-compiler and are not
+ necessary for the task of cross-compiling the temporary libc.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-multilib</parameter></term>
+ <listitem>
+ <para>On x86_64, LFS does not yet support a multilib configuration.
+ This switch is harmless for x86.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--enable-languages=c,c++</parameter></term>
+ <listitem>
+ <para>This option ensures that only the C and C++ compilers are built.
+ These are the only languages needed now.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile GCC by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+ <screen><userinput remap="install">make install</userinput></screen>
+
+ <para>This build of GCC has installed a couple of internal system
+ headers. Normally one of them, <filename>limits.h</filename>, would in turn
+ include the corresponding system <filename>limits.h</filename> header, in
+ this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
+ time of this build of gcc <filename>$LFS/usr/include/limits.h</filename>
+ does not exist, so the internal header that has just been installed is a
+ partial, self-contained file and does not include the extended features of
+ the system header. This is adequate for building glibc, but the full
+ internal header will be needed later. Create a full version of the internal
+ header using a command that is identical to what the GCC build system does
+ in normal circumstances:</para>
+
+<screen><userinput remap="install">cd ..
+cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
+ `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gcc" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/gcc-pass2.xml b/chapter07/gcc-pass2.xml
new file mode 100644
index 000000000..5f6864d02
--- /dev/null
+++ b/chapter07/gcc-pass2.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-gcc-pass2" role="wrap">
+ <?dbhtml filename="gcc-pass2.html"?>
+
+ <sect1info condition="script">
+ <productname>gcc-pass2</productname>
+ <productnumber>&gcc-version;</productnumber>
+ <address>&gcc-url;</address>
+ </sect1info>
+
+ <title>GCC-&gcc-version; - Pass 2</title>
+
+ <indexterm zone="ch-tools-gcc-pass2">
+ <primary sortas="a-GCC">GCC</primary>
+ <secondary>tools, pass 2</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/gcc.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&gcc-ch5p2-sbu;</seg>
+ <seg>&gcc-ch5p2-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of GCC</title>
+
+ <para>As in the first build of GCC, the GMP, MPFR, and MPC packages are
+ required. Unpack the tarballs and move them into the required directory
+ names:</para>
+
+<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc</userinput></screen>
+
+ <para>If building on x86_64, change the default directory name for 64-bit
+ libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+ x86_64)
+ sed -e '/m64=/s/lib64/lib/' \
+ -i.orig gcc/config/i386/t-linux64
+ ;;
+esac</userinput></screen>
+
+ <para>Fix an issue with GCC-10.1 when building with a cross
+ compiler:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
+
+ <para>Create a separate build directory again:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <para>Create a symlink that allos libgcc to be built with posix threads
+ support:</para>
+
+<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
+ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
+
+ <para>Before starting to build GCC, remember to unset any environment
+ variables that override the default optimization flags.</para>
+
+ <para>Now prepare GCC for compilation:</para>
+
+<screen><userinput remap="configure">../configure \
+ --build=$(../config.guess) \
+ --host=$LFS_TGT \
+ --prefix=/usr \
+ CC_FOR_TARGET=$LFS_TGT-gcc \
+ --with-build-sysroot=$LFS \
+ --enable-initfini-array \
+ --disable-nls \
+ --disable-multilib \
+ --disable-decimal-float \
+ --disable-libatomic \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --disable-libssp \
+ --disable-libvtv \
+ --disable-libstdcxx \
+ --enable-languages=c,c++</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the new configure options:</title><!-- WIP -->
+
+ <varlistentry>
+ <term><parameter>-with-build-sysroot=$LFS</parameter></term>
+ <listitem>
+ <para>Normally, using <parameter>--host=</parameter> ensures that
+ a cross-compiler is used for building gcc, and that compiler knows
+ that it has to look for headers and libraries in <filename
+ class="directory">$LFS</filename>. But the build system of GCC uses
+ other tools, which are not aware of this location. This switch is
+ needed to have them find the needed files in <filename
+ class="directory">$LFS</filename>, and not on the host.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--enable-initfini-array</parameter></term>
+ <listitem>
+ <para>This option is automatically enabled when building a native
+ compiler with a native compiler on x86. But here, we build with
+ a cross compiler, so we need to explicitely set this option.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ <para>As a finishing touch, create a symlink. Many programs and scripts
+ run <command>cc</command> instead of <command>gcc</command>, which is
+ used to keep programs generic and therefore usable on all kinds of UNIX
+ systems where the GNU C compiler is not always installed. Running
+ <command>cc</command> leaves the system administrator free to decide
+ which C compiler to install:</para>
+
+<screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gcc" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/generalinstructions.xml b/chapter07/generalinstructions.xml
new file mode 100644
index 000000000..05b88b98c
--- /dev/null
+++ b/chapter07/generalinstructions.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-generalinstructions">
+ <?dbhtml filename="generalinstructions.html"?>
+
+ <title>General Compilation Instructions</title>
+
+ <para>When building packages there are several assumptions made within
+ the instructions:</para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>Several of the packages are patched before compilation, but only when
+ the patch is needed to circumvent a problem. A patch is often needed in
+ both this and the next chapter, but sometimes in only one or the other.
+ Therefore, do not be concerned if instructions for a downloaded patch seem
+ to be missing. Warning messages about <emphasis>offset</emphasis> or
+ <emphasis>fuzz</emphasis> may also be encountered when applying a patch. Do
+ not worry about these warnings, as the patch was still successfully
+ applied.</para>
+ </listitem>
+
+ <listitem>
+ <para>During the compilation of most packages, there will be several
+ warnings that scroll by on the screen. These are normal and can safely be
+ ignored. These warnings are as they appear&mdash;warnings about
+ deprecated, but not invalid, use of the C or C++ syntax. C standards change
+ fairly often, and some packages still use the older standard. This is not a
+ problem, but does prompt the warning.</para>
+ </listitem>
+
+ <listitem>
+ <para>Check one last time that the <envar>LFS</envar> environment variable
+ is set up properly:</para>
+
+<screen role="nodump"><userinput>echo $LFS</userinput></screen>
+
+ <para>Make sure the output shows the path to the LFS partition's mount
+ point, which is <filename class="directory">/mnt/lfs</filename>, using our
+ example.</para>
+ </listitem>
+
+ <listitem>
+
+ <para>Finally, two important items must be emphasized:</para>
+
+ <important>
+
+ <para>The build instructions assume that the <xref
+ linkend='ch-partitioning-hostreqs'/>, including symbolic links, have
+ been set properly:</para>
+
+ <itemizedlist role='important'>
+
+ <listitem override='bullet'><para><command>bash</command> is the shell
+ in use.</para></listitem>
+
+ <listitem override='bullet'><para><command>sh</command> is a symbolic
+ link to <command>bash</command>.</para></listitem>
+
+ <listitem override='bullet'><para><command>/usr/bin/awk</command> is a
+ symbolic link to <command>gawk</command>.</para></listitem>
+
+ <listitem override='bullet'><para><command>/usr/bin/yacc</command> is a
+ symbolic link to <command>bison</command> or a small script that
+ executes bison.</para></listitem>
+
+ </itemizedlist>
+ </important>
+
+ <important>
+ <para>To re-emphasize the build process:</para>
+
+ <orderedlist numeration="arabic" spacing="compact">
+ <listitem>
+ <para>Place all the sources and patches in a directory that will be
+ accessible from the chroot environment such as
+ <filename class="directory">/mnt/lfs/sources/</filename>.<!-- Do
+ <emphasis>not</emphasis> put sources in
+ <filename class="directory">/mnt/lfs/tools/</filename>. --></para>
+ </listitem>
+ <listitem>
+ <para>Change to the sources directory.</para>
+ </listitem>
+ <listitem id='buildinstr' xreflabel='Package build instructions'>
+ <para>For each package:</para>
+ <orderedlist numeration="loweralpha" spacing="compact">
+ <listitem>
+ <para>Using the <command>tar</command> program, extract the package
+ to be built. In Chapter&nbsp;5, ensure you are the <emphasis>lfs</emphasis>
+ user when extracting the package.</para>
+ </listitem>
+ <listitem>
+ <para>Change to the directory created when the package was
+ extracted.</para>
+ </listitem>
+ <listitem>
+ <para>Follow the book's instructions for building the package.</para>
+ </listitem>
+ <listitem>
+ <para>Change back to the sources directory.</para>
+ </listitem>
+ <listitem>
+ <para>Delete the extracted source directory unless instructed otherwise.</para>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ </orderedlist>
+ </important>
+ </listitem>
+
+ </itemizedlist>
+
+</sect1>
diff --git a/chapter07/gettext.xml b/chapter07/gettext.xml
new file mode 100644
index 000000000..a3baed723
--- /dev/null
+++ b/chapter07/gettext.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-gettext" role="wrap">
+ <?dbhtml filename="gettext.html"?>
+
+ <sect1info condition="script">
+ <productname>gettext</productname>
+ <productnumber>&gettext-version;</productnumber>
+ <address>&gettext-url;</address>
+ </sect1info>
+
+ <title>Gettext-&gettext-version;</title>
+
+ <indexterm zone="ch-tools-gettext">
+ <primary sortas="a-Gettext">Gettext</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/gettext.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&gettext-ch5-sbu;</seg>
+ <seg>&gettext-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Gettext</title>
+
+ <para>For our temporary set of tools, we only need to install
+ three programs from Gettext.</para>
+
+ <para>Prepare Gettext for compilation:</para>
+
+<screen><userinput remap="configure">./configure --disable-shared</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure option:</title>
+
+ <varlistentry>
+ <term><parameter>--disable-shared</parameter></term>
+ <listitem>
+ <para>We do not need to install any of the shared Gettext libraries at
+ this time, therefore there is no need to build them.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
+ <command>xgettext</command> programs:</para>
+
+<screen><userinput remap="install">cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gettext" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/glibc.xml b/chapter07/glibc.xml
new file mode 100644
index 000000000..5213c23e5
--- /dev/null
+++ b/chapter07/glibc.xml
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-glibc" role="wrap">
+ <?dbhtml filename="glibc.html"?>
+
+ <sect1info condition="script">
+ <productname>glibc</productname>
+ <productnumber>&glibc-version;</productnumber>
+ <address>&glibc-url;</address>
+ </sect1info>
+
+ <title>Glibc-&glibc-version;</title>
+
+ <indexterm zone="ch-tools-glibc">
+ <primary sortas="a-Glibc">Glibc</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/glibc.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&glibc-ch5-sbu;</seg>
+ <seg>&glibc-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Glibc</title>
+
+ <para>First, create two symbolic links, which are needed for proper
+ operation of the dynamic library loader:</para>
+
+<screen><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
+ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
+
+ <para>Some of the Glibc programs use the non-FHS compliant
+ <filename class="directory">/var/db</filename> directory to store their
+ runtime data. Apply the following patch to make such programs store their
+ runtime data in the FHS-compliant locations:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen>
+
+ <para>The Glibc documentation recommends building Glibc
+ in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <para>Next, prepare Glibc for compilation:</para>
+
+<screen><userinput remap="configure">../configure \
+ --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(../scripts/config.guess) \
+ --enable-kernel=&min-kernel; \
+ --with-headers=$LFS/usr/include \
+ libc_cv_slibdir=/lib</userinput></screen>
+<!--
+ libc_cv_forced_unwind=yes \
+ libc_cv_c_cleanup=yes</userinput></screen> -->
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
+ <listitem>
+ <para>The combined effect of these switches is that Glibc's build system
+ configures itself to be cross-compiled, using the cross-linker and
+ cross-compiler in <filename class="directory">/tools</filename>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
+ <listitem>
+ <para>This tells Glibc to compile the library with support
+ for &min-kernel; and later Linux kernels. Workarounds for older
+ kernels are not enabled.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--with-headers=$LFS/usr/include</parameter></term>
+ <listitem>
+ <para>This tells Glibc to compile itself against the headers recently
+ installed to the usr/include directory, so that it knows exactly what
+ features the kernel has and can optimize itself accordingly.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>libc_cv_slibdir=/lib</parameter></term>
+ <listitem>
+ <para>This ensures that the library is installed in /lib instead
+ of the default /lib64 on 64 bit machines.</para>
+ </listitem>
+ </varlistentry>
+<!--
+ <varlistentry>
+ <term><parameter>libc_cv_c_cleanup=yes</parameter></term>
+ <listitem>
+ <para>Similarly, we pass libc_cv_c_cleanup=yes through to the
+ <command>configure</command> script so that the test is skipped and C
+ cleanup handling support is configured.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>libc_cv_ctors_header=yes</parameter></term>
+ <listitem>
+ <para>Similarly, we pass libc_cv_ctors_header=yes through to the
+ <command>configure</command> script so that the test is skipped and
+ gcc constructor support is configured.</para>
+ </listitem>
+ </varlistentry>-->
+
+ </variablelist>
+
+ <para>During this stage the following warning might appear:</para>
+
+ <blockquote>
+<screen><computeroutput>configure: WARNING:
+*** These auxiliary programs are missing or
+*** incompatible versions: msgfmt
+*** some features will be disabled.
+*** Check the INSTALL file for required versions.</computeroutput></screen>
+ </blockquote>
+
+ <para>The missing or incompatible <command>msgfmt</command> program is
+ generally harmless. This <command>msgfmt</command> program is part of the
+ Gettext package which the host distribution should provide.</para>
+
+ <note><para>There have been reports that this package may fail when
+ building as a "parallel make". If this occurs, rerun the make command
+ with a "-j1" option.</para></note>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the <command>make install</command> option:</title>
+
+ <varlistentry>
+ <term><parameter>DESTDIR=$LFS</parameter></term>
+ <listitem>
+ <para>The <envar>DESTDIR</envar> make variable is used by almost all
+ packages to define the location where the package should be
+ installed. If it is not set, it defaults to the root (<filename
+ class="directory">/</filename>) directory. Here we specify that
+ the package be installed in <filename class="directory">$LFS
+ </filename>, which will become the root after <xref linkend=
+ "ch-tools-chroot"/>.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <caution>
+ <para>At this point, it is imperative to stop and ensure that the basic
+ functions (compiling and linking) of the new toolchain are working as
+ expected. To perform a sanity check, run the following commands:</para>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc dummy.c
+readelf -l a.out | grep '/ld-linux'</userinput></screen>
+
+ <para>If everything is working correctly, there should be no errors,
+ and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
+
+ <para>Note that for 32-bit machines, the interpreter name will be
+ <filename>/lib/ld-linux.so.2</filename>.</para>
+
+ <para>If the output is not shown as above or there was no output at all,
+ then something is wrong. Investigate and retrace the steps to find out
+ where the problem is and correct it. This issue must be resolved before
+ continuing on.</para>
+
+ <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+ </caution>
+
+ <note><para>Building packages in the next sections will serve as an
+ additional check that the toolchain has been built properly. If some
+ package, especially binutils-pass2 or gcc-pass2, fails to build, it is
+ an indication that something has gone wrong with the
+ previous Binutils, GCC, or Glibc installations.</para></note>
+
+ <para>Now that our cross-toolchain is complete, finalize the installation
+ of the limits.h header. For doing so, run an utility provided by the GCC
+ developers:</para>
+
+<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-glibc" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/grep.xml b/chapter07/grep.xml
new file mode 100644
index 000000000..bac311f2f
--- /dev/null
+++ b/chapter07/grep.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-grep" role="wrap">
+ <?dbhtml filename="grep.html"?>
+
+ <sect1info condition="script">
+ <productname>grep</productname>
+ <productnumber>&grep-version;</productnumber>
+ <address>&grep-url;</address>
+ </sect1info>
+
+ <title>Grep-&grep-version;</title>
+
+ <indexterm zone="ch-tools-grep">
+ <primary sortas="a-Grep">Grep</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/grep.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&grep-ch5-sbu;</seg>
+ <seg>&grep-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Grep</title>
+
+ <para>Prepare Grep for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --bindir=/bin</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-grep" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/gzip.xml b/chapter07/gzip.xml
new file mode 100644
index 000000000..e9bdd3bd8
--- /dev/null
+++ b/chapter07/gzip.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-gzip" role="wrap">
+ <?dbhtml filename="gzip.html"?>
+
+ <sect1info condition="script">
+ <productname>gzip</productname>
+ <productnumber>&gzip-version;</productnumber>
+ <address>&gzip-url;</address>
+ </sect1info>
+
+ <title>Gzip-&gzip-version;</title>
+
+ <indexterm zone="ch-tools-gzip">
+ <primary sortas="a-Gzip">Gzip</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/gzip.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&gzip-ch5-sbu;</seg>
+ <seg>&gzip-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Gzip</title>
+
+ <para>Prepare Gzip for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ <para>Move the excutable to its final expected location:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gzip" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/inputrc.xml b/chapter07/inputrc.xml
deleted file mode 100644
index 00d36877f..000000000
--- a/chapter07/inputrc.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-inputrc">
- <?dbhtml filename="inputrc.html"?>
-
- <title>Creating the /etc/inputrc File</title>
-
- <indexterm zone="ch-config-inputrc">
- <primary sortas="e-/etc/inputrc">/etc/inputrc</primary>
- </indexterm>
-
- <para>The <filename>inputrc</filename> file is the configuration file for
- the Readline library, which provides editing capabilities while the user is
- entering a line from the terminal. It works by translating keyboard inputs
- into specific actions. Readline is used by Bash and most other shells as
- well as many other applications.</para>
-
- <para>Most people do not need user-specific functionality so the command
- below creates a global <filename>/etc/inputrc</filename> used by everyone who
- logs in. If you later decide you need to override the defaults on a per-user
- basis, you can create a <filename>.inputrc</filename> file in the user's home
- directory with the modified mappings.</para>
-
- <para>For more information on how to edit the <filename>inputrc</filename>
- file, see <command>info bash</command> under the <emphasis>Readline Init
- File</emphasis> section. <command>info readline</command> is also a good
- source of information.</para>
-
- <para>Below is a generic global <filename>inputrc</filename> along with comments
- to explain what the various options do. Note that comments cannot be on the same
- line as commands. Create the file using the following command:</para>
-
-<screen><userinput>cat &gt; /etc/inputrc &lt;&lt; "EOF"
-<literal># Begin /etc/inputrc
-# Modified by Chris Lynn &lt;roryo@roryo.dynup.net&gt;
-
-# Allow the command prompt to wrap to the next line
-set horizontal-scroll-mode Off
-
-# Enable 8bit input
-set meta-flag On
-set input-meta On
-
-# Turns off 8th bit stripping
-set convert-meta Off
-
-# Keep the 8th bit for display
-set output-meta On
-
-# none, visible or audible
-set bell-style none
-
-# All of the following map the escape sequence of the value
-# contained in the 1st argument to the readline specific functions
-"\eOd": backward-word
-"\eOc": forward-word
-
-# for linux console
-"\e[1~": beginning-of-line
-"\e[4~": end-of-line
-"\e[5~": beginning-of-history
-"\e[6~": end-of-history
-"\e[3~": delete-char
-"\e[2~": quoted-insert
-
-# for xterm
-"\eOH": beginning-of-line
-"\eOF": end-of-line
-
-# for Konsole
-"\e[H": beginning-of-line
-"\e[F": end-of-line
-
-# End /etc/inputrc</literal>
-EOF</userinput></screen>
-
-</sect1>
diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml
index cbc197a7b..5614270b2 100644
--- a/chapter07/introduction.xml
+++ b/chapter07/introduction.xml
@@ -5,221 +5,25 @@
%general-entities;
]>
-<sect1 id="ch-config-introduction" revision="sysv">
+<sect1 id="ch-tools-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
- <para>Booting a Linux system involves several tasks. The process must
- mount both virtual and real file systems, initialize devices, activate swap,
- check file systems for integrity, mount any swap partitions or files, set
- the system clock, bring up networking, start any daemons required by the
- system, and accomplish any other custom tasks needed by the user. This
- process must be organized to ensure the tasks are performed in the correct
- order but, at the same time, be executed as fast as possible.</para>
+ <para>This chapter shows how to build a minimal Linux system.
+ This system will contain just enough tools to start constructing the final
+ LFS system in <xref linkend="chapter-building-system"/> and allow a working
+ environment with more user convenience than a minimum environment would.</para>
-<!-- <para>In the packages that were installed in Chapter&nbsp;6, there were two
- different boot systems installed. LFS provides the ability to easily
- select which system the user wants to use and to compare and contrast the
- two systems by actually running each system on the local computer. The
- advantages and disadvantages of these systems is presented below.</para>-->
-
- <sect2 id='sysv-desc'>
- <title>System V</title>
-
- <para>System V is the classic boot process that has been used in Unix and
- Unix-like systems such as Linux since about 1983. It consists of a small
- program, <command>init</command>, that sets up basic programs such as
- <command>login</command> (via getty) and runs a script. This script,
- usually named <command>rc</command>, controls the execution of a set of
- additional scripts that perform the tasks required to initialize the
- system.</para>
-
- <para>The <command>init</command> program is controlled by the
- <filename>/etc/inittab</filename> file and is organized into run levels that
- can be run by the user:</para>
-
-<literallayout>
-0 &mdash; halt
-1 &mdash; Single user mode
-2 &mdash; Multiuser, without networking
-3 &mdash; Full multiuser mode
-4 &mdash; User definable
-5 &mdash; Full multiuser mode with display manager
-6 &mdash; reboot
-</literallayout>
-
- <para>The usual default run level is 3 or 5.</para>
-
- <bridgehead renderas="sect3">Advantages</bridgehead>
-
- <itemizedlist>
- <listitem>
- <para>Established, well understood system.</para>
- </listitem>
-
- <listitem>
- <para>Easy to customize.</para>
- </listitem>
-
- </itemizedlist>
-
-
- <bridgehead renderas="sect3">Disadvantages</bridgehead>
-
- <itemizedlist>
- <listitem>
- <para>Slower to boot. A medium speed base LFS system
- takes 8-12 seconds where the boot time is measured from the
- first kernel message to the login prompt. Network
- connectivity is typically established about 2 seconds
- after the login prompt.</para>
- </listitem>
-
- <listitem>
- <para>Serial processing of boot tasks. This is related to the previous
- point. A delay in any process such as a file system check, will
- delay the entire boot process.</para>
- </listitem>
-
- <listitem>
- <para>Does not directly support advanced features like
- control groups (cgroups), and per-user fair share scheduling.</para>
- </listitem>
-
- <listitem>
- <para>Adding scripts requires manual, static sequencing decisions.</para>
- </listitem>
-
- </itemizedlist>
-
- </sect2>
-<!--
- <sect2 id='sysd-desc'>
- <title>Systemd</title>
-
- <para>Systemd is a group of interconnected programs that handles system and
- individual process requests. It provides a dependency system between
- various entities called "units". It automatically addresses dependencies
- between units and can execute several startup tasks in parallel. It
- provides login, inetd, logging, time, and networking services. </para>
-
- <bridgehead renderas="sect3">Advantages</bridgehead>
-
- <itemizedlist>
- <listitem>
- <para>Used on many established distributions by default.</para>
- </listitem>
-
- <listitem>
- <para>There is extensive documentation.
- See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>
- </listitem>
-
- <listitem>
- <para>Parallel execution of boot processes. A medium speed
- base LFS system takes 6-10 seconds from kernel start to a
- login prompt. Network connectivity is typically established
- about 2 seconds after the login prompt. More complex startup
- procedures may show a greater speedup when compared to System V.</para>
- </listitem>
-
- <listitem>
- <para>Implements advanced features such as control groups to
- manage related processes.</para>
- </listitem>
-
- <listitem>
- <para>Maintains backward compatibility with System V programs
- and scripts.</para>
- </listitem>
- </itemizedlist>
-
- <bridgehead renderas="sect3">Disadvantages</bridgehead>
-
- <itemizedlist>
- <listitem>
- <para>There is a substantial learning curve.</para>
- </listitem>
-
- <listitem>
- <para>Some advanced features such as dbus or cgroups cannot be
- disabled if they are not otherwise needed.</para>
- </listitem>
-
- <listitem>
- <para>Although implemented as several executable programs
- the user cannot choose to implement only the portions desired.</para>
- </listitem>
-
- <listitem>
- <para>Due to the nature of using compiled programs, systemd is
- more difficult to debug.</para>
- </listitem>
-
- <listitem>
- <para>Logging is done in a binary format. Extra tools must
- be used to process logs or additional processes must be implemented
- to duplicate traditional logging programs.</para>
- </listitem>
-
- </itemizedlist>
-
- </sect2>
--->
+ <para>There are two steps in building this minimal system. The first step
+ is to build a new and host-independent toolchain (compiler, assembler,
+ linker, libraries, and a few useful utilities). The second step uses this
+ toolchain to build the other essential tools.</para>
<!--
- <sect2 id='sysv'>
- <title>Selecting a Boot Method</title>
-
- <para>Selecting a boot method in LFS is relatively easy.
- Both systems are installed side-by-side. The only task needed is to
- ensure the files that are needed by the system have the correct names.
- The following scripts do that.</para>
-
-<screen><userinput remap="install">cat &gt; /usr/sbin/set-systemd &lt;&lt; "EOF"
-#! /bin/bash
-
-ln -svfn init-systemd /sbin/init
-ln -svfn init.d-systemd /etc/init.d
-
-for tool in halt poweroff reboot runlevel shutdown telinit; do
- ln -sfvn ${tool}-systemd /sbin/${tool}
- ln -svfn ${tool}-systemd.8 /usr/share/man/man8/${tool}.8
-done
-
-echo "Now reboot with /sbin/reboot-sysv"
-EOF
-
-chmod 0744 /usr/sbin/set-systemd
-
-cat &gt; /usr/sbin/set-sysv &lt;&lt; "EOF"
-#! /bin/bash
-
-ln -sfvn init-sysv /sbin/init
-ln -svfn init.d-sysv /etc/init.d
-
-for tool in halt poweroff reboot runlevel shutdown telinit; do
- ln -sfvn ${tool}-sysv /sbin/${tool}
- ln -svfn ${tool}-sysv.8 /usr/share/man/man8/${tool}.8
-done
-
-echo "Now reboot with /sbin/reboot-systemd"
-EOF
-
-chmod 0744 /usr/sbin/set-sysv</userinput></screen>
-
- <note><para>The comment about the correct command to reboot in the
- above scripts is correct. The reboot command for the current boot
- system must be used after the script changes the default reboot command.
- </para></note>
-
- <para>Now set the desired boot system. The default is System V:</para>
-
-<screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>
-
- <para>Changing the boot system can be done at any time by running the
- appropriate script above and rebooting.</para>
-
- </sect2>
+ <para>The files compiled in this chapter will be installed under the
+ <filename class="directory">$LFS</filename> directory to keep them
+ separate from the files installed in the next chapter and the host
+ production directories. Since the packages compiled here are temporary,
+ we do not want them to pollute the soon-to-be LFS system.</para>
-->
</sect1>
diff --git a/chapter07/introductiond.xml b/chapter07/introductiond.xml
deleted file mode 100644
index fa2403edb..000000000
--- a/chapter07/introductiond.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-introduction" revision="systemd">
- <?dbhtml filename="introduction.html"?>
-
- <title>Introduction</title>
-
- <para>This chapter discusses configuration files and systemd services.
- First, the general configuration files needed to set up networking are
- presented.</para>
-
- <itemizedlist>
- <listitem>
- <para><xref linkend="ch-config-network" role="."/></para>
- </listitem>
- <listitem>
- <para><xref linkend="ch-config-hostname" role="."/></para>
- </listitem>
- <listitem>
- <para><xref linkend="ch-config-hosts" role="."/></para>
- </listitem>
- </itemizedlist>
-
- <para>Second, issues that affect the proper setup of devices are
- discussed.</para>
-
- <itemizedlist>
- <listitem>
- <para><xref linkend="ch-config-udev" role="."/></para>
- </listitem>
- <listitem>
- <para><xref linkend="ch-config-symlinks" role="."/></para>
- </listitem>
- </itemizedlist>
-
- <para>Third, configuring the system clock and keyboard layout.</para>
-
- <itemizedlist>
- <listitem>
- <para><xref linkend="ch-config-clock" role="."/></para>
- </listitem>
- <listitem>
- <para><xref linkend="ch-config-console" role="."/></para>
- </listitem>
- </itemizedlist>
-
-
- <para>Fourth, a brief introduction to the scripts and configuration
- files used when the user logs into the system.</para>
-
- <itemizedlist>
- <listitem>
- <para><xref linkend="ch-config-locale" role="."/></para>
- </listitem>
- <listitem>
- <para><xref linkend="ch-config-inputrc" role="."/></para>
- </listitem>
- </itemizedlist>
-
- <para>And finally, configuring the systemd behavior.</para>
-
- <itemizedlist>
- <listitem>
- <para><xref linkend="ch-config-systemd-custom" role="."/></para>
- </listitem>
- </itemizedlist>
-
-</sect1>
diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml
new file mode 100644
index 000000000..dd6b8991c
--- /dev/null
+++ b/chapter07/kernfs.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-kernfs">
+ <?dbhtml filename="kernfs.html"?>
+
+ <title>Preparing Virtual Kernel File Systems</title>
+
+ <indexterm zone="ch-tools-kernfs">
+ <primary sortas="e-/dev/">/dev/*</primary>
+ </indexterm>
+
+ <para>Various file systems exported by the kernel are used to communicate to
+ and from the kernel itself. These file systems are virtual in that no disk
+ space is used for them. The content of the file systems resides in
+ memory.</para>
+
+ <para>Begin by creating directories onto which the file systems will be
+ mounted:</para>
+
+<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
+
+ <sect2>
+ <title>Creating Initial Device Nodes</title>
+
+ <para>When the kernel boots the system, it requires the presence of a few
+ device nodes, in particular the <filename
+ class="devicefile">console</filename> and <filename
+ class="devicefile">null</filename> devices. The device nodes must be created
+ on the hard disk so that they are available before <command>udevd</command>
+ has been started, and additionally when Linux is started with
+ <parameter>init=/bin/bash</parameter>. Create the devices by running the
+ following commands:</para>
+
+<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
+mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
+
+ </sect2>
+
+ <sect2 id="ch-system-bindmount">
+ <title>Mounting and Populating /dev</title>
+
+ <para>The recommended method of populating the <filename
+ class="directory">/dev</filename> directory with devices is to mount a
+ virtual filesystem (such as <systemitem
+ class="filesystem">tmpfs</systemitem>) on the <filename
+ class="directory">/dev</filename> directory, and allow the devices to be
+ created dynamically on that virtual filesystem as they are detected or
+ accessed. Device creation is generally done during the boot process
+ by Udev. Since this new system does not yet have Udev and has not yet
+ been booted, it is necessary to mount and populate <filename
+ class="directory">/dev</filename> manually. This is accomplished by bind
+ mounting the host system's <filename class="directory">/dev</filename>
+ directory. A bind mount is a special type of mount that allows you to
+ create a mirror of a directory or mount point to some other location. Use
+ the following command to achieve this:</para>
+
+<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
+
+ </sect2>
+
+ <sect2 id="ch-system-kernfsmount">
+ <title>Mounting Virtual Kernel File Systems</title>
+
+ <para>Now mount the remaining virtual kernel filesystems:</para>
+
+<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
+mount -vt proc proc $LFS/proc
+mount -vt sysfs sysfs $LFS/sys
+mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the mount options for devpts:</title>
+
+ <varlistentry>
+ <term><parameter>gid=5</parameter></term>
+ <listitem>
+ <para>This ensures that all devpts-created device nodes are owned by
+ group ID 5. This is the ID we will use later on for the <systemitem
+ class="groupname">tty</systemitem> group. We use the group ID instead
+ of a name, since the host system might use a different ID for its
+ <systemitem class="groupname">tty</systemitem> group.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>mode=0620</parameter></term>
+ <listitem>
+ <para>This ensures that all devpts-created device nodes have mode 0620
+ (user readable and writable, group writable). Together with the
+ option above, this ensures that devpts will create device nodes that
+ meet the requirements of grantpt(), meaning the Glibc
+ <command>pt_chown</command> helper binary (which is not installed by
+ default) is not necessary.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>In some host systems, <filename>/dev/shm</filename> is a
+ symbolic link to <filename class="directory">/run/shm</filename>.
+ The /run tmpfs was mounted above so in this case only a
+ directory needs to be created.</para>
+
+<screen><userinput>if [ -h $LFS/dev/shm ]; then
+ mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+fi</userinput></screen>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/libstdc++-pass2.xml b/chapter07/libstdc++-pass2.xml
new file mode 100644
index 000000000..999a4fa4e
--- /dev/null
+++ b/chapter07/libstdc++-pass2.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-libstdcpp-pass2" role="wrap">
+ <?dbhtml filename="gcc-libstdc++-pass2.html"?>
+
+ <sect1info condition="script">
+ <productname>gcc-libstdc++</productname>
+ <productnumber>&gcc-version;</productnumber>
+ <address>&gcc-url;</address>
+ </sect1info>
+
+ <title>Libstdc++ from GCC-&gcc-version;, Pass 2</title>
+
+ <indexterm zone="ch-tools-libstdcpp-pass2">
+ <primary sortas="a-GCC">GCC</primary>
+ <secondary>tools, libstdc++ pass 2</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to
+ defer the installation of the C++ standard library, because no suitable
+ compiler was available to compile it: we could not use the compiler
+ installed, because this compiler is a native
+ compiler, and should not be used outside of chroot without being at
+ risk of polluting the build with some host components.</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <!-- TODO -->
+ <seglistitem>
+ <seg>&libstdcpp-ch5-sbu;</seg>
+ <seg>&libstdcpp-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Target Libstdc++</title>
+
+ <note>
+ <para><application>Libstdc++</application> is part of the GCC sources.
+ You should first unpack the GCC tarball and change to the
+ <filename>gcc-&gcc-version;</filename> directory.</para>
+ </note>
+
+ <para>Create a link which exists when building Libstdc++ in the gcc
+ tree:</para>
+
+<screen><userinput remap="pre">ln -s gthr-posix.h libgcc/gthr-default.h</userinput></screen>
+
+ <para>Create a separate build directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../libstdc++-v3/configure \
+ CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
+ --prefix=/usr \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libstdcxx-pch</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>CXXFLAGS="-g -O2 -D_GNU_SOURCE"</parameter></term>
+ <listitem>
+ <para>Those flags are passed by the top level Makefile when doing
+ a full build of GCC.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-libstdcxx-pch</parameter></term>
+ <listitem>
+ <para>This switch prevents the installation of precompiled
+ include files, which are not needed at this stage.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile libstdc++ by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the library:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gcc" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/libstdc++.xml b/chapter07/libstdc++.xml
new file mode 100644
index 000000000..3a1b0f2bf
--- /dev/null
+++ b/chapter07/libstdc++.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
+ <?dbhtml filename="gcc-libstdc++-pass1.html"?>
+
+ <sect1info condition="script">
+ <productname>gcc-libstdc++</productname>
+ <productnumber>&gcc-version;</productnumber>
+ <address>&gcc-url;</address>
+ </sect1info>
+
+ <title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
+
+ <indexterm zone="ch-tools-libstdcpp-pass1">
+ <primary sortas="a-GCC">GCC</primary>
+ <secondary>tools, libstdc++ pass 1</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>Libstdc++ is the standard C++ library. It is needed
+ to compile C++ code
+ (part of GCC is written in C++), but we had to defer its installation
+ when we built <xref linkend="ch-tools-gcc-pass1"/>
+ because it depends on glibc, which was not yet available in the target
+ directory.
+ </para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&libstdcpp-ch5-sbu;</seg>
+ <seg>&libstdcpp-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Target Libstdc++</title>
+
+ <note>
+ <para><application>Libstdc++</application> is part of the GCC sources.
+ You should first unpack the GCC tarball and change to the
+ <filename>gcc-&gcc-version;</filename> directory.</para>
+ </note>
+
+ <para>Create a separate build directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd build</userinput></screen>
+
+ <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../libstdc++-v3/configure \
+ --host=$LFS_TGT \
+ --build=$(../config.guess) \
+ --prefix=/usr \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libstdcxx-pch \
+ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--host=...</parameter></term>
+ <listitem>
+ <para>Indicates to use the cross compiler we have just built
+ instead of the one in <filename>/usr/bin</filename>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-libstdcxx-pch</parameter></term>
+ <listitem>
+ <para>This switch prevents the installation of precompiled
+ include files, which are not needed at this stage.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
+ <listitem>
+ <para>This is the location where the standard include files are
+ searched by the C++ compiler. In a normal build, this information
+ is automatically passed to the Libstdc++ <command>configure</command>
+ options from the top level directory. In our case, this information
+ must be explicitly given.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile libstdc++ by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the library:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-gcc" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/linux-headers.xml b/chapter07/linux-headers.xml
new file mode 100644
index 000000000..6c1af3173
--- /dev/null
+++ b/chapter07/linux-headers.xml
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-linux-headers" role="wrap">
+ <?dbhtml filename="linux-headers.html"?>
+
+ <sect1info condition="script">
+ <productname>linux-headers</productname>
+ <productnumber>&linux-version;</productnumber>
+ <address>&linux-url;</address>
+ </sect1info>
+
+ <title>Linux-&linux-version; API Headers</title>
+
+ <indexterm zone="ch-tools-linux-headers">
+ <primary sortas="a-Linux">Linux</primary>
+ <secondary>tools, API headers</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
+ kernel's API for use by Glibc.</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&linux-headers-ch5-sbu;</seg>
+ <seg>&linux-headers-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Linux API Headers</title>
+
+ <para>The Linux kernel needs to expose an Application Programming Interface
+ (API) for the system's C library (Glibc in LFS) to use. This is done
+ by way of sanitizing various C header files that are shipped in the Linux
+ kernel source tarball.</para>
+
+ <para>Make sure there are no stale files embedded in the package:</para>
+
+<screen><userinput remap="pre">make mrproper</userinput></screen>
+
+ <para>Now extract the user-visible kernel headers from the source.
+ The recommended make target <quote>headers_install</quote> cannot be
+ used, because it requires <application>rsync</application>, which may not
+ be available. The headers are first placed in
+ <filename class="directory">./usr</filename>, then copied to the needed
+ location.</para>
+
+<screen><userinput remap="make">make headers
+find usr/include -name '.*' -delete
+rm usr/include/Makefile
+</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
+
+ </sect2>
+
+ <sect2 id="contents-linux-headers" role="content">
+ <title>Contents of Linux API Headers</title>
+
+ <segmentedlist>
+ <segtitle>Installed headers</segtitle>
+ <segtitle>Installed directories</segtitle>
+
+ <seglistitem>
+ <seg>/usr/include/asm/*.h, /usr/include/asm-generic/*.h,
+ /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h,
+ /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h,
+ /usr/include/sound/*.h, /usr/include/video/*.h,
+ and /usr/include/xen/*.h</seg>
+ <seg>/usr/include/asm, /usr/include/asm-generic, /usr/include/drm,
+ /usr/include/linux, /usr/include/misc, /usr/include/mtd,
+ /usr/include/rdma, /usr/include/scsi, /usr/include/sound,
+ /usr/include/video, and /usr/include/xen</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ <variablelist>
+ <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+ <?dbfo list-presentation="list"?>
+ <?dbhtml list-presentation="table"?>
+
+ <varlistentry id="asm">
+ <term><filename class="headerfile">/usr/include/asm/*.h</filename></term>
+ <listitem>
+ <para>The Linux API ASM Headers</para>
+ <indexterm zone="ch-tools-linux-headers asm">
+ <primary sortas="e-/usr/include/asm/*.h">/usr/include/asm/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="asm-generic">
+ <term><filename class="headerfile">/usr/include/asm-generic/*.h</filename></term>
+ <listitem>
+ <para>The Linux API ASM Generic Headers</para>
+ <indexterm zone="ch-tools-linux-headers asm-generic">
+ <primary sortas="e-/usr/include/asm-generic/*.h">/usr/include/asm-generic/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="drm">
+ <term><filename class="headerfile">/usr/include/drm/*.h</filename></term>
+ <listitem>
+ <para>The Linux API DRM Headers</para>
+ <indexterm zone="ch-tools-linux-headers drm">
+ <primary sortas="e-/usr/include/drm/*.h">/usr/include/drm/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="linux">
+ <term><filename class="headerfile">/usr/include/linux/*.h</filename></term>
+ <listitem>
+ <para>The Linux API Linux Headers</para>
+ <indexterm zone="ch-tools-linux-headers linux">
+ <primary sortas="e-/usr/include/linux/*.h">/usr/include/linux/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="misc">
+ <term><filename class="headerfile">/usr/include/misc/*.h</filename></term>
+ <listitem>
+ <para>The Linux API Miscellaneous Headers</para>
+ <indexterm zone="ch-tools-linux-headers misc">
+ <primary sortas="e-/usr/include/misc/*.h">/usr/include/misc/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="mtd">
+ <term><filename class="headerfile">/usr/include/mtd/*.h</filename></term>
+ <listitem>
+ <para>The Linux API MTD Headers</para>
+ <indexterm zone="ch-tools-linux-headers mtd">
+ <primary sortas="e-/usr/include/mtd/*.h">/usr/include/mtd/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="rdma">
+ <term><filename class="headerfile">/usr/include/rdma/*.h</filename></term>
+ <listitem>
+ <para>The Linux API RDMA Headers</para>
+ <indexterm zone="ch-tools-linux-headers rdma">
+ <primary sortas="e-/usr/include/rdma/*.h">/usr/include/rdma/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="scsi">
+ <term><filename class="headerfile">/usr/include/scsi/*.h</filename></term>
+ <listitem>
+ <para>The Linux API SCSI Headers</para>
+ <indexterm zone="ch-tools-linux-headers scsi">
+ <primary sortas="e-/usr/include/scsi/*.h">/usr/include/scsi/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="sound">
+ <term><filename class="headerfile">/usr/include/sound/*.h</filename></term>
+ <listitem>
+ <para>The Linux API Sound Headers</para>
+ <indexterm zone="ch-tools-linux-headers sound">
+ <primary sortas="e-/usr/include/sound/*.h">/usr/include/sound/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="video">
+ <term><filename class="headerfile">/usr/include/video/*.h</filename></term>
+ <listitem>
+ <para>The Linux API Video Headers</para>
+ <indexterm zone="ch-tools-linux-headers video">
+ <primary sortas="e-/usr/include/video/*.h">/usr/include/video/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="xen">
+ <term><filename class="headerfile">/usr/include/xen/*.h</filename></term>
+ <listitem>
+ <para>The Linux API Xen Headers</para>
+ <indexterm zone="ch-tools-linux-headers xen">
+ <primary sortas="e-/usr/include/xen/*.h">/usr/include/xen/*.h</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/locale.xml b/chapter07/locale.xml
deleted file mode 100644
index 5f473ac72..000000000
--- a/chapter07/locale.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-locale" revision="systemd">
- <?dbhtml filename="locale.html"?>
-
- <title>Configuring the System Locale</title>
-
- <indexterm zone="ch-config-locale">
- <primary sortas="e-etc-locale-conf">/etc/locale.conf</primary>
- </indexterm>
-
- <para>The <filename>/etc/locale.conf</filename> below sets some
- environment variables necessary for native language support. Setting
- them properly results in:</para>
-
- <itemizedlist>
- <listitem>
- <para>The output of programs translated into the native language</para>
- </listitem>
- <listitem>
- <para>Correct classification of characters into letters, digits and other
- classes. This is necessary for <command>bash</command> to properly accept
- non-ASCII characters in command lines in non-English locales</para>
- </listitem>
- <listitem>
- <para>The correct alphabetical sorting order for the country</para>
- </listitem>
- <listitem>
- <para>Appropriate default paper size</para>
- </listitem>
- <listitem>
- <para>Correct formatting of monetary, time, and date values</para>
- </listitem>
- </itemizedlist>
-
- <para>Replace <replaceable>&lt;ll&gt;</replaceable> below with the two-letter code
- for the desired language (e.g., <quote>en</quote>) and
- <replaceable>&lt;CC&gt;</replaceable> with the two-letter code for the appropriate
- country (e.g., <quote>GB</quote>). <replaceable>&lt;charmap&gt;</replaceable> should
- be replaced with the canonical charmap for your chosen locale. Optional
- modifiers such as <quote>@euro</quote> may also be present.</para>
-
- <para>The list of all locales supported by Glibc can be obtained by running
- the following command:</para>
-
-<screen role="nodump"><userinput>locale -a</userinput></screen>
-
- <para>Charmaps can have a number of aliases, e.g., <quote>ISO-8859-1</quote>
- is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
- Some applications cannot handle the various synonyms correctly (e.g., require
- that <quote>UTF-8</quote> is written as <quote>UTF-8</quote>, not
- <quote>utf8</quote>), so it is safest in most
- cases to choose the canonical name for a particular locale. To determine
- the canonical name, run the following command, where <replaceable>&lt;locale
- name&gt;</replaceable> is the output given by <command>locale -a</command> for
- your preferred locale (<quote>en_GB.iso88591</quote> in our example).</para>
-
-<screen role="nodump"><userinput>LC_ALL=<replaceable>&lt;locale name&gt;</replaceable> locale charmap</userinput></screen>
-
- <para>For the <quote>en_GB.iso88591</quote> locale, the above command
- will print:</para>
-
-<screen><computeroutput>ISO-8859-1</computeroutput></screen>
-
- <para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>.
- It is important that the locale found using the heuristic above is tested prior
- to it being added to the Bash startup files:</para>
-
-<screen role="nodump"><userinput>LC_ALL=&lt;locale name&gt; locale language
-LC_ALL=&lt;locale name&gt; locale charmap
-LC_ALL=&lt;locale name&gt; locale int_curr_symbol
-LC_ALL=&lt;locale name&gt; locale int_prefix</userinput></screen>
-
- <para>The above commands should print the language name, the character
- encoding used by the locale, the local currency, and the prefix to dial
- before the telephone number in order to get into the country. If any of the
- commands above fail with a message similar to the one shown below, this means
- that your locale was either not installed in Chapter&nbsp;6 or is not supported by
- the default installation of Glibc.</para>
-
-<screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen>
-
- <para>If this happens, you should either install the desired locale using the
- <command>localedef</command> command, or consider choosing a different locale.
- Further instructions assume that there are no such error messages from
- Glibc.</para>
-
- <!-- FIXME: the xlib example will became obsolete real soon -->
- <para>Some packages beyond LFS may also lack support for your chosen locale. One
- example is the X library (part of the X Window System), which outputs the
- following error message if the locale does not exactly match one of the character
- map names in its internal files:</para>
-
-<screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen>
-
- <para>In several cases Xlib expects that the character map will be listed in
- uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather
- than "iso88591". It is also possible to find an appropriate specification by
- removing the charmap part of the locale specification. This can be checked
- by running the <command>locale charmap</command> command in both locales.
- For example, one would have to change "de_DE.ISO-8859-15@euro" to
- "de_DE@euro" in order to get this locale recognized by Xlib.</para>
-
- <para>Other packages can also function incorrectly (but may not necessarily
- display any error messages) if the locale name does not meet their expectations.
- In those cases, investigating how other Linux distributions support your locale
- might provide some useful information.</para>
-
- <para>Once the proper locale settings have been determined, create the
- <filename>/etc/locale.conf</filename> file:</para>
-
-<screen><userinput>cat &gt; /etc/locale.conf &lt;&lt; "EOF"
-<literal>LANG=<replaceable>&lt;ll&gt;_&lt;CC&gt;.&lt;charmap&gt;&lt;@modifiers&gt;</replaceable></literal>
-EOF</userinput></screen>
-
- <para>Note that you can modify <filename>/etc/locale.conf</filename> with the
- systemd <command>localectl</command> utility. To use
- <command>localectl</command> for the example above, run:</para>
-
-<screen role="nodump"><userinput>localectl set-locale LANG="<replaceable>&lt;ll&gt;_&lt;CC&gt;.&lt;charmap&gt;&lt;@modifiers&gt;</replaceable>"</userinput></screen>
-
- <para>You can also specify other language specific environment variables such
- as <envar>LANG</envar>, <envar>LC_CTYPE</envar>, <envar>LC_NUMERIC</envar> or
- any other environment variable from <command>locale</command> output. Just
- separate them with a space. An example where <envar>LANG</envar> is set as
- en_US.UTF-8 but <envar>LC_CTYPE</envar> is set as just en_US is:</para>
-
-<screen role="nodump"><userinput>localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US"</userinput></screen>
-
- <note><para>Please note that the <command>localectl</command> command can
- be used only on a system booted with systemd.</para></note>
-
- <para>The <quote>C</quote> (default) and <quote>en_US</quote> (the recommended
- one for United States English users) locales are different. <quote>C</quote>
- uses the US-ASCII 7-bit character set, and treats bytes with the high bit set
- as invalid characters. That's why, e.g., the <command>ls</command> command
- substitutes them with question marks in that locale. Also, an attempt to send
- mail with such characters from Mutt or Pine results in non-RFC-conforming
- messages being sent (the charset in the outgoing mail is indicated as <quote>unknown
- 8-bit</quote>). So you can use the <quote>C</quote> locale only if you are sure that
- you will never need 8-bit characters.</para>
-
- <para>UTF-8 based locales are not supported well by many programs.
- Work is in progress to document and, if possible, fix such problems, see
- <ulink url="&blfs-book;introduction/locale-issues.html"/>.</para>
-
-</sect1>
diff --git a/chapter07/m4.xml b/chapter07/m4.xml
new file mode 100644
index 000000000..3f51c11d1
--- /dev/null
+++ b/chapter07/m4.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-m4" role="wrap">
+ <?dbhtml filename="m4.html"?>
+
+ <sect1info condition="script">
+ <productname>m4</productname>
+ <productnumber>&m4-version;</productnumber>
+ <address>&m4-url;</address>
+ </sect1info>
+
+ <title>M4-&m4-version;</title>
+
+ <indexterm zone="ch-tools-m4">
+ <primary sortas="a-M4">M4</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/m4.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&m4-ch5-sbu;</seg>
+ <seg>&m4-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of M4</title>
+
+ <para>First, make some fixes introduced by glibc-2.28:</para>
+
+<screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
+echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h</userinput></screen>
+
+ <para>Prepare M4 for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+ <para>Details on this package are located in
+ <xref linkend="contents-m4" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/make.xml b/chapter07/make.xml
new file mode 100644
index 000000000..2d054dd9e
--- /dev/null
+++ b/chapter07/make.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+<sect1 id="ch-tools-make" role="wrap">
+ <?dbhtml filename="make.html"?>
+
+ <sect1info condition="script">
+ <productname>make</productname>
+ <productnumber>&make-version;</productnumber>
+ <address>&make-url;</address>
+ </sect1info>
+
+ <title>Make-&make-version;</title>
+
+ <indexterm zone="ch-tools-make">
+ <primary sortas="a-Make">Make</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/make.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&make-ch5-sbu;</seg>
+ <seg>&make-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Make</title>
+
+ <para>Prepare Make for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --without-guile \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the new configure option:</title>
+
+ <varlistentry>
+ <term><parameter>--without-guile</parameter></term>
+ <listitem>
+ <para>Although we are cross-compiling, configure tries to use
+ guile from the build host if it finds it. This makes compilation
+ fail, so this switch prevents using it.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-make" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/ncurses.xml b/chapter07/ncurses.xml
new file mode 100644
index 000000000..e2455eb7a
--- /dev/null
+++ b/chapter07/ncurses.xml
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-ncurses" role="wrap">
+ <?dbhtml filename="ncurses.html"?>
+
+ <sect1info condition="script">
+ <productname>ncurses</productname>
+ <productnumber>&ncurses-version;</productnumber>
+ <address>&ncurses-url;</address>
+ </sect1info>
+
+ <title>Ncurses-&ncurses-version;</title>
+
+ <indexterm zone="ch-tools-ncurses">
+ <primary sortas="a-Ncurses">Ncurses</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/ncurses.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&ncurses-ch5-sbu;</seg>
+ <seg>&ncurses-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Ncurses</title>
+
+ <para>First, ensure that <command>gawk</command> is found first during configuration:</para>
+
+<screen><userinput remap="pre">sed -i s/mawk// configure</userinput></screen>
+
+ <para>Then, run the following commands to build the <quote>tic</quote>
+ program on the build host:</para>
+
+<screen><userinput remap="pre">mkdir build
+cd build
+../configure
+make -C include
+make -C progs tic
+cd ..</userinput></screen>
+
+ <para>Prepare Ncurses for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess) \
+ --mandir=/usr/share/man \
+ --with-shared \
+ --without-debug \
+ --without-ada \
+ --without-normal \
+ --enable-widec \
+ --enable-pc-files</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the new configure options:</title>
+
+ <varlistentry>
+ <term><parameter>--without-ada</parameter></term>
+ <listitem>
+ <para>This ensures that Ncurses does not build support for the Ada
+ compiler which may be present on the host but will not be available
+ once we enter the <command>chroot</command> environment.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--enable-widec</parameter></term>
+ <listitem>
+ <para>This switch causes wide-character libraries (e.g., <filename
+ class="libraryfile">libncursesw.so.&ncurses-version;</filename>)
+ to be built instead of normal ones (e.g., <filename
+ class="libraryfile">libncurses.so.&ncurses-version;</filename>).
+ These wide-character libraries are usable in both multibyte and
+ traditional 8-bit locales, while normal libraries work properly
+ only in 8-bit locales. Wide-character and normal libraries are
+ source-compatible, but not binary-compatible.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--enable-pc-files</parameter></term>
+ <listitem>
+ <para>This switch generates and installs .pc files for pkg-config.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--without-normal</parameter></term>
+ <listitem>
+ <para>This switch disables building and installing most static libraries.
+ </para>
+ </listitem>
+ </varlistentry>
+ <!--
+ <varlistentry>
+ <term><parameter>- -disable-db-install</parameter></term>
+ <listitem>
+ <para>This switch disables building the terminfo database: it is not
+ needed at this stage, and if <command>tic</command> is too old,
+ it cannot compile recent databases.</para>
+ </listitem>
+ </varlistentry>
+ -->
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+<!-- TODO: check and document -->
+<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
+ln -s libncursesw.so $LFS/usr/lib/libncurses.so</userinput></screen>
+
+ <para>Move the shared libraries to the
+ <filename class="directory">/lib</filename> directory, where they are
+ expected to reside:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib</userinput></screen>
+
+ <para>Because the libraries have been moved, one symlink points to
+ a non-existent file. Recreate it:</para>
+
+<screen><userinput remap="install">ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so</userinput></screen>
+
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-ncurses" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/network.xml b/chapter07/network.xml
deleted file mode 100644
index b527258ee..000000000
--- a/chapter07/network.xml
+++ /dev/null
@@ -1,247 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-network" revision="sysv">
- <?dbhtml filename="network.html"?>
-
- <title>General Network Configuration</title>
-
- <indexterm zone="ch-config-network">
- <primary sortas="d-network">network</primary>
- <secondary>configuring</secondary></indexterm>
-<!--
- <para>This section only applies if a network card is to be
- configured.</para>
-
- <para>If a network card will not be used, there is likely no need to create
- any configuration files relating to network cards. If that is the case, you
- will need to remove the <filename class="symlink">network</filename> symlinks
- from all run-level directories (<filename
- class="directory">/etc/rc.d/rc*.d</filename>) after the bootscripts are
- installed in <xref linkend="ch-config-bootscripts"/>.</para>
--->
- <sect2>
- <title>Creating Network Interface Configuration Files</title>
-
- <para>Which interfaces are brought up and down by the network script
- usually depends on the files in <filename
- class="directory">/etc/sysconfig/</filename>. This directory should
- contain a file for each interface to be configured, such as
- <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> should describe
- the network card. The interface name (e.g. eth0) is usually appropriate.
- Inside this file are attributes to this interface, such as its IP
- address(es), subnet masks, and so forth. It is necessary that the stem of
- the filename be <emphasis>ifconfig</emphasis>.</para>
-
- <note><para>If the procedure in the previous section was not used, Udev
- will assign network card interface names based on system physical
- characteristics such as enp2s1. If you are not sure what your interface
- name is, you can always run <command>ip link</command> or <command>ls
- /sys/class/net</command> after you have booted your system.
- </para></note>
-
- <para>The following command creates a sample file for the
- <emphasis>eth0</emphasis> device with a static IP address:</para>
-<!-- jhalfs relies on the values for IFACE, IP, etc. If you want to change
- them, please inform the jhalfs maintainer(s). -->
-<screen><userinput>cd /etc/sysconfig/
-cat &gt; ifconfig.<replaceable>eth0</replaceable> &lt;&lt; "EOF"
-<literal>ONBOOT=<replaceable>yes</replaceable>
-IFACE=<replaceable>eth0</replaceable>
-SERVICE=<replaceable>ipv4-static</replaceable>
-IP=<replaceable>192.168.1.2</replaceable>
-GATEWAY=<replaceable>192.168.1.1</replaceable>
-PREFIX=<replaceable>24</replaceable>
-BROADCAST=<replaceable>192.168.1.255</replaceable></literal>
-EOF</userinput></screen>
-
- <para>The values in italics must be changed in every file to match
- the proper setup.</para>
-
- <para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the
- System V network script will bring up the Network Interface Card (NIC) during
- booting of the system. If set to anything but <quote>yes</quote> the NIC
- will be ignored by the network script and not be automatically brought up.
- The interface can be manually started or stopped with the
- <command>ifup</command> and <command>ifdown</command> commands.</para>
-
- <para>The <envar>IFACE</envar> variable defines the interface name,
- for example, eth0. It is required for all network device configuration
- files. The filename extension must match this value.</para>
-
- <para>The <envar>SERVICE</envar> variable defines the method used for
- obtaining the IP address. The LFS-Bootscripts package has a modular IP
- assignment format, and creating additional files in the <filename
- class="directory">/lib/services/</filename> directory allows other IP
- assignment methods. This is commonly used for Dynamic Host Configuration
- Protocol (DHCP), which is addressed in the BLFS book.</para>
-
- <para>The <envar>GATEWAY</envar> variable should contain the default
- gateway IP address, if one is present. If not, then comment out the
- variable entirely.</para>
-
- <para>The <envar>PREFIX</envar> variable contains the number of
- bits used in the subnet. Each octet in an IP address is 8 bits. If the
- subnet's netmask is 255.255.255.0, then it is using the first three octets
- (24 bits) to specify the network number. If the netmask is 255.255.255.240,
- it would be using the first 28 bits. Prefixes longer than 24 bits are
- commonly used by DSL and cable-based Internet Service Providers (ISPs).
- In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
- <envar>PREFIX</envar> variable according to your specific subnet.
- If omitted, the PREFIX defaults to 24.</para>
-
- <para>For more information see the <command>ifup</command> man page.</para>
-
- </sect2>
- <sect2 id="resolv.conf">
- <title>Creating the /etc/resolv.conf File</title>
-
- <indexterm zone="resolv.conf">
- <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
- </indexterm>
-
- <para>The system will need some means of obtaining Domain Name Service
- (DNS) name resolution to resolve Internet domain names to IP addresses, and
- vice versa. This is best achieved by placing the IP address of the DNS
- server, available from the ISP or network administrator, into
- <filename>/etc/resolv.conf</filename>. Create the file by running the
- following:</para>
-
-<screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
-<literal># Begin /etc/resolv.conf
-
-domain <replaceable>&lt;Your Domain Name&gt;</replaceable>
-nameserver <replaceable>&lt;IP address of your primary nameserver&gt;</replaceable>
-nameserver <replaceable>&lt;IP address of your secondary nameserver&gt;</replaceable>
-
-# End /etc/resolv.conf</literal>
-EOF</userinput></screen>
-
- <para>The <varname>domain</varname> statement can be omitted
- or replaced with a <varname>search</varname> statement. See the man page for
- resolv.conf for more details.</para>
-
- <para>Replace <replaceable>&lt;IP address of the nameserver&gt;</replaceable>
- with the IP address of the DNS most appropriate for the setup. There will
- often be more than one entry (requirements demand secondary servers for
- fallback capability). If you only need or want one DNS server, remove the
- second <emphasis>nameserver</emphasis> line from the file. The IP address
- may also be a router on the local network.</para>
-
- <note>
- <para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para>
- </note>
-
- </sect2>
-
- <sect2 id="ch-config-hostname">
- <title>Configuring the system hostname</title>
-
- <indexterm zone="ch-config-hostname">
- <primary sortas="d-hostname">hostname</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <para>During the boot process, the file <filename>/etc/hostname</filename>
- is used for establishing the system's hostname.</para>
-
- <para>Create the <filename>/etc/hostname</filename> file and enter a
- hostname by running:</para>
-
-<screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen>
-
- <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the
- name given to the computer. Do not enter the Fully Qualified Domain Name
- (FQDN) here. That information is put in the
- <filename>/etc/hosts</filename> file.</para>
-
- </sect2>
-
- <sect2 id="ch-config-hosts">
- <title>Customizing the /etc/hosts File</title>
-
- <indexterm zone="ch-config-hosts">
- <primary sortas="e-/etc/hosts">/etc/hosts</primary>
- </indexterm>
-
- <indexterm zone="ch-config-hosts">
- <primary sortas="d-localnet">localnet</primary>
- <secondary>/etc/hosts</secondary>
- </indexterm>
-
- <indexterm zone="ch-config-hosts">
- <primary sortas="d-network">network</primary>
- <secondary>/etc/hosts</secondary>
- </indexterm>
-
- <para>Decide on the IP address, fully-qualified domain name (FQDN), and
- possible aliases for use in the <filename>/etc/hosts</filename> file. The
- syntax is:</para>
-
-<screen><literal>IP_address myhost.example.org aliases</literal></screen>
-
- <para>Unless the computer is to be visible to the Internet (i.e., there is
- a registered domain and a valid block of assigned IP addresses&mdash;most
- users do not have this), make sure that the IP address is in the private
- network IP address range. Valid ranges are:</para>
-
-<screen><literal>Private Network Address Range Normal Prefix
-10.0.0.1 - 10.255.255.254 8
-172.x.0.1 - 172.x.255.254 16
-192.168.y.1 - 192.168.y.254 24</literal></screen>
-
- <para>x can be any number in the range 16-31. y can be any number in the
- range 0-255.</para>
-
- <para>A valid private IP address could be 192.168.1.1. A valid FQDN for
- this IP could be lfs.example.org.</para>
-
- <para>Even if not using a network card, a valid FQDN is still required.
- This is necessary for certain programs to operate correctly.</para>
-
- <para>Create the <filename>/etc/hosts</filename> file by running:</para>
-
-<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
-<literal># Begin /etc/hosts
-
-127.0.0.1 localhost.localdomain localhost
-127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
-<replaceable>&lt;192.168.1.1&gt;</replaceable> <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> <replaceable>[alias1] [alias2 ...]</replaceable>
-::1 localhost ip6-localhost ip6-loopback
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-
-# End /etc/hosts</literal>
-EOF</userinput></screen>
-
- <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable>,
- <replaceable>&lt;FQDN&gt;</replaceable>, and
- <replaceable>&lt;HOSTNAME&gt;</replaceable> values need to be
- changed for specific uses or requirements (if assigned an IP address by a
- network/system administrator and the machine will be connected to an
- existing network). The optional alias name(s) can be omitted.</para>
-
-<!-- This is not very useful
-
- <para>If a network card is not going to be configured, create the
- <filename>/etc/hosts</filename> file by running:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
-<literal># Begin /etc/hosts (no network card version)
-
-127.0.0.1 localhost
-127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
-::1 localhost ip6-localhost ip6-loopback
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-
-# End /etc/hosts (no network card version)</literal>
-EOF</userinput></screen> -->
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/networkd.xml b/chapter07/networkd.xml
deleted file mode 100644
index 688c315aa..000000000
--- a/chapter07/networkd.xml
+++ /dev/null
@@ -1,335 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-network" revision="systemd">
- <?dbhtml filename="network.html"?>
-
- <title>General Network Configuration</title>
-
- <indexterm zone="ch-config-network">
- <primary sortas="d-network">network</primary>
- <secondary>configuring</secondary></indexterm>
-
- <para>This section only applies if a network card is to be
- configured.</para>
-
- <sect2>
- <title>Network Interface Configuration Files</title>
-
- <para>Starting with version 209, systemd ships a network configuration
- daemon called <command>systemd-networkd</command> which can be used for
- basic network configuration. Additionally, since version 213, DNS name
- resolution can be handled by <command>systemd-resolved</command> in place
- of a static <filename>/etc/resolv.conf</filename> file. Both services are
- enabled by default.</para>
-
- <para>Configuration files for <command>systemd-networkd</command> (and
- <command>systemd-resolved</command>) can be placed in
- <filename class="directory">/usr/lib/systemd/network</filename>
- or <filename class="directory">/etc/systemd/network</filename>. Files in
- <filename class="directory">/etc/systemd/network</filename> have a
- higher priority than the ones in
- <filename class="directory">/usr/lib/systemd/network</filename>.
- There are three types of configuration files:
- <filename class="extension">.link</filename>,
- <filename class="extension">.netdev</filename> and
- <filename class="extension">.network</filename> files. For detailed
- descriptions and example contents of these configuration files, consult
- the <filename>systemd-link(5)</filename>,
- <filename>systemd-netdev(5)</filename> and
- <filename>systemd-network(5)</filename> manual pages.</para>
-
- <sect3 id="systemd-network-devices">
- <title>Network Device Naming</title>
-
- <para>
- Udev normally assigns network card interface names based
- on system physical characteristics such as enp2s1. If you are
- not sure what your interface name is, you can always run
- <command>ip link</command> after you have booted your system.
- </para>
-
- <para>
- For most systems, there is only one network interface for
- each type of connection. For example, the classic interface
- name for a wired connection is eth0. A wireless connection
- will usually have the name wifi0 or wlan0.
- </para>
-
- <para>
- If you prefer to use the classic or customized network interface names,
- there are three alternative ways to do that:</para>
-
- <itemizedlist>
- <listitem>
- <para>
- Mask udev's .link file for the default policy:
-<screen role="nodump"><userinput>ln -s /dev/null /etc/systemd/network/99-default.link</userinput></screen>
- </para>
- </listitem>
-
- <listitem>
- <para>
- Create a manual naming scheme, for example by naming the
- interfaces something like "internet0", "dmz0", or "lan0".
- For that, create .link
- files in /etc/systemd/network/, that choose an explicit name or a
- better naming scheme for one, some, or all of your interfaces.
- For example:
- </para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/systemd/network/10-ether0.link &lt;&lt; "EOF"
-<literal>[Match]
-# Change the MAC address as appropriate for your network device
-MACAddress=12:34:45:78:90:AB
-
-[Link]
-Name=ether0</literal>
-EOF</userinput></screen>
-
- <para>
- See the man page systemd.link(5) for more information.
- </para>
- </listitem>
-
- <listitem>
- <para>
- In /boot/grub/grub.cfg, pass the option net.ifnames=0 on the
- kernel command line.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3 id="systemd-networkd-static">
- <title>Static IP Configuration</title>
-
- <para>The command below creates a basic configuration file for a
- Static IP setup (using both systemd-networkd and
- systemd-resolved):</para>
-<!-- jhalfs relies on the values for Name, Address, etc. If you want to change
- them, please inform the jhalfs maintainer(s). -->
-<screen><userinput>cat &gt; /etc/systemd/network/10-eth-static.network &lt;&lt; "EOF"
-<literal>[Match]
-Name=<replaceable>&lt;network-device-name&gt;</replaceable>
-
-[Network]
-Address=192.168.0.2/24
-Gateway=192.168.0.1
-DNS=192.168.0.1
-Domains=<replaceable>&lt;Your Domain Name&gt;</replaceable></literal>
-EOF</userinput></screen>
-
- <para>Multiple DNS entries can be added if you have more than one DNS
- server. Do not include DNS or Domains entries if you intend to use a
- static <filename>/etc/resolv.conf</filename> file.</para>
-
- </sect3>
-
- <sect3 id="systemd-networkd-dhcp">
- <title>DHCP Configuration</title>
-
- <para>The command below creates a basic configuration file for an IPv4
- DHCP setup:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/systemd/network/10-eth-dhcp.network &lt;&lt; "EOF"
-<literal>[Match]
-Name=&lt;network-device-name&gt;
-
-[Network]
-DHCP=ipv4
-
-[DHCP]
-UseDomains=true</literal>
-EOF</userinput></screen>
-
- </sect3>
-
- </sect2>
-
- <sect2 id="resolv.conf">
- <title>Creating the /etc/resolv.conf File</title>
-
- <indexterm zone="resolv.conf">
- <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
- </indexterm>
-
- <para>If the system is going to be connected to the Internet, it will
- need some means of Domain Name Service (DNS) name resolution to
- resolve Internet domain names to IP addresses, and vice versa. This is
- best achieved by placing the IP address of the DNS server, available
- from the ISP or network administrator, into
- <filename>/etc/resolv.conf</filename>.</para>
-
- <sect3 id="resolv-conf-systemd-resolved">
- <title>systemd-resolved Configuration</title>
-
- <note><para>If using another means to configure your network
- interfaces (ex: ppp, network-manager, etc.), or if using any type of
- local resolver (ex: bind, dnsmasq, etc.), or any other software that
- generates an <filename>/etc/resolv.conf</filename> (ex: resolvconf), the
- <command>systemd-resolved</command> service should not be
- used.</para></note>
-
- <para>When using <command>systemd-resolved</command> for DNS
- configuration, it creates the file
- <filename>/run/systemd/resolve/resolv.conf</filename>. Create a
- symlink in <filename>/etc</filename> to use the generated file:</para>
-
-<screen><userinput>ln -sfv /run/systemd/resolve/resolv.conf /etc/resolv.conf</userinput></screen>
-
- </sect3>
-
- <sect3 id="resolv-conf-static">
- <title>Static resolv.conf Configuration</title>
-
- <para>If a static <filename>/etc/resolv.conf</filename> is desired,
- create it by running the following command:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
-<literal># Begin /etc/resolv.conf
-
-domain <replaceable>&lt;Your Domain Name&gt;</replaceable>
-nameserver <replaceable>&lt;IP address of your primary nameserver&gt;</replaceable>
-nameserver <replaceable>&lt;IP address of your secondary nameserver&gt;</replaceable>
-
-# End /etc/resolv.conf</literal>
-EOF</userinput></screen>
-
- <para>The <varname>domain</varname> statement can be omitted
- or replaced with a <varname>search</varname> statement. See the man page
- for resolv.conf for more details.</para>
-
- <para>Replace
- <replaceable>&lt;IP address of the nameserver&gt;</replaceable>
- with the IP address of the DNS most appropriate for the setup. There will
- often be more than one entry (requirements demand secondary servers for
- fallback capability). If you only need or want one DNS server, remove the
- second <emphasis>nameserver</emphasis> line from the file. The IP address
- may also be a router on the local network.</para>
-
- <note><para>The Google Public IPv4 DNS addresses are
- <parameter>8.8.8.8</parameter> and <parameter>8.8.4.4</parameter>
- for IPv4, and <parameter>2001:4860:4860::8888</parameter> and
- <parameter>2001:4860:4860::8844</parameter> for IPv6.</para></note>
-
- </sect3>
-
- </sect2>
-
- <sect2 id="ch-config-hostname">
- <title>Configuring the system hostname</title>
-
- <indexterm zone="ch-config-hostname">
- <primary sortas="d-hostname">hostname</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <para>During the boot process, the file <filename>/etc/hostname</filename>
- is used for establishing the system's hostname.</para>
-
- <para>Create the <filename>/etc/hostname</filename> file and enter a
- hostname by running:</para>
-
-<screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen>
-
- <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the
- name given to the computer. Do not enter the Fully Qualified Domain Name
- (FQDN) here. That information is put in the
- <filename>/etc/hosts</filename> file.</para>
-
- </sect2>
-
- <sect2 id="ch-config-hosts">
- <title>Customizing the /etc/hosts File</title>
-
- <indexterm zone="ch-config-hosts">
- <primary sortas="e-/etc/hosts">/etc/hosts</primary>
- </indexterm>
-
- <indexterm zone="ch-config-hosts">
- <primary sortas="d-localnet">localnet</primary>
- <secondary>/etc/hosts</secondary>
- </indexterm>
-
- <indexterm zone="ch-config-hosts">
- <primary sortas="d-network">network</primary>
- <secondary>/etc/hosts</secondary>
- </indexterm>
-
- <para>Decide on a fully-qualified domain name (FQDN), and possible aliases
- for use in the <filename>/etc/hosts</filename> file. If using static
- addresses, you'll also need to decide on an IP address. The syntax
- for a hosts file entry is:</para>
-
-<screen><literal>IP_address myhost.example.org aliases</literal></screen>
-
- <para>Unless the computer is to be visible to the Internet (i.e., there is
- a registered domain and a valid block of assigned IP addresses&mdash;most
- users do not have this), make sure that the IP address is in the private
- network IP address range. Valid ranges are:</para>
-
-<screen><literal>Private Network Address Range Normal Prefix
-10.0.0.1 - 10.255.255.254 8
-172.x.0.1 - 172.x.255.254 16
-192.168.y.1 - 192.168.y.254 24</literal></screen>
-
- <para>x can be any number in the range 16-31. y can be any number in the
- range 0-255.</para>
-
- <para>A valid private IP address could be 192.168.1.1. A valid FQDN for
- this IP could be lfs.example.org.</para>
-
- <para>Even if not using a network card, a valid FQDN is still required.
- This is necessary for certain programs to operate correctly.</para>
-
- <para>If using DHCP, DHCPv6, IPv6 Autoconfiguration, or if a network card
- is not going to be configured, create the <filename>/etc/hosts</filename>
- file by running the following command:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
-<literal># Begin /etc/hosts
-
-127.0.0.1 localhost.localdomain localhost
-127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
-::1 localhost ip6-localhost ip6-loopback
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-
-# End /etc/hosts</literal>
-EOF</userinput></screen>
-
- <para>The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents
- the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved
- specifically for the FQDN.</para>
-
- <para>If using a static address, create the <filename>/etc/hosts</filename>
- file by running this command instead:</para>
-
-<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
-<literal># Begin /etc/hosts
-
-127.0.0.1 localhost
-127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
-<replaceable>&lt;192.168.0.2&gt;</replaceable> <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> <replaceable>[alias1] [alias2] ...</replaceable>
-::1 localhost ip6-localhost ip6-loopback
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-
-# End /etc/hosts</literal>
-EOF</userinput></screen>
-
- <para>The <replaceable>&lt;192.168.0.2&gt;</replaceable>,
- <replaceable>&lt;FQDN&gt;</replaceable>, and
- <replaceable>&lt;HOSTNAME&gt;</replaceable> values need to be
- changed for specific uses or requirements (if assigned an IP address by a
- network/system administrator and the machine will be connected to an
- existing network). The optional alias name(s) can be omitted.</para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/patch.xml b/chapter07/patch.xml
new file mode 100644
index 000000000..08bad5c56
--- /dev/null
+++ b/chapter07/patch.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-patch" role="wrap">
+ <?dbhtml filename="patch.html"?>
+
+ <sect1info condition="script">
+ <productname>patch</productname>
+ <productnumber>&patch-version;</productnumber>
+ <address>&patch-url;</address>
+ </sect1info>
+
+ <title>Patch-&patch-version;</title>
+
+ <indexterm zone="ch-tools-patch">
+ <primary sortas="a-Patch">Patch</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/patch.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&patch-ch5-sbu;</seg>
+ <seg>&patch-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Patch</title>
+
+ <para>Prepare Patch for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-patch" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/perl.xml b/chapter07/perl.xml
new file mode 100644
index 000000000..2e2bfd6bd
--- /dev/null
+++ b/chapter07/perl.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-perl" role="wrap">
+ <?dbhtml filename="perl.html"?>
+
+ <sect1info condition="script">
+ <productname>perl</productname>
+ <productnumber>&perl-version;</productnumber>
+ <address>&perl-url;</address>
+ </sect1info>
+
+ <title>Perl-&perl-version;</title>
+
+ <indexterm zone="ch-tools-perl">
+ <primary sortas="a-Perl">Perl</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter08/perl.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&perl-ch5-sbu;</seg>
+ <seg>&perl-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Perl</title>
+
+ <para>Prepare Perl for compilation:</para>
+
+<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the new Configure options:</title>
+ <varlistentry>
+ <term><parameter>-des</parameter></term>
+ <listitem>
+ <para>This is a combination of three options: -d uses defaults for
+ all items; -e ensures completion of all tasks; -s silences
+ non-essential output.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Build the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-perl" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/profile.xml b/chapter07/profile.xml
deleted file mode 100644
index 226dd9fac..000000000
--- a/chapter07/profile.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-profile" revision="sysv">
- <?dbhtml filename="profile.html"?>
-
- <title>The Bash Shell Startup Files</title>
-
- <indexterm zone="ch-config-profile">
- <primary sortas="e-/etc/profile">/etc/profile</primary>
- </indexterm>
-
- <para>The shell program <command>/bin/bash</command> (hereafter referred to
- as <quote>the shell</quote>) uses a collection of startup files to help
- create an environment to run in. Each file has a specific use and may affect
- login and interactive environments differently. The files in the <filename
- class="directory">/etc</filename> directory provide global settings. If an
- equivalent file exists in the home directory, it may override the global
- settings.</para>
-
- <para>An interactive login shell is started after a successful login, using
- <command>/bin/login</command>, by reading the <filename>/etc/passwd</filename>
- file. An interactive non-login shell is started at the command-line (e.g.,
- <prompt>[prompt]$</prompt><command>/bin/bash</command>). A non-interactive
- shell is usually present when a shell script is running. It is non-interactive
- because it is processing a script and not waiting for user input between
- commands.</para>
-
- <para>For more information, see <command>info bash</command> under the
- <emphasis>Bash Startup Files and Interactive Shells</emphasis> section.</para>
-
- <para>The files <filename>/etc/profile</filename> and
- <filename>~/.bash_profile</filename> are read when the shell is
- invoked as an interactive login shell.</para>
-
- <para>The base <filename>/etc/profile</filename> below sets some
- environment variables necessary for native language support. Setting
- them properly results in:</para>
-
- <itemizedlist>
- <listitem>
- <para>The output of programs translated into the native language</para>
- </listitem>
- <listitem>
- <para>Correct classification of characters into letters, digits and other
- classes. This is necessary for <command>bash</command> to properly accept
- non-ASCII characters in command lines in non-English locales</para>
- </listitem>
- <listitem>
- <para>The correct alphabetical sorting order for the country</para>
- </listitem>
- <listitem>
- <para>Appropriate default paper size</para>
- </listitem>
- <listitem>
- <para>Correct formatting of monetary, time, and date values</para>
- </listitem>
- </itemizedlist>
-
- <para>Replace <replaceable>&lt;ll&gt;</replaceable> below with the two-letter code
- for the desired language (e.g., <quote>en</quote>) and
- <replaceable>&lt;CC&gt;</replaceable> with the two-letter code for the appropriate
- country (e.g., <quote>GB</quote>). <replaceable>&lt;charmap&gt;</replaceable> should
- be replaced with the canonical charmap for your chosen locale. Optional
- modifiers such as <quote>@euro</quote> may also be present.</para>
-
- <para>The list of all locales supported by Glibc can be obtained by running
- the following command:</para>
-
-<screen role="nodump"><userinput>locale -a</userinput></screen>
-
- <para>Charmaps can have a number of aliases, e.g., <quote>ISO-8859-1</quote>
- is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
- Some applications cannot handle the various synonyms correctly (e.g., require
- that <quote>UTF-8</quote> is written as <quote>UTF-8</quote>, not
- <quote>utf8</quote>), so it is safest in most
- cases to choose the canonical name for a particular locale. To determine
- the canonical name, run the following command, where <replaceable>&lt;locale
- name&gt;</replaceable> is the output given by <command>locale -a</command> for
- your preferred locale (<quote>en_GB.iso88591</quote> in our example).</para>
-
-<screen role="nodump"><userinput>LC_ALL=<replaceable>&lt;locale name&gt;</replaceable> locale charmap</userinput></screen>
-
- <para>For the <quote>en_GB.iso88591</quote> locale, the above command
- will print:</para>
-
-<screen><computeroutput>ISO-8859-1</computeroutput></screen>
-
- <para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>.
- It is important that the locale found using the heuristic above is tested prior
- to it being added to the Bash startup files:</para>
-
-<screen role="nodump"><userinput>LC_ALL=&lt;locale name&gt; locale language
-LC_ALL=&lt;locale name&gt; locale charmap
-LC_ALL=&lt;locale name&gt; locale int_curr_symbol
-LC_ALL=&lt;locale name&gt; locale int_prefix</userinput></screen>
-
- <para>The above commands should print the language name, the character
- encoding used by the locale, the local currency, and the prefix to dial
- before the telephone number in order to get into the country. If any of the
- commands above fail with a message similar to the one shown below, this means
- that your locale was either not installed in Chapter&nbsp;6 or is not supported by
- the default installation of Glibc.</para>
-
-<screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen>
-
- <para>If this happens, you should either install the desired locale using the
- <command>localedef</command> command, or consider choosing a different locale.
- Further instructions assume that there are no such error messages from
- Glibc.</para>
-
- <!-- FIXME: the xlib example will became obsolete real soon -->
- <para>Some packages beyond LFS may also lack support for your chosen locale. One
- example is the X library (part of the X Window System), which outputs the
- following error message if the locale does not exactly match one of the character
- map names in its internal files:</para>
-
-<screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen>
-
- <para>In several cases Xlib expects that the character map will be listed in
- uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather
- than "iso88591". It is also possible to find an appropriate specification by
- removing the charmap part of the locale specification. This can be checked
- by running the <command>locale charmap</command> command in both locales.
- For example, one would have to change "de_DE.ISO-8859-15@euro" to
- "de_DE@euro" in order to get this locale recognized by Xlib.</para>
-
- <para>Other packages can also function incorrectly (but may not necessarily
- display any error messages) if the locale name does not meet their expectations.
- In those cases, investigating how other Linux distributions support your locale
- might provide some useful information.</para>
-
- <para>Once the proper locale settings have been determined, create the
- <filename>/etc/profile</filename> file:</para>
-
-<screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
-<literal># Begin /etc/profile
-
-export LANG=<replaceable>&lt;ll&gt;_&lt;CC&gt;.&lt;charmap&gt;&lt;@modifiers&gt;</replaceable>
-
-# End /etc/profile</literal>
-EOF</userinput></screen>
-
- <para>The <quote>C</quote> (default) and <quote>en_US</quote> (the recommended
- one for United States English users) locales are different. <quote>C</quote>
- uses the US-ASCII 7-bit character set, and treats bytes with the high bit set
- as invalid characters. That's why, e.g., the <command>ls</command> command
- substitutes them with question marks in that locale. Also, an attempt to send
- mail with such characters from Mutt or Pine results in non-RFC-conforming
- messages being sent (the charset in the outgoing mail is indicated as <quote>unknown
- 8-bit</quote>). So you can use the <quote>C</quote> locale only if you are sure that
- you will never need 8-bit characters.</para>
-
- <para>UTF-8 based locales are not supported well by some programs.
- Work is in progress to document and, if possible, fix such problems, see
- <ulink url="&blfs-book;introduction/locale-issues.html"/>.</para>
-
-</sect1>
diff --git a/chapter07/python.xml b/chapter07/python.xml
new file mode 100644
index 000000000..8e7afaf03
--- /dev/null
+++ b/chapter07/python.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-system-Python-temp" role="wrap">
+ <?dbhtml filename="Python-temp.html"?>
+
+ <sect1info condition="script">
+ <productname>Python</productname>
+ <productnumber>&python-version;</productnumber>
+ <address>&python-url;</address>
+ </sect1info>
+
+ <title>Python-&python-version;</title>
+
+ <indexterm zone="ch-system-Python-temp">
+ <primary sortas="a-Python">Python</primary>
+ <secondary>temporary</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/python.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&python-ch5-sbu;</seg>
+ <seg>&python-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Python</title>
+
+ <note>
+ <para>There are two package files whose name starts with
+ <quote>python</quote>. The one to extract from is
+ <filename>Python-&python-version;.tar.xz</filename> (notice the
+ uppercase first letter).</para>
+ </note>
+
+ <para>Prepare Python for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure option:</title>
+
+ <varlistentry>
+ <term><parameter>--without-ensurepip</parameter></term>
+ <listitem>
+ <para>This switch disables the Python package installer, which is not
+ needed at this stage.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-python" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/sed.xml b/chapter07/sed.xml
new file mode 100644
index 000000000..5daaf6b7e
--- /dev/null
+++ b/chapter07/sed.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-sed" role="wrap">
+ <?dbhtml filename="sed.html"?>
+
+ <sect1info condition="script">
+ <productname>sed</productname>
+ <productnumber>&sed-version;</productnumber>
+ <address>&sed-url;</address>
+ </sect1info>
+
+ <title>Sed-&sed-version;</title>
+
+ <indexterm zone="ch-tools-sed">
+ <primary sortas="a-Sed">Sed</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/sed.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&sed-ch5-sbu;</seg>
+ <seg>&sed-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Sed</title>
+
+ <para>Prepare Sed for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --bindir=/bin</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-sed" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/stripping.xml b/chapter07/stripping.xml
new file mode 100644
index 000000000..7c054b6b2
--- /dev/null
+++ b/chapter07/stripping.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-stripping">
+ <?dbhtml filename="stripping.html"?>
+
+ <title>Stripping</title>
+
+ <para>The steps in this section are optional, but if the LFS partition is
+ rather small, it is beneficial to learn that unnecessary items can be removed.
+ The executables and libraries built so far contain about 70 MB of unneeded
+ debugging symbols. Remove those symbols with:</para>
+
+<screen><userinput>$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
+$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*</userinput></screen>
+
+ <para>These commands will skip a number of files, reporting that it does not
+ recognize their file format. Most of these are scripts instead of binaries.
+ Note that we use the <command>strip</command> program built in
+ <quote>Binutils pass 1</quote>, since it is the one that knows how to strip
+ our cross-compiled programs.</para>
+<!-- Normally, the host "strip" could be used too, since it is actually the
+same computer. But Some old versions of binutils may generate buggy crt1.o
+and the like, because they do not know about recently introduced symbol
+types. For more details,
+see https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
+
+ <para>Take care <emphasis>not</emphasis> to use
+ <parameter>--strip-unneeded</parameter> on the libraries. The static
+ ones would be destroyed and the toolchain packages would need to be
+ built all over again.</para>
+
+ <para>To save more, remove the documentation:</para>
+
+<screen><userinput>rm -rf $LFS/usr/{,share}/{info,man,doc}</userinput></screen>
+
+ <para>The libtool .la files are only useful when linking with static
+ libraries. They are unneeded, and potentially harmful, when using dynamic
+ shared libraries, specially when using also non-autotools build systems.
+ Remove those files now:</para>
+
+<screen><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
+
+ <para>At this point, you should have at least 3 GB of free space in
+ <envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
+ the next phase. If you can build and install Glibc, you can build and install
+ the rest too.</para>
+
+</sect1>
diff --git a/chapter07/symlinks.xml b/chapter07/symlinks.xml
deleted file mode 100644
index 951e6976d..000000000
--- a/chapter07/symlinks.xml
+++ /dev/null
@@ -1,256 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-symlinks">
- <?dbhtml filename="symlinks.html"?>
-
- <title>Managing Devices</title>
-
- <sect2 revision="sysv">
-
- <title>Network Devices</title>
-
- <para>Udev, by default, names network devices according to Firmware/BIOS
- data or physical characteristics like the bus, slot, or MAC address. The
- purpose of this naming convention is to ensure that network devices are
- named consistently and not based on the time the network card was
- discovered. For example, on a computer having two network cards made by
- Intel and Realtek, the network card manufactured by Intel may become eth0
- and the Realtek card becomes eth1. In some cases, after a reboot the cards
- get renumbered the other way around.</para>
-
- <para>In the new naming scheme, typical network device names would then
- be something like enp5s0 or wlp3s0. If this naming convention is not
- desired, the traditional naming scheme or a custom scheme can be
- implemented.</para>
-
- <sect3>
- <title>Disabling Persistent Naming on the Kernel Command Line</title>
-
- <para>The traditional naming scheme using eth0, eth1, etc can be
- restored by adding <userinput>net.ifnames=0</userinput> on the
- kernel command line. This is most appropriate for those systems
- that have only one ethernet device of the same type. Laptops
- often have multiple ethernet connections that are named eth0 and
- wlan0 and are also candidates for this method. The command line
- is passed in the GRUB configuration file.
- See <xref linkend="grub-cfg"/>.</para>
- </sect3>
-
- <sect3>
- <title>Creating Custom Udev Rules</title>
-
- <para>The naming scheme can be customized by creating custom Udev
- rules. A script has been included that generates the initial rules.
- Generate these rules by running:</para>
-
-<screen role="install"><userinput>bash /lib/udev/init-net-rules.sh</userinput></screen>
-
- <para> Now, inspect the
- <filename>/etc/udev/rules.d/70-persistent-net.rules</filename> file, to
- find out which name was assigned to which network device:</para>
-
-<screen role="nodump"><userinput>cat /etc/udev/rules.d/70-persistent-net.rules</userinput></screen>
-
- <note><para>In some cases such as when MAC addresses have been assigned to
- a network card manually or in a virtual environment such as Qemu or Xen,
- the network rules file may not have been generated because addresses
- are not consistently assigned. In these cases, this method cannot
- be used.</para></note>
-
- <para>The file begins with a comment block followed by two lines for each
- NIC. The first line for each NIC is a commented description showing its
- hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card),
- along with its driver in parentheses, if the driver can be found. Neither
- the hardware ID nor the driver is used to determine which name to give an
- interface; this information is only for reference. The second line is the
- Udev rule that matches this NIC and actually assigns it a name.</para>
-
- <para>All Udev rules are made up of several keys, separated by commas and
- optional whitespace. This rule's keys and an explanation of each of them
- are as follows:</para>
-
- <itemizedlist>
- <listitem>
- <para><literal>SUBSYSTEM=="net"</literal> - This tells Udev to ignore
- devices that are not network cards.</para>
- </listitem>
- <listitem>
- <para><literal>ACTION=="add"</literal> - This tells Udev to ignore this
- rule for a uevent that isn't an add ("remove" and "change" uevents also
- happen, but don't need to rename network interfaces).</para>
- </listitem>
- <listitem>
- <para><literal>DRIVERS=="?*"</literal> - This exists so that Udev will
- ignore VLAN or bridge sub-interfaces (because these sub-interfaces do
- not have drivers). These sub-interfaces are skipped because the name
- that would be assigned would collide with their parent devices.</para>
- </listitem>
- <listitem>
- <para><literal>ATTR{address}</literal> - The value of this key is the
- NIC's MAC address.</para>
- </listitem>
- <listitem>
- <para><literal>ATTR{type}=="1"</literal> - This ensures the rule only
- matches the primary interface in the case of certain wireless drivers,
- which create multiple virtual interfaces. The secondary interfaces are
- skipped for the same reason that VLAN and bridge sub-interfaces are
- skipped: there would be a name collision otherwise.</para>
- </listitem>
- <listitem>
- <para><literal>NAME</literal> - The value of this key is the name that
- Udev will assign to this interface.</para>
- </listitem>
- </itemizedlist>
-
- <para>The value of <literal>NAME</literal> is the important part. Make sure
- you know which name has been assigned to each of your network cards before
- proceeding, and be sure to use that <literal>NAME</literal> value when
- creating your configuration files below.</para>
-
- </sect3>
-
- </sect2>
-
- <sect2 revision="sysv">
-
- <title>CD-ROM symlinks</title>
-
- <para>Some software that you may want to install later (e.g., various
- media players) expect the <filename class="symlink">/dev/cdrom</filename>
- and <filename class="symlink">/dev/dvd</filename> symlinks to exist, and
- to point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put
- references to those symlinks into <filename>/etc/fstab</filename>. Udev
- comes with a script that will generate rules files to create these symlinks
- for you, depending on the capabilities of each device, but you need to
- decide which of two modes of operation you wish to have the script use.</para>
-
- <para>First, the script can operate in <quote>by-path</quote> mode (used by
- default for USB and FireWire devices), where the rules it creates depend on
- the physical path to the CD or DVD device. Second, it can operate in
- <quote>by-id</quote> mode (default for IDE and SCSI devices), where the
- rules it creates depend on identification strings stored in the CD or DVD
- device itself. The path is determined by Udev's <command>path_id</command>
- script, and the identification strings are read from the hardware by its
- <command>ata_id</command> or <command>scsi_id</command> programs, depending
- on which type of device you have.</para>
-
- <para>There are advantages to each approach; the correct approach to use
- will depend on what kinds of device changes may happen. If you expect the
- physical path to the device (that is, the ports and/or slots that it plugs
- into) to change, for example because you plan on moving the drive to a
- different IDE port or a different USB connector, then you should use the
- <quote>by-id</quote> mode. On the other hand, if you expect the device's
- identification to change, for example because it may die, and you would
- replace it with a different device with the same capabilities and which
- is plugged into the same connectors, then you should use the
- <quote>by-path</quote> mode.</para>
-
- <para>If either type of change is possible with your drive, then choose a
- mode based on the type of change you expect to happen more often.</para>
-
-<!-- If you use by-id mode, the symlinks will survive even the transition
- to libata for IDE drives, but that is not for the book. -->
-
- <important><para>External devices (for example, a USB-connected CD drive)
- should not use by-path persistence, because each time the device is plugged
- into a new external port, its physical path will change. All
- externally-connected devices will have this problem if you write Udev rules
- to recognize them by their physical path; the problem is not limited to CD
- and DVD drives.</para></important>
-
- <para>If you wish to see the values that the Udev scripts will use, then
- for the appropriate CD-ROM device, find the corresponding directory under
- <filename class="directory">/sys</filename> (e.g., this can be
- <filename class="directory">/sys/block/hdd</filename>) and
- run a command similar to the following:</para>
-
-<screen role="nodump"><userinput>udevadm test /sys/block/hdd</userinput></screen>
-
- <para>Look at the lines containing the output of various *_id programs.
- The <quote>by-id</quote> mode will use the ID_SERIAL value if it exists and
- is not empty, otherwise it will use a combination of ID_MODEL and
- ID_REVISION. The <quote>by-path</quote> mode will use the ID_PATH value.</para>
-
- <para>If the default mode is not suitable for your situation, then the
- following modification can be made to the
- <filename>/etc/udev/rules.d/83-cdrom-symlinks.rules</filename> file,
- as follows (where <replaceable>mode</replaceable> is one of
- <quote>by-id</quote> or <quote>by-path</quote>):</para>
-
-<screen role="nodump"><userinput>sed -i -e 's/"write_cd_rules"/"write_cd_rules <replaceable>mode</replaceable>"/' \
- /etc/udev/rules.d/83-cdrom-symlinks.rules</userinput></screen>
-
- <para>Note that it is not necessary to create the rules files or symlinks
- at this time, because you have bind-mounted the host's
- <filename class="directory">/dev</filename> directory into the LFS system,
- and we assume the symlinks exist on the host. The rules and symlinks will
- be created the first time you boot your LFS system.</para>
-
- <para>However, if you have multiple CD-ROM devices, then the symlinks
- generated at that time may point to different devices than they point to on
- your host, because devices are not discovered in a predictable order. The
- assignments created when you first boot the LFS system will be stable, so
- this is only an issue if you need the symlinks on both systems to point to
- the same device. If you need that, then inspect (and possibly edit) the
- generated <filename>/etc/udev/rules.d/70-persistent-cd.rules</filename>
- file after booting, to make sure the assigned symlinks match what you need.</para>
-
- </sect2>
-
- <sect2>
-
- <title>Dealing with duplicate devices</title>
-
- <para>As explained in <xref linkend="ch-config-udev"/>, the order in
- which devices with the same function appear in
- <filename class="directory">/dev</filename> is essentially random.
- E.g., if you have a USB web camera and a TV tuner, sometimes
- <filename>/dev/video0</filename> refers to the camera and
- <filename>/dev/video1</filename> refers to the tuner, and sometimes
- after a reboot the order changes to the opposite one.
- For all classes of hardware except sound cards and network cards, this is
- fixable by creating Udev rules for custom persistent symlinks.
- The case of network cards is covered separately in
- <xref linkend="ch-config-network"/>, and sound card configuration can
- be found in <ulink url="&blfs-book;postlfs/devices.html">BLFS</ulink>.</para>
-
- <para>For each of your devices that is likely to have this problem
- (even if the problem doesn't exist in your current Linux distribution),
- find the corresponding directory under
- <filename class="directory">/sys/class</filename> or
- <filename class="directory">/sys/block</filename>.
- For video devices, this may be
- <filename
- class="directory">/sys/class/video4linux/video<replaceable>X</replaceable></filename>.
- Figure out the attributes that identify the device uniquely (usually,
- vendor and product IDs and/or serial numbers work):</para>
-
-<screen role="nodump"><userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput></screen>
-
- <para>Then write rules that create the symlinks, e.g.:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; "EOF"
-<literal>
-# Persistent symlinks for webcam and tuner
-KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \
- SYMLINK+="webcam"
-KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \
- SYMLINK+="tvtuner"
-</literal>
-EOF</userinput></screen>
-
- <para>The result is that <filename>/dev/video0</filename> and
- <filename>/dev/video1</filename> devices still refer randomly to the tuner
- and the web camera (and thus should never be used directly), but there are
- symlinks <filename>/dev/tvtuner</filename> and
- <filename>/dev/webcam</filename> that always point to the correct
- device.</para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/systemd-custom.xml b/chapter07/systemd-custom.xml
deleted file mode 100644
index 787fd4572..000000000
--- a/chapter07/systemd-custom.xml
+++ /dev/null
@@ -1,313 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-systemd-custom" revision="systemd">
- <?dbhtml filename="systemd-custom.html"?>
-
- <title>Systemd Usage and Configuration</title>
-
- <indexterm zone="ch-config-systemd-custom">
- <primary sortas="e-Systemd">Systemd Customization</primary>
- </indexterm>
-
- <sect2>
- <title>Basic Configuration</title>
-
- <para>The <filename>/etc/systemd/system.conf</filename> file contains a set
- of options to control basic systemd operations. The default file has all
- entries commented out with the default settings indicated. This file is
- where the log level may be changed as well as some basic logging settings.
- See the <filename>systemd-system.conf(5)</filename> manual page for details
- on each configuration option.</para>
-
- </sect2>
-
- <sect2>
- <title>Disabling Screen Clearing at Boot Time</title>
-
- <para>The normal behavior for systemd is to clear the screen at
- the end of the boot sequence. If desired, this behavior may be
- changed by running the following command:</para>
-
-<screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/getty@tty1.service.d
-
-cat &gt; /etc/systemd/system/getty@tty1.service.d/noclear.conf &lt;&lt; EOF
-<literal>[Service]
-TTYVTDisallocate=no</literal>
-EOF</userinput></screen>
-
- <para>The boot messages can always be reviewed by using the
- <userinput>journalctl -b</userinput> command as the root user.</para>
-
- </sect2>
-
- <sect2>
- <title>Disabling tmpfs for /tmp</title>
-
- <para>By default, <filename class="directory">/tmp</filename> is created as
- a tmpfs. If this is not desired, it can be overridden by the following:</para>
-
-<screen role="nodump"><userinput>ln -sfv /dev/null /etc/systemd/system/tmp.mount</userinput></screen>
-
- <para>Alternatively, if a a separate partition for
- <filename class="directory">/tmp</filename> is desired, specify that
- partition in an <filename>/etc/fstab</filename> entry.</para>
-
- <warning>
- <para>
- Do not create the symbolic link above if a separate partition is used
- for <filename class="directory">/tmp</filename>. This will prevent the
- root file system (/) from being remounted r/w and make the system
- unusable when booted.
- </para>
- </warning>
-
- </sect2>
-
- <sect2>
- <title>Configuring Automatic File Creation and Deletion</title>
-
- <para>There are several services that create or delete files or
- directories:</para>
-
- <itemizedlist>
- <listitem><para>systemd-tmpfiles-clean.service</para></listitem>
- <listitem><para>systemd-tmpfiles-setup-dev.service</para></listitem>
- <listitem><para>systemd-tmpfiles-setup.service</para></listitem>
- </itemizedlist>
-
- <para>The system location for the configuration files is
- <filename>/usr/lib/tmpfiles.d/*.conf</filename>. The local
- configuration files are in
- <filename class="directory">/etc/tmpfiles.d</filename>. Files in
- <filename class="directory">/etc/tmpfiles.d</filename> override
- files with the same name in
- <filename class="directory">/usr/lib/tmpfiles.d</filename>. See
- <filename>tmpfiles.d(5)</filename> manual page for file format
- details.</para>
-
- <para>
- Note that the syntax for the
- <filename>/usr/lib/tmpfiles.d/*.conf</filename> files can be
- confusing. For example, the default deletion of files in the /tmp directory
- is located in <filename>/usr/lib/tmpfiles.d/tmp.conf</filename> with
- the line:
-
-<screen role="nodump">q /tmp 1777 root root 10d</screen>
-
- The type field, q, discusses creating a subvolume with quotas which
- is really only applicable to btrfs filesystems. It references type v
- which in turn references type d (directory). This then creates the
- specified directory if is is not present and adjusts the permissions
- and ownership as specified. Contents of the directory will be
- subject to time based cleanup if the age argument is specified.
- </para>
-
- <para>
- If the default parameters are not desired, then the file should
- be copied to <filename class="directory">/etc/tmpfiles.d</filename>
- and edited as desired. For example:
-
-<screen role="nodump"><userinput>mkdir -p /etc/tmpfiles.d
-cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d</userinput></screen>
- </para>
-
- </sect2>
-
- <sect2>
- <title>Overriding Default Services Behavior</title>
-
- <para>The parameter of a unit can be overriden by creating a directory
- and a configuration file in <filename
- class="directory">/etc/systemd/system</filename>. For example:</para>
-
-<screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/foobar.service.d
-
-cat > /etc/systemd/system/foobar.service.d/foobar.conf &lt;&lt; EOF
-<literal>[Service]
-Restart=always
-RestartSec=30</literal>
-EOF</userinput></screen>
-
- <para>See <filename>systemd.unit(5)</filename> manual page for more
- information. After creating the configuration file, run
- <userinput>systemctl daemon-reload</userinput> and <userinput>systemctl
- restart foobar</userinput> to activate the changes to a service.</para>
-
- </sect2>
-
- <sect2>
- <title>Debugging the Boot Sequence</title>
-
- <para>Rather than plain shell scripts used in SysVinit or BSD style init
- systems, systemd uses a unified format for different types of startup
- files (or units). The command <command>systemctl</command> is used to
- enable, disable, control state, and obtain status of unit files. Here
- are some examples of frequently used commands:</para>
-
- <itemizedlist>
- <listitem>
- <para><command>systemctl list-units -t <replaceable>&lt;service&gt;</replaceable> [--all]</command>:
- lists loaded unit files of type service.</para>
- </listitem>
- <listitem>
- <para><command>systemctl list-units -t <replaceable>&lt;target&gt;</replaceable> [--all]</command>:
- lists loaded unit files of type target.</para>
- </listitem>
- <listitem>
- <para><command>systemctl show -p Wants <replaceable>&lt;multi-user.target&gt;</replaceable></command>:
- shows all units that depend on the multi-user target. Targets are
- special unit files that are anogalous to runlevels under
- SysVinit.</para>
- </listitem>
- <listitem>
- <para><command>systemctl status <replaceable>&lt;servicename.service&gt;</replaceable></command>:
- shows the status of the servicename service. The .service extension
- can be omitted if there are no other unit files with the same name,
- such as .socket files (which create a listening socket that provides
- similar functionality to inetd/xinetd).</para>
- </listitem>
- </itemizedlist>
-
- </sect2>
-
- <sect2>
- <title>Working with the Systemd Journal</title>
-
- <para>Logging on a system booted with systemd is handled with
- systemd-journald (by default), rather than a typical unix syslog daemon.
- You can also add a normal syslog daemon and have both work side by
- side if desired. The systemd-journald program stores journal entries in a
- binary format rather than a plain text log file. To assist with
- parsing the file, the command <command>journalctl</command> is provided.
- Here are some examples of frequently used commands:</para>
-
- <itemizedlist>
- <listitem>
- <para><command>journalctl -r</command>: shows all contents of the
- journal in reverse chronological order.</para>
- </listitem>
- <listitem>
- <para><command>journalctl -u <replaceable>UNIT</replaceable></command>:
- shows the journal entries associated with the specified UNIT
- file.</para>
- </listitem>
- <listitem>
- <para><command>journalctl -b[=ID] -r</command>: shows the journal
- entries since last successful boot (or for boot ID) in reverse
- chronological order.</para>
- </listitem>
- <listitem>
- <para><command>journalctl -f</command>: povides functionality similar
- to tail -f (follow).</para>
- </listitem>
- </itemizedlist>
-
- </sect2>
-
- <sect2>
- <title>Working with Core Dumps</title>
-
- <para>Core dumps are useful to debug crashed programs, especially
- when a daemon process crashes. On systemd booted systems the core
- dumping is handled by <command>systemd-coredump</command>. It will
- log the core dump into the journal and store the core dump itself in
- <filename class="directory">/var/lib/systemd/coredump</filename>.
- To retrieve and process core dumps, <command>coredumpctl</command>
- tool is provided. Here are some examples of frequently used commands:
- </para>
-
- <itemizedlist>
- <listitem>
- <para><command>coredumpctl -r</command>: lists all core dumps in
- reversed chronological order.</para>
- </listitem>
- <listitem>
- <para><command>coredumpctl -1 info</command>: show the information
- of the last core dump.</para>
- </listitem>
- <listitem>
- <para><command>coredumpctl -1 debug</command>: load the last core
- dump into <ulink url="&blfs-book;general/gdb.html">GDB</ulink>.
- </para>
- </listitem>
- </itemizedlist>
-
- <para>Core dumps may use a lot of disk space. The maximum disk space
- used by core dumps can be limited by creating a configuration file in
- <filename class="directory">/etc/systemd/coredump.conf.d</filename>.
- For example:</para>
-
-<screen role="nodump"><userinput>mkdir -pv /etc/systemd/coredump.conf.d
-
-cat &gt; /etc/systemd/coredump.conf.d/maxuse.conf &lt;&lt; EOF
-<literal>[Coredump]
-MaxUse=5G</literal>
-EOF</userinput></screen>
-
- <para>See <filename>systemd-coredump(8)</filename>,
- <filename>coredumpctl(1)</filename>, and
- <filename>coredump.conf.d(5)</filename> manual pages for more
- information.</para>
- </sect2>
-
- <sect2>
- <title>Long Running Processes</title>
-
- <para>Beginning with systemd-230, all user processes are killed when a user
- session is ended, even if nohup is used, or the process uses the
- <function>daemon()</function> or <function>setsid()</function> functions.
- This is a deliberate change from a historically permissive environment to a
- more restrictive one. The new behavior may cause issues if you depend on
- long running programs (e.g., <command>screen</command> or
- <command>tmux</command>) to remain active after ending your user session.
- There are three ways to enable lingering processes to remain after a user
- session is ended.</para>
-
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>Enable process lingering for only selected users</emphasis>:
- Normal users have permission to enable process lingering
- with the command <command>loginctl enable-linger</command> for their
- own user. System administrators can use the same command with a
- <parameter>user</parameter> argument to enable for a user. That user
- can then use the <command>systemd-run</command> command to start
- long running processes. For example: <command>systemd-run --scope
- --user /usr/bin/screen</command>. If you enable lingering for your
- user, the user@.service will remain even after all login sessions are
- closed, and will automatically start at system boot. This has the
- advantage of explicitly allowing and disallowing processes to run
- after the user session has ended, but breaks backwards compatibility
- with tools like <command>nohup</command> and utilities that use
- <function>deamon()</function>.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>Enable system-wide process lingering</emphasis>:
- You can set <parameter>KillUserProcesses=no</parameter> in
- <filename>/etc/systemd/logind.conf</filename> to enable process lingering
- globally for all users. This has the benefit of leaving the old
- method available to all users at the expense of explicit control.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>Disable at build-time</emphasis>: You can enable
- lingering by default while building systemd by adding the switch
- <parameter>-Ddefault-kill-user-processes=false</parameter> to the
- <command>meson</command> command for systemd. This completely
- disables the ability of systemd to kill user processes at session
- end.
- </para>
- </listitem>
- </itemizedlist>
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/tar.xml b/chapter07/tar.xml
new file mode 100644
index 000000000..26f676121
--- /dev/null
+++ b/chapter07/tar.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-tar" role="wrap">
+ <?dbhtml filename="tar.html"?>
+
+ <sect1info condition="script">
+ <productname>tar</productname>
+ <productnumber>&tar-version;</productnumber>
+ <address>&tar-url;</address>
+ </sect1info>
+
+ <title>Tar-&tar-version;</title>
+
+ <indexterm zone="ch-tools-tar">
+ <primary sortas="a-Tar">Tar</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/tar.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&tar-ch5-sbu;</seg>
+ <seg>&tar-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Tar</title>
+
+ <para>Prepare Tar for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess) \
+ --bindir=/bin</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-tar" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/tcl.xml b/chapter07/tcl.xml
new file mode 100644
index 000000000..bd17a91a8
--- /dev/null
+++ b/chapter07/tcl.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+ <!ENTITY tdbc-ver "1.1.1">
+ <!ENTITY itcl-ver "4.2.0">
+]>
+
+<sect1 id="ch-tools-tcl" role="wrap">
+ <?dbhtml filename="tcl.html"?>
+
+ <sect1info condition="script">
+ <productname>tcl</productname>
+ <productnumber>&tcl-version;</productnumber>
+ <address>&tcl-url;</address>
+ </sect1info>
+
+ <title>Tcl-&tcl-version;</title>
+
+ <indexterm zone="ch-tools-tcl">
+ <primary sortas="a-Tcl">Tcl</primary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>The <application>Tcl</application> package contains the Tool Command Language,
+ a robust general-purpose scripting language. The <application>Expect</application> package
+ is written in the <application>Tcl</application> language.</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&tcl-ch5-sbu;</seg>
+ <seg>&tcl-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Tcl</title>
+
+ <para>This package and the next two (Expect and DejaGNU) are
+ installed to support running the test suites for GCC and Binutils and other
+ packages. Installing three packages for testing purposes may seem
+ excessive, but it is very reassuring, if not essential, to know that the
+ most important tools are working properly. These packages are required
+ to run the test suites in <xref linkend="chapter-building-system"/>.</para>
+
+ <para>Note that the Tcl package used here is a minimal version needed
+ to run the LFS tests. For the full package, see the
+ <ulink url='&blfs-book;general/tcl.html'>BLFS Tcl procedures</ulink>.</para>
+
+ <para>Prepare Tcl for compilation:</para>
+
+<screen><userinput remap="configure">SRCDIR=$(pwd)
+cd unix
+./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ $([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+
+ <varlistentry>
+ <term><parameter>$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</parameter></term>
+ <listitem>
+ <para>The construct <parameter>$(&lt;shell command&gt;)</parameter>
+ is replaced by the output of the chell command. Here this output is
+ empty if running on a 32 bit machine, and is
+ <parameter>--enable-64bit</parameter> if running on a 64 bit machine.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Build the package:</para>
+
+<screen><userinput remap="make">make
+
+sed -e "s|$SRCDIR/unix|/usr/lib|" \
+ -e "s|$SRCDIR|/usr/include|" \
+ -i tclConfig.sh
+
+sed -e "s|$SRCDIR/unix/pkgs/tdbc&tdbc-ver;|/usr/lib/tdbc&tdbc-ver;|" \
+ -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/generic|/usr/include|" \
+ -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/library|/usr/lib/tcl8.6|" \
+ -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;|/usr/include|" \
+ -i pkgs/tdbc&tdbc-ver;/tdbcConfig.sh
+
+sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \
+ -e "s|$SRCDIR/pkgs/itcl&itcl-ver;/generic|/usr/include|" \
+ -e "s|$SRCDIR/pkgs/itcl&itcl-ver;|/usr/include|" \
+ -i pkgs/itcl&itcl-ver;/itclConfig.sh
+
+unset SRCDIR</userinput></screen>
+
+ <para>The various <quote>sed</quote> after the <quote>make</quote> command
+ remove references to the build directory from various configuration files,
+ and replaces them with the install directory. This is not mandatory
+ for the remaining of LFS, but may be needed in case a package built later
+ uses Tcl.</para>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ <para>Make the installed library writable so debugging symbols can
+ be removed later:</para>
+
+<screen><userinput remap="install">chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so</userinput></screen>
+
+ <para>Install Tcl's headers. The next package, Expect, requires them
+ to build.</para>
+
+<screen><userinput remap="install">make install-private-headers</userinput></screen>
+
+ <para>Now make a necessary symbolic link:</para>
+
+<screen><userinput remap="install">ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh</userinput></screen>
+
+ </sect2>
+
+ <sect2 id="contents-tcl" role="content">
+ <title>Contents of Tcl</title>
+
+ <segmentedlist>
+ <segtitle>Installed programs</segtitle>
+ <segtitle>Installed library</segtitle>
+
+ <seglistitem>
+ <seg>tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;</seg>
+ <seg>libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ <variablelist>
+ <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+ <?dbfo list-presentation="list"?>
+ <?dbhtml list-presentation="table"?>
+
+ <varlistentry id="tclsh&tcl-major-version;">
+ <term><command>tclsh&tcl-major-version;</command></term>
+ <listitem>
+ <para>The Tcl command shell</para>
+ <indexterm zone="ch-tools-tcl tclsh&tcl-major-version;">
+ <primary sortas="b-tclsh&tcl-major-version;">tclsh&tcl-major-version;</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="tclsh">
+ <term><command>tclsh</command></term>
+ <listitem>
+ <para>A link to tclsh&tcl-major-version;</para>
+ <indexterm zone="ch-tools-tcl tclsh">
+ <primary sortas="b-tclsh">tclsh</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="libtcl&tcl-major-version;.so">
+ <term><filename class="libraryfile">libtcl&tcl-major-version;.so</filename></term>
+ <listitem>
+ <para>The Tcl library</para>
+ <indexterm zone="ch-tools-tcl libtcl&tcl-major-version;.so">
+ <primary sortas="c-libtcl&tcl-major-version;.so">libtcl&tcl-major-version;.so</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="libtclstub&tcl-major-version;.a">
+ <term><filename class="libraryfile">libtclstub&tcl-major-version;.a</filename></term>
+ <listitem>
+ <para>The Tcl Stub library</para>
+ <indexterm zone="ch-tools-tcl libtclstub&tcl-major-version;.a">
+ <primary sortas="c-libtclstub&tcl-major-version;.a">libtclstub&tcl-major-version;.a</primary>
+ </indexterm>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/texinfo.xml b/chapter07/texinfo.xml
new file mode 100644
index 000000000..2cb7764cb
--- /dev/null
+++ b/chapter07/texinfo.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-system-texinfo-temp" role="wrap">
+ <?dbhtml filename="texinfo-temp.html"?>
+
+ <sect1info condition="script">
+ <productname>texinfo</productname>
+ <productnumber>&texinfo-version;</productnumber>
+ <address>&texinfo-url;</address>
+ </sect1info>
+
+ <title>Texinfo-&texinfo-version;</title>
+
+ <indexterm zone="ch-system-texinfo-temp">
+ <primary sortas="a-Texinfo">Texinfo</primary>
+ <secondary>temporary</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/texinfo.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&texinfo-ch5-sbu;</seg>
+ <seg>&texinfo-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Texinfo</title>
+
+ <para>Prepare Texinfo for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+
+ <note>
+ <para>As part of the configure process, a test is made that indicates an
+ error for TestXS_la-TestXS.lo. This is not relevant for LFS and should be
+ ignored.</para>
+ </note>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-texinfo" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/toolchaintechnotes.xml b/chapter07/toolchaintechnotes.xml
new file mode 100644
index 000000000..63c9210e5
--- /dev/null
+++ b/chapter07/toolchaintechnotes.xml
@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-toolchaintechnotes">
+ <?dbhtml filename="toolchaintechnotes.html"?>
+
+ <title>Toolchain Technical Notes</title>
+
+ <para>This section explains some of the rationale and technical details
+ behind the overall build method. It is not essential to immediately
+ understand everything in this section. Most of this information will be
+ clearer after performing an actual build. This section can be referred
+ to at any time during the process.</para>
+
+ <para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
+ produce a temporary area that contains a known-good set of tools that can be
+ isolated from the host system. By using <command>chroot</command>, the
+ commands in the remaining chapters will be contained within that environment,
+ ensuring a clean, trouble-free build of the target LFS system. The build
+ process has been designed to minimize the risks for new readers and to provide
+ the most educational value at the same time.</para>
+
+ <para>The build process is based on the process of
+ <emphasis>cross-compilation</emphasis>. Cross-compilation is normally used
+ for building a compiler and its toolchain for a machine different from
+ the one that is used for the build. This is not strictly needed for LFS,
+ since the machine where the new system will run is the same as the one
+ used for the build. But cross-compilation has the great advantage that
+ anything that is cross-compiled cannot depend on the host environment.</para>
+
+ <sect2 id="cross-compile" xreflabel="About Cross-Compilation">
+
+ <title>About Cross-Compilation</title>
+
+ <para>Cross-compilation involves some concepts that deserve a section on
+ their own. Although this section may be omitted in a first reading, it
+ is strongly suggested to come back to it later in order to get a full
+ grasp of the build process.</para>
+
+ <para>Let us first define some terms used in this context:</para>
+
+ <variablelist>
+ <varlistentry><term>build</term><listitem>
+ <para>is the machine where we build programs. Note that this machine
+ is referred to as the <quote>host</quote> in other
+ sections.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term>host</term><listitem>
+ <para>is the machine/system where the built programs will run. Note
+ that this use of <quote>host</quote> is not the same as in other
+ sections.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term>target</term><listitem>
+ <para>is only used for compilers. It is the machine the compiler
+ produces code for. It may be different from both build and
+ host.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>As an example, let us imagine the following scenario: we may have a
+ compiler on a slow machine only, let's call the machine A, and the compiler
+ ccA. We may have also a fast machine (B), but with no compiler, and we may
+ want to produce code for a another slow machine (C). Then, to build a
+ compiler for machine C, we would have three stages:</para>
+
+ <informaltable align="center">
+ <tgroup cols="5">
+ <colspec colnum="1" align="center"/>
+ <colspec colnum="2" align="center"/>
+ <colspec colnum="3" align="center"/>
+ <colspec colnum="4" align="center"/>
+ <colspec colnum="5" align="left"/>
+ <thead>
+ <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+ <entry>Target</entry><entry>Action</entry></row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>1</entry><entry>A</entry><entry>A</entry><entry>B</entry>
+ <entry>build cross-compiler cc1 using ccA on machine A</entry>
+ </row>
+ <row>
+ <entry>2</entry><entry>A</entry><entry>B</entry><entry>B</entry>
+ <entry>build cross-compiler cc2 using cc1 on machine A</entry>
+ </row>
+ <row>
+ <entry>3</entry><entry>B</entry><entry>C</entry><entry>C</entry>
+ <entry>build compiler ccC using cc2 on machine B</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ <para>Then, all the other programs needed by machine C can be compiled
+ using cc2 on the fast machine B. Note that unless B can run programs
+ produced for C, there is no way to test the built programs until machine
+ C itself is running. For example, for testing ccC, we may want to add a
+ fourth stage:</para>
+
+ <informaltable align="center">
+ <tgroup cols="5">
+ <colspec colnum="1" align="center"/>
+ <colspec colnum="2" align="center"/>
+ <colspec colnum="3" align="center"/>
+ <colspec colnum="4" align="center"/>
+ <colspec colnum="5" align="left"/>
+ <thead>
+ <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+ <entry>Target</entry><entry>Action</entry></row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4</entry><entry>C</entry><entry>C</entry><entry>C</entry>
+ <entry>rebuild and test ccC using itself on machine C</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ <para>In the example above, only cc1 and cc2 are cross-compilers, that is,
+ they produce code for a machine different from the one they are run on.
+ The other compilers ccA and ccC produce code for the machine they are run
+ on. Such compilers are called <emphasis>native</emphasis> compilers.</para>
+
+ </sect2>
+
+ <sect2 id="lfs-cross">
+ <title>Implementation of Cross-Compilation for LFS</title>
+
+ <note>
+ <para>Almost all the build systems use names of the form
+ cpu-vendor-kernel-os referred to as the machine triplet. An astute
+ reader may wonder why a <quote>triplet</quote> refers to a four component
+ name. The reason is history: initially, three component names were enough
+ to designate unambiguously a machine, but with new machines and systems
+ appearing, that proved insufficient. The word <quote>triplet</quote>
+ remained. A simple way to determine your machine triplet is to run
+ the <command>config.guess</command>
+ script that comes with the source for many packages. Unpack the Binutils
+ sources and run the script: <userinput>./config.guess</userinput> and note
+ the output. For example, for a 32-bit Intel processor the
+ output will be <emphasis>i686-pc-linux-gnu</emphasis>. On a 64-bit
+ system it will be <emphasis>x86_64-pc-linux-gnu</emphasis>.</para>
+
+ <para>Also be aware of the name of the platform's dynamic linker, often
+ referred to as the dynamic loader (not to be confused with the standard
+ linker <command>ld</command> that is part of Binutils). The dynamic linker
+ provided by Glibc finds and loads the shared libraries needed by a
+ program, prepares the program to run, and then runs it. The name of the
+ dynamic linker for a 32-bit Intel machine will be <filename
+ class="libraryfile">ld-linux.so.2</filename> (<filename
+ class="libraryfile">ld-linux-x86-64.so.2</filename> for 64-bit systems). A
+ sure-fire way to determine the name of the dynamic linker is to inspect a
+ random binary from the host system by running: <userinput>readelf -l
+ &lt;name of binary&gt; | grep interpreter</userinput> and noting the
+ output. The authoritative reference covering all platforms is in the
+ <filename>shlib-versions</filename> file in the root of the Glibc source
+ tree.</para>
+ </note>
+
+ <para>In order to fake a cross compilation, the name of the host triplet
+ is slightly adjusted by changing the &quot;vendor&quot; field in the
+ <envar>LFS_TGT</envar> variable. We also use the
+ <parameter>--with-sysroot</parameter> when building the cross linker and
+ cross compiler, to tell them where to find the needed host files. This
+ ensures none of the other programs built in <xref
+ linkend="chapter-temporary-tools"/> can link to libraries on the build
+ machine. Only two stages are mandatory, and one more for tests:</para>
+
+ <informaltable align="center">
+ <tgroup cols="5">
+ <colspec colnum="1" align="center"/>
+ <colspec colnum="2" align="center"/>
+ <colspec colnum="3" align="center"/>
+ <colspec colnum="4" align="center"/>
+ <colspec colnum="5" align="left"/>
+ <thead>
+ <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+ <entry>Target</entry><entry>Action</entry></row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>1</entry><entry>pc</entry><entry>pc</entry><entry>lfs</entry>
+ <entry>build cross-compiler cc1 using cc-pc on pc</entry>
+ </row>
+ <row>
+ <entry>2</entry><entry>pc</entry><entry>lfs</entry><entry>lfs</entry>
+ <entry>build compiler cc-lfs using cc1 on pc</entry>
+ </row>
+ <row>
+ <entry>3</entry><entry>lfs</entry><entry>lfs</entry><entry>lfs</entry>
+ <entry>rebuild and test cc-lfs using itself on lfs</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ <para>In the above table, <quote>on pc</quote> means the commands are run
+ on a machine using the already installed distribution. <quote>On
+ lfs</quote> means the commands are run in a chrooted environment.</para>
+
+ <para>Now, there is more about cross-compiling: the C language is not
+ just a compiler, but also defines a standard library. In this book, the
+ GNU C library, named glibc, is used. This library must
+ be compiled for the lfs machine, that is, using the cross compiler cc1.
+ But the compiler itself uses an internal library implementing complex
+ instructions not available in the assembler instruction set. This
+ internal library is named libgcc, and must be linked to the glibc
+ library to be fully functional! Furthermore, the standard library for
+ C++ (libstdc++) also needs being linked to glibc. The solution
+ to this chicken and egg problem is to first build a degraded cc1+libgcc,
+ lacking some fuctionalities such as threads and exception handling, then
+ build glibc using this degraded compiler (glibc itself is not
+ degraded), then build libstdc++. But this last library will lack the
+ same functionalities as libgcc.</para>
+
+ <para>This is not the end of the story: the conclusion of the preceding
+ paragraph is that cc1 is unable to build a fully functional libstdc++, but
+ this is the only compiler available for building the C/C++ libraries
+ during stage 2! Of course, the compiler built during stage 2, cc-lfs,
+ would be able to build those libraries, but (i) the build system of
+ gcc does not know that it is usable on pc, and (ii) using it on pc
+ would be at risk of linking to the pc libraries, since cc-lfs is a native
+ compiler. So we have to build libstdc++ later, in chroot.</para>
+
+ </sect2>
+
+ <sect2 id="other-details">
+
+ <title>Other procedural details</title>
+
+ <para>The cross-compiler will be installed in a separate <filename
+ class="directory">$LFS/tools</filename> directory, since it will not
+ be part of the final system.</para>
+
+ <para>Binutils is installed first because the <command>configure</command>
+ runs of both GCC and Glibc perform various feature tests on the assembler
+ and linker to determine which software features to enable or disable. This
+ is more important than one might first realize. An incorrectly configured
+ GCC or Glibc can result in a subtly broken toolchain, where the impact of
+ such breakage might not show up until near the end of the build of an
+ entire distribution. A test suite failure will usually highlight this error
+ before too much additional work is performed.</para>
+
+ <para>Binutils installs its assembler and linker in two locations,
+ <filename class="directory">$LFS/tools/bin</filename> and <filename
+ class="directory">$LFS/tools/$LFS_TGT/bin</filename>. The tools in one
+ location are hard linked to the other. An important facet of the linker is
+ its library search order. Detailed information can be obtained from
+ <command>ld</command> by passing it the <parameter>--verbose</parameter>
+ flag. For example, <command>$LFS_TGT-ld --verbose | grep SEARCH</command>
+ will illustrate the current search paths and their order. It shows which
+ files are linked by <command>ld</command> by compiling a dummy program and
+ passing the <parameter>--verbose</parameter> switch to the linker. For
+ example,
+ <command>$LFS_TGT-gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</command>
+ will show all the files successfully opened during the linking.</para>
+
+ <para>The next package installed is GCC. An example of what can be
+ seen during its run of <command>configure</command> is:</para>
+
+<screen><computeroutput>checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as
+checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
+
+ <para>This is important for the reasons mentioned above. It also
+ demonstrates that GCC's configure script does not search the PATH
+ directories to find which tools to use. However, during the actual
+ operation of <command>gcc</command> itself, the same search paths are not
+ necessarily used. To find out which standard linker <command>gcc</command>
+ will use, run: <command>$LFS_TGT-gcc -print-prog-name=ld</command>.</para>
+
+ <para>Detailed information can be obtained from <command>gcc</command> by
+ passing it the <parameter>-v</parameter> command line option while compiling
+ a dummy program. For example, <command>gcc -v dummy.c</command> will show
+ detailed information about the preprocessor, compilation, and assembly
+ stages, including <command>gcc</command>'s included search paths and their
+ order.</para>
+
+ <para>Next installed are sanitized Linux API headers. These allow the
+ standard C library (Glibc) to interface with features that the Linux
+ kernel will provide.</para>
+
+ <para>The next package installed is Glibc. The most important
+ considerations for building Glibc are the compiler, binary tools, and
+ kernel headers. The compiler is generally not an issue since Glibc will
+ always use the compiler relating to the <parameter>--host</parameter>
+ parameter passed to its configure script; e.g. in our case, the compiler
+ will be <command>$LFS_TGT-gcc</command>. The binary tools and kernel
+ headers can be a bit more complicated. Therefore, take no risks and use
+ the available configure switches to enforce the correct selections. After
+ the run of <command>configure</command>, check the contents of the
+ <filename>config.make</filename> file in the <filename
+ class="directory">build</filename> directory for all important details.
+ Note the use of <parameter>CC="$LFS_TGT-gcc"</parameter> (with
+ <envar>$LFS_TGT</envar> expanded) to control which binary tools are used
+ and the use of the <parameter>-nostdinc</parameter> and
+ <parameter>-isystem</parameter> flags to control the compiler's include
+ search path. These items highlight an important aspect of the Glibc
+ package&mdash;it is very self-sufficient in terms of its build machinery
+ and generally does not rely on toolchain defaults.</para>
+
+ <para>As said above, the standard C++ library is compiled next, followed
+ by all the programs that need themselves to be built. The install step
+ uses the <envar>DESTDIR</envar> variable to have the programs land into
+ the LFS filesystem.</para>
+
+ <para>Then the native lfs compiler is built. First Binutils Pass 2, with
+ the same <envar>DESTDIR</envar> install as the other programs, then the
+ second pass of GCC, omitting libstdc++ and other non-important libraries.
+ Due to some weird logic in GCC's configure script,
+ <envar>CC_FOR_TARGET</envar> ends up as <command>cc</command> when host
+ is the same as target, but is different from build. This is why
+ <parameter>CC_FOR_TARGET=$LFS_TGT-gcc</parameter> is put explicitely into
+ the configure options.</para>
+
+ <para>Upon entering the chroot environment in <xref
+ linkend="chapter-building-system"/>, the first task is to install
+ libstdc++. Then temporary installations of programs needed for the proper
+ operation of the toolchain are performed. Programs needed for testing
+ other programs are also built. From this point onwards, the
+ core toolchain is self-contained and self-hosted. In the remainder of
+ the <xref linkend="chapter-building-system"/>, final versions of all the
+ packages needed for a fully functional system are built, tested and
+ installed.</para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/udev.xml b/chapter07/udev.xml
deleted file mode 100644
index 6060849be..000000000
--- a/chapter07/udev.xml
+++ /dev/null
@@ -1,342 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-config-udev">
- <?dbhtml filename="udev.html"?>
-
- <title>Overview of Device and Module Handling</title>
-
- <indexterm zone="ch-config-udev">
- <primary sortas="a-Udev">Udev</primary>
- <secondary>usage</secondary>
- </indexterm>
-
- <para>In <xref linkend="chapter-building-system"/>, we installed the Udev
- package when <phrase revision="sysv">eudev</phrase>
- <phrase revision="systemd">systemd</phrase> was built. Before we go into the
- details regarding how this works, a brief history of previous methods of
- handling devices is in order.</para>
-
- <para>Linux systems in general traditionally used a static device creation
- method, whereby a great many device nodes were created under <filename
- class="directory">/dev</filename> (sometimes literally thousands of nodes),
- regardless of whether the corresponding hardware devices actually existed. This
- was typically done via a <command>MAKEDEV</command> script, which contains a
- number of calls to the <command>mknod</command> program with the relevant
- major and minor device numbers for every possible device that might exist in
- the world.</para>
-
- <para>Using the Udev method, only those devices which are detected by the
- kernel get device nodes created for them. Because these device nodes will be
- created each time the system boots, they will be stored on a <systemitem
- class="filesystem">devtmpfs</systemitem> file system (a virtual file system
- that resides entirely in system memory). Device nodes do not require much
- space, so the memory that is used is negligible.</para>
-
- <sect2>
- <title>History</title>
-
- <para>In February 2000, a new filesystem called <systemitem
- class="filesystem">devfs</systemitem> was merged into the 2.3.46 kernel
- and was made available during the 2.4 series of stable kernels. Although
- it was present in the kernel source itself, this method of creating devices
- dynamically never received overwhelming support from the core kernel
- developers.</para>
-
- <para>The main problem with the approach adopted by <systemitem
- class="filesystem">devfs</systemitem> was the way it handled device
- detection, creation, and naming. The latter issue, that of device node
- naming, was perhaps the most critical. It is generally accepted that if
- device names are allowed to be configurable, then the device naming policy
- should be up to a system administrator, not imposed on them by any
- particular developer(s). The <systemitem
- class="filesystem">devfs</systemitem> file system also suffered from race
- conditions that were inherent in its design and could not be fixed without a
- substantial revision to the kernel. It was marked as deprecated for a long
- period &ndash; due to a lack of maintenance &ndash; and was finally removed
- from the kernel in June, 2006.</para>
-
- <para>With the development of the unstable 2.5 kernel tree, later released
- as the 2.6 series of stable kernels, a new virtual filesystem called
- <systemitem class="filesystem">sysfs</systemitem> came to be. The job of
- <systemitem class="filesystem">sysfs</systemitem> is to export a view of
- the system's hardware configuration to userspace processes. With this
- userspace-visible representation, the possibility of developing a userspace
- replacement for <systemitem class="filesystem">devfs</systemitem> became
- much more realistic.</para>
-
- </sect2>
-
- <sect2>
- <title>Udev Implementation</title>
-
- <sect3>
- <title>Sysfs</title>
-
- <para>The <systemitem class="filesystem">sysfs</systemitem> filesystem
- was mentioned briefly above. One may wonder how <systemitem
- class="filesystem">sysfs</systemitem> knows about the devices present on
- a system and what device numbers should be used for them. Drivers that
- have been compiled into the kernel directly register their objects with a
- <systemitem class="filesystem">sysfs</systemitem> (devtmpfs internally)
- as they are detected by the kernel. For drivers compiled as modules, this
- registration will happen when the module is loaded. Once the <systemitem
- class="filesystem">sysfs</systemitem> filesystem is mounted (on /sys),
- data which the drivers register with <systemitem
- class="filesystem">sysfs</systemitem> are available to userspace
- processes and to udevd for processing (including modifications to device
- nodes).</para>
-
- </sect3>
-
- <sect3>
- <title>Device Node Creation</title>
-
- <para>Device files are created by the kernel by the <systemitem
- class="filesystem">devtmpfs</systemitem> filesystem. Any driver that
- wishes to register a device node will go through the <systemitem
- class="filesystem">devtmpfs</systemitem> (via the driver core) to do it.
- When a <systemitem class="filesystem">devtmpfs</systemitem> instance is
- mounted on <filename class="directory">/dev</filename>, the device node
- will initially be created with a fixed name, permissions, and
- owner.</para>
-
- <para>A short time later, the kernel will send a uevent to <command>
- udevd</command>. Based on the rules specified in the files within the
- <filename class="directory">/etc/udev/rules.d</filename>, <filename
- class="directory">/lib/udev/rules.d</filename>, and <filename
- class="directory">/run/udev/rules.d</filename> directories, <command>
- udevd</command> will create additional symlinks to the device node, or
- change its permissions, owner, or group, or modify the internal
- <command>udevd</command> database entry (name) for that object.</para>
-
- <para>The rules in these three directories are numbered and all three
- directories are merged together. If <command>udevd</command> can't find a
- rule for the device it is creating, it will leave the permissions and
- ownership at whatever <systemitem
- class="filesystem">devtmpfs</systemitem> used initially.</para> </sect3>
-
- <sect3 id="module-loading">
- <title>Module Loading</title>
-
- <para>Device drivers compiled as modules may have aliases built into them.
- Aliases are visible in the output of the <command>modinfo</command>
- program and are usually related to the bus-specific identifiers of devices
- supported by a module. For example, the <emphasis>snd-fm801</emphasis>
- driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801,
- and has an alias of <quote>pci:v00001319d00000801sv*sd*bc04sc01i*</quote>.
- For most devices, the bus driver exports the alias of the driver that
- would handle the device via <systemitem
- class="filesystem">sysfs</systemitem>. E.g., the
- <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file
- might contain the string
- <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
- The default rules provided with Udev will cause <command>udevd</command>
- to call out to <command>/sbin/modprobe</command> with the contents of the
- <envar>MODALIAS</envar> uevent environment variable (which should be the
- same as the contents of the <filename>modalias</filename> file in sysfs),
- thus loading all modules whose aliases match this string after wildcard
- expansion.</para>
-
- <para>In this example, this means that, in addition to
- <emphasis>snd-fm801</emphasis>, the obsolete (and unwanted)
- <emphasis>forte</emphasis> driver will be loaded if it is
- available. See below for ways in which the loading of unwanted drivers can
- be prevented.</para>
-
- <para>The kernel itself is also able to load modules for network
- protocols, filesystems and NLS support on demand.</para>
-
- </sect3>
-
- <sect3>
- <title>Handling Hotpluggable/Dynamic Devices</title>
-
- <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3
- player, the kernel recognizes that the device is now connected and
- generates a uevent. This uevent is then handled by
- <command>udevd</command> as described above.</para>
-
- </sect3>
-
- </sect2>
-
- <sect2>
- <title>Problems with Loading Modules and Creating Devices</title>
-
- <para>There are a few possible problems when it comes to automatically
- creating device nodes.</para>
-
- <sect3>
- <title>A kernel module is not loaded automatically</title>
-
- <para>Udev will only load a module if it has a bus-specific alias and the
- bus driver properly exports the necessary aliases to <systemitem
- class="filesystem">sysfs</systemitem>. In other cases, one should
- arrange module loading by other means. With Linux-&linux-version;, Udev is
- known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI,
- SERIO, and FireWire devices.</para>
-
- <para>To determine if the device driver you require has the necessary
- support for Udev, run <command>modinfo</command> with the module name as
- the argument. Now try locating the device directory under
- <filename class="directory">/sys/bus</filename> and check whether there is
- a <filename>modalias</filename> file there.</para>
-
- <para>If the <filename>modalias</filename> file exists in <systemitem
- class="filesystem">sysfs</systemitem>, the driver supports the device and
- can talk to it directly, but doesn't have the alias, it is a bug in the
- driver. Load the driver without the help from Udev and expect the issue
- to be fixed later.</para>
-
- <para>If there is no <filename>modalias</filename> file in the relevant
- directory under <filename class="directory">/sys/bus</filename>, this
- means that the kernel developers have not yet added modalias support to
- this bus type. With Linux-&linux-version;, this is the case with ISA
- busses. Expect this issue to be fixed in later kernel versions.</para>
-
- <para>Udev is not intended to load <quote>wrapper</quote> drivers such as
- <emphasis>snd-pcm-oss</emphasis> and non-hardware drivers such as
- <emphasis>loop</emphasis> at all.</para>
-
- </sect3>
-
- <sect3>
- <title>A kernel module is not loaded automatically, and Udev is not
- intended to load it</title>
-
- <para>If the <quote>wrapper</quote> module only enhances the
- functionality provided by some other module (e.g.,
- <emphasis>snd-pcm-oss</emphasis> enhances the functionality of
- <emphasis>snd-pcm</emphasis> by making the sound cards available to OSS
- applications), configure <command>modprobe</command> to load the wrapper
- after Udev loads the wrapped module. To do this, add a
- <quote>softdep</quote> line to the corresponding
- <filename>/etc/modprobe.d/<replaceable>&lt;filename&gt;</replaceable>.conf</filename>
- file. For example:</para>
-
-<screen role="nodump"><literal>softdep snd-pcm post: snd-pcm-oss</literal></screen>
-
- <para>Note that the <quote>softdep</quote> command also allows
- <literal>pre:</literal> dependencies, or a mixture of both
- <literal>pre:</literal> and <literal>post:</literal>. See the
- <filename>modprobe.d(5)</filename> manual page for more information
- on <quote>softdep</quote> syntax and capabilities.</para>
-
- <para>If the module in question is not a wrapper and is useful by itself,
- configure the <command>modules</command> bootscript to load this
- module on system boot. To do this, add the module name to the
- <filename>/etc/sysconfig/modules</filename> file on a separate line.
- This works for wrapper modules too, but is suboptimal in that case.</para>
-
- </sect3>
-
- <sect3>
- <title>Udev loads some unwanted module</title>
-
- <para>Either don't build the module, or blacklist it in a
- <filename>/etc/modprobe.d/blacklist.conf</filename> file as done with the
- <emphasis>forte</emphasis> module in the example below:</para>
-
-<screen role="nodump"><literal>blacklist forte</literal></screen>
-
- <para>Blacklisted modules can still be loaded manually with the
- explicit <command>modprobe</command> command.</para>
-
- </sect3>
-
- <sect3>
- <title>Udev creates a device incorrectly, or makes a wrong symlink</title>
-
- <para>This usually happens if a rule unexpectedly matches a device. For
- example, a poorly-written rule can match both a SCSI disk (as desired)
- and the corresponding SCSI generic device (incorrectly) by vendor.
- Find the offending rule and make it more specific, with the help of the
- <command>udevadm info</command> command.</para>
-
- </sect3>
-
- <sect3>
- <title>Udev rule works unreliably</title>
-
- <para>This may be another manifestation of the previous problem. If not,
- and your rule uses <systemitem class="filesystem">sysfs</systemitem>
- attributes, it may be a kernel timing issue, to be fixed in later kernels.
- For now, you can work around it by creating a rule that waits for the used
- <systemitem class="filesystem">sysfs</systemitem> attribute and appending
- it to the <filename>/etc/udev/rules.d/10-wait_for_sysfs.rules</filename>
- file (create this file if it does not exist). Please notify the LFS
- Development list if you do so and it helps.</para>
-
- </sect3>
-
- <sect3>
- <title>Udev does not create a device</title>
-
- <para>Further text assumes that the driver is built statically into the
- kernel or already loaded as a module, and that you have already checked
- that Udev doesn't create a misnamed device.</para>
-
- <para>Udev has no information needed to create a device node if a kernel
- driver does not export its data to
- <systemitem class="filesystem">sysfs</systemitem>. This is most common
- with third party drivers from outside the kernel tree. Create a static
- device node in <filename>/lib/udev/devices</filename> with the
- appropriate major/minor numbers (see the file
- <filename>devices.txt</filename> inside the kernel documentation or the
- documentation provided by the third party driver vendor). The static
- device node will be copied to <filename class="directory">/dev</filename>
- by <command>udev</command>.</para>
-
- </sect3>
-
- <sect3>
- <title>Device naming order changes randomly after rebooting</title>
-
- <para>This is due to the fact that Udev, by design, handles uevents and
- loads modules in parallel, and thus in an unpredictable order. This will
- never be <quote>fixed</quote>. You should not rely upon the kernel device
- names being stable. Instead, create your own rules that make symlinks with
- stable names based on some stable attributes of the device, such as a
- serial number or the output of various *_id utilities installed by Udev.
- See <xref linkend="ch-config-symlinks"/> and
- <xref linkend="ch-config-network"/> for examples.</para>
-
- </sect3>
-
- </sect2>
-
- <sect2>
- <title>Useful Reading</title>
-
- <para>Additional helpful documentation is available at the following
- sites:</para>
-
- <itemizedlist>
-
- <listitem>
- <para>A Userspace Implementation of <systemitem class="filesystem">devfs</systemitem>
- <ulink url="http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf"/></para>
- </listitem>
-
- <listitem>
- <para>The <systemitem class="filesystem">sysfs</systemitem> Filesystem
- <ulink url="http://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf"/></para>
- </listitem>
-
-<!-- No longer available
- <listitem>
- <para>Pointers to further reading
- <ulink url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"/>
- </para>
- </listitem>
--->
- </itemizedlist>
-
- </sect2>
-
-</sect1>
diff --git a/chapter07/usage.xml b/chapter07/usage.xml
deleted file mode 100644
index 4a4cf6c36..000000000
--- a/chapter07/usage.xml
+++ /dev/null
@@ -1,710 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- <!ENTITY site SYSTEM "../appendices/rc.site.script">
- %general-entities;
-]>
-
-<sect1 id="ch-config-usage" revision="sysv">
- <?dbhtml filename="usage.html"?>
-
- <title>System V Bootscript Usage and Configuration</title>
-
- <indexterm zone="ch-config-usage">
- <primary sortas="a-Bootscripts">Bootscripts</primary>
- <secondary>usage</secondary>
- </indexterm>
-
- <sect2>
- <title>How Do the System V Bootscripts Work?</title>
-
- <para>Linux uses a special booting facility named SysVinit that is based on a
- concept of <emphasis>run-levels</emphasis>. It can be quite different from one
- system to another, so it cannot be assumed that because things worked in one
- particular Linux distribution, they should work the same in LFS too. LFS has its
- own way of doing things, but it respects generally accepted standards.</para>
-
- <para>SysVinit (which will be referred to as <quote>init</quote> from now on)
- works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels
- (actually, there are more run-levels, but they are for special cases and are
- generally not used. See <filename>init(8)</filename> for more details), and
- each one of those corresponds to the actions the computer is supposed to
- perform when it starts up. The default run-level is 3. Here are the
- descriptions of the different run-levels as they are implemented:</para>
-
-<literallayout>0: halt the computer
-1: single-user mode
-2: multi-user mode without networking
-3: multi-user mode with networking
-4: reserved for customization, otherwise does the same as 3
-5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>)
-6: reboot the computer</literallayout>
-
- </sect2>
-
- <sect2 id="conf-sysvinit" role="configuration">
- <title>Configuring Sysvinit</title>
-
- <indexterm zone="conf-sysvinit">
- <primary sortas="a-Sysvinit">Sysvinit</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <indexterm zone="conf-sysvinit">
- <primary sortas="e-/etc/inittab">/etc/inittab</primary>
- </indexterm>
-
- <para>During the kernel initialization, the first program that is run
- is either specified on the command line or, by default
- <command>init</command>. This program reads the initialization file
- <filename>/etc/inittab</filename>. Create this file with:</para>
-
-<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
-<literal># Begin /etc/inittab
-
-id:3:initdefault:
-
-si::sysinit:/etc/rc.d/init.d/rc S
-
-l0:0:wait:/etc/rc.d/init.d/rc 0
-l1:S1:wait:/etc/rc.d/init.d/rc 1
-l2:2:wait:/etc/rc.d/init.d/rc 2
-l3:3:wait:/etc/rc.d/init.d/rc 3
-l4:4:wait:/etc/rc.d/init.d/rc 4
-l5:5:wait:/etc/rc.d/init.d/rc 5
-l6:6:wait:/etc/rc.d/init.d/rc 6
-
-ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
-
-su:S016:once:/sbin/sulogin
-
-1:2345:respawn:/sbin/agetty --noclear tty1 9600
-2:2345:respawn:/sbin/agetty tty2 9600
-3:2345:respawn:/sbin/agetty tty3 9600
-4:2345:respawn:/sbin/agetty tty4 9600
-5:2345:respawn:/sbin/agetty tty5 9600
-6:2345:respawn:/sbin/agetty tty6 9600
-
-# End /etc/inittab</literal>
-EOF</userinput></screen>
-
- <para>An explanation of this initialization file is in the man page for
- <emphasis>inittab</emphasis>. For LFS, the key command that is run is
- <command>rc</command>. The initialization file above will instruct
- <command>rc</command> to run all the scripts starting with an S in the
- <filename class="directory">/etc/rc.d/rcS.d</filename> directory
- followed by all the scripts starting with an S in the <filename
- class="directory">/etc/rc.d/rc?.d</filename> directory where the question
- mark is specified by the initdefault value.</para>
-
- <para>As a convenience, the <command>rc</command> script reads a library of
- functions in <filename class="directory">/lib/lsb/init-functions</filename>.
- This library also reads an optional configuration file,
- <filename>/etc/sysconfig/rc.site</filename>. Any of the system
- configuration file parameters described in subsequent sections can be
- alternatively placed in this file allowing consolidation of all system
- parameters in this one file.</para>
-
- <para>As a debugging convenience, the functions script also logs all output
- to <filename>/run/var/bootlog</filename>. Since the <filename
- class="directory">/run</filename> directory is a tmpfs, this file is not
- persistent across boots, however it is appended to the more permanent file
- <filename>/var/log/boot.log</filename> at the end of the boot process.</para>
-
- <sect3 id="init-levels" >
- <title>Changing Run Levels</title>
-
- <para>Changing run-levels is done with <command>init
- <replaceable>&lt;runlevel&gt;</replaceable></command>, where
- <replaceable>&lt;runlevel&gt;</replaceable> is the target run-level. For example, to
- reboot the computer, a user could issue the <command>init 6</command> command,
- which is an alias for the <command>reboot</command> command. Likewise,
- <command>init 0</command> is an alias for the <command>halt</command>
- command.</para>
-
- <para>There are a number of directories under <filename
- class="directory">/etc/rc.d</filename> that look like <filename
- class="directory">rc?.d</filename> (where ? is the number of the run-level) and
- <filename class="directory">rcsysinit.d</filename>, all containing a number of
- symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
- an <emphasis>S</emphasis>, and all of them have two numbers following the
- initial letter. The K means to stop (kill) a service and the S means to start a
- service. The numbers determine the order in which the scripts are run, from 00
- to 99&mdash;the lower the number the earlier it gets executed. When
- <command>init</command> switches to another run-level, the appropriate services
- are either started or stopped, depending on the runlevel chosen.</para>
-
- <para>The real scripts are in <filename
- class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and
- the symlinks all point to them. K links and S links point to
- the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
- This is because the scripts can be called with different parameters like
- <parameter>start</parameter>, <parameter>stop</parameter>,
- <parameter>restart</parameter>, <parameter>reload</parameter>, and
- <parameter>status</parameter>. When a K link is encountered, the appropriate
- script is run with the <parameter>stop</parameter> argument. When an S link
- is encountered, the appropriate script is run with the
- <parameter>start</parameter> argument.</para>
-
- <para>There is one exception to this explanation. Links that start
- with an <emphasis>S</emphasis> in the <filename
- class="directory">rc0.d</filename> and <filename
- class="directory">rc6.d</filename> directories will not cause anything
- to be started. They will be called with the parameter
- <parameter>stop</parameter> to stop something. The logic behind this
- is that when a user is going to reboot or halt the system, nothing
- needs to be started. The system only needs to be stopped.</para>
-
- <para>These are descriptions of what the arguments make the scripts
- do:</para>
-
- <variablelist>
-
- <varlistentry>
- <term><parameter>start</parameter></term>
- <listitem>
- <para>The service is started.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>stop</parameter></term>
- <listitem>
- <para>The service is stopped.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>restart</parameter></term>
- <listitem>
- <para>The service is stopped and then started again.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>reload</parameter></term>
- <listitem>
- <para>The configuration of the service is updated.
- This is used after the configuration file of a service was modified, when
- the service does not need to be restarted.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>status</parameter></term>
- <listitem>
- <para>Tells if the service is running and with which PIDs.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- <para>Feel free to modify the way the boot process works (after all,
- it is your own LFS system). The files given here are an example of how
- it can be done.</para>
-
- </sect3>
- </sect2>
-
- <sect2>
- <title>Udev Bootscripts</title>
-
- <para>The <filename>/etc/rc.d/init.d/udev</filename> initscript starts
- <command>udevd</command>, triggers any "coldplug" devices that have
- already been created by the kernel and waits for any rules to complete.
- The script also unsets the uevent handler from the default of
- <filename>/sbin/hotplug </filename>. This is done because the kernel no
- longer needs to call out to an external binary. Instead
- <command>udevd</command> will listen on a netlink socket for uevents that
- the kernel raises.</para>
-
- <para>The <command>/etc/rc.d/init.d/udev_retry</command> initscript takes
- care of re-triggering events for subsystems whose rules may rely on
- filesystems that are not mounted until the <command>mountfs</command>
- script is run (in particular, <filename class="directory">/usr</filename>
- and <filename class="directory">/var</filename> may cause this). This
- script runs after the <command>mountfs</command> script, so those rules
- (if re-triggered) should succeed the second time around. It is
- configured from the <filename>/etc/sysconfig/udev_retry</filename> file;
- any words in this file other than comments are considered subsystem names
- to trigger at retry time. To find the subsystem of a device, use
- <command>udevadm info --attribute-walk &lt;device&gt;</command> where
- &lt;device&gt; is an absolute path in /dev or /sys such as /dev/sr0 or
- /sys/class/rtc.</para>
-
- <para>For information on kernel module loading and udev, see
- <xref linkend="module-loading"/>.</para>
-<!--
- <sect3>
- <title>Module Loading</title>
-
- <para>Device drivers compiled as modules may have aliases built into them.
- Aliases are visible in the output of the <command>modinfo</command>
- program and are usually related to the bus-specific identifiers of devices
- supported by a module. For example, the <emphasis>snd-fm801</emphasis>
- driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801,
- and has an alias of <quote>pci:v00001319d00000801sv*sd*bc04sc01i*</quote>.
- For most devices, the bus driver exports the alias of the driver that
- would handle the device via <systemitem
- class="filesystem">sysfs</systemitem>. E.g., the
- <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file
- might contain the string
- <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
- The default rules provided with Udev will cause <command>udevd</command>
- to call out to <command>/sbin/modprobe</command> with the contents of the
- <envar>MODALIAS</envar> uevent environment variable (which should be the
- same as the contents of the <filename>modalias</filename> file in sysfs),
- thus loading all modules whose aliases match this string after wildcard
- expansion.</para>
-
- <para>In this example, this means that, in addition to
- <emphasis>snd-fm801</emphasis>, the obsolete (and unwanted)
- <emphasis>forte</emphasis> driver will be loaded if it is
- available. See below for ways in which the loading of unwanted drivers can
- be prevented.</para>
-
- <para>The kernel itself is also able to load modules for network
- protocols, filesystems and NLS support on demand.</para>
-
- </sect3>
-
- <sect3>
- <title>Handling Hotpluggable/Dynamic Devices</title>
-
- <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3
- player, the kernel recognizes that the device is now connected and
- generates a uevent. This uevent is then handled by
- <command>udevd</command> as described above.</para>
-
- </sect3>
--->
- </sect2>
-
- <sect2 id="ch-config-clock">
- <title>Configuring the System Clock</title>
-
- <indexterm zone="ch-config-clock">
- <primary sortas="d-setclock">setclock</primary>
- <secondary>configuring</secondary></indexterm>
-
- <para>The <command>setclock</command> script reads the time from the hardware
- clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
- (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
- hardware clock's time to the local time using the
- <filename>/etc/localtime</filename> file (which tells the
- <command>hwclock</command> program which timezone the user is in). There is no
- way to detect whether or not the hardware clock is set to UTC, so this
- needs to be configured manually.</para>
-
- <para>The <command>setclock</command> is run via
- <application>udev</application> when the kernel detects the hardware
- capability upon boot. It can also be run manually with the stop parameter to
- store the system time to the CMOS clock.</para>
-
- <para>If you cannot remember whether or not the hardware clock is set to UTC,
- find out by running the <userinput>hwclock --localtime --show</userinput>
- command. This will display what the current time is according to the hardware
- clock. If this time matches whatever your watch says, then the hardware clock is
- set to local time. If the output from <command>hwclock</command> is not local
- time, chances are it is set to UTC time. Verify this by adding or subtracting
- the proper amount of hours for the timezone to the time shown by
- <command>hwclock</command>. For example, if you are currently in the MST
- timezone, which is also known as GMT -0700, add seven hours to the local
- time.</para>
-
- <para>Change the value of the <envar>UTC</envar> variable below
- to a value of <parameter>0</parameter> (zero) if the hardware clock
- is <emphasis>not</emphasis> set to UTC time.</para>
-
- <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
- the following:</para>
-
-<screen><userinput>cat &gt; /etc/sysconfig/clock &lt;&lt; "EOF"
-<literal># Begin /etc/sysconfig/clock
-
-UTC=1
-
-# Set this to any options you might need to give to hwclock,
-# such as machine hardware clock type for Alphas.
-CLOCKPARAMS=
-
-# End /etc/sysconfig/clock</literal>
-EOF</userinput></screen>
-
- <para>A good hint explaining how to deal with time on LFS is available
- at <ulink url="&hints-root;time.txt"/>. It explains issues such as
- time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
-
- <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
- in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
-
- </sect2>
-
- <sect2 id="ch-config-console">
- <?dbhtml filename="console.html"?>
-
- <title>Configuring the Linux Console</title>
-
- <indexterm zone="ch-config-console">
- <primary sortas="d-console">console</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <para>This section discusses how to configure the <command>console</command>
- bootscript that sets up the keyboard map, console font and console kernel log
- level. If non-ASCII characters (e.g., the copyright sign, the British pound
- sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
- of this section can be skipped. Without the configuration file, (or
- equivalent settings in <filename>rc.site</filename>), the
- <command>console</command> bootscript will do nothing.</para>
-
- <para>The <command>console</command> script reads the
- <filename>/etc/sysconfig/console</filename> file for configuration
- information. Decide which keymap and screen font will be used. Various
- language-specific HOWTOs can also help with this, see <ulink
- url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
- doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
- and <filename class="directory">/usr/share/consolefonts</filename> directories
- for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
- <filename>setfont(8)</filename> manual pages to determine the correct
- arguments for these programs.</para>
-
- <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
- of the form: VARIABLE="value". The following variables are recognized:</para>
- <variablelist>
-
- <varlistentry>
- <term>LOGLEVEL</term>
- <listitem>
- <para>This variable specifies the log level for kernel messages sent
- to the console as set by <command>dmesg -n</command>. Valid levels are
- from "1" (no messages) to "8". The default level is "7".</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>KEYMAP</term>
- <listitem>
- <para>This variable specifies the arguments for the
- <command>loadkeys</command> program, typically, the name of keymap
- to load, e.g., <quote>it</quote>. If this variable is not set, the
- bootscript will not run the <command>loadkeys</command> program,
- and the default kernel keymap will be used. Note that a few keymaps
- have multiple versions with the same name (cz and its variants in
- qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and
- qwerty/). In these cases the parent directory should also be specified
- (e.g. qwerty/es) to ensure the proper keymap is loaded.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>KEYMAP_CORRECTIONS</term>
- <listitem>
- <para>This (rarely used) variable
- specifies the arguments for the second call to the
- <command>loadkeys</command> program. This is useful if the stock keymap
- is not completely satisfactory and a small adjustment has to be made. E.g.,
- to include the Euro sign into a keymap that normally doesn't have it,
- set this variable to <quote>euro2</quote>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>FONT</term>
- <listitem>
- <para>This variable specifies the arguments for the
- <command>setfont</command> program. Typically, this includes the font
- name, <quote>-m</quote>, and the name of the application character
- map to load. E.g., in order to load the <quote>lat1-16</quote> font
- together with the <quote>8859-1</quote> application character map
- (as it is appropriate in the USA),
- <!-- because of the copyright sign -->
- set this variable to <quote>lat1-16 -m 8859-1</quote>.
- In UTF-8 mode, the kernel uses the application character map for
- conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
- the argument of the "-m" parameter should be set to the encoding of the
- composed key codes in the keymap.</para>
-
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>UNICODE</term>
- <listitem>
- <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
- <quote>true</quote> in order to put the
- console into UTF-8 mode. This is useful in UTF-8 based locales and
- harmful otherwise.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>LEGACY_CHARSET</term>
- <listitem>
- <para>For many keyboard layouts, there is no stock Unicode keymap in
- the Kbd package. The <command>console</command> bootscript will
- convert an available keymap to UTF-8 on the fly if this variable is
- set to the encoding of the available non-UTF-8 keymap.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- <para>Some examples:</para>
-
- <itemizedlist>
-
- <listitem>
- <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
- generally needed. E.g., for a Polish setup, one would use:</para>
-<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
-<literal># Begin /etc/sysconfig/console
-
-KEYMAP="pl2"
-FONT="lat2a-16 -m 8859-2"
-
-# End /etc/sysconfig/console</literal>
-EOF</userinput></screen>
- </listitem>
-
- <listitem>
- <para>As mentioned above, it is sometimes necessary to adjust a
- stock keymap slightly. The following example adds the Euro symbol to the
- German keymap:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
-<literal># Begin /etc/sysconfig/console
-
-KEYMAP="de-latin1"
-KEYMAP_CORRECTIONS="euro2"
-FONT="lat0-16 -m 8859-15"
-UNICODE="1"
-
-# End /etc/sysconfig/console</literal>
-EOF</userinput></screen>
- </listitem>
-
- <listitem>
- <para>The following is a Unicode-enabled example for Bulgarian, where a
- stock UTF-8 keymap exists:</para>
-<!-- This is what is used by jhalfs for creating the console file: whenever
- you change the following, please inform the jhalfs maintainer(s). -->
-<screen><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
-<literal># Begin /etc/sysconfig/console
-
-UNICODE="1"
-KEYMAP="bg_bds-utf8"
-FONT="LatArCyrHeb-16"
-
-# End /etc/sysconfig/console</literal>
-EOF</userinput></screen>
- </listitem>
-
- <listitem>
- <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
- example, bright colors are no longer available on the Linux console unless
- a framebuffer is used. If one wants to have bright colors without
- framebuffer and can live without characters not belonging to his language,
- it is still possible to use a language-specific 256-glyph font, as
- illustrated below:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
-<literal># Begin /etc/sysconfig/console
-
-UNICODE="1"
-KEYMAP="bg_bds-utf8"
-FONT="cyr-sun16"
-
-# End /etc/sysconfig/console</literal>
-EOF</userinput></screen>
- </listitem>
-
- <listitem>
- <para>The following example illustrates keymap autoconversion from
- ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
-
-<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
-<literal># Begin /etc/sysconfig/console
-
-UNICODE="1"
-KEYMAP="de-latin1"
-KEYMAP_CORRECTIONS="euro2"
-LEGACY_CHARSET="iso-8859-15"
-FONT="LatArCyrHeb-16 -m 8859-15"
-
-# End /etc/sysconfig/console</literal>
-EOF</userinput></screen>
- </listitem>
-
- <listitem>
- <para>Some keymaps have dead keys (i.e., keys that don't produce a
- character by themselves, but put an accent on the character produced
- by the next key) or define composition rules (such as: <quote>press
- Ctrl+. A E to get &AElig;</quote> in the default keymap).
- Linux-&linux-version; interprets dead keys and composition rules in the
- keymap correctly only when the source characters to be composed together
- are not multibyte. This deficiency doesn't affect keymaps for European
- languages, because there accents are added to unaccented ASCII
- characters, or two ASCII characters are composed together. However, in
- UTF-8 mode it is a problem, e.g., for the Greek language, where one
- sometimes needs to put an accent on the letter <quote>alpha</quote>.
- The solution is either to avoid the use of UTF-8, or to install the
- X window system that doesn't have this limitation in its input
- handling.</para>
- </listitem>
-
- <listitem>
- <para>For Chinese, Japanese, Korean and some other languages, the Linux
- console cannot be configured to display the needed characters. Users
- who need such languages should install the X Window System, fonts that
- cover the necessary character ranges, and the proper input method (e.g.,
- SCIM, it supports a wide variety of languages).</para>
- </listitem>
-
- </itemizedlist>
-
- <!-- Added because folks keep posting their console file with X questions
- to blfs-support list -->
- <note>
- <para>The <filename>/etc/sysconfig/console</filename> file only controls
- the Linux text console localization. It has nothing to do with setting
- the proper keyboard layout and terminal fonts in the X Window System, with
- ssh sessions or with a serial console. In such situations, limitations
- mentioned in the last two list items above do not apply.</para>
- </note>
-
- </sect2>
-
- <sect2 id="ch-config-createfiles">
- <title>Creating Files at Boot</title>
-
- <indexterm zone="ch-config-createfiles">
- <primary sortas="d-createfiles">File creation at boot</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <para>At times, it is desired to create files at boot time. For instance,
- the <filename class="directory">/tmp/.ICE-unix</filename> directory
- may be desired. This can be done by creating an entry in the
- <filename>/etc/sysconfig/createfiles</filename> configuration script.
- The format of this file is embedded in the comments of the default
- configuration file.</para>
- </sect2>
-
- <sect2 id="ch-config-sysklogd">
- <title>Configuring the sysklogd Script</title>
-
- <indexterm zone="ch-config-sysklogd">
- <primary sortas="d-sysklogd">sysklogd</primary>
- <secondary>configuring</secondary>
- </indexterm>
-
- <para>The <filename>sysklogd</filename> script invokes the
- <command>syslogd</command> program as a part of System V initialization. The
- <parameter>-m 0</parameter> option turns off the periodic timestamp mark that
- <command>syslogd</command> writes to the log files every 20 minutes by
- default. If you want to turn on this periodic timestamp mark, edit
- <filename>/etc/sysconfig/rc.site</filename> and define the variable
- SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
- set the variable to a null value:</para>
-
-<screen role="nodump">SYSKLOGD_PARMS=</screen>
-
- <para>See <userinput>man syslogd</userinput> for more options.</para>
-
- </sect2>
-
- <sect2 id="ch-config-site">
- <title>The rc.site File</title>
-
- <indexterm zone="ch-config-site">
- <primary sortas="a-rc.site">rc.site</primary>
- </indexterm>
-
- <para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
- settings that are automatically set for each SystemV boot script. It can
- alternatively set the values specified in the <filename>hostname</filename>,
- <filename>console</filename>, and <filename>clock</filename> files in the
- <filename class='directory'>/etc/sysconfig/</filename> directory. If the
- associated variables are present in both these separate files and
- <filename>rc.site</filename>, the values in the script specific files have
- precedence. </para>
-
- <para><filename>rc.site</filename> also contains parameters that can
- customize other aspects of the boot process. Setting the IPROMPT variable
- will enable selective running of bootscripts. Other options are described
- in the file comments. The default version of the file is as follows:</para>
-
- <!-- Use role to fix a pdf generation problem -->
- <screen role="auto">&site;</screen>
-
- <sect3>
- <title>Customizing the Boot and Shutdown Scripts</title>
-
- <para>The LFS boot scripts boot and shut down a system in a fairly
- efficient manner, but there are a few tweaks that you can make in the
- rc.site file to improve speed even more and to adjust messages according
- to your preferences. To do this, adjust the settings in
- the <filename>/etc/sysconfig/rc.site</filename> file above.</para>
-
- <itemizedlist>
-
- <listitem><para>During the boot script <filename>udev</filename>, there is
- a call to <command>udev settle</command> that requires some time to
- complete. This time may or may not be required depending on devices present
- in the system. If you only have simple partitions and a single ethernet
- card, the boot process will probably not need to wait for this command. To
- skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem>
-
- <listitem><para>The boot script <filename>udev_retry</filename> also runs
- <command>udev settle</command> by default. This command is only needed by
- default if the <filename class='directory'>/var</filename> directory is
- separately mounted. This is because the clock needs the file
- <filename>/var/lib/hwclock/adjtime</filename>. Other customizations may
- also need to wait for udev to complete, but in many installations it is not
- needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y.
- </para></listitem>
-
- <listitem><para>By default, the file system checks are silent. This can
- appear to be a delay during the bootup process. To turn on the
- <command>fsck</command> output, set the variable VERBOSE_FSCK=y.
- </para></listitem>
-
- <listitem><para>When rebooting, you may want to skip the filesystem check,
- <command>fsck</command>, completely. To do this, either create the file
- <filename>/fastboot</filename> or reboot the system with the command
- <command>/sbin/shutdown -f -r now</command>. On the other hand, you can
- force all file systems to be checked by creating
- <filename>/forcefsck</filename> or running <command>shutdown</command> with
- the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>.
- </para>
-
- <para>Setting the variable FASTBOOT=y will disable <command>fsck</command>
- during the boot process until it is removed. This is not recommended
- on a permanent basis.</para></listitem>
-
- <listitem><para>Normally, all files in the <filename
- class='directory'>/tmp</filename> directory are deleted at boot time.
- Depending on the number of files or directories present, this can cause a
- noticeable delay in the boot process. To skip removing these files set the
- variable SKIPTMPCLEAN=y.</para></listitem>
-
- <listitem><para>During shutdown, the <command>init</command> program sends
- a TERM signal to each program it has started (e.g. agetty), waits for a set
- time (default 3 seconds), and sends each process a KILL signal and waits
- again. This process is repeated in the <command>sendsignals</command>
- script for any processes that are not shut down by their own scripts. The
- delay for <command>init</command> can be set by passing a parameter. For
- example to remove the delay in <command>init</command>, pass the -t0
- parameter when shutting down or rebooting (e.g. <command>/sbin/shutdown
- -t0 -r now</command>). The delay for the <command>sendsignals</command>
- script can be skipped by setting the parameter
- KILLDELAY=0.</para></listitem>
-
- </itemizedlist>
-
- </sect3>
- </sect2>
-</sect1>
diff --git a/chapter07/util-linux.xml b/chapter07/util-linux.xml
new file mode 100644
index 000000000..6aebad7a1
--- /dev/null
+++ b/chapter07/util-linux.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-util-linux" role="wrap">
+ <?dbhtml filename="util-linux.html"?>
+
+ <sect1info condition="script">
+ <productname>util-linux</productname>
+ <productnumber>&util-linux-version;</productnumber>
+ <address>&util-linux-url;</address>
+ </sect1info>
+
+ <title>Util-linux-&util-linux-version;</title>
+
+ <indexterm zone="ch-tools-util-linux">
+ <primary sortas="a-Util-linux">Util-linux</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <para>The Util-linux package contains miscellaneous utility programs.</para>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&util-linux-ch5-sbu;</seg>
+ <seg>&util-linux-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Util-linux</title>
+
+ <para>First create a directory
+ to enable storage for the <command>hwclock</command> program:</para>
+
+<screen><userinput remap="pre">mkdir -pv /var/lib/hwclock</userinput></screen>
+
+ <para>Prepare Util-linux for compilation:</para>
+
+<screen><userinput remap="configure">./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
+ --docdir=/usr/share/doc/util-linux-&util-linux-version; \
+ --disable-chfn-chsh \
+ --disable-login \
+ --disable-nologin \
+ --disable-su \
+ --disable-setpriv \
+ --disable-runuser \
+ --disable-pylibmount \
+ --disable-static \
+ --without-python</userinput></screen>
+
+ <variablelist>
+ <title>The meaning of the configure options:</title>
+<!-- TODO -->
+ <varlistentry>
+ <term><parameter>ADJTIME_PATH=/var/lib/hwclock/adjtime</parameter></term>
+ <listitem>
+ <para>This sets the location of the file recording information about
+ the hardware clock, in accordance to the FHS. This is not stricly
+ needed fot his temporary tool, but it prevent creating a file
+ at another location, which would not be overwritten or removed
+ when building the final util-linux.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--disable-*</parameter></term>
+ <listitem>
+ <para>Those switches prevent warnings about building components
+ that require packages not in LFS or not installed yet.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>--without-python</parameter></term>
+ <listitem>
+ <para>This switch disables using <application>Python</application>.
+ It avoids trying to build unneeded bindings.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+
+ <para>Details on this package are located in
+ <xref linkend="contents-utillinux" role="."/></para>
+
+ </sect2>
+
+</sect1>
diff --git a/chapter07/xz.xml b/chapter07/xz.xml
new file mode 100644
index 000000000..83e4a96d6
--- /dev/null
+++ b/chapter07/xz.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % general-entities SYSTEM "../general.ent">
+ %general-entities;
+]>
+
+<sect1 id="ch-tools-xz" role="wrap">
+ <?dbhtml filename="xz.html"?>
+
+ <sect1info condition="script">
+ <productname>xz</productname>
+ <productnumber>&xz-version;</productnumber>
+ <address>&xz-url;</address>
+ </sect1info>
+
+ <title>Xz-&xz-version;</title>
+
+ <indexterm zone="ch-tools-xz">
+ <primary sortas="a-xz">Xz</primary>
+ <secondary>tools</secondary>
+ </indexterm>
+
+ <sect2 role="package">
+ <title/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="../chapter06/xz.xml"
+ xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+ <segmentedlist>
+ <segtitle>&buildtime;</segtitle>
+ <segtitle>&diskspace;</segtitle>
+
+ <seglistitem>
+ <seg>&xz-ch5-sbu;</seg>
+ <seg>&xz-ch5-du;</seg>
+ </seglistitem>
+ </segmentedlist>
+
+ </sect2>
+
+ <sect2 role="installation">
+ <title>Installation of Xz</title>
+
+ <para>Prepare Xz for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess) \
+ --disable-static \
+ --docdir=/usr/share/doc/xz-&xz-version;</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+ <para>Make sure that all essential files are in the correct directory:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
+mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
+ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so</userinput></screen>
+
+ </sect2>
+
+ <sect2 role="content">
+ <title/>
+ <para>Details on this package are located in<!-- TODO
+ <xref linkend="contents-xz" role="."/> --></para>
+
+ </sect2>
+
+</sect1>