aboutsummaryrefslogtreecommitdiffstats
path: root/chapter05
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2020-06-16 11:56:28 +0000
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2020-06-16 11:56:28 +0000
commit675606bde2ba53946537b42a5aa576692a311621 (patch)
treeaf20c20ce3841c16b24d0b9903af6878a4a0f5a6 /chapter05
parent560065f976e371779928dbf8b9428217f3f57331 (diff)
parent1cd59612d00603c9ce773ad821a15d20bc4fa0b7 (diff)
Split Chapter 5 into three separate chapters.
Implement a new method of cross-building the LFS tool chain and other tools to simplify the method of isolating the new system from the original host. This will be the start of LFS-10.0. Move old trunk/BOOK to branches/old-trunk. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11946 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter05')
-rw-r--r--chapter05/bash.xml101
-rw-r--r--chapter05/binutils-pass1.xml43
-rw-r--r--chapter05/binutils-pass2.xml156
-rw-r--r--chapter05/bison.xml72
-rw-r--r--chapter05/bzip2.xml91
-rw-r--r--chapter05/changingowner.xml53
-rw-r--r--chapter05/chapter05.xml32
-rw-r--r--chapter05/coreutils.xml99
-rw-r--r--chapter05/dejagnu.xml91
-rw-r--r--chapter05/diffutils.xml74
-rw-r--r--chapter05/expect.xml167
-rw-r--r--chapter05/file.xml74
-rw-r--r--chapter05/findutils.xml80
-rw-r--r--chapter05/flex.xml72
-rw-r--r--chapter05/gawk.xml74
-rw-r--r--chapter05/gcc-pass1.xml139
-rw-r--r--chapter05/gcc-pass2.xml232
-rw-r--r--chapter05/generalinstructions.xml10
-rw-r--r--chapter05/gettext.xml98
-rw-r--r--chapter05/glibc.xml144
-rw-r--r--chapter05/grep.xml74
-rw-r--r--chapter05/gzip.xml74
-rw-r--r--chapter05/introduction.xml21
-rw-r--r--chapter05/libstdc++.xml47
-rw-r--r--chapter05/linux-headers.xml152
-rw-r--r--chapter05/m4.xml79
-rw-r--r--chapter05/make.xml90
-rw-r--r--chapter05/ncurses.xml123
-rw-r--r--chapter05/patch.xml74
-rw-r--r--chapter05/perl.xml103
-rw-r--r--chapter05/python.xml101
-rw-r--r--chapter05/sed.xml74
-rw-r--r--chapter05/stripping.xml46
-rw-r--r--chapter05/tar.xml74
-rw-r--r--chapter05/tcl.xml163
-rw-r--r--chapter05/texinfo.xml80
-rw-r--r--chapter05/toolchaintechnotes.xml463
-rw-r--r--chapter05/util-linux.xml124
-rw-r--r--chapter05/xz.xml74
39 files changed, 627 insertions, 3311 deletions
diff --git a/chapter05/bash.xml b/chapter05/bash.xml
deleted file mode 100644
index 21df197e7..000000000
--- a/chapter05/bash.xml
+++ /dev/null
@@ -1,101 +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-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>First, apply the following patch to fix various bugs that have been
- addressed upstream:</para>
-
-<screen><userinput remap="pre">patch -Np1 -i ../&bash-fixes-patch;</userinput></screen>
--->
- <para>Prepare Bash for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools --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>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Bash test suite anyway, issue the following command:</para>
-
-
-<screen><userinput remap="test">make tests</userinput></screen>
-
- <para>Install the package:</para>
-
-<screen><userinput remap="install">make install</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 /tools/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/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml
index b54941a23..914e119b8 100644
--- a/chapter05/binutils-pass1.xml
+++ b/chapter05/binutils-pass1.xml
@@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="../chapter06/binutils.xml"
+ href="../chapter08/binutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
- <seg>&binutils-ch5p1-sbu;</seg>
- <seg>&binutils-ch5p1-du;</seg>
+ <seg>&binutils-tmpp1-sbu;</seg>
+ <seg>&binutils-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
@@ -63,18 +63,14 @@ cd build</userinput></screen>
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; ...
+ command like this: <userinput>time { ./configure ... &amp;&amp; make
&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=/tools \
+<screen><userinput remap="configure">../configure --prefix=$LFS/tools \
--with-sysroot=$LFS \
- --with-lib-path=/tools/lib \
--target=$LFS_TGT \
--disable-nls \
--disable-werror</userinput></screen>
@@ -83,11 +79,11 @@ cd build</userinput></screen>
<title>The meaning of the configure options:</title>
<varlistentry>
- <term><parameter>--prefix=/tools</parameter></term>
+ <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">/tools</filename>
- directory.</para>
+ binutils programs in the <filename
+ class="directory">$LFS/tools</filename> directory.</para>
</listitem>
</varlistentry>
@@ -100,20 +96,12 @@ cd build</userinput></screen>
</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
+ <command>configure</command> script to adjust binutil's build system
for building a cross linker. </para>
</listitem>
</varlistentry>
@@ -140,19 +128,6 @@ cd build</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
- <para>Compilation is now complete. Ordinarily we would now run the
- test suite, but at this early stage the test suite framework (Tcl,
- Expect, and DejaGNU) is not yet in place. The benefits of running the
- tests at this point are minimal since the programs from this
- first pass will soon be replaced by those from the second.</para>
-
- <para>If building on x86_64, create a symlink to ensure the sanity of
- the toolchain:</para>
-
-<screen><userinput remap="install">case $(uname -m) in
- x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
-esac</userinput></screen>
-
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml
deleted file mode 100644
index 4e3dcb9f6..000000000
--- a/chapter05/binutils-pass2.xml
+++ /dev/null
@@ -1,156 +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-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">CC=$LFS_TGT-gcc \
-AR=$LFS_TGT-ar \
-RANLIB=$LFS_TGT-ranlib \
-../configure \
- --prefix=/tools \
- --disable-nls \
- --disable-werror \
- --with-lib-path=/tools/lib \
- --with-sysroot</userinput></screen>
-
- <variablelist>
- <title>The meaning of the new configure options:</title>
-
- <varlistentry>
- <term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
- <listitem>
- <para>Because this is really a native build of Binutils, setting these
- variables ensures that the build system uses the cross-compiler and
- associated tools instead of the ones on the host system.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--with-lib-path=/tools/lib</parameter></term>
- <listitem>
- <para>This tells the configure script to specify the library
- search path during the compilation of Binutils, resulting in
- <filename class="directory">/tools/lib</filename> being passed
- to the linker. This prevents the linker from searching through
- library directories on the host.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--with-sysroot</parameter></term>
- <listitem>
- <para>This defines a default (non-existent) sysroot directory
- <filename class="directory">/tools/$LFS_TGT/sys-root</filename>.
- It is useful when looking for shared objects which are required by
- other shared objects explicitly included on the linker's command
- line. Those objects are searched into the directories listed in
- <filename>&lt;sysroot&gt;/etc/ld.so.conf</filename>, and failing
- that, into the linker search path, which is right. If this switch
- is not given, <filename>/etc/ld.so.conf</filename> on the host
- is used, that is, programs may be linked to libraries on
- the host, which we want to avoid.</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>
-
- <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
- the next chapter:</para>
-
-<screen><userinput remap="adjust">make -C ld clean
-make -C ld LIB_PATH=/usr/lib:/lib
-cp -v ld/ld-new /tools/bin</userinput></screen>
-
- <variablelist>
- <title>The meaning of the make parameters:</title>
-
- <varlistentry>
- <term><parameter>-C ld clean</parameter></term>
- <listitem>
- <para>This tells the make program to remove all compiled
- files in the <filename class="directory">ld</filename>
- subdirectory.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
- <listitem>
- <para>This option rebuilds everything in the <filename
- class="directory">ld</filename> subdirectory. Specifying the
- <envar>LIB_PATH</envar> Makefile variable on the command line
- allows us to override the default value of the temporary tools
- and point it to the proper final path. The value of this variable
- specifies the linker's default library search path. This
- preparation is used in the next chapter.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- </sect2>
-
- <sect2 role="content">
- <title/>
-
- <para>Details on this package are located in
- <xref linkend="contents-binutils" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/bison.xml b/chapter05/bison.xml
deleted file mode 100644
index 98c8cdc35..000000000
--- a/chapter05/bison.xml
+++ /dev/null
@@ -1,72 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>To test the results, issue:</para>
-
-<screen><userinput remap="test">make check</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/chapter05/bzip2.xml b/chapter05/bzip2.xml
deleted file mode 100644
index 4f1e3aab9..000000000
--- a/chapter05/bzip2.xml
+++ /dev/null
@@ -1,91 +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-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>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 -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</userinput></screen>
-
- <para>Install the package:</para>
-
-<screen><userinput remap="install">make PREFIX=/tools install
-cp -v bzip2-shared /tools/bin/bzip2
-cp -av libbz2.so* /tools/lib
-ln -sv libbz2.so.1.0 /tools/lib/libbz2.so</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/chapter05/changingowner.xml b/chapter05/changingowner.xml
deleted file mode 100644
index 96a15b027..000000000
--- a/chapter05/changingowner.xml
+++ /dev/null
@@ -1,53 +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-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 <filename class="directory">$LFS/tools</filename> directory
- is owned by the user <systemitem class="username">lfs</systemitem>, a user
- that exists only on the host system. If the <filename
- class="directory">$LFS/tools</filename> directory is kept as is, 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 the
- <filename class="directory">$LFS/tools</filename> directory and all the files
- therein, 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/tools</filename> directory to
- user <systemitem class="username">root</systemitem> by running the following
- command:</para>
-
-<screen><userinput>chown -R root:root $LFS/tools</userinput></screen>
-
- <para>Although the <filename class="directory">$LFS/tools</filename> directory
- can be deleted once the LFS system has been finished, it can be retained to build
- additional LFS systems <emphasis>of the same book version</emphasis>. How best
- to backup <filename class="directory">$LFS/tools</filename> is a matter of
- personal preference.</para>
-
- <caution>
- <para>If you intend to keep the temporary tools for use in building future LFS
- systems, <emphasis>now</emphasis> is the time to back them up. Subsequent
- commands in chapter 6 will alter the tools currently in place, rendering them
- useless for future builds.</para>
- </caution>
-
-</sect1>
diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml
index b6ab70ada..1a2393b93 100644
--- a/chapter05/chapter05.xml
+++ b/chapter05/chapter05.xml
@@ -5,11 +5,11 @@
%general-entities;
]>
-<chapter id="chapter-temporary-tools" xreflabel="Chapter&nbsp;5">
+<chapter id="chapter-cross-tools" xreflabel="Chapter&nbsp;5">
<?dbhtml dir="chapter05"?>
<?dbhtml filename="chapter05.html"?>
- <title>Constructing a Temporary System</title>
+ <title>Compiling a Cross-Toolchain</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="toolchaintechnotes.xml"/>
@@ -19,33 +19,5 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="linux-headers.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass2.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.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"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="m4.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ncurses.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bash.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="coreutils.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="diffutils.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="findutils.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gawk.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="grep.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gzip.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="make.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="patch.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="sed.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tar.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="xz.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stripping.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
</chapter>
diff --git a/chapter05/coreutils.xml b/chapter05/coreutils.xml
deleted file mode 100644
index 6f56a4108..000000000
--- a/chapter05/coreutils.xml
+++ /dev/null
@@ -1,99 +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-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=/tools --enable-install-program=hostname</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>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Coreutils test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make RUN_EXPENSIVE_TESTS=yes check</userinput></screen>
-
- <para>The <parameter>RUN_EXPENSIVE_TESTS=yes</parameter> parameter tells the
- test suite to run several additional tests that are considered
- relatively expensive (in terms of CPU power and memory usage) on some
- platforms, but generally are not a problem on Linux.</para>
-
- <para>Install the package:</para>
-
-<screen><userinput remap="install">make 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>
--->
- </sect2>
-
- <sect2 role="content">
- <title/>
-
- <para>Details on this package are located in
- <xref linkend="contents-coreutils" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/dejagnu.xml b/chapter05/dejagnu.xml
deleted file mode 100644
index a821e9bba..000000000
--- a/chapter05/dejagnu.xml
+++ /dev/null
@@ -1,91 +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-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=/tools</userinput></screen>
-
- <para>Build and install the package:</para>
-
-<screen><userinput remap="install">make install</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/chapter05/diffutils.xml b/chapter05/diffutils.xml
deleted file mode 100644
index 62ba35874..000000000
--- a/chapter05/diffutils.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Diffutils test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-diffutils" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/expect.xml b/chapter05/expect.xml
deleted file mode 100644
index a2cc67d0e..000000000
--- a/chapter05/expect.xml
+++ /dev/null
@@ -1,167 +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-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>First, force Expect's configure script to use <filename>/bin/stty</filename>
- instead of a <filename>/usr/local/bin/stty</filename> it may find on the host system.
- This will ensure that our test suite tools remain sane for the final builds of our
- toolchain:</para>
-
-<screen><userinput remap="pre">cp -v configure{,.orig}
-sed 's:/usr/local/bin:/bin:' configure.orig &gt; configure</userinput></screen>
-
- <para>Now prepare Expect for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools \
- --with-tcl=/tools/lib \
- --with-tclinclude=/tools/include</userinput></screen>
-
- <variablelist>
- <title>The meaning of the configure options:</title>
-
- <varlistentry>
- <term><parameter>--with-tcl=/tools/lib</parameter></term>
- <listitem>
- <para>This ensures that the configure script finds the Tcl
- installation in the temporary tools location instead of possibly
- locating an existing one on the host system.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--with-tclinclude=/tools/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>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Expect test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make test</userinput></screen>
-
- <para>Note that the Expect test suite is known to experience failures under
- certain host conditions that are not within our control. Therefore,
- test suite failures here are not surprising and are not considered
- critical.</para>
-
- <para>Install the package:</para>
-
-<screen><userinput remap="install">make SCRIPTS="" install</userinput></screen>
-
- <variablelist>
- <title>The meaning of the make parameter:</title>
-
- <varlistentry>
- <term><parameter>SCRIPTS=""</parameter></term>
- <listitem>
- <para>This prevents installation of the supplementary Expect
- scripts, which are not needed.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- </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/chapter05/file.xml b/chapter05/file.xml
deleted file mode 100644
index 9fcfd1e6f..000000000
--- a/chapter05/file.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the File test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-file" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/findutils.xml b/chapter05/findutils.xml
deleted file mode 100644
index 064a9e848..000000000
--- a/chapter05/findutils.xml
+++ /dev/null
@@ -1,80 +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-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>First, make some fixes required by glibc-2.28:</para>
-
-<screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
-sed -i '/unistd/a #include &lt;sys/sysmacros.h&gt;' gl/lib/mountlist.c
-echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h</userinput></screen>
--->
- <para>Prepare Findutils for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Findutils test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-findutils" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/flex.xml b/chapter05/flex.xml
deleted file mode 100644
index 5e1afa194..000000000
--- a/chapter05/flex.xml
+++ /dev/null
@@ -1,72 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>To test the results, issue:</para>
-
-<screen><userinput remap="test">make check</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/chapter05/gawk.xml b/chapter05/gawk.xml
deleted file mode 100644
index adcd2ea15..000000000
--- a/chapter05/gawk.xml
+++ /dev/null
@@ -1,74 +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-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>Prepare Gawk for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Gawk test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-gawk" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml
index d209cd44f..0cd852ee6 100644
--- a/chapter05/gcc-pass1.xml
+++ b/chapter05/gcc-pass1.xml
@@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="../chapter06/gcc.xml"
+ href="../chapter08/gcc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
- <seg>&gcc-ch5p1-sbu;</seg>
- <seg>&gcc-ch5p1-du;</seg>
+ <seg>&gcc-tmpp1-sbu;</seg>
+ <seg>&gcc-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
@@ -43,7 +43,7 @@
<sect2 role="installation">
<title>Installation of Cross GCC</title>
- <para>GCC now requires the GMP, MPFR and MPC packages. As these packages may
+ <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
@@ -62,42 +62,7 @@ mv -v gmp-&gmp-version; gmp
tar -xf ../mpc-&mpc-version;.tar.gz
mv -v mpc-&mpc-version; mpc</userinput></screen>
- <para>The following command will change the location of GCC's default
- dynamic linker to use the one installed in <filename
- class="directory">/tools</filename>. It also removes <filename
- class="directory">/usr/include</filename> from GCC's include search path.
- Issue:</para>
-
-<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
-do
- cp -uv $file{,.orig}
- sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
- -e 's@/usr@/tools@g' $file.orig &gt; $file
- echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
- touch $file.orig
-done</userinput></screen>
-
- <para>In case the above seems hard to follow, let's break it down a bit.
- First we copy the files <filename>gcc/config/linux.h</filename>,
- <filename>gcc/config/i386/linux.h</filename>, and
- <filename>gcc/config/i386/linux64.h</filename> to a file of
- the same name but with an added suffix of <quote>.orig</quote>. Then the
- first sed expression prepends <quote>/tools</quote> to every instance of
- <quote>/lib/ld</quote>, <quote>/lib64/ld</quote> or
- <quote>/lib32/ld</quote>, while the second one replaces hard-coded
- instances of <quote>/usr</quote>. Next, we add our define statements which
- alter the default startfile prefix to the end of the file. Note that the
- trailing <quote>/</quote> in <quote>/tools/lib/</quote> is required.
- Finally, we use <command>touch</command> to update the timestamp on the
- copied files. When used in conjunction with <command>cp -u</command>, this
- prevents unexpected changes to the original files in case the commands are
- inadvertently run twice.</para>
-
- <para>Finally, on x86_64 hosts, set the default directory name for
+ <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
@@ -107,19 +72,6 @@ done</userinput></screen>
;;
esac</userinput></screen>
-<!--
- <para>GCC doesn't detect stack protection correctly, which causes problems
- for the build of Glibc-&glibc-version;, so fix that by issuing the following
- command:</para>
-
-<screen><userinput remap="pre">sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure</userinput></screen>
--->
-
-<!--
- <para>Also fix a problem identified upstream:</para>
-
-<screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
--->
<para>The GCC documentation recommends building GCC
in a dedicated build directory:</para>
@@ -130,13 +82,12 @@ cd build</userinput></screen>
<screen><userinput remap="configure">../configure \
--target=$LFS_TGT \
- --prefix=/tools \
+ --prefix=$LFS/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
- --with-local-prefix=/tools \
- --with-native-system-header-dir=/tools/include \
+ --enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
@@ -181,46 +132,39 @@ cd build</userinput></screen>
</varlistentry>
<varlistentry>
- <term><parameter>--with-local-prefix=/tools</parameter></term>
+ <term><parameter>--enable-initfini-array</parameter></term>
<listitem>
- <para>The local prefix is the location in the system that GCC will search
- for locally installed include files. The default is <filename>/usr/local</filename>.
- Setting this to <filename>/tools</filename> helps keep the host location of
- <filename>/usr/local</filename> out of this GCC's search path.</para>
+ <para>This switch forces the use of some internal data structures
+ that are needed but cannot be detected when building a cross
+ compiler.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><parameter>--with-native-system-header-dir=/tools/include</parameter></term>
+ <term><parameter>--disable-shared</parameter></term>
<listitem>
- <para>By default, GCC searches <filename>/usr/include</filename> for
- system headers. In conjunction with the sysroot switch, this would
- normally translate to <filename>$LFS/usr/include</filename>. However
- the headers that will be installed in the next two sections will go
- to <filename>$LFS/tools/include</filename>. This switch ensures that
- gcc will find them correctly. In the second pass of GCC, this same
- switch will ensure that no headers from the host system are
- found.</para>
+ <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-shared</parameter></term>
+ <term><parameter>--disable-multilib</parameter></term>
<listitem>
- <para>This switch forces GCC to link its internal libraries
- statically. We do this to avoid possible issues with the host
- system.</para>
+ <para>On x86_64, LFS does not support a multilib configuration.
+ This switch is harmless for x86.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-decimal-float, --disable-threads,
- --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
+ --disable-libatomic, --disable-libgomp,
--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,
+ extension, threading, libatomic, libgomp, 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>
@@ -228,14 +172,6 @@ cd build</userinput></screen>
</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.
@@ -249,26 +185,25 @@ cd build</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
- <para>Compilation is now complete. At this point, the test suite would
- normally be run, but, as mentioned before, the test suite framework is
- not in place yet. The benefits of running the tests at this point
- are minimal since the programs from this first pass will soon be
- replaced.</para>
-
<para>Install the package:</para>
-<screen><userinput remap="install">make install</userinput></screen>
-<!--
- <para>Using <parameter>- -disable-shared</parameter> means that the
- <filename>libgcc_eh.a</filename> file isn't created and installed. The
- Glibc package depends on this library as it uses
- <parameter>-lgcc_eh</parameter> within its build system. This dependency
- can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
- since that file will end up containing the objects normally contained in
- <filename>libgcc_eh.a</filename>:</para>
-
-<screen><userinput remap="install">ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&amp;_eh/'`</userinput></screen>
--->
+ <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">
diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml
deleted file mode 100644
index ca2a06f1c..000000000
--- a/chapter05/gcc-pass2.xml
+++ /dev/null
@@ -1,232 +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-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>Once again, change the location of GCC's default dynamic linker to
- use the one installed in <filename
- class="directory">/tools</filename>.</para>
-
-<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
-do
- cp -uv $file{,.orig}
- sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
- -e 's@/usr@/tools@g' $file.orig &gt; $file
- echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
- touch $file.orig
-done</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>Our first build of GCC has installed a couple of internal system
- headers. Normally one of them, <filename>limits.h</filename>, will in turn
- include the corresponding system <filename>limits.h</filename> header, in
- this case, <filename>/tools/include/limits.h</filename>. However, at the
- time of the first build of gcc <filename>/tools/include/limits.h</filename>
- did not exist, so the internal header that GCC installed is a partial,
- self-contained file and does not include the extended features of the
- system header. This was adequate for building the temporary libc, but this
- build of GCC now requires the full internal header. 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="pre">cat gcc/limitx.h gcc/glimits.h gcc/limity.h &gt; \
- `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h</userinput></screen>
-<!--
- <para>For x86 machines, the limited number of registers is a bottleneck
- for the system. Free one up by not using a frame pointer that is not
- needed:</para>
-
-<screen><userinput remap="pre">case `uname -m` in
- i?86) sed -i 's/^T_CFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in ;;
-esac</userinput></screen>
--->
- <para>Create a separate build directory again:</para>
-
-<screen><userinput remap="pre">mkdir -v build
-cd build</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">CC=$LFS_TGT-gcc \
-CXX=$LFS_TGT-g++ \
-AR=$LFS_TGT-ar \
-RANLIB=$LFS_TGT-ranlib \
-../configure \
- --prefix=/tools \
- --with-local-prefix=/tools \
- --with-native-system-header-dir=/tools/include \
- --enable-languages=c,c++ \
- --disable-libstdcxx-pch \
- --disable-multilib \
- --disable-bootstrap \
- --disable-libgomp</userinput></screen>
-
- <variablelist>
- <title>The meaning of the new configure options:</title>
-
- <varlistentry>
- <term><parameter>--enable-languages=c,c++</parameter></term>
- <listitem>
- <para>This option ensures that both the C and C++ compilers are
- built.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--disable-libstdcxx-pch</parameter></term>
- <listitem>
- <para>Do not build the pre-compiled header (PCH) for
- <filename class="libraryfile">libstdc++</filename>. It takes up a
- lot of space, and we have no use for it.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--disable-bootstrap</parameter></term>
- <listitem>
- <para>For native builds of GCC, the default is to do a "bootstrap"
- build. This does not just compile GCC, but compiles it several times.
- It uses the programs compiled in a first round to compile itself a
- second time, and then again a third time. The second and third
- iterations are compared to make sure it can reproduce itself
- flawlessly. This also implies that it was compiled correctly.
- However, the LFS build method should provide a solid compiler
- without the need to bootstrap each time.</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>
-
- <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 /tools/bin/cc</userinput></screen>
-
- <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
-cc dummy.c
-readelf -l a.out | grep ': /tools'</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: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
-
- <para>Note that the dynamic linker will be /tools/lib/ld-linux.so.2
- for 32-bit machines.</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. First, perform the sanity check again, using
- <command>gcc</command> instead of <command>cc</command>. If this works,
- then the <filename class="symlink">/tools/bin/cc</filename> symlink is
- missing. Install the symlink as per above.
- Next, ensure that the <envar>PATH</envar> is correct. This
- can be checked by running <command>echo $PATH</command> and verifying that
- <filename class="directory">/tools/bin</filename> is at the head of the
- list. If the <envar>PATH</envar> is wrong it could mean that you are not
- logged in as user <systemitem class="username">lfs</systemitem> or that
- something went wrong back in <xref linkend="ch-preps-settingenviron"
- role="."/></para>
-
- <para>Once all is well, clean up the test files:</para>
-
-<screen><userinput>rm -v dummy.c a.out</userinput></screen>
-
- </caution>
-
- </sect2>
-
- <sect2 role="content">
- <title/>
-
- <para>Details on this package are located in
- <xref linkend="contents-gcc" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/generalinstructions.xml b/chapter05/generalinstructions.xml
index bf1ec6112..b0a5377e1 100644
--- a/chapter05/generalinstructions.xml
+++ b/chapter05/generalinstructions.xml
@@ -18,7 +18,7 @@
<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.
+ both this and the following chapters, but sometimes in only one location.
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
@@ -81,9 +81,9 @@
<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
+ <filename class="directory">/mnt/lfs/sources/</filename>.<!-- Do
<emphasis>not</emphasis> put sources in
- <filename class="directory">/mnt/lfs/tools/</filename>.</para>
+ <filename class="directory">/mnt/lfs/tools/</filename>. --></para>
</listitem>
<listitem>
<para>Change to the sources directory.</para>
@@ -93,8 +93,8 @@
<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>
+ to be built. In Chapters 5 and 6, 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
diff --git a/chapter05/gettext.xml b/chapter05/gettext.xml
deleted file mode 100644
index ff064cb7e..000000000
--- a/chapter05/gettext.xml
+++ /dev/null
@@ -1,98 +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-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>EMACS="no"</parameter></term>
- <listitem>
- <para>This prevents the configure script from determining where to
- install Emacs Lisp files as the test is known to hang on some hosts.
- </para>
- </listitem>
- </varlistentry>
--->
- <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>
- Due to the limited environment, running the test suite at this stage
- is not recommended.</para>
-
- <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} /tools/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/chapter05/glibc.xml b/chapter05/glibc.xml
index d8a4f6733..0888427df 100644
--- a/chapter05/glibc.xml
+++ b/chapter05/glibc.xml
@@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="../chapter06/glibc.xml"
+ href="../chapter08/glibc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
- <seg>&glibc-ch5-sbu;</seg>
- <seg>&glibc-ch5-du;</seg>
+ <seg>&glibc-tmp-sbu;</seg>
+ <seg>&glibc-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@@ -43,6 +43,25 @@
<sect2 role="installation">
<title>Installation of Glibc</title>
+ <para>First, create a symbolic link for LSB compliance. Additionally,
+ for x86_64, create a compatibility symbolic link required for proper
+ operation of the dynamic library loader:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+ i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
+ ;;
+ x86_64) 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
+ ;;
+esac</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>
@@ -52,11 +71,12 @@ cd build</userinput></screen>
<para>Next, prepare Glibc for compilation:</para>
<screen><userinput remap="configure">../configure \
- --prefix=/tools \
+ --prefix=/usr \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
- --with-headers=/tools/include</userinput></screen>
+ --with-headers=$LFS/usr/include \
+ libc_cv_slibdir=/lib</userinput></screen>
<!--
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes</userinput></screen> -->
@@ -68,7 +88,7 @@ cd build</userinput></screen>
<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 cross-compile, using the cross-linker and
+ configures itself to be cross-compiled, using the cross-linker and
cross-compiler in <filename class="directory">/tools</filename>.</para>
</listitem>
</varlistentry>
@@ -83,43 +103,22 @@ cd build</userinput></screen>
</varlistentry>
<varlistentry>
- <term><parameter>--with-headers=/tools/include</parameter></term>
- <listitem>
- <para>This tells Glibc to compile itself against the headers recently
- installed to the tools directory, so that it knows exactly what
- features the kernel has and can optimize itself accordingly.</para>
- </listitem>
- </varlistentry>
-<!--
- <varlistentry>
- <term><parameter>libc_cv_forced_unwind=yes</parameter></term>
+ <term><parameter>--with-headers=$LFS/usr/include</parameter></term>
<listitem>
- <para>The linker installed during
- <xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as
- such cannot be used until Glibc has been installed. This means that
- the configure test for force-unwind support will fail, as it relies on
- a working linker. The libc_cv_forced_unwind=yes variable is passed in
- order to inform <command>configure</command> that force-unwind
- support is available without it having to run the test.</para>
+ <para>This tells Glibc to compile itself against the headers
+ recently installed to the $LFS/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_c_cleanup=yes</parameter></term>
+ <term><parameter>libc_cv_slibdir=/lib</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>
+ <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_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>
@@ -147,40 +146,71 @@ cd build</userinput></screen>
<para>Install the package:</para>
-<screen><userinput remap="install">make install</userinput></screen>
+ <warning><para>If <envar>LFS</envar> is not properly set, and despite the
+ recommendations, you are building as root, the next command will install
+ the newly built glibc to your host system, which most likely will render it
+ unusable. So double check that the environment is correctly set for user
+ <systemitem class="username">lfs</systemitem>.</para></warning>
- <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 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 ': /tools'</userinput></screen>
+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>
+ <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: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
+<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>/tools/lib/ld-linux.so.2</filename>.</para>
+ <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>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>
+ <para>Once all is well, clean up the test files:</para>
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
- </caution>
+ </caution>
+
+ <note><para>Building packages in the next chapter 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 a utility provided by the GCC
+ developers:</para>
- <note><para>Building Binutils in the section after next will serve as an
- additional check that the toolchain has been built properly. If Binutils
- fails to build, it is an indication that something has gone wrong with the
- previous Binutils, GCC, or Glibc installations.</para></note>
+<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
</sect2>
diff --git a/chapter05/grep.xml b/chapter05/grep.xml
deleted file mode 100644
index 2be213b6f..000000000
--- a/chapter05/grep.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Grep test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-grep" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/gzip.xml b/chapter05/gzip.xml
deleted file mode 100644
index 44b25faf7..000000000
--- a/chapter05/gzip.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Gzip test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-gzip" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/introduction.xml b/chapter05/introduction.xml
index 33a566877..28b496993 100644
--- a/chapter05/introduction.xml
+++ b/chapter05/introduction.xml
@@ -10,20 +10,15 @@
<title>Introduction</title>
- <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>This chapter shows how to build a cross-compiler and its associated
+ tools. Although here cross-compilation is faked, the principles are
+ the same as for a real cross-toolchain, and are detailed in the next
+ section.</para>
- <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>
-
- <para>The files compiled in this chapter will be installed under the
+ <para>The programs compiled in this chapter will be installed under the
<filename class="directory">$LFS/tools</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>
+ separate from the files installed in the following chapters. The libraries,
+ on the other hand, are installed into their final place, since they pertain
+ to the system we want to build.</para>
</sect1>
diff --git a/chapter05/libstdc++.xml b/chapter05/libstdc++.xml
index 66128aa8a..6dacb059e 100644
--- a/chapter05/libstdc++.xml
+++ b/chapter05/libstdc++.xml
@@ -5,8 +5,8 @@
%general-entities;
]>
-<sect1 id="ch-tools-libstdcpp" role="wrap">
- <?dbhtml filename="gcc-libstdc++.html"?>
+<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
+ <?dbhtml filename="gcc-libstdc++-pass1.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
@@ -14,11 +14,11 @@
<address>&gcc-url;</address>
</sect1info>
- <title>Libstdc++ from GCC-&gcc-version;</title>
+ <title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
- <indexterm zone="ch-tools-libstdcpp">
+ <indexterm zone="ch-tools-libstdcpp-pass1">
<primary sortas="a-GCC">GCC</primary>
- <secondary>tools, libstdc++</secondary>
+ <secondary>tools, libstdc++ pass 1</secondary>
</indexterm>
<sect2 role="package">
@@ -28,7 +28,8 @@
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 /tools.
+ because it depends on glibc, which was not yet available in the target
+ directory.
</para>
<segmentedlist>
@@ -36,8 +37,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
- <seg>&libstdcpp-ch5-sbu;</seg>
- <seg>&libstdcpp-ch5-du;</seg>
+ <seg>&libstdcpp-tmpp1-sbu;</seg>
+ <seg>&libstdcpp-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
@@ -52,19 +53,19 @@
<filename>gcc-&gcc-version;</filename> directory.</para>
</note>
- <para>Create a separate build directory for Libstdc++ and enter it:</para>
+ <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>
+ <para>Prepare libstdc++ for compilation:</para>
<screen><userinput remap="configure">../libstdc++-v3/configure \
--host=$LFS_TGT \
- --prefix=/tools \
+ --build=$(../config.guess) \
+ --prefix=/usr \
--disable-multilib \
- --disable-nls \<!--
- - -disable-libstdcxx-threads \-->
+ --disable-nls \
--disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
@@ -74,19 +75,11 @@ cd build</userinput></screen>
<varlistentry>
<term><parameter>--host=...</parameter></term>
<listitem>
- <para>Indicates to use the cross compiler we have just built
+ <para>Specifies the 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-threads</parameter></term>
- <listitem>
- <para>Since gcc-pass1 is built without thread support, the C++
- thread library cannot be built either.</para>
- </listitem>
- </varlistentry>
- -->
+
<varlistentry>
<term><parameter>--disable-libstdcxx-pch</parameter></term>
<listitem>
@@ -98,9 +91,9 @@ cd build</userinput></screen>
<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>
+ <para>This is the location where the C++ compiler should search for the
+ standard include files. 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>
@@ -114,7 +107,7 @@ cd build</userinput></screen>
<para>Install the library:</para>
-<screen><userinput remap="install">make install</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
diff --git a/chapter05/linux-headers.xml b/chapter05/linux-headers.xml
index 7a92b466f..213fe7dc3 100644
--- a/chapter05/linux-headers.xml
+++ b/chapter05/linux-headers.xml
@@ -24,17 +24,16 @@
<sect2 role="package">
<title/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="../chapter06/linux-headers.xml"
- xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+ <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>
+ <seg>&linux-headers-tmp-sbu;</seg>
+ <seg>&linux-headers-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@@ -60,15 +59,148 @@
location.</para>
<screen><userinput remap="make">make headers
-</userinput><userinput remap="install">cp -rv usr/include/* /tools/include</userinput></screen>
+find usr/include -name '.*' -delete
+rm usr/include/Makefile
+</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
</sect2>
- <sect2 role="content">
- <title/>
+ <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>
- <para>Details on this package are located in
- <xref linkend="contents-linux-headers" role="."/></para>
+ <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>
diff --git a/chapter05/m4.xml b/chapter05/m4.xml
deleted file mode 100644
index 0dcc6b774..000000000
--- a/chapter05/m4.xml
+++ /dev/null
@@ -1,79 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the M4 test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-m4" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/make.xml b/chapter05/make.xml
deleted file mode 100644
index 205ae5f15..000000000
--- a/chapter05/make.xml
+++ /dev/null
@@ -1,90 +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-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>First, work around an error caused by glibc-2.27 and later:</para>
-
-<screen><userinput remap="pre">sed -i '211,217 d; 219,229 d; 232 d' glob/glob.c</userinput></screen>
--->
- <para>Prepare Make for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools --without-guile</userinput></screen>
-
- <variablelist>
- <title>The meaning of the configure option:</title>
-
- <varlistentry>
- <term><parameter>--without-guile</parameter></term>
- <listitem>
- <para>This ensures that Make-&make-version; won't link against Guile libraries, which
- may be present on the host system, but won't be available within the
- <command>chroot</command> environment in the next chapter.</para>
- </listitem>
- </varlistentry>
- </variablelist>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Make test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-make" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/ncurses.xml b/chapter05/ncurses.xml
deleted file mode 100644
index c00135f12..000000000
--- a/chapter05/ncurses.xml
+++ /dev/null
@@ -1,123 +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-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>Prepare Ncurses for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools \
- --with-shared \
- --without-debug \
- --without-ada \
- --enable-widec \
- --enable-overwrite</userinput></screen>
-
- <variablelist>
- <title>The meaning of the 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-overwrite</parameter></term>
- <listitem>
- <para>This tells Ncurses to install its header files into
- <filename class="directory">/tools/include</filename>, instead of
- <filename class="directory">/tools/include/ncurses</filename>, to
- ensure that other packages can find the Ncurses headers
- successfully.</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>
-
- </variablelist>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>This package has a test suite, but it can only be run after the
- package has been installed. The tests reside in the
- <filename class="directory">test/</filename> directory. See the
- <filename>README</filename> file in that directory for further details.
- </para>
-
- <para>Install the package:</para>
-
-<screen><userinput remap="install">make install
-ln -s libncursesw.so /tools/lib/libncurses.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/chapter05/patch.xml b/chapter05/patch.xml
deleted file mode 100644
index 15049bbe5..000000000
--- a/chapter05/patch.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Patch test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-patch" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/perl.xml b/chapter05/perl.xml
deleted file mode 100644
index 2bb15453b..000000000
--- a/chapter05/perl.xml
+++ /dev/null
@@ -1,103 +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-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="../chapter06/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=/tools -Dlibs=-lm -Uloclibpth -Ulocincpth</userinput></screen>
-
- <variablelist>
- <title>The meaning of the 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>
-
- <varlistentry>
- <term>
- <parameter>-Uloclibpth</parameter> and
- <parameter>-Ulocincpth</parameter>
- </term>
- <listitem>
- <para>These entries undefine variables that cause the configuration
- to search for locally installed components that may exist on the
- host system.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
-
-
-
- <para>Build the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Although Perl comes with a test suite, it would be better to wait
- until it is installed in the next chapter.</para>
-
- <para>Only a few of the utilities and libraries need to be installed at this
- time:</para>
-
-<screen><userinput remap="install">cp -v perl cpan/podlators/scripts/pod2man /tools/bin
-mkdir -pv /tools/lib/perl5/&perl-version;
-cp -Rv lib/* /tools/lib/perl5/&perl-version;</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/chapter05/python.xml b/chapter05/python.xml
deleted file mode 100644
index fcca9c92c..000000000
--- a/chapter05/python.xml
+++ /dev/null
@@ -1,101 +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-tools-Python" role="wrap">
- <?dbhtml filename="Python.html"?>
-
- <sect1info condition="script">
- <productname>Python</productname>
- <productnumber>&python-version;</productnumber>
- <address>&python-url;</address>
- </sect1info>
-
- <title>Python-&python-version;</title>
-
- <indexterm zone="ch-tools-Python">
- <primary sortas="a-Python">Python</primary>
- <secondary>tools</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>This package first builds the Python interpreter, then some
- standard Python modules. The main script for building modules is
- written in Python, and uses hard-coded paths to the host <filename
- class="directory">/usr/include</filename> and <filename
- class="directory">/usr/lib</filename> directories. To prevent them
- from being used, issue:</para>
-
-<screen><userinput remap="pre">sed -i '/def add_multiarch_paths/a \ return' setup.py</userinput></screen>
-
- <para>Prepare Python for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools --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>Compilation is now complete. The test suite requires TK and
- and X Windows and cannot be run at this time.
- </para>
-
- <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/chapter05/sed.xml b/chapter05/sed.xml
deleted file mode 100644
index 9a945e772..000000000
--- a/chapter05/sed.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Sed test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-sed" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/stripping.xml b/chapter05/stripping.xml
deleted file mode 100644
index dc55959bf..000000000
--- a/chapter05/stripping.xml
+++ /dev/null
@@ -1,46 +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-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>strip --strip-debug /tools/lib/*
-/usr/bin/strip --strip-unneeded /tools/{,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.
- Also use the system strip command to include the strip binary in /tools.</para>
-
- <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 /tools/{,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 /tools/{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/chapter05/tar.xml b/chapter05/tar.xml
deleted file mode 100644
index 002dc228f..000000000
--- a/chapter05/tar.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Tar test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-tar" role="."/></para>
-
- </sect2>
-
-</sect1>
diff --git a/chapter05/tcl.xml b/chapter05/tcl.xml
deleted file mode 100644
index f2265fd8d..000000000
--- a/chapter05/tcl.xml
+++ /dev/null
@@ -1,163 +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-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. Even if the test suites are not
- run in this chapter (they are not mandatory), 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">cd unix
-./configure --prefix=/tools</userinput></screen>
-
- <para>Build the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Tcl test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">TZ=UTC make test</userinput></screen>
-
- <para>The Tcl test suite may experience failures under certain host
- conditions that are not fully understood. Therefore, test suite failures
- here are not surprising, and are not considered critical. The
- <parameter>TZ=UTC</parameter> parameter sets the time zone to Coordinated
- Universal Time (UTC), but only
- for the duration of the test suite run. This ensures that the clock tests
- are exercised correctly. Details on the <envar>TZ</envar> environment
- variable are provided in <xref linkend="chapter-config"/>.</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 /tools/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 -sv tclsh&tcl-major-version; /tools/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/chapter05/texinfo.xml b/chapter05/texinfo.xml
deleted file mode 100644
index 3e5ecfaef..000000000
--- a/chapter05/texinfo.xml
+++ /dev/null
@@ -1,80 +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-tools-texinfo" role="wrap">
- <?dbhtml filename="texinfo.html"?>
-
- <sect1info condition="script">
- <productname>texinfo</productname>
- <productnumber>&texinfo-version;</productnumber>
- <address>&texinfo-url;</address>
- </sect1info>
-
- <title>Texinfo-&texinfo-version;</title>
-
- <indexterm zone="ch-tools-texinfo">
- <primary sortas="a-Texinfo">Texinfo</primary>
- <secondary>tools</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=/tools</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>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Texinfo test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml
index e0ab899eb..1e7086aaf 100644
--- a/chapter05/toolchaintechnotes.xml
+++ b/chapter05/toolchaintechnotes.xml
@@ -16,151 +16,322 @@
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>
-
- <note>
- <para>Before continuing, be aware of the name of the working platform,
- often referred to as the target triplet. A simple way to determine the
- name of the target 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>Some key technical points of how the <xref
- linkend="chapter-temporary-tools"/> build method works:</para>
-
- <itemizedlist>
- <listitem>
- <para>Slightly adjusting the name of the working platform, by changing the
- &quot;vendor&quot; field target triplet by way of the
- <envar>LFS_TGT</envar> variable, ensures that the first build of Binutils
- and GCC produces a compatible cross-linker and cross-compiler. Instead of
- producing binaries for another architecture, the cross-linker and
- cross-compiler will produce binaries compatible with the current
- hardware.</para>
- </listitem>
- <listitem>
- <para> The temporary libraries are cross-compiled. Because a
- cross-compiler by its nature cannot rely on anything from its host
- system, this method removes potential contamination of the target
- system by lessening the chance of headers or libraries from the host
- being incorporated into the new tools. Cross-compilation also allows for
- the possibility of building both 32-bit and 64-bit libraries on 64-bit
- capable hardware.</para>
- </listitem>
- <listitem>
- <para>Careful manipulation of the GCC source tells the compiler which target
- dynamic linker will be used.</para>
- </listitem>
- </itemizedlist>
-
- <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">/tools/bin</filename> and <filename
- class="directory">/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, an <userinput>ld --verbose | grep SEARCH</userinput>
- 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,
- <userinput>gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</userinput>
- 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... /tools/i686-lfs-linux-gnu/bin/as
-checking what linker to use... /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:
- <userinput>gcc -print-prog-name=ld</userinput>.</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, <userinput>gcc -v dummy.c</userinput> 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>i686-lfs-linux-gnu-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">glibc-build</filename> directory for all important details.
- Note the use of <parameter>CC="i686-lfs-gnu-gcc"</parameter> 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>During the second pass of Binutils, we are able to utilize the
- <parameter>--with-lib-path</parameter> configure switch to control
- <command>ld</command>'s library search path.</para>
-
- <para>For the second pass of GCC, its sources also need to be modified to
- tell GCC to use the new dynamic linker. Failure to do so will result in the
- GCC programs themselves having the name of the dynamic linker from the host
- system's <filename class="directory">/lib</filename> directory embedded into
- them, which would defeat the goal of getting away from the host. From this
- point onwards, the core toolchain is self-contained and self-hosted. The
- remainder of the <xref linkend="chapter-temporary-tools"/> packages all build
- against the new Glibc in <filename
- class="directory">/tools</filename>.</para>
-
- <para>Upon entering the chroot environment in <xref
- linkend="chapter-building-system"/>, the first major package to be
- installed is Glibc, due to its self-sufficient nature mentioned above.
- Once this Glibc is installed into <filename
- class="directory">/usr</filename>, we will perform a quick changeover of the
- toolchain defaults, and then proceed in building the rest of the target
- LFS system.</para>
+ <para>The overall goal of this chapter and <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> option when building the cross linker and
+ cross compiler to tell them where to find the needed host files. This
+ ensures that 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 based 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 (1) the build system of
+ GCC does not know that it is usable on pc, and (2) 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 in
+ Chapter 6 by all the programs that need themselves to be built. The install
+ step of libstdc++ uses the <envar>DESTDIR</envar> variable to have the
+ programs land into the LFS filesystem.</para>
+
+ <para>In Chapter 7 the native lfs compiler is built. First binutils-pass2,
+ with the same <envar>DESTDIR</envar> install as the other programs is
+ built, and then the second pass of GCC is constructed, 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 the host is the same as the target, but is
+ different from the build system. 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-chroot-temporary-tools"/>, 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
+ <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/chapter05/util-linux.xml b/chapter05/util-linux.xml
deleted file mode 100644
index b164fa2db..000000000
--- a/chapter05/util-linux.xml
+++ /dev/null
@@ -1,124 +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-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>Prepare Util-linux for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/tools \
- --without-python \
- --disable-makeinstall-chown \
- --without-systemdsystemunitdir \
- --without-ncurses \
- PKG_CONFIG=""</userinput></screen>
-
- <variablelist>
- <title>The meaning of the configure option:</title>
-
- <varlistentry>
- <term><parameter>--without-python</parameter></term>
- <listitem>
- <para>This switch disables using <application>Python</application>
- if it is installed on the host system. It avoids trying to build
- unneeded bindings.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--disable-makeinstall-chown</parameter></term>
- <listitem>
- <para>This switch disables using the <command>chown</command> command
- during installation. This is not needed when installing into the
- /tools directory and avoids the necessity of installing as
- root.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--without-ncurses</parameter></term>
- <listitem>
- <para>This switch disables using the ncurses library for
- the build process. This is not needed when installing into the
- /tools directory and avoids problems on some host distros.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--without-systemdsystemunitdir</parameter></term>
- <listitem>
- <para>On systems that use systemd, the package tries to install
- a systemd specific file to a non-existent directory in /tools.
- This switch disables the unnecessary action.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><envar>PKG_CONFIG=""</envar></term>
- <listitem>
- <para>Setting this environment variable prevents adding unneeded
- features that may be available on the host. Note that the location
- shown for setting this environment variable is different from other
- LFS sections where variables are set preceding the command. This
- location is shown to demonstrate an alternative way of setting an
- environment variable when using configure.</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/chapter05/xz.xml b/chapter05/xz.xml
deleted file mode 100644
index ea1ea4966..000000000
--- a/chapter05/xz.xml
+++ /dev/null
@@ -1,74 +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-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=/tools</userinput></screen>
-
- <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Compilation is now complete. As discussed earlier, running the test
- suite is not mandatory for the temporary tools here in this chapter. To run
- the Xz test suite anyway, issue the following command:</para>
-
-<screen><userinput remap="test">make check</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-xz" role="."/></para>
-
- </sect2>
-
-</sect1>