소스 검색

Initial commit of alternative cross LFS

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Bruce Dubbs 4 년 전
부모
커밋
fcc027677d
100개의 변경된 파일7908개의 추가작업 그리고 7184개의 파일을 삭제
  1. 2 2
      Makefile
  2. 1 1
      chapter05/binutils-pass1.xml
  3. 2 36
      chapter05/chapter05.xml
  4. 1 1
      chapter05/gcc-pass1.xml
  5. 1 1
      chapter05/glibc.xml
  6. 30 107
      chapter06/bash.xml
  7. 156 0
      chapter06/binutils-pass1.xml
  8. 94 0
      chapter06/binutils-pass2.xml
  9. 25 85
      chapter06/bison.xml
  10. 32 170
      chapter06/bzip2.xml
  11. 41 0
      chapter06/changingowner.xml
  12. 11 82
      chapter06/chapter06.xml
  13. 65 0
      chapter06/chroot.xml
  14. 41 1223
      chapter06/coreutils.xml
  15. 204 0
      chapter06/createfiles.xml
  16. 59 0
      chapter06/creatingdirs.xml
  17. 96 0
      chapter06/dejagnu.xml
  18. 14 71
      chapter06/diffutils.xml
  19. 139 0
      chapter06/expect.xml
  20. 20 55
      chapter06/file.xml
  21. 19 105
      chapter06/findutils.xml
  22. 33 94
      chapter06/flex.xml
  23. 16 70
      chapter06/gawk.xml
  24. 208 0
      chapter06/gcc-pass1.xml
  25. 160 0
      chapter06/gcc-pass2.xml
  26. 120 0
      chapter06/generalinstructions.xml
  27. 25 385
      chapter06/gettext.xml
  28. 120 860
      chapter06/glibc.xml
  29. 16 57
      chapter06/grep.xml
  30. 0 374
      chapter06/grub.xml
  31. 16 180
      chapter06/gzip.xml
  32. 17 62
      chapter06/introduction.xml
  33. 115 0
      chapter06/kernfs.xml
  34. 114 0
      chapter06/libstdc++-pass2.xml
  35. 122 0
      chapter06/libstdc++.xml
  36. 207 0
      chapter06/linux-headers.xml
  37. 17 47
      chapter06/m4.xml
  38. 30 46
      chapter06/make.xml
  39. 58 281
      chapter06/ncurses.xml
  40. 16 42
      chapter06/patch.xml
  41. 21 464
      chapter06/perl.xml
  42. 34 199
      chapter06/python.xml
  43. 20 47
      chapter06/sed.xml
  44. 53 0
      chapter06/stripping.xml
  45. 16 61
      chapter06/tar.xml
  46. 191 0
      chapter06/tcl.xml
  47. 19 182
      chapter06/texinfo.xml
  48. 335 0
      chapter06/toolchaintechnotes.xml
  49. 36 1242
      chapter06/util-linux.xml
  50. 24 311
      chapter06/xz.xml
  51. 96 0
      chapter07/bash.xml
  52. 156 0
      chapter07/binutils-pass1.xml
  53. 94 0
      chapter07/binutils-pass2.xml
  54. 82 0
      chapter07/bison.xml
  55. 112 0
      chapter07/bzip2.xml
  56. 41 0
      chapter07/changingowner.xml
  57. 17 31
      chapter07/chapter07.xml
  58. 65 0
      chapter07/chroot.xml
  59. 105 0
      chapter07/coreutils.xml
  60. 204 0
      chapter07/createfiles.xml
  61. 59 0
      chapter07/creatingdirs.xml
  62. 96 0
      chapter07/dejagnu.xml
  63. 68 0
      chapter07/diffutils.xml
  64. 139 0
      chapter07/expect.xml
  65. 73 0
      chapter07/file.xml
  66. 75 0
      chapter07/findutils.xml
  67. 88 0
      chapter07/flex.xml
  68. 74 0
      chapter07/gawk.xml
  69. 208 0
      chapter07/gcc-pass1.xml
  70. 160 0
      chapter07/gcc-pass2.xml
  71. 120 0
      chapter07/generalinstructions.xml
  72. 85 0
      chapter07/gettext.xml
  73. 230 0
      chapter07/glibc.xml
  74. 70 0
      chapter07/grep.xml
  75. 72 0
      chapter07/gzip.xml
  76. 14 210
      chapter07/introduction.xml
  77. 115 0
      chapter07/kernfs.xml
  78. 114 0
      chapter07/libstdc++-pass2.xml
  79. 122 0
      chapter07/libstdc++.xml
  80. 207 0
      chapter07/linux-headers.xml
  81. 74 0
      chapter07/m4.xml
  82. 83 0
      chapter07/make.xml
  83. 157 0
      chapter07/ncurses.xml
  84. 70 0
      chapter07/patch.xml
  85. 79 0
      chapter07/perl.xml
  86. 88 0
      chapter07/python.xml
  87. 70 0
      chapter07/sed.xml
  88. 53 0
      chapter07/stripping.xml
  89. 71 0
      chapter07/tar.xml
  90. 191 0
      chapter07/tcl.xml
  91. 74 0
      chapter07/texinfo.xml
  92. 335 0
      chapter07/toolchaintechnotes.xml
  93. 113 0
      chapter07/util-linux.xml
  94. 77 0
      chapter07/xz.xml
  95. 0 0
      chapter08/aboutdebug.xml
  96. 0 0
      chapter08/acl.xml
  97. 0 0
      chapter08/adjusting.xml
  98. 0 0
      chapter08/attr.xml
  99. 0 0
      chapter08/autoconf.xml
  100. 0 0
      chapter08/automake.xml

+ 2 - 2
Makefile

@@ -23,10 +23,10 @@ ifneq ($(REV), sysv)
 endif
 
 ifeq ($(REV), sysv)
-  BASEDIR         ?= ~/lfs-book
+  BASEDIR         ?= ~/cross2-lfs-book
   PDF_OUTPUT      ?= LFS-BOOK.pdf
   NOCHUNKS_OUTPUT ?= LFS-BOOK.html
-  DUMPDIR         ?= ~/lfs-commands
+  DUMPDIR         ?= ~/cross-lfs-commands
 else
   BASEDIR         ?= ~/lfs-systemd
   PDF_OUTPUT      ?= LFS-SYSD-BOOK.pdf

+ 1 - 1
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>

+ 2 - 36
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>Cross Compiling a 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,39 +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="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="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="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="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="xz.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="stripping.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingdirs.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="createfiles.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++-pass2.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>
-<!--  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="flex.xml"/>-->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dejagnu.xml"/>
 
 </chapter>

+ 1 - 1
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>

+ 1 - 1
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>

+ 30 - 107
chapter06/bash.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-bash" role="wrap">
+<sect1 id="ch-tools-bash" role="wrap">
   <?dbhtml filename="bash.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>Bash-&bash-version;</title>
 
-  <indexterm zone="ch-system-bash">
+  <indexterm zone="ch-tools-bash">
     <primary sortas="a-Bash">Bash</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Bash package contains the Bourne-Again SHell.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/bash.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&bash-ch6-sbu;</seg>
-        <seg>&bash-ch6-du;</seg>
+        <seg>&bash-ch5-sbu;</seg>
+        <seg>&bash-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -40,27 +43,24 @@
   <sect2 role="installation">
     <title>Installation of Bash</title>
 
-    <para>Incorporate some upstream fixes:</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=/usr                    \
-            --docdir=/usr/share/doc/bash-&bash-version; \
-            --without-bash-malloc            \
-            --with-installed-readline</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr                   \
+            --build=$(support/config.guess) \
+            --host=$LFS_TGT                 \
+            --without-bash-malloc</userinput></screen>
 
     <variablelist>
-      <title>The meaning of the new configure option:</title>
+      <title>The meaning of the configure options:</title>
 
       <varlistentry>
-        <term><parameter>--with-installed-readline</parameter></term>
+        <term><parameter>--without-bash-malloc</parameter></term>
         <listitem>
-          <para>This option tells Bash to use the <filename
-          class="libraryfile">readline</filename> library that is already
-          installed on the system rather than using its own readline
-          version.</para>
+          <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>
 
@@ -70,103 +70,26 @@
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>Skip down to <quote>Install the
-    package</quote> if not running the test suite.</para>
-
-    <para>To prepare the tests, ensure that the <systemitem class="username">tester</systemitem> user can write to the sources tree:</para>
-
-<screen><userinput remap="test">chown -Rv tester .</userinput></screen>
+    <para>Install the package:</para>
 
-    <para>Now, run the tests as the <systemitem
-    class="username">tester</systemitem> user:</para>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
-<screen><userinput remap="test">su tester &lt;&lt; EOF
-PATH=$PATH make tests &lt; $(tty)
-EOF</userinput></screen>
-<!--
-    <para>The <systemitem class="username">tester</systemitem>
-    user does not have enough permissions for all the tests to pass. This shows
-    up in some <quote>diff</quote> output in four test results. Portions of the 
-    run-execscript, run-lastpipe, run-read, and run-test programs
-    are known to fail in the LFS chroot environment, but pass if the tests
-    are run in a full system.</para>
--->
-    <para>Install the package and move the main executable to
-    <filename class='directory'>/bin</filename>:</para>
+    <para>Move the excutable to where it is expected to be:</para>
 
-<screen><userinput remap="install">make install
-mv -vf /usr/bin/bash /bin</userinput></screen>
+<screen><userinput remap="install">mv $LFS/usr/bin/bash $LFS/bin/bash</userinput></screen>
 
-    <para>Run the newly compiled <command>bash</command> program (replacing the one that is
-    currently being executed):</para>
+    <para>Make a link for the programs that use <command>sh</command> for
+    a shell:</para>
 
-<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
-
-    <note>
-      <para>The parameters used make the <command>bash</command>
-      process an interactive login shell and continue to disable hashing so
-      that new programs are found as they become available.</para>
-    </note>
+<screen><userinput remap="install">ln -sv bash $LFS/bin/sh</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-bash" role="content">
-    <title>Contents of Bash</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>bash, bashbug, and sh (link to bash)</seg>
-        <seg>/usr/include/bash, /usr/lib/bash, and
-        /usr/share/doc/bash-&bash-version;</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="bash">
-        <term><command>bash</command></term>
-        <listitem>
-          <para>A widely-used command interpreter; it performs many types of
-          expansions and substitutions on a given command line before executing
-          it, thus making this interpreter a powerful tool</para>
-          <indexterm zone="ch-system-bash bash">
-            <primary sortas="b-bash">bash</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bashbug">
-        <term><command>bashbug</command></term>
-        <listitem>
-          <para>A shell script to help the user compose and mail standard
-          formatted bug reports concerning <command>bash</command></para>
-          <indexterm zone="ch-system-bash bashbug">
-            <primary sortas="b-bashbug">bashbug</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sh">
-        <term><command>sh</command></term>
-        <listitem>
-          <para>A symlink to the <command>bash</command> program; when invoked
-          as <command>sh</command>, <command>bash</command> tries to mimic the
-          startup behavior of historical versions of <command>sh</command> as
-          closely as possible, while conforming to the POSIX standard as
-          well</para>
-          <indexterm zone="ch-system-bash sh">
-            <primary sortas="b-sh">sh</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-bash" role="."/></para>
 
   </sect2>
 

+ 156 - 0
chapter06/binutils-pass1.xml

@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-binutils-pass1" role="wrap">
+  <?dbhtml filename="binutils-pass1.html"?>
+
+  <sect1info condition="script">
+    <productname>binutils-pass1</productname>
+    <productnumber>&binutils-version;</productnumber>
+    <address>&binutils-url;</address>
+  </sect1info>
+
+  <title>Binutils-&binutils-version; - Pass 1</title>
+
+  <indexterm zone="ch-tools-binutils-pass1">
+    <primary sortas="a-Binutils">Binutils</primary>
+    <secondary>tools, pass 1</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/binutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&binutils-ch5p1-sbu;</seg>
+        <seg>&binutils-ch5p1-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Cross Binutils</title>
+
+    <note><para>Go back and re-read the notes in the previous section.
+    Understanding the notes labeled important will save you a lot
+    of problems later.</para></note>
+
+    <para>It is important that Binutils be the first package compiled
+    because both Glibc and GCC perform various tests on the available
+    linker and assembler to determine which of their own features to
+    enable.</para>
+
+    <para>The Binutils documentation recommends building Binutils 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <note>
+      <para>In order for the SBU values listed in the rest of the book
+      to be of any use, measure the time it takes to build this package from
+      the configuration, up to and including the first install. To achieve
+      this easily, wrap the commands in a <command>time</command>
+      command like this: <userinput>time { ./configure ... &amp;&amp; ...
+      &amp;&amp; make install; }</userinput>.</para>
+    </note>
+<!--
+    <note><para>The approximate build SBU values and required disk space
+    in Chapter&nbsp;5 does not include test suite data.</para></note>
+-->
+    <para>Now prepare Binutils for compilation:</para>
+
+<screen><userinput remap="configure">../configure --prefix=$LFS/tools       \
+             --with-sysroot=$LFS        \
+             --target=$LFS_TGT          \
+             --disable-nls              \
+             --disable-werror</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--prefix=$LFS/tools</parameter></term>
+        <listitem>
+          <para>This tells the configure script to prepare to install the
+          Binutils programs in the <filename
+          class="directory">$LFS/tools</filename> directory.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-sysroot=$LFS</parameter></term>
+        <listitem>
+          <para>For cross compilation, this tells the build system to look in
+          $LFS for the target system libraries as needed.</para>
+        </listitem>
+      </varlistentry>
+ <!--
+      <varlistentry>
+        <term><parameter>- -with-lib-path=/tools/lib</parameter></term>
+        <listitem>
+          <para>This specifies which library path the linker should be
+          configured to use.</para>
+        </listitem>
+      </varlistentry>
+  -->
+      <varlistentry>
+        <term><envar>--target=$LFS_TGT</envar></term>
+        <listitem>
+          <para>Because the machine description in the <envar>LFS_TGT</envar>
+          variable is slightly different than the value returned by the
+          <command>config.guess</command> script, this switch will tell the
+          <command>configure</command> script to adjust Binutil's build system
+          for building a cross linker.  </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-nls</parameter></term>
+        <listitem>
+          <para>This disables internationalization as i18n is not needed for the
+          temporary tools.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-werror</parameter></term>
+        <listitem>
+          <para>This prevents the build from stopping in the event that there
+          are warnings from the host's compiler.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Continue with compiling the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-binutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 94 - 0
chapter06/binutils-pass2.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-binutils-pass2" role="wrap">
+  <?dbhtml filename="binutils-pass2.html"?>
+
+  <sect1info condition="script">
+    <productname>binutils-pass2</productname>
+    <productnumber>&binutils-version;</productnumber>
+    <address>&binutils-url;</address>
+  </sect1info>
+
+  <title>Binutils-&binutils-version; - Pass 2</title>
+
+  <indexterm zone="ch-tools-binutils-pass2">
+    <primary sortas="a-Binutils">Binutils</primary>
+    <secondary>tools, pass 2</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/binutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&binutils-ch5p2-sbu;</seg>
+        <seg>&binutils-ch5p2-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Binutils</title>
+
+    <para>Create a separate build directory again:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Binutils for compilation:</para>
+
+<screen><userinput remap="configure">../configure                   \
+    --prefix=/usr              \
+    --build=$(../config.guess) \
+    --host=$LFS_TGT            \
+    --disable-nls              \
+    --enable-shared            \
+    --disable-werror</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--host=$LFS_TGT</parameter></term>
+        <listitem>
+          <para>This tells the configure script that we want to build
+          this pass of binutils for the $LFS_TGT machine, using our just
+          built cross-compiler.  This prevents the linker from searching
+          through library directories on the host.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-binutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 25 - 85
chapter06/bison.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-bison" role="wrap">
+<sect1 id="ch-tools-bison" role="wrap">
   <?dbhtml filename="bison.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>Bison-&bison-version;</title>
 
-  <indexterm zone="ch-system-bison">
+  <indexterm zone="ch-tools-bison">
     <primary sortas="a-Bison">Bison</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Bison package contains a parser generator.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/bison.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&bison-ch6-sbu;</seg>
-        <seg>&bison-ch6-du;</seg>
+        <seg>&bison-ch5-sbu;</seg>
+        <seg>&bison-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -39,103 +42,40 @@
 
   <sect2 role="installation">
     <title>Installation of Bison</title>
-<!--
-    <para>First, fix a build problem with the current version:</para>
 
-<screen><userinput remap="pre">sed -i '9327 s/mv/cp/' Makefile.in</userinput></screen>
--->
     <para>Prepare Bison for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
 
-<!--  I could not find a race condidtion in the current version.
-    <para>Compile the package, but work around a race condition in the 
-    current version:</para>
+    <variablelist>
+      <title>The meaning of the new configure option:</title>
+
+      <varlistentry>
+        <term><parameter>--docdir=/usr/share/doc/bison-&bison-version;</parameter></term>
+        <listitem>
+          <para>This tells the build system to install bison documentation
+	  into a versioned directory.</para>
+        </listitem>
+      </varlistentry>
 
-<screen><userinput remap="make">make -j1</userinput></screen>-->
+    </variablelist>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results (about 5.5 SBU), issue:</para>
-
-<screen><userinput remap="test">make check</userinput></screen>
-
-    <para>Fourteen tests fail in the "Diagnostics" section, probably because of
-    missing locales.</para>
-
-<!--
-    <para>There is a circular dependency between bison and flex with regard to
-    the checks.  If desired, after installing flex in the next section, the
-    bison package can be rebuilt and the bison checks can be run with 
-    <command>make check</command>.</para>
--->
-
     <para>Install the package:</para>
 
 <screen><userinput remap="install">make install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-bison" role="content">
-    <title>Contents of Bison</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed library</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>bison and yacc</seg>
-        <seg>liby.a</seg>
-        <seg>/usr/share/bison</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="bison">
-        <term><command>bison</command></term>
-        <listitem>
-          <para>Generates, from a series of rules, a program for analyzing the
-          structure of text files; Bison is a replacement for Yacc (Yet Another
-          Compiler Compiler)</para>
-          <indexterm zone="ch-system-bison bison">
-            <primary sortas="b-bison">bison</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="yacc">
-        <term><command>yacc</command></term>
-        <listitem>
-          <para>A wrapper for <command>bison</command>, meant for programs that
-          still call <command>yacc</command> instead of <command>bison</command>;
-          it calls <command>bison</command> with the <parameter>-y</parameter>
-          option</para>
-          <indexterm zone="ch-system-bison yacc">
-            <primary sortas="b-yacc">yacc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="liby">
-        <term><filename class="libraryfile">liby</filename></term>
-        <listitem>
-          <para>The Yacc library containing implementations of Yacc-compatible
-          <function>yyerror</function> and <function>main</function> functions;
-          this library is normally not very useful, but POSIX requires it</para>
-          <indexterm zone="ch-system-bison liby">
-            <primary sortas="c-liby">liby</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-bison" role="."/></para>
 
   </sect2>
 

+ 32 - 170
chapter06/bzip2.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-bzip2" role="wrap">
+<sect1 id="ch-tools-bzip2" role="wrap">
   <?dbhtml filename="bzip2.html"?>
 
   <sect1info condition="script">
@@ -16,25 +16,25 @@
 
   <title>Bzip2-&bzip2-version;</title>
 
-  <indexterm zone="ch-system-bzip2">
+  <indexterm zone="ch-tools-bzip2">
     <primary sortas="a-Bzip2">Bzip2</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Bzip2 package contains programs for compressing and decompressing
-    files. Compressing text files with <command>bzip2</command> yields a much
-    better compression percentage than with the traditional
-    <command>gzip</command>.</para>
+    <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-ch6-sbu;</seg>
-        <seg>&bzip2-ch6-du;</seg>
+        <seg>&bzip2-ch5-sbu;</seg>
+        <seg>&bzip2-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,11 +43,13 @@
   <sect2 role="installation">
     <title>Installation of Bzip2</title>
 
-    <para>Apply a patch that will install the documentation for this package:</para>
+    <para>Apply a patch that will install the documentation for this
+    package:</para>
 
 <screen><userinput remap="pre">patch -Np1 -i ../&bzip2-docs-patch;</userinput></screen>
 
-   <para>The following command ensures installation of symbolic links are relative:</para>
+    <para>The following command ensures installation of symbolic links are
+    relative:</para>
 
 <screen><userinput remap="pre">sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile</userinput></screen>
 
@@ -55,9 +57,12 @@
 
 <screen><userinput remap="pre">sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile</userinput></screen>
 
-    <para>Prepare Bzip2 for compilation with:</para>
+    <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
+<screen><userinput remap="make">make CC=$LFS_TGT-gcc -f Makefile-libbz2_so
 make clean</userinput></screen>
 
     <variablelist>
@@ -76,174 +81,31 @@ make clean</userinput></screen>
 
     </variablelist>
 
-    <para>Compile and test the package:</para>
+    <para>Compile and test the package with:</para>
 
-<screen><userinput remap="make">make</userinput></screen>
+<screen><userinput remap="make">make CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</userinput></screen>
 
-    <para>Install the programs:</para>
+    <para>Install the package:</para>
 
-<screen><userinput remap="install">make PREFIX=/usr install</userinput></screen>
+<screen><userinput remap="install">make PREFIX=$LFS/usr install</userinput></screen>
 
     <para>Install the shared <command>bzip2</command> binary into the
-    <filename class="directory">/bin</filename> directory, make
-    some necessary symbolic links, and clean up:</para>
+    <filename class="directory">/bin</filename> directory, make some necessary
+    symbolic links, and clean up:</para>
 
-<screen><userinput remap="install">cp -v bzip2-shared /bin/bzip2
-cp -av libbz2.so* /lib
+<screen><userinput remap="install">cp -v bzip2-shared $LFS/bin/bzip2
+cp -av libbz2.so* $LFS/lib
 ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
-rm -v /usr/bin/{bunzip2,bzcat,bzip2}
-ln -sv bzip2 /bin/bunzip2
-ln -sv bzip2 /bin/bzcat</userinput></screen>
+rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
+ln -sv bzip2 $LFS/bin/bunzip2
+ln -sv bzip2 $LFS/bin/bzcat</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-bzip2" role="content">
-    <title>Contents of Bzip2</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp (link to
-        bzdiff), bzdiff, bzegrep (link to bzgrep), bzfgrep (link to bzgrep),
-        bzgrep, bzip2, bzip2recover, bzless (link to bzmore), and bzmore</seg>
-        <seg>libbz2.{a,so}</seg>
-        <seg>/usr/share/doc/bzip2-&bzip2-version;</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="bunzip2">
-        <term><command>bunzip2</command></term>
-        <listitem>
-          <para>Decompresses bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bunzip2">
-            <primary sortas="b-bunzip2">bunzip2</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzcat">
-        <term><command>bzcat</command></term>
-        <listitem>
-          <para>Decompresses to standard output</para>
-          <indexterm zone="ch-system-bzip2 bzcat">
-            <primary sortas="b-bzcat">bzcat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzcmp">
-        <term><command>bzcmp</command></term>
-        <listitem>
-          <para>Runs <command>cmp</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzcmp">
-            <primary sortas="b-bzcmp">bzcmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzdiff">
-        <term><command>bzdiff</command></term>
-        <listitem>
-          <para>Runs <command>diff</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzdiff">
-            <primary sortas="b-bzdiff">bzdiff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzegrep">
-        <term><command>bzegrep</command></term>
-        <listitem>
-          <para>Runs <command>egrep</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzegrep">
-            <primary sortas="b-bzegrep">bzegrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzfgrep">
-        <term><command>bzfgrep</command></term>
-        <listitem>
-          <para>Runs <command>fgrep</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzfgrep">
-            <primary sortas="b-bzfgrep">bzfgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzgrep">
-        <term><command>bzgrep</command></term>
-        <listitem>
-          <para>Runs <command>grep</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzgrep">
-            <primary sortas="b-bzgrep">bzgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzip2">
-        <term><command>bzip2</command></term>
-        <listitem>
-          <para>Compresses files using the Burrows-Wheeler block sorting text
-          compression algorithm with Huffman coding; the compression rate is
-          better than that achieved by more conventional compressors using
-          <quote>Lempel-Ziv</quote> algorithms, like <command>gzip</command></para>
-          <indexterm zone="ch-system-bzip2 bzip2">
-            <primary sortas="b-bzip2">bzip2</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzip2recover">
-        <term><command>bzip2recover</command></term>
-        <listitem>
-          <para>Tries to recover data from damaged bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzip2recover">
-            <primary sortas="b-bzip2recover">bzip2recover</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzless">
-        <term><command>bzless</command></term>
-        <listitem>
-          <para>Runs <command>less</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzless">
-            <primary sortas="b-bzless">bzless</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="bzmore">
-        <term><command>bzmore</command></term>
-        <listitem>
-          <para>Runs <command>more</command> on bzipped files</para>
-          <indexterm zone="ch-system-bzip2 bzmore">
-            <primary sortas="b-bzmore">bzmore</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libbz2">
-        <term><filename class="libraryfile">libbz2</filename></term>
-        <listitem>
-          <para>The library implementing lossless, block-sorting data
-          compression, using the Burrows-Wheeler algorithm</para>
-          <indexterm zone="ch-system-bzip2 libbz2">
-            <primary sortas="c-libbz2">libbz2</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in
+    <xref linkend="contents-bzip2" role="."/></para>
 
   </sect2>
 

+ 41 - 0
chapter06/changingowner.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-changingowner">
+  <?dbhtml filename="changingowner.html"?>
+
+  <title>Changing Ownership</title>
+
+  <note>
+    <para>The commands in the remainder of this book must be performed while
+    logged in as user <systemitem class="username">root</systemitem> and no
+    longer as user <systemitem class="username">lfs</systemitem>. Also, double
+    check that <envar>$LFS</envar> is set in <systemitem
+    class="username">root</systemitem>'s environment.</para>
+  </note>
+
+  <para>Currently, the whole directory hierarchy in <filename
+  class="directory">$LFS</filename>
+  is owned by the user <systemitem class="username">lfs</systemitem>, a user
+  that exists only on the host system. If the directories under <filename
+  class="directory">$LFS</filename> are kept as they are, the files are
+  owned by a user ID without a corresponding account. This is dangerous because
+  a user account created later could get this same user ID and would own all
+  the files under <filename class="directory">$LFS</filename>, thus exposing
+  these files to possible malicious manipulation.</para>
+
+  <para>To avoid this issue, you could add the <systemitem
+  class="username">lfs</systemitem> user to the new LFS system later when
+  creating the <filename>/etc/passwd</filename> file, taking care to assign it
+  the same user and group IDs as on the host system. Better yet, change the
+  ownership of the <filename class="directory">$LFS/*</filename> directories to
+  user <systemitem class="username">root</systemitem> by running the following
+  command:</para>
+
+<screen><userinput>chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}</userinput></screen>
+
+</sect1>

+ 11 - 82
chapter06/chapter06.xml

@@ -5,101 +5,30 @@
   %general-entities;
 ]>
 
-<chapter id="chapter-building-system" xreflabel="Chapter&nbsp;6">
+<chapter id="chapter-temporary-tools" xreflabel="Chapter&nbsp;6">
   <?dbhtml dir="chapter06"?>
   <?dbhtml filename="chapter06.html"?>
 
-  <title>Installing Basic System Software</title>
+  <title>Cross Compiling Temporary Tools</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="pkgmgt.xml"/>
-<!--  <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="man-pages.xml"/>
-<!--  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="adjusting.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="zlib.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bzip2.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="zstd.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="readline.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="bc.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="flex.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gmp.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpfr.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpc.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="attr.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="acl.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libcap.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="shadow.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pkgconfig.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="sed.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="psmisc.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="iana-etc.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="bison.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="bash.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libtool.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gdbm.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gperf.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expat.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inetutils.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="xml-parser.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="intltool.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="autoconf.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="automake.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kmod.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libelf.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libffi.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="openssl.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="ninja.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="meson.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="check.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="gawk.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="groff.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grub.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="less.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="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="iproute2.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kbd.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libpipeline.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="man-db.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="vim.xml"/>
-
-  <!-- systemd only -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dbus.xml"/>
-
-  <!-- sysv only -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="eudev.xml"/>
-
-  <!-- Both sysv on systemd builds -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="procps.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
-
-  <!-- Both sysv and systemd builds -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="e2fsprogs.xml"/>
-
-  <!-- sysv only -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysvinit.xml"/>
-
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutdebug.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="strippingagain.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="revisedchroot.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="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="stripping.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
 
 </chapter>

+ 65 - 0
chapter06/chroot.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-chroot">
+  <?dbhtml filename="chroot.html"?>
+
+  <title>Entering the Chroot Environment</title>
+
+  <para>Now that all the packages which depend on themselves for being built
+  are on the system, it is time to enter the chroot environment to finish
+  installing the remaining temporary tools. This environment will be in use
+  also for installing the final system. As user <systemitem
+  class="username">root</systemitem>, run the following command to enter the
+  realm that is, at the moment, populated with only the temporary tools:</para>
+
+<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
+    HOME=/root                  \
+    TERM="$TERM"                \
+    PS1='(lfs chroot) \u:\w\$ ' \
+    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
+    /bin/bash --login +h</userinput></screen>
+
+  <para>The <parameter>-i</parameter> option given to the <command>env</command>
+  command will clear all variables of the chroot environment. After that, only
+  the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
+  <envar>PATH</envar> variables are set again. The
+  <parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
+  variable inside chroot to the same value as outside chroot. This variable is
+  needed for programs like <command>vim</command> and <command>less</command>
+  to operate properly.  If other variables are needed, such as
+  <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
+  them again.</para>
+
+  <para>From this point on, there is no need to use the
+  <envar>LFS</envar> variable anymore, because all work will be restricted
+  to the LFS file system.  This is because the Bash shell is told that
+  <filename class="directory">$LFS</filename> is now the root
+  (<filename class="directory">/</filename>) directory.</para>
+
+  <para>Notice that <filename class="directory">/tools/bin</filename> is not
+  anymore in the <envar>PATH</envar>. This means that a temporary tool will no longer be
+  used once its final version is installed. This occurs when the shell does not
+  <quote>remember</quote> the locations of executed binaries&mdash;for this
+  reason, hashing is switched off by passing the <parameter>+h</parameter> option
+  to <command>bash</command>.</para>
+
+  <para>Note that the <command>bash</command> prompt will say
+  <computeroutput>I have no name!</computeroutput> This is normal because the
+  <filename>/etc/passwd</filename> file has not been created yet.</para>
+
+  <note>
+    <para>It is important that all the commands throughout the remainder of this
+    chapter and the following chapters are run from within the chroot
+    environment. If you leave this environment for any reason (rebooting for
+    example), ensure that the virtual kernel filesystems are mounted as
+    explained in <xref linkend="ch-system-bindmount"/> and <xref
+    linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
+    with the installation.</para>
+  </note>
+
+</sect1>

+ 41 - 1223
chapter06/coreutils.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-coreutils" role="wrap">
+<sect1 id="ch-tools-coreutils" role="wrap">
   <?dbhtml filename="coreutils.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>Coreutils-&coreutils-version;</title>
 
-  <indexterm zone="ch-system-coreutils">
+  <indexterm zone="ch-tools-coreutils">
     <primary sortas="a-Coreutils">Coreutils</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Coreutils package contains utilities for showing and setting the
-    basic system characteristics.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/coreutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&coreutils-ch6-sbu;</seg>
-        <seg>&coreutils-ch6-du;</seg>
+        <seg>&coreutils-ch5-sbu;</seg>
+        <seg>&coreutils-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -41,59 +43,23 @@
   <sect2 role="installation">
     <title>Installation of Coreutils</title>
 
-    <para>POSIX requires that programs from Coreutils recognize character
-    boundaries correctly even in multibyte locales. The following patch fixes
-    this non-compliance and other internationalization-related bugs.</para>
+    <para>Prepare Coreutils for compilation:</para>
 
-<screen><userinput remap="pre">patch -Np1 -i ../&coreutils-i18n-patch;</userinput></screen>
-
-    <note>
-      <para>In the past, many bugs were found in this patch. When reporting new
-      bugs to Coreutils maintainers, please check first if they are reproducible
-      without this patch.</para>
-    </note>
-
-   <!-- this has been fixed in upstream gnulib, when a new version of
-   coreutils is released, please check #4055 to see if the change has been
-   picked up in this package -->
-   <para>Suppress a test which on some machines can loop forever:</para>
-
-<screen><userinput remap="pre">sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk</userinput></screen>
-
-    <para>Now prepare Coreutils for compilation:</para>
-
-<screen><userinput remap="configure">autoreconf -fiv
-FORCE_UNSAFE_CONFIGURE=1 ./configure \
-            --prefix=/usr            \
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --host=$LFS_TGT                   \
+            --build=$(build-aux/config.guess) \
+            --enable-install-program=hostname \
             --enable-no-install-program=kill,uptime</userinput></screen>
 
     <variablelist>
       <title>The meaning of the configure options:</title>
 
       <varlistentry>
-        <term><command>autoreconf</command></term>
-        <listitem>
-          <para>This command updates generated configuration files 
-          consistent with the latest version of automake.
-          </para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><envar>FORCE_UNSAFE_CONFIGURE=1</envar></term>
-        <listitem>
-          <para>This environment variable allows the package to be 
-          built as the root user.
-          </para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><parameter>--enable-no-install-program=kill,uptime</parameter></term>
+        <term><envar>--enable-install-program=hostname</envar></term>
         <listitem>
-          <para>The purpose of this switch is to prevent Coreutils from
-          installing binaries that will be installed by other packages later.
-          </para>
+          <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>
@@ -102,1185 +68,37 @@ FORCE_UNSAFE_CONFIGURE=1 ./configure \
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>Skip down to <quote>Install the
-    package</quote> if not running the test suite.</para>
-
-    <para>Now the test suite is ready to be run. First, run the tests that are
-    meant to be run as user <systemitem class="username">root</systemitem>:</para>
-
-<screen><userinput remap="test">make NON_ROOT_USERNAME=tester check-root</userinput></screen>
-
-    <para>We're going to run the remainder of the tests as the
-    <systemitem class="username">tester</systemitem> user. Certain tests,
-    however, require that the user be a member of more than one group. So that
-    these tests are not skipped we'll add a temporary group and make the
-    user <systemitem class="username">tester</systemitem> a part of it:</para>
-
-<screen><userinput remap="test">echo "dummy:x:102:tester" &gt;&gt; /etc/group</userinput></screen>
-
-    <para>Fix some of the permissions so that the non-root user can compile and
-    run the tests:</para>
-
-<screen><userinput remap="test">chown -Rv tester . </userinput></screen>
-
-    <para>Now run the tests:</para>
-
-<screen><userinput remap="test">su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"</userinput></screen>
-<!--
-    <para>The test program test-getlogin is known to fail in a
-    partially built system environment like the chroot environment here, but
-    passes if run at the end of this chapter.  The test program tty.sh is
-    also known to fail.</para>
--->
-
-    <para>Remove the temporary group:</para>
-
-<screen><userinput remap="test">sed -i '/dummy/d' /etc/group</userinput></screen>
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make install</userinput></screen>
-
-    <para>Move programs to the locations specified by the FHS:</para>
-
-<screen><userinput remap="install">mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
-mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
-mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
-mv -v /usr/bin/chroot /usr/sbin
-mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
-sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8</userinput></screen>
-
-    <para revision="sysv">Some of the scripts in the LFS-Bootscripts package
-    depend on <command>head</command>, <command>nice</command>,
-    <command>sleep</command>, and <command>touch</command>.  As <filename
-    class="directory">/usr</filename> may not be available during the early and
-    late stages of booting, those binaries need to be on the root partition to
-    maintain FHS compliance:</para>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+<!--
+    <para>The above command refuses to install <filename>su</filename>
+    because the program cannot be installed setuid root as a non-privileged
+    user. By manually installing it, we can use it for running tests in the
+    final system as a non-privileged user. Install it with:</para>
 
-<screen><userinput remap="install">mv -v /usr/bin/{head,nice,sleep,touch} /bin</userinput></screen>
+<screen><userinput remap="install">cp -v src/su /tools/bin</userinput></screen>
+-->
+    <para>Move programs to their final expected locations. Although this is
+    not necessary in this temporary environment, we must do so because some
+    programs harcode executable locations:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin
+mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin
+mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin
+mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
+mkdir -pv $LFS/usr/share/man/man8
+mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
+sed -i s/\"1\"/\"8\"/1 $LFS/usr/share/man/man8/chroot.8
+mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-coreutils" role="content">
-    <title>Contents of Coreutils</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed library</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>[, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown,
-        chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors,
-        dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups,
-        head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir,
-        mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste,
-        pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm,
-        rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum,
-        sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum,
-        sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort,
-        tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and
-        yes</seg>
-        <seg>libstdbuf.so (in /usr/libexec/coreutils)</seg>
-        <seg>/usr/libexec/coreutils</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="base32">
-        <term><command>base32</command></term>
-        <listitem>
-          <para>Encodes and decodes data according to the base32 specification
-          (RFC 4648)</para>
-          <indexterm zone="ch-system-coreutils base64">
-            <primary sortas="b-base64">base64</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="base64">
-        <term><command>base64</command></term>
-        <listitem>
-          <para>Encodes and decodes data according to the base64 specification
-          (RFC 4648)</para>
-          <indexterm zone="ch-system-coreutils base64">
-            <primary sortas="b-base64">base64</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="b2sum">
-        <term><command>b2sum</command></term>
-        <listitem>
-          <para>Prints or checks BLAKE2 (512-bit) checksums</para>
-          <indexterm zone="ch-system-coreutils b2sum">
-            <primary sortas="b-b2sum">b2sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="basename">
-        <term><command>basename</command></term>
-        <listitem>
-          <para>Strips any path and a given suffix from a file name</para>
-          <indexterm zone="ch-system-coreutils basename">
-            <primary sortas="b-basename">basename</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="basenc">
-        <term><command>basenc</command></term>
-        <listitem>
-          <para>Encodes or decodes data using various algorithms</para>
-          <indexterm zone="ch-system-coreutils basenc">
-            <primary sortas="b-basenc">basenc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cat">
-        <term><command>cat</command></term>
-        <listitem>
-          <para>Concatenates files to standard output</para>
-          <indexterm zone="ch-system-coreutils cat">
-            <primary sortas="b-cat">cat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chcon">
-        <term><command>chcon</command></term>
-        <listitem>
-          <para>Changes security context for files and directories</para>
-          <indexterm zone="ch-system-coreutils chcon">
-            <primary sortas="b-chcon">chcon</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chgrp">
-        <term><command>chgrp</command></term>
-        <listitem>
-          <para>Changes the group ownership of files and directories</para>
-          <indexterm zone="ch-system-coreutils chgrp">
-            <primary sortas="b-chgrp">chgrp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chmod">
-        <term><command>chmod</command></term>
-        <listitem>
-          <para>Changes the permissions of each file to the given mode; the mode
-          can be either a symbolic representation of the changes to make or an
-          octal number representing the new permissions</para>
-          <indexterm zone="ch-system-coreutils chmod">
-            <primary sortas="b-chmod">chmod</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chown">
-        <term><command>chown</command></term>
-        <listitem>
-          <para>Changes the user and/or group ownership of files and
-          directories</para>
-          <indexterm zone="ch-system-coreutils chown">
-            <primary sortas="b-chown">chown</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chroot">
-        <term><command>chroot</command></term>
-        <listitem>
-          <para>Runs a command with the specified directory as the
-          <filename class="directory">/</filename> directory</para>
-          <indexterm zone="ch-system-coreutils chroot">
-            <primary sortas="b-chroot">chroot</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cksum">
-        <term><command>cksum</command></term>
-        <listitem>
-          <para>Prints the Cyclic Redundancy Check (CRC) checksum and the byte
-          counts of each specified file</para>
-          <indexterm zone="ch-system-coreutils cksum">
-            <primary sortas="b-cksum">cksum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="comm">
-        <term><command>comm</command></term>
-        <listitem>
-          <para>Compares two sorted files, outputting in three columns the lines
-          that are unique and the lines that are common</para>
-          <indexterm zone="ch-system-coreutils comm">
-            <primary sortas="b-comm">comm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cp">
-        <term><command>cp</command></term>
-        <listitem>
-          <para>Copies files</para>
-          <indexterm zone="ch-system-coreutils cp">
-            <primary sortas="b-cp">cp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="csplit">
-        <term><command>csplit</command></term>
-        <listitem>
-          <para>Splits a given file into several new files, separating them
-          according to given patterns or line numbers and outputting the byte
-          count of each new file</para>
-          <indexterm zone="ch-system-coreutils csplit">
-            <primary sortas="b-csplit">csplit</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cut">
-        <term><command>cut</command></term>
-        <listitem>
-          <para>Prints sections of lines, selecting the parts according to given
-          fields or positions</para>
-          <indexterm zone="ch-system-coreutils cut">
-            <primary sortas="b-cut">cut</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="date">
-        <term><command>date</command></term>
-        <listitem>
-          <para>Displays the current time in the given format, or sets the
-          system date</para>
-          <indexterm zone="ch-system-coreutils date">
-            <primary sortas="b-date">date</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="dd">
-        <term><command>dd</command> </term>
-        <listitem>
-          <para>Copies a file using the given block size and count, while
-          optionally performing conversions on it</para>
-          <indexterm zone="ch-system-coreutils dd">
-            <primary sortas="b-dd">dd</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="df">
-        <term><command>df</command></term>
-        <listitem>
-          <para>Reports the amount of disk space available (and used) on all
-          mounted file systems, or only on the file systems holding the selected
-          files</para>
-          <indexterm zone="ch-system-coreutils df">
-            <primary sortas="b-df">df</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="dir">
-        <term><command>dir</command></term>
-        <listitem>
-          <para>Lists the contents of each given directory (the same as
-          the <command>ls</command> command)</para>
-          <indexterm zone="ch-system-coreutils dir">
-            <primary sortas="b-dir">dir</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="dircolors">
-        <term><command>dircolors</command></term>
-        <listitem>
-          <para>Outputs commands to set the <envar>LS_COLOR</envar>
-          environment variable to change the color scheme used by
-          <command>ls</command></para>
-          <indexterm zone="ch-system-coreutils dircolors">
-            <primary sortas="b-dircolors">dircolors</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="dirname">
-        <term><command>dirname</command></term>
-        <listitem>
-          <para>Strips the non-directory suffix from a file name</para>
-          <indexterm zone="ch-system-coreutils dirname">
-            <primary sortas="b-dirname">dirname</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="du">
-        <term><command>du</command></term>
-        <listitem>
-          <para>Reports the amount of disk space used by the current directory,
-          by each of the given directories (including all subdirectories) or by
-          each of the given files</para>
-          <indexterm zone="ch-system-coreutils du">
-            <primary sortas="b-du">du</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="echo">
-        <term><command>echo</command></term>
-        <listitem>
-          <para>Displays the given strings</para>
-          <indexterm zone="ch-system-coreutils echo">
-            <primary sortas="b-echo">echo</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="env">
-        <term><command>env</command></term>
-        <listitem>
-          <para>Runs a command in a modified environment</para>
-          <indexterm zone="ch-system-coreutils env">
-            <primary sortas="b-env">env</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="expand">
-        <term><command>expand</command></term>
-        <listitem>
-          <para>Converts tabs to spaces</para>
-          <indexterm zone="ch-system-coreutils expand">
-            <primary sortas="b-expand">expand</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="expr">
-        <term><command>expr</command></term>
-        <listitem>
-          <para>Evaluates expressions</para>
-          <indexterm zone="ch-system-coreutils expr">
-            <primary sortas="b-expr">expr</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="factor">
-        <term><command>factor</command></term>
-        <listitem>
-          <para>Prints the prime factors of all specified integer numbers</para>
-          <indexterm zone="ch-system-coreutils factor">
-            <primary sortas="b-factor">factor</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="false">
-        <term><command>false</command></term>
-        <listitem>
-          <para>Does nothing, unsuccessfully; it always exits with a status code
-          indicating failure</para>
-          <indexterm zone="ch-system-coreutils false">
-            <primary sortas="b-false">false</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fmt">
-        <term><command>fmt</command></term>
-        <listitem>
-          <para>Reformats the paragraphs in the given files</para>
-          <indexterm zone="ch-system-coreutils fmt">
-            <primary sortas="b-fmt">fmt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fold">
-        <term><command>fold</command></term>
-        <listitem>
-          <para>Wraps the lines in the given files</para>
-          <indexterm zone="ch-system-coreutils fold">
-            <primary sortas="b-fold">fold</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="groups">
-        <term><command>groups</command></term>
-        <listitem>
-          <para>Reports a user's group memberships</para>
-          <indexterm zone="ch-system-coreutils groups">
-            <primary sortas="b-groups">groups</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="head">
-        <term><command>head</command></term>
-        <listitem>
-          <para>Prints the first ten lines (or the given number of lines)
-          of each given file</para>
-          <indexterm zone="ch-system-coreutils head">
-            <primary sortas="b-head">head</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="hostid">
-        <term><command>hostid</command></term>
-        <listitem>
-          <para>Reports the numeric identifier (in hexadecimal) of the host</para>
-          <indexterm zone="ch-system-coreutils hostid">
-            <primary sortas="b-hostid">hostid</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="id">
-        <term><command>id</command></term>
-        <listitem>
-          <para>Reports the effective user ID, group ID, and group memberships
-          of the current user or specified user</para>
-          <indexterm zone="ch-system-coreutils id">
-            <primary sortas="b-id">id</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="install">
-        <term><command>install</command> </term>
-        <listitem>
-          <para>Copies files while setting their permission modes and, if
-          possible, their owner and group</para>
-          <indexterm zone="ch-system-coreutils install">
-            <primary sortas="b-install">install</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="join">
-        <term><command>join</command></term>
-        <listitem>
-          <para>Joins the lines that have identical join fields from two
-          separate files</para>
-          <indexterm zone="ch-system-coreutils join">
-            <primary sortas="b-join">join</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="link">
-        <term><command>link</command></term>
-        <listitem>
-          <para>Creates a hard link with the given name to a file</para>
-          <indexterm zone="ch-system-coreutils link">
-            <primary sortas="b-link">link</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ln">
-        <term><command>ln</command></term>
-        <listitem>
-          <para>Makes hard links or soft (symbolic) links between files</para>
-          <indexterm zone="ch-system-coreutils ln">
-            <primary sortas="b-ln">ln</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="logname">
-        <term><command>logname</command></term>
-        <listitem>
-          <para>Reports the current user's login name</para>
-          <indexterm zone="ch-system-coreutils logname">
-            <primary sortas="b-logname">logname</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ls">
-        <term><command>ls</command></term>
-        <listitem>
-          <para>Lists the contents of each given directory</para>
-          <indexterm zone="ch-system-coreutils ls">
-            <primary sortas="b-ls">ls</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="md5sum">
-        <term><command>md5sum</command></term>
-        <listitem>
-          <para>Reports or checks Message Digest 5 (MD5) checksums</para>
-          <indexterm zone="ch-system-coreutils md5sum">
-            <primary sortas="b-md5sum">md5sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkdir">
-        <term><command>mkdir</command></term>
-        <listitem>
-          <para>Creates directories with the given names</para>
-          <indexterm zone="ch-system-coreutils mkdir">
-            <primary sortas="b-mkdir">mkdir</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkfifo">
-        <term><command>mkfifo</command></term>
-        <listitem>
-          <para>Creates First-In, First-Outs (FIFOs), a "named
-          pipe" in UNIX parlance, with the given names</para>
-          <indexterm zone="ch-system-coreutils mkfifo">
-            <primary sortas="b-mkfifo">mkfifo</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mknod">
-        <term><command>mknod</command></term>
-        <listitem>
-          <para>Creates device nodes with the given names; a device node is a
-          character special file, a block special file, or a FIFO</para>
-          <indexterm zone="ch-system-coreutils mknod">
-            <primary sortas="b-mknod">mknod</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mktemp">
-        <term><command>mktemp</command></term>
-        <listitem>
-          <para>Creates temporary files in a secure manner; it is used in scripts</para>
-        <indexterm zone="ch-system-coreutils mktemp">
-          <primary sortas="b-mktemp">mktemp</primary>
-        </indexterm>
-       </listitem>
-     </varlistentry>
-
-      <varlistentry id="mv">
-        <term><command>mv</command></term>
-        <listitem>
-          <para>Moves or renames files or directories</para>
-          <indexterm zone="ch-system-coreutils mv">
-            <primary sortas="b-mv">mv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="nice">
-        <term><command>nice</command></term>
-        <listitem>
-          <para>Runs a program with modified scheduling priority</para>
-          <indexterm zone="ch-system-coreutils nice">
-            <primary sortas="b-nice">nice</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="nl">
-        <term><command>nl</command></term>
-        <listitem>
-          <para>Numbers the lines from the given files</para>
-          <indexterm zone="ch-system-coreutils nl">
-            <primary sortas="b-nl">nl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="nohup">
-        <term><command>nohup</command></term>
-        <listitem>
-          <para>Runs a command immune to hangups, with its output redirected to
-          a log file</para>
-          <indexterm zone="ch-system-coreutils nohup">
-            <primary sortas="b-nohup">nohup</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="nproc">
-        <term><command>nproc</command></term>
-        <listitem>
-          <para>Prints the number of processing units available to a
-          process</para>
-          <indexterm zone="ch-system-coreutils nproc">
-            <primary sortas="b-nproc">nproc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="numfmt">
-        <term><command>numfmt</command></term>
-        <listitem>
-          <para>Converts numbers to or from human-readable strings</para>
-          <indexterm zone="ch-system-coreutils numfmt">
-            <primary sortas="b-numfmt">numfmt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="od">
-        <term><command>od</command></term>
-        <listitem>
-          <para>Dumps files in octal and other formats</para>
-          <indexterm zone="ch-system-coreutils od">
-            <primary sortas="b-od">od</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="paste">
-        <term><command>paste</command></term>
-        <listitem>
-          <para>Merges the given files, joining sequentially corresponding lines
-          side by side, separated by tab characters</para>
-          <indexterm zone="ch-system-coreutils paste">
-            <primary sortas="b-paste">paste</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pathchk">
-        <term><command>pathchk</command></term>
-        <listitem>
-          <para>Checks if file names are valid or portable</para>
-          <indexterm zone="ch-system-coreutils pathchk">
-            <primary sortas="b-pathchk">pathchk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pinky">
-        <term><command>pinky</command></term>
-        <listitem>
-          <para>Is a lightweight finger client; it reports some information
-          about the given users</para>
-          <indexterm zone="ch-system-coreutils pinky">
-            <primary sortas="b-pinky">pinky</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pr">
-        <term><command>pr</command></term>
-        <listitem>
-          <para>Paginates and columnates files for printing</para>
-          <indexterm zone="ch-system-coreutils pr">
-            <primary sortas="b-pr">pr</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="printenv">
-        <term><command>printenv</command></term>
-        <listitem>
-          <para>Prints the environment</para>
-          <indexterm zone="ch-system-coreutils printenv">
-            <primary sortas="b-printenv">printenv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="printf">
-        <term><command>printf</command></term>
-        <listitem>
-          <para>Prints the given arguments according to the given format, much
-          like the C printf function</para>
-          <indexterm zone="ch-system-coreutils printf">
-            <primary sortas="b-printf">printf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ptx">
-        <term><command>ptx</command></term>
-        <listitem>
-          <para>Produces a permuted index from the contents of the given files,
-          with each keyword in its context</para>
-          <indexterm zone="ch-system-coreutils ptx">
-            <primary sortas="b-ptx">ptx</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pwd">
-        <term><command>pwd</command></term>
-        <listitem>
-          <para>Reports the name of the current working directory</para>
-          <indexterm zone="ch-system-coreutils pwd">
-            <primary sortas="b-pwd">pwd</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="readlink">
-        <term><command>readlink</command></term>
-        <listitem>
-          <para>Reports the value of the given symbolic link</para>
-          <indexterm zone="ch-system-coreutils readlink">
-            <primary sortas="b-readlink">readlink</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="realpath">
-        <term><command>realpath</command></term>
-        <listitem>
-          <para>Prints the resolved path</para>
-          <indexterm zone="ch-system-coreutils realpath">
-            <primary sortas="b-realpath">realpath</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="rm">
-        <term><command>rm</command></term>
-        <listitem>
-          <para>Removes files or directories</para>
-          <indexterm zone="ch-system-coreutils rm">
-            <primary sortas="b-rm">rm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="rmdir">
-        <term><command>rmdir</command></term>
-        <listitem>
-          <para>Removes directories if they are empty</para>
-          <indexterm zone="ch-system-coreutils rmdir">
-            <primary sortas="b-rmdir">rmdir</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="runcon">
-        <term><command>runcon</command></term>
-        <listitem>
-          <para>Runs a command with specified security context</para>
-          <indexterm zone="ch-system-coreutils runcon">
-            <primary sortas="b-runcon">runcon</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="seq">
-        <term><command>seq</command></term>
-        <listitem>
-          <para>Prints a sequence of numbers within a given range and with a
-          given increment</para>
-          <indexterm zone="ch-system-coreutils seq">
-            <primary sortas="b-seq">seq</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sha1sum">
-        <term><command>sha1sum</command></term>
-        <listitem>
-          <para>Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1)
-          checksums</para>
-          <indexterm zone="ch-system-coreutils sha1sum">
-            <primary sortas="b-sha1sum">sha1sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sha224sum">
-        <term><command>sha224sum</command></term>
-        <listitem>
-          <para>Prints or checks 224-bit Secure Hash Algorithm checksums</para>
-          <indexterm zone="ch-system-coreutils sha224sum">
-            <primary sortas="b-sha224sum">sha224sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sha256sum">
-        <term><command>sha256sum</command></term>
-        <listitem>
-          <para>Prints or checks 256-bit Secure Hash Algorithm checksums</para>
-          <indexterm zone="ch-system-coreutils sha256sum">
-            <primary sortas="b-sha256sum">sha256sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sha384sum">
-        <term><command>sha384sum</command></term>
-        <listitem>
-          <para>Prints or checks 384-bit Secure Hash Algorithm checksums</para>
-          <indexterm zone="ch-system-coreutils sha384sum">
-            <primary sortas="b-sha384sum">sha384sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sha512sum">
-        <term><command>sha512sum</command></term>
-        <listitem>
-          <para>Prints or checks 512-bit Secure Hash Algorithm checksums</para>
-          <indexterm zone="ch-system-coreutils sha512sum">
-            <primary sortas="b-sha512sum">sha512sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="shred">
-        <term><command>shred</command></term>
-        <listitem>
-          <para>Overwrites the given files repeatedly with complex patterns,
-          making it difficult to recover the data</para>
-          <indexterm zone="ch-system-coreutils shred">
-            <primary sortas="b-shred">shred</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="shuf">
-        <term><command>shuf</command></term>
-        <listitem>
-          <para>Shuffles lines of text</para>
-          <indexterm zone="ch-system-coreutils shuf">
-            <primary sortas="b-shuf">shuf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sleep">
-        <term><command>sleep</command></term>
-        <listitem>
-          <para>Pauses for the given amount of time</para>
-          <indexterm zone="ch-system-coreutils sleep">
-            <primary sortas="b-sleep">sleep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sort">
-        <term><command>sort</command></term>
-        <listitem>
-          <para>Sorts the lines from the given files</para>
-          <indexterm zone="ch-system-coreutils sort">
-            <primary sortas="b-sort">sort</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="split">
-        <term><command>split</command></term>
-        <listitem>
-          <para>Splits the given file into pieces, by size or by number of
-          lines</para>
-          <indexterm zone="ch-system-coreutils split">
-            <primary sortas="b-split">split</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="stat">
-        <term><command>stat</command></term>
-        <listitem>
-          <para>Displays file or filesystem status</para>
-          <indexterm zone="ch-system-coreutils stat">
-            <primary sortas="b-stat">stat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="stdbuf">
-        <term><command>stdbuf</command></term>
-        <listitem>
-          <para>Runs commands with altered buffering operations for its standard
-          streams</para>
-          <indexterm zone="ch-system-coreutils stdbuf">
-            <primary sortas="b-stdbuf">stdbuf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="stty">
-        <term><command>stty</command></term>
-        <listitem>
-          <para>Sets or reports terminal line settings</para>
-          <indexterm zone="ch-system-coreutils stty">
-            <primary sortas="b-stty">stty</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sum">
-        <term><command>sum</command></term>
-        <listitem>
-          <para>Prints checksum and block counts for each given file</para>
-          <indexterm zone="ch-system-coreutils sum">
-            <primary sortas="b-sum">sum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sync">
-        <term><command>sync</command></term>
-        <listitem>
-          <para>Flushes file system buffers; it forces changed blocks to disk
-          and updates the super block</para>
-          <indexterm zone="ch-system-coreutils sync">
-            <primary sortas="b-sync">sync</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tac">
-        <term><command>tac</command></term>
-        <listitem>
-          <para>Concatenates the given files in reverse</para>
-          <indexterm zone="ch-system-coreutils tac">
-            <primary sortas="b-tac">tac</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tail">
-        <term><command>tail</command></term>
-        <listitem>
-          <para>Prints the last ten lines (or the given number of lines) of each
-          given file</para>
-          <indexterm zone="ch-system-coreutils tail">
-            <primary sortas="b-tail">tail</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tee">
-        <term><command>tee</command></term>
-        <listitem>
-          <para>Reads from standard input while writing both to standard output
-          and to the given files</para>
-          <indexterm zone="ch-system-coreutils tee">
-            <primary sortas="b-tee">tee</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="test">
-        <term><command>test</command></term>
-        <listitem>
-          <para>Compares values and checks file types</para>
-          <indexterm zone="ch-system-coreutils test">
-            <primary sortas="b-test">test</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="timeout">
-        <term><command>timeout</command></term>
-        <listitem>
-          <para>Runs a command with a time limit</para>
-          <indexterm zone="ch-system-coreutils timeout">
-            <primary sortas="b-timeout">timeout</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="touch">
-        <term><command>touch</command></term>
-        <listitem>
-          <para>Changes file timestamps, setting the access and modification
-          times of the given files to the current time; files that do not exist
-          are created with zero length</para>
-          <indexterm zone="ch-system-coreutils touch">
-            <primary sortas="b-touch">touch</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tr">
-        <term><command>tr</command></term>
-        <listitem>
-          <para>Translates, squeezes, and deletes the given characters from
-          standard input</para>
-          <indexterm zone="ch-system-coreutils tr">
-            <primary sortas="b-tr">tr</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="true">
-        <term><command>true</command></term>
-        <listitem>
-          <para>Does nothing, successfully; it always exits with a status code
-          indicating success</para>
-          <indexterm zone="ch-system-coreutils true">
-            <primary sortas="b-true">true</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="truncate">
-        <term><command>truncate</command></term>
-        <listitem>
-          <para>Shrinks or expands a file to the specified size</para>
-          <indexterm zone="ch-system-coreutils truncate">
-            <primary sortas="b-truncate">truncate</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tsort">
-        <term><command>tsort</command></term>
-        <listitem>
-          <para>Performs a topological sort; it writes a completely ordered list
-          according to the partial ordering in a given file</para>
-          <indexterm zone="ch-system-coreutils tsort">
-            <primary sortas="b-tsort">tsort</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tty">
-        <term><command>tty</command></term>
-        <listitem>
-          <para>Reports the file name of the terminal connected to standard
-          input</para>
-          <indexterm zone="ch-system-coreutils tty">
-            <primary sortas="b-tty">tty</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uname">
-        <term><command>uname</command></term>
-        <listitem>
-          <para>Reports system information</para>
-          <indexterm zone="ch-system-coreutils uname">
-            <primary sortas="b-uname">uname</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="unexpand">
-        <term><command>unexpand</command></term>
-        <listitem>
-          <para>Converts spaces to tabs</para>
-          <indexterm zone="ch-system-coreutils unexpand">
-            <primary sortas="b-unexpand">unexpand</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uniq">
-        <term><command>uniq</command></term>
-        <listitem>
-          <para>Discards all but one of successive identical lines</para>
-          <indexterm zone="ch-system-coreutils uniq">
-            <primary sortas="b-uniq">uniq</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="unlink">
-        <term><command>unlink</command></term>
-        <listitem>
-          <para>Removes the given file</para>
-          <indexterm zone="ch-system-coreutils unlink">
-            <primary sortas="b-unlink">unlink</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="users">
-        <term><command>users</command></term>
-        <listitem>
-          <para>Reports the names of the users currently logged on</para>
-          <indexterm zone="ch-system-coreutils users">
-            <primary sortas="b-users">users</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="vdir">
-        <term><command>vdir</command></term>
-        <listitem>
-          <para>Is the same as <command>ls -l</command></para>
-          <indexterm zone="ch-system-coreutils vdir">
-            <primary sortas="b-vdir">vdir</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="wc">
-        <term><command>wc</command></term>
-        <listitem>
-          <para>Reports the number of lines, words, and bytes for each given
-          file, as well as a total line when more than one file is given</para>
-          <indexterm zone="ch-system-coreutils wc">
-            <primary sortas="b-wc">wc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="who">
-        <term><command>who</command></term>
-        <listitem>
-          <para>Reports who is logged on</para>
-          <indexterm zone="ch-system-coreutils who">
-            <primary sortas="b-who">who</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="whoami">
-        <term><command>whoami</command></term>
-        <listitem>
-          <para>Reports the user name associated with the current effective
-          user ID</para>
-          <indexterm zone="ch-system-coreutils whoami">
-            <primary sortas="b-whoami">whoami</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="yes">
-        <term><command>yes</command></term>
-        <listitem>
-          <para>Repeatedly outputs <quote>y</quote> or a given string until
-          killed</para>
-          <indexterm zone="ch-system-coreutils yes">
-            <primary sortas="b-yes">yes</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libstdbuf">
-        <term><filename class="libraryfile">libstdbuf</filename></term>
-        <listitem>
-          <para>Library used by <command>stdbuf</command></para>
-          <indexterm zone="ch-system-coreutils libstdbuf">
-            <primary sortas="c-libstdbuf">libstdbuf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-coreutils" role="."/></para>
 
   </sect2>
 

+ 204 - 0
chapter06/createfiles.xml

@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-createfiles">
+  <?dbhtml filename="createfiles.html"?>
+
+  <title>Creating Essential Files and Symlinks</title>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/etc/passwd">/etc/passwd</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/etc/group">/etc/group</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
+  </indexterm>
+
+  <para>Historically, Linux maintains a list of the mounted file systems in the
+  file <filename>/etc/mtab</filename>. Modern kernels maintain this list
+  internally and exposes it to the user via the <filename
+  class="directory">/proc</filename> filesystem. To satisfy utilities that
+  expect the presence of <filename>/etc/mtab</filename>, create the following
+  symbolic link:</para>
+
+<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
+
+  <para>In order for user <systemitem class="username">root</systemitem> to be
+  able to login and for the name <quote>root</quote> to be recognized, there
+  must be relevant entries in the <filename>/etc/passwd</filename> and
+  <filename>/etc/group</filename> files.</para>
+
+  <para>Create the <filename>/etc/passwd</filename> file by running the following
+  command:</para>
+
+<screen revision="sysv"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
+EOF</userinput></screen>
+
+<screen revision="systemd"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
+systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false
+systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false
+systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false
+systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false
+systemd-network:x:76:76:systemd Network Management:/:/bin/false
+systemd-resolve:x:77:77:systemd Resolver:/:/bin/false
+systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false
+systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
+EOF</userinput></screen>
+
+  <para>The actual password for <systemitem class="username">root</systemitem>
+  (the <quote>x</quote> used here is just a placeholder) will be set later.</para>
+
+  <para>Create the <filename>/etc/group</filename> file by running the following
+  command:</para>
+
+<screen revision="sysv"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
+<literal>root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:</literal>
+EOF</userinput></screen>
+
+<screen revision="systemd"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
+<literal>root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+systemd-journal:x:23:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+systemd-bus-proxy:x:72:
+systemd-journal-gateway:x:73:
+systemd-journal-remote:x:74:
+systemd-journal-upload:x:75:
+systemd-network:x:76:
+systemd-resolve:x:77:
+systemd-timesync:x:78:
+systemd-coredump:x:79:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:</literal>
+EOF</userinput></screen>
+
+  <para>The created groups are not part of any standard&mdash;they are groups
+  decided on in part by the requirements of the Udev configuration in the next
+  chapter, and in part by common convention employed by a number of existing
+  Linux distributions. In addition, some test suites rely on specific users
+  or groups.  The Linux Standard Base (LSB, available at <ulink
+  url="http://www.linuxbase.org"/>) recommends only that, besides the group
+  <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
+  a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
+  present. All other group names and GIDs can be chosen freely by the system
+  administrator since well-written programs do not depend on GID numbers, but
+  rather use the group's name.</para>
+
+  <para>Some tests in <xref linkend="chapter-building-system"/> need a regular
+  user. We add this user here and delete this account at the end of that
+  chapter.</para>
+
+<screen><userinput>echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" &gt;&gt; /etc/passwd
+echo "tester:x:101:" &gt;&gt; /etc/group
+install -o tester -d /home/tester</userinput></screen>
+
+  <para>To remove the <quote>I have no name!</quote> prompt, start a new
+  shell. Since the
+  <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
+  files have been created, user name and group name resolution will now
+  work:</para>
+
+<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
+
+  <para>Note the use of the <parameter>+h</parameter> directive. This tells
+  <command>bash</command> not to use its internal path hashing. Without this
+  directive, <command>bash</command> would remember the paths to binaries it has
+  executed. To ensure the use of the newly compiled binaries as soon as they are
+  installed, the <parameter>+h</parameter> directive will be used for the duration
+  of this chapter.</para>
+
+  <para>The <command>login</command>, <command>agetty</command>, and
+  <command>init</command> programs (and others) use a number of log
+  files to record information such as who was logged into the system and
+  when. However, these programs will not write to the log files if they
+  do not already exist. Initialize the log files and give them
+  proper permissions:</para>
+
+<screen><userinput>touch /var/log/{btmp,lastlog,faillog,wtmp}
+chgrp -v utmp /var/log/lastlog
+chmod -v 664  /var/log/lastlog
+chmod -v 600  /var/log/btmp</userinput></screen>
+
+  <para>The <filename>/var/log/wtmp</filename> file records all logins and
+  logouts. The <filename>/var/log/lastlog</filename> file records when each
+  user last logged in. The <filename>/var/log/faillog</filename> file records
+  failed login attempts.  The <filename>/var/log/btmp</filename> file records
+  the bad login attempts.</para>
+
+  <note><para>The <filename>/run/utmp</filename> file records the users that
+  are currently logged in.  This file is created dynamically in the boot
+  scripts.</para></note>
+
+</sect1>

+ 59 - 0
chapter06/creatingdirs.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-creatingdirs">
+  <?dbhtml filename="creatingdirs.html"?>
+
+  <title>Creating Directories</title>
+
+  <para>It is time to create the full structure in the LFS file system. Create
+  a standard directory tree by issuing the following commands:</para>
+
+<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
+mkdir -pv /{media/{floppy,cdrom},srv,var}
+install -dv -m 0750 /root
+install -dv -m 1777 /tmp /var/tmp
+mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
+mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
+mkdir -pv  /usr/{,local/}share/{misc,terminfo,zoneinfo}
+mkdir -pv /usr/{,local/}share/man/man{1..8}
+
+mkdir -v /var/{log,mail,spool}
+ln -sv /run /var/run
+ln -sv /run/lock /var/lock
+mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
+
+  <para>Directories are, by default, created with permission mode 755, but
+  this is not desirable for all directories. In the commands above, two
+  changes are made&mdash;one to the home directory of user <systemitem
+  class="username">root</systemitem>, and another to the directories for
+  temporary files.</para>
+
+  <para>The first mode change ensures that not just anybody can enter
+  the <filename class="directory">/root</filename> directory&mdash;the
+  same as a normal user would do with his or her home directory. The
+  second mode change makes sure that any user can write to the
+  <filename class="directory">/tmp</filename> and <filename
+  class="directory">/var/tmp</filename> directories, but cannot remove
+  another user's files from them. The latter is prohibited by the so-called
+  <quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
+
+  <sect2>
+    <title>FHS Compliance Note</title>
+
+    <para>The directory tree is based on the Filesystem Hierarchy Standard
+    (FHS) (available at <ulink
+    url="https://refspecs.linuxfoundation.org/fhs.shtml"/>).  The FHS also specifies
+    the optional existence of some directories such as <filename
+    class="directory">/usr/local/games</filename> and <filename
+    class="directory">/usr/share/games</filename>.  We create only the
+    directories that are needed. However, feel free to create these
+    directories.  </para>
+
+  </sect2>
+
+</sect1>

+ 96 - 0
chapter06/dejagnu.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-dejagnu" role="wrap">
+  <?dbhtml filename="dejagnu.html"?>
+
+  <sect1info condition="script">
+    <productname>dejagnu</productname>
+    <productnumber>&dejagnu-version;</productnumber>
+    <address>&dejagnu-url;</address>
+  </sect1info>
+
+  <title>DejaGNU-&dejagnu-version;</title>
+
+  <indexterm zone="ch-tools-dejagnu">
+    <primary sortas="a-DejaGNU">DejaGNU</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The <application>DejaGnu</application> package contains a framework for running test
+      suites on GNU tools. It is written in <command>expect</command>, which itself
+      uses <application>Tcl</application> (Tool Command Language).</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&dejagnu-ch5-sbu;</seg>
+        <seg>&dejagnu-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of DejaGNU</title>
+
+    <para>Prepare DejaGNU for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr
+makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi
+makeinfo --plaintext       -o doc/dejagnu.txt  doc/dejagnu.texi</userinput></screen>
+
+    <para>Build and install the package:</para>
+
+<screen><userinput remap="install">make install
+install -v -dm755  /usr/share/doc/dejagnu-&dejagnu-version;
+install -v -m644   doc/dejagnu.{html,txt} \
+                   /usr/share/doc/dejagnu-&dejagnu-version;</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+  </sect2>
+
+
+  <sect2 id="contents-dejagnu" role="content">
+    <title>Contents of DejaGNU</title>
+
+    <segmentedlist>
+      <segtitle>Installed program</segtitle>
+
+      <seglistitem>
+        <seg>runtest</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="runtest">
+        <term><command>runtest</command></term>
+        <listitem>
+          <para>A wrapper script that locates the proper
+          <command>expect</command> shell and then runs DejaGNU</para>
+          <indexterm zone="ch-tools-dejagnu runtest">
+            <primary sortas="b-runtest">runtest</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 14 - 71
chapter06/diffutils.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-diffutils" role="wrap">
+<sect1 id="ch-tools-diffutils" role="wrap">
   <?dbhtml filename="diffutils.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>Diffutils-&diffutils-version;</title>
 
-  <indexterm zone="ch-system-diffutils">
+  <indexterm zone="ch-tools-diffutils">
     <primary sortas="a-Diffutils">Diffutils</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Diffutils package contains programs that show the differences
-    between files or directories.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/diffutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&diffutils-ch6-sbu;</seg>
-        <seg>&diffutils-ch6-du;</seg>
+        <seg>&diffutils-ch5-sbu;</seg>
+        <seg>&diffutils-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,82 +45,23 @@
 
     <para>Prepare Diffutils for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
+  <sect2 role="content">
+    <title/>
 
-  <sect2 id="contents-diffutils" role="content">
-    <title>Contents of Diffutils</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-
-      <seglistitem>
-        <seg>cmp, diff, diff3, and sdiff</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="cmp">
-        <term><command>cmp</command></term>
-        <listitem>
-          <para>Compares two files and reports whether or in which bytes they
-          differ</para>
-          <indexterm zone="ch-system-diffutils cmp">
-            <primary sortas="b-cmp">cmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="diff">
-        <term><command>diff</command></term>
-        <listitem>
-          <para>Compares two files or directories and reports which lines in
-          the files differ</para>
-          <indexterm zone="ch-system-diffutils diff">
-            <primary sortas="b-diff">diff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="diff3">
-        <term><command>diff3</command></term>
-        <listitem>
-            <para>Compares three files line by line</para>
-            <indexterm zone="ch-system-diffutils diff3">
-              <primary sortas="b-diff3">diff3</primary>
-            </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sdiff">
-        <term><command>sdiff</command></term>
-        <listitem>
-          <para>Merges two files and interactively outputs the results</para>
-          <indexterm zone="ch-system-diffutils sdiff">
-            <primary sortas="b-sdiff">sdiff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-diffutils" role="."/></para>
 
   </sect2>
 

+ 139 - 0
chapter06/expect.xml

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-expect" role="wrap">
+  <?dbhtml filename="expect.html"?>
+
+  <sect1info condition="script">
+    <productname>expect</productname>
+    <productnumber>&expect-version;</productnumber>
+    <address>&expect-url;</address>
+  </sect1info>
+
+  <title>Expect-&expect-version;</title>
+
+  <indexterm zone="ch-tools-expect">
+    <primary sortas="a-Expect">Expect</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The <application>Expect</application> package contains tools for
+    automating, via scripted dialogues, interactive applications such as
+    <command>telnet</command>, <command>ftp</command>,
+    <command>passwd</command>, <command>fsck</command>,
+    <command>rlogin</command>, and <command>tip</command>.
+    <application>Expect</application> is also useful for testing these same
+    applications as well as easing all sorts of tasks that are prohibitively
+    difficult with anything else. The <application>DejaGnu</application>
+    framework is written in <application>Expect</application>.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&expect-ch5-sbu;</seg>
+        <seg>&expect-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Expect</title>
+
+    <para>Prepare Expect for compilation:</para>
+
+<screen><userinput remap="configure">
+./configure --prefix=/usr           \
+            --with-tcl=/usr/lib     \
+            --enable-shared         \
+            --mandir=/usr/share/man \
+            --with-tclinclude=/usr/include</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--with-tcl=/usr/lib</parameter></term>
+        <listitem>
+          <para>This parameter is needed to tell the
+          <command>configure</command> where the
+          <command>tclConfig.sh</command> is located.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-tclinclude=/usr/include</parameter></term>
+        <listitem>
+          <para>This explicitly tells Expect where to find Tcl's internal
+          headers. Using this option avoids conditions where
+          <command>configure</command> fails because it cannot automatically
+          discover the location of Tcl's headers.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Build the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install
+ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-expect" role="content">
+    <title>Contents of Expect</title>
+
+    <segmentedlist>
+      <segtitle>Installed program</segtitle>
+      <segtitle>Installed library</segtitle>
+
+      <seglistitem>
+        <seg>expect</seg>
+        <seg>libexpect-&expect-lib-version;.so</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="expect">
+        <term><command>expect</command></term>
+        <listitem>
+          <para>Communicates with other interactive programs according
+          to a script</para>
+          <indexterm zone="ch-tools-expect expect">
+            <primary sortas="b-expect">expect</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="libexpect">
+        <term><filename class="libraryfile">libexpect-&expect-lib-version;.so</filename></term>
+        <listitem>
+          <para>Contains functions that allow Expect to be used as a Tcl
+          extension or to be used directly from C or C++ (without Tcl)</para>
+          <indexterm zone="ch-tools-expect libexpect">
+            <primary sortas="c-libexpect-&expect-lib-version;">libexpect-&expect-lib-version;</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 20 - 55
chapter06/file.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-file" role="wrap">
+<sect1 id="ch-tools-file" role="wrap">
   <?dbhtml filename="file.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>File-&file-version;</title>
 
-  <indexterm zone="ch-system-file">
+  <indexterm zone="ch-tools-file">
     <primary sortas="a-File">File</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The File package contains a utility for determining the type of a given
-    file or files.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/file.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&file-ch6-sbu;</seg>
-        <seg>&file-ch6-du;</seg>
+        <seg>&file-ch5-sbu;</seg>
+        <seg>&file-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,65 +45,28 @@
 
     <para>Prepare File for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT</userinput></screen>
 
+<!-- devs: if using - -build here, the build system wants to compile
+     the signature file with "file" on the build system, but stops if it is not
+     the same version. One possibility would be to build "file" on the build
+     system first, but it is simpler to have the system think it is not
+     cross-compiling, and use the just built "file". -->
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
-
-  <sect2 id="contents-file" role="content">
-    <title>Contents of File</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed library</segtitle>
-
-      <seglistitem>
-        <seg>file</seg>
-        <seg>libmagic.so</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="file">
-        <term><command>file</command></term>
-        <listitem>
-          <para>Tries to classify each given file; it does this by performing
-          several tests&mdash;file system tests, magic number tests, and language
-          tests</para>
-          <indexterm zone="ch-system-file file">
-            <primary sortas="b-file">file</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libmagic">
-        <term><filename class="libraryfile">libmagic</filename></term>
-        <listitem>
-          <para>Contains routines for magic number recognition, used by the
-          <command>file</command> program</para>
-          <indexterm zone="ch-system-file libmagic">
-            <primary sortas="c-libmagic">libmagic</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in<!-- TODO
+    <xref linkend="contents-file" role="."/>      --></para>
 
   </sect2>
 

+ 19 - 105
chapter06/findutils.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-findutils" role="wrap">
+<sect1 id="ch-tools-findutils" role="wrap">
   <?dbhtml filename="findutils.html"?>
 
   <sect1info condition="script">
@@ -16,25 +16,25 @@
 
   <title>Findutils-&findutils-version;</title>
 
-  <indexterm zone="ch-system-findutils">
+  <indexterm zone="ch-tools-findutils">
     <primary sortas="a-Findutils">Findutils</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Findutils package contains programs to find files. These programs
-    are provided to recursively search through a directory tree and to
-    create, maintain, and search a database (often faster than the recursive
-    find, but unreliable if the database has not been recently updated).</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/findutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&findutils-ch6-sbu;</seg>
-        <seg>&findutils-ch6-du;</seg>
+        <seg>&findutils-ch5-sbu;</seg>
+        <seg>&findutils-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -45,116 +45,30 @@
 
     <para>Prepare Findutils for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr --localstatedir=/var/lib/locate</userinput></screen>
-
-    <variablelist>
-      <title>The meaning of the configure options:</title>
-
-      <varlistentry>
-        <term><parameter>--localstatedir</parameter></term>
-        <listitem>
-          <para>This option changes the location of the <command>locate</command>
-          database to be in <filename class="directory">/var/lib/locate</filename>,
-          which is FHS-compliant.</para>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results, issue:</para>
-
-<screen><userinput remap="test">chown -Rv tester .
-su tester -c "PATH=$PATH make check"</userinput></screen>
-
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make install</userinput></screen>
-
-    <para revision="sysv">Some of the scripts in the LFS-Bootscripts package
-    depend on <command>find</command>.  As <filename
-    class="directory">/usr</filename> may not be available during the early
-    stages of booting, this program needs to be on the root partition.  The
-    <command>updatedb</command> script also needs to be modified to correct an
-    explicit path:</para>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
-    <para revision="systemd"> Some packages in BLFS and beyond expect the
-    <command>find</command> program in <filename
-    class="directory">/bin</filename>, so make sure it's placed there:</para>
+    <para>Move the excutable to its final expected location:</para>
 
-<screen><userinput remap="install">mv -v /usr/bin/find /bin
-sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb</userinput></screen>
+<screen><userinput remap="install">mv -v $LFS/usr/bin/find $LFS/bin
+sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-findutils" role="content">
-    <title>Contents of Findutils</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>find, locate, updatedb, and xargs</seg>
-        <seg>/var/lib/locate</seg>
-      </seglistitem>
-
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="find">
-        <term><command>find</command></term>
-        <listitem>
-          <para>Searches given directory trees for files matching the specified
-          criteria</para>
-          <indexterm zone="ch-system-findutils find">
-            <primary sortas="b-find">find</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="locate">
-        <term><command>locate</command></term>
-        <listitem>
-          <para>Searches through a database of file names and reports the names
-          that contain a given string or match a given pattern</para>
-          <indexterm zone="ch-system-findutils locate">
-            <primary sortas="b-locate">locate</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="updatedb">
-      <term><command>updatedb</command></term>
-        <listitem>
-          <para>Updates the <command>locate</command> database; it scans the
-          entire file system (including other file systems that are currently
-          mounted, unless told not to) and puts every file name it finds into
-          the database</para>
-          <indexterm zone="ch-system-findutils updatedb">
-            <primary sortas="b-updatedb">updatedb</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xargs">
-        <term><command>xargs</command></term>
-        <listitem>
-          <para>Can be used to apply a given command to a list of files</para>
-          <indexterm zone="ch-system-findutils xargs">
-            <primary sortas="b-xargs">xargs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-findutils" role="."/></para>
 
   </sect2>
 

+ 33 - 94
chapter06/flex.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-flex" role="wrap">
+<sect1 id="ch-tools-flex" role="wrap">
   <?dbhtml filename="flex.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>Flex-&flex-version;</title>
 
-  <indexterm zone="ch-system-flex">
+  <indexterm zone="ch-tools-flex">
     <primary sortas="a-Flex">Flex</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Flex package contains a utility for generating programs that
-    recognize patterns in text.</para>
+    <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-ch6-sbu;</seg>
-        <seg>&flex-ch6-du;</seg>
+        <seg>&flex-ch5-sbu;</seg>
+        <seg>&flex-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -41,108 +43,45 @@
   <sect2 role="installation">
     <title>Installation of Flex</title>
 
-<!--
-    <para>First, fix a problem introduced with glibc-2.26:</para>
-
-<screen><userinput remap="pre">sed -i "/math.h/a #include &lt;malloc.h&gt;" src/flexdef.h</userinput></screen>
-
-    <para>The build procedure assumes the <application>help2man</application>
-    program is available to create a man page from the executable - -help option.
-    This is not present, so we use an environment variable to skip this process.
-    Now, prepare Flex for compilation:</para> -->
-
     <para>Prepare Flex for compilation:</para>
 
-<!-- <screen><userinput remap="configure">HELP2MAN=/tools/bin/true \ -->
-<screen><userinput remap="configure">./configure --prefix=/usr --docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
 
+    <!--
+    <variablelist>
+      <title>The meaning of the new configure option:</title>
+
+      <varlistentry>
+        <term><parameter>- -disable-bootstrap</parameter></term>
+	<listitem>
+          <para>Normally, building flex is done in two stages. A first
+	  programs, which is used to generate the source of a second one,
+	  which is then compiled. When using cross-compilation, the first
+	  program is generated on the build system. However, due to a bug
+	  in configure, the presence of some function is tested only on the
+	  host system. If this function is not found on the build system, the
+	  build fails. This can be prevented by disabling the two stage
+	  build.</para>
+	</listitem>
+      </varlistentry>
+    </variablelist>
+    -->
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results (about 0.5 SBU), issue:</para>
-
-<screen><userinput remap="test">make check</userinput></screen>
-
     <para>Install the package:</para>
 
 <screen><userinput remap="install">make install</userinput></screen>
 
-    <para>A few programs do not know about <command>flex</command> yet and
-    try to run its predecessor, <command>lex</command>. To support those
-    programs, create a symbolic link named <filename>lex</filename> that
-    runs <filename>flex</filename> in <command>lex</command> emulation
-    mode:</para>
-
-<screen><userinput remap="install">ln -sv flex /usr/bin/lex</userinput></screen>
-
   </sect2>
 
-  <sect2 id="contents-flex" role="content">
-    <title>Contents of Flex</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>flex, flex++ (link to flex), and lex (link to flex)</seg>
-        <seg>libfl.so</seg>
-        <seg>/usr/share/doc/flex-&flex-version;</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="flex">
-        <term><command>flex</command></term>
-        <listitem>
-          <para>A tool for generating programs that recognize patterns in text;
-          it allows for the versatility to specify the rules for pattern-finding,
-          eradicating the need to develop a specialized program</para>
-          <indexterm zone="ch-system-flex flex">
-            <primary sortas="b-flex">flex</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="flexpp">
-        <term><command>flex++</command></term>
-        <listitem>
-          <para>An extension of flex, is used for generating C++ code
-          and classes. It is a symbolic link to <command>flex</command></para>
-          <indexterm zone="ch-system-flex flexpp">
-            <primary sortas="b-flex++">flex++</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lex">
-        <term><command>lex</command></term>
-        <listitem>
-          <para>A symbolic link that runs <command>flex</command> in
-          <command>lex</command> emulation mode</para>
-          <indexterm zone="ch-system-flex lex">
-            <primary sortas="b-lex">lex</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libfl">
-        <term><filename class="libraryfile">libfl</filename></term>
-        <listitem>
-          <para>The <filename class="libraryfile">flex</filename> library</para>
-          <indexterm zone="ch-system-flex libfl">
-            <primary sortas="c-libfl">libfl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-flex" role="."/></para>
 
   </sect2>
 

+ 16 - 70
chapter06/gawk.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-gawk" role="wrap">
+<sect1 id="ch-tools-gawk" role="wrap">
   <?dbhtml filename="gawk.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>Gawk-&gawk-version;</title>
 
-  <indexterm zone="ch-system-gawk">
+  <indexterm zone="ch-tools-gawk">
     <primary sortas="a-Gawk">Gawk</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Gawk package contains programs for manipulating text files.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/gawk.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&gawk-ch6-sbu;</seg>
-        <seg>&gawk-ch6-du;</seg>
+        <seg>&gawk-ch5-sbu;</seg>
+        <seg>&gawk-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -46,82 +49,25 @@
 
     <para>Prepare Gawk for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(./config.guess)</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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>
-
-    <para>If desired, install the documentation:</para>
-
-<screen><userinput remap="install">mkdir -v /usr/share/doc/gawk-&gawk-version;
-cp    -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-&gawk-version;</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-gawk" role="content">
-    <title>Contents of Gawk</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>awk (link to gawk), gawk, and awk-&gawk-version;</seg>
-        <seg>filefuncs.so, fnmatch.so, fork.so, inplace.so, intdiv.so, ordchr.so,
-        readdir.so, readfile.so, revoutput.so, revtwoway.so, rwarray.so,
-        and time.so (all in /usr/lib/gawk)</seg>
-        <seg>/usr/lib/gawk, /usr/libexec/awk, /usr/share/awk, and
-        /usr/share/doc/gawk-&gawk-version;</seg>
-      </seglistitem>
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="awk">
-        <term><command>awk</command></term>
-        <listitem>
-          <para>A link to <command>gawk</command></para>
-          <indexterm zone="ch-system-gawk awk">
-            <primary sortas="b-awk">awk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gawk">
-        <term><command>gawk</command></term>
-        <listitem>
-          <para>A program for manipulating text files; it is the GNU
-          implementation of <command>awk</command></para>
-          <indexterm zone="ch-system-gawk gawk">
-            <primary sortas="b-gawk">gawk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gawk-version">
-        <term><command>gawk-&gawk-version;</command></term>
-        <listitem>
-          <para>A hard link to <command>gawk</command></para>
-          <indexterm zone="ch-system-gawk gawk-version">
-            <primary sortas="b-gawk-&gawk-version;">gawk-&gawk-version;</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-gawk" role="."/></para>
 
   </sect2>
 

+ 208 - 0
chapter06/gcc-pass1.xml

@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
+  <?dbhtml filename="gcc-pass1.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-pass1</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>GCC-&gcc-version; - Pass 1</title>
+
+  <indexterm zone="ch-tools-gcc-pass1">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, pass 1</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/gcc.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gcc-ch5p1-sbu;</seg>
+        <seg>&gcc-ch5p1-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Cross GCC</title>
+
+    <para>GCC requires the GMP, MPFR and MPC packages. As these packages may
+    not be included in your host distribution, they will be built with
+    GCC.  Unpack each package into the GCC source directory and rename the
+    resulting directories so the GCC build procedures will automatically
+    use them:</para>
+
+    <note><para>There are frequent misunderstandings about this chapter.  The
+    procedures are the same as every other chapter as explained earlier (<xref
+    linkend='buildinstr'/>).  First extract the gcc tarball from the sources
+    directory and then change to the directory created.  Only then should you
+    proceed with the instructions below.</para></note>
+
+<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc</userinput></screen>
+
+    <para>On x86_64 hosts, set the default directory name for
+    64-bit libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+  x86_64)
+    sed -e '/m64=/s/lib64/lib/' \
+        -i.orig gcc/config/i386/t-linux64
+ ;;
+esac</userinput></screen>
+
+    <para>The GCC documentation recommends building GCC 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare GCC for compilation:</para>
+
+<screen><userinput remap="configure">../configure                                       \
+    --target=$LFS_TGT                              \
+    --prefix=$LFS/tools                            \
+    --with-glibc-version=2.11                      \
+    --with-sysroot=$LFS                            \
+    --with-newlib                                  \
+    --without-headers                              \
+    --enable-initfini-array                        \
+    --disable-nls                                  \
+    --disable-shared                               \
+    --disable-multilib                             \
+    --disable-decimal-float                        \
+    --disable-threads                              \
+    --disable-libatomic                            \
+    --disable-libgomp                              \
+    --disable-libquadmath                          \
+    --disable-libssp                               \
+    --disable-libvtv                               \
+    --disable-libstdcxx                            \
+    --enable-languages=c,c++</userinput></screen>
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--with-glibc-version=2.11</parameter></term>
+        <listitem>
+          <para>This option ensures the package will be compatible with the host's
+          version of glibc.  It is set to the minimum glibc requirement 
+          specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-newlib</parameter></term>
+        <listitem>
+          <para>Since a working C library is not yet available, this ensures
+          that the inhibit_libc constant is defined when building libgcc. This prevents
+          the compiling of any code that requires libc support.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-headers</parameter></term>
+        <listitem>
+          <para>When creating a complete cross-compiler, GCC requires
+          standard headers compatible with the target system. For our
+          purposes these headers will not be needed. This switch prevents
+          GCC from looking for them.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-shared</parameter></term>
+        <listitem>
+          <para>This switch forces GCC to link its internal libraries
+	  statically. We need this because the shared libraries require glibc,
+	  which is not yet installed on the target system.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-decimal-float, --disable-threads,
+              --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
+        --disable-libquadmath, --disable-libssp, --disable-libvtv,
+        --disable-libstdcxx</parameter></term>
+        <listitem>
+          <para>These switches disable support for the decimal floating point
+          extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
+          libvtv, and the C++ standard library respectively. These features
+          will fail to compile when building a cross-compiler and are not
+          necessary for the task of cross-compiling the temporary libc.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-multilib</parameter></term>
+        <listitem>
+          <para>On x86_64, LFS does not yet support a multilib configuration.
+          This switch is harmless for x86.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-languages=c,c++</parameter></term>
+        <listitem>
+          <para>This option ensures that only the C and C++ compilers are built.
+          These are the only languages needed now.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile GCC by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+    <screen><userinput remap="install">make install</userinput></screen>
+
+    <para>This build of GCC has installed a couple of internal system
+    headers.  Normally one of them, <filename>limits.h</filename>, would in turn
+    include the corresponding system <filename>limits.h</filename> header, in
+    this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
+    time of this build of gcc <filename>$LFS/usr/include/limits.h</filename>
+    does not exist, so the internal header that has just been installed is a
+    partial, self-contained file and does not include the extended features of
+    the system header. This is adequate for building glibc, but the full
+    internal header will be needed later.  Create a full version of the internal
+    header using a command that is identical to what the GCC build system does
+    in normal circumstances:</para>
+
+<screen><userinput remap="install">cd ..
+cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
+  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 160 - 0
chapter06/gcc-pass2.xml

@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gcc-pass2" role="wrap">
+  <?dbhtml filename="gcc-pass2.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-pass2</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>GCC-&gcc-version; - Pass 2</title>
+
+  <indexterm zone="ch-tools-gcc-pass2">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, pass 2</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/gcc.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gcc-ch5p2-sbu;</seg>
+        <seg>&gcc-ch5p2-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of GCC</title>
+
+    <para>As in the first build of GCC, the GMP, MPFR, and MPC packages are
+    required. Unpack the tarballs and move them into the required directory
+    names:</para>
+
+<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc</userinput></screen>
+
+    <para>If building on x86_64, change the default directory name for 64-bit
+    libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+  x86_64)
+    sed -e '/m64=/s/lib64/lib/' \
+        -i.orig gcc/config/i386/t-linux64
+  ;;
+esac</userinput></screen>
+
+    <para>Fix an issue with GCC-10.1 when building with a cross
+    compiler:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
+
+    <para>Create a separate build directory again:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Create a symlink that allos libgcc to be built with posix threads
+    support:</para>
+
+<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
+ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
+
+    <para>Before starting to build GCC, remember to unset any environment
+    variables that override the default optimization flags.</para>
+
+    <para>Now prepare GCC for compilation:</para>
+
+<screen><userinput remap="configure">../configure                                       \
+    --build=$(../config.guess)                     \
+    --host=$LFS_TGT                                \
+    --prefix=/usr                                  \
+    CC_FOR_TARGET=$LFS_TGT-gcc                     \
+    --with-build-sysroot=$LFS                      \
+    --enable-initfini-array                        \
+    --disable-nls                                  \
+    --disable-multilib                             \
+    --disable-decimal-float                        \
+    --disable-libatomic                            \
+    --disable-libgomp                              \
+    --disable-libquadmath                          \
+    --disable-libssp                               \
+    --disable-libvtv                               \
+    --disable-libstdcxx                            \
+    --enable-languages=c,c++</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title><!-- WIP -->
+
+      <varlistentry>
+        <term><parameter>-with-build-sysroot=$LFS</parameter></term>
+        <listitem>
+          <para>Normally, using <parameter>--host=</parameter> ensures that
+          a cross-compiler is used for building gcc, and that compiler knows
+          that it has to look for headers and libraries in <filename
+          class="directory">$LFS</filename>. But the build system of GCC uses
+          other tools, which are not aware of this location. This switch is
+          needed to have them find the needed files in <filename
+          class="directory">$LFS</filename>, and not on the host.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-initfini-array</parameter></term>
+        <listitem>
+          <para>This option is automatically enabled when building a native
+          compiler with a native compiler on x86. But here, we build with
+          a cross compiler, so we need to explicitely set this option.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <para>As a finishing touch, create a symlink. Many programs and scripts
+    run <command>cc</command> instead of <command>gcc</command>, which is
+    used to keep programs generic and therefore usable on all kinds of UNIX
+    systems where the GNU C compiler is not always installed. Running
+    <command>cc</command> leaves the system administrator free to decide
+    which C compiler to install:</para>
+
+<screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 120 - 0
chapter06/generalinstructions.xml

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-generalinstructions">
+  <?dbhtml filename="generalinstructions.html"?>
+
+  <title>General Compilation Instructions</title>
+
+  <para>When building packages there are several assumptions made within
+  the instructions:</para>
+
+  <itemizedlist>
+
+  <listitem>
+    <para>Several of the packages are patched before compilation, but only when
+    the patch is needed to circumvent a problem. A patch is often needed in
+    both this and the next chapter, but sometimes in only one or the other.
+    Therefore, do not be concerned if instructions for a downloaded patch seem
+    to be missing.  Warning messages about <emphasis>offset</emphasis> or
+    <emphasis>fuzz</emphasis> may also be encountered when applying a patch. Do
+    not worry about these warnings, as the patch was still successfully
+    applied.</para>
+  </listitem>
+
+  <listitem>
+    <para>During the compilation of most packages, there will be several
+    warnings that scroll by on the screen. These are normal and can safely be
+    ignored.  These warnings are as they appear&mdash;warnings about
+    deprecated, but not invalid, use of the C or C++ syntax. C standards change
+    fairly often, and some packages still use the older standard. This is not a
+    problem, but does prompt the warning.</para>
+  </listitem>
+
+  <listitem>
+    <para>Check one last time that the <envar>LFS</envar> environment variable
+    is set up properly:</para>
+
+<screen role="nodump"><userinput>echo $LFS</userinput></screen>
+
+    <para>Make sure the output shows the path to the LFS partition's mount
+    point, which is <filename class="directory">/mnt/lfs</filename>, using our
+    example.</para>
+  </listitem>
+
+  <listitem>
+
+    <para>Finally, two important items must be emphasized:</para>
+
+    <important>
+
+      <para>The build instructions assume that the <xref
+      linkend='ch-partitioning-hostreqs'/>, including symbolic links, have
+      been set properly:</para>
+
+      <itemizedlist role='important'>
+
+        <listitem override='bullet'><para><command>bash</command> is the shell
+        in use.</para></listitem>
+
+        <listitem override='bullet'><para><command>sh</command> is a symbolic
+        link to <command>bash</command>.</para></listitem>
+
+        <listitem override='bullet'><para><command>/usr/bin/awk</command> is a
+        symbolic link to <command>gawk</command>.</para></listitem>
+
+        <listitem override='bullet'><para><command>/usr/bin/yacc</command> is a
+        symbolic link to <command>bison</command> or a small script that
+        executes bison.</para></listitem>
+
+      </itemizedlist>
+    </important>
+
+    <important>
+      <para>To re-emphasize the build process:</para>
+
+      <orderedlist numeration="arabic" spacing="compact">
+        <listitem>
+          <para>Place all the sources and patches in a directory that will be
+          accessible from the chroot environment such as
+      	  <filename class="directory">/mnt/lfs/sources/</filename>.<!-- Do
+          <emphasis>not</emphasis> put sources in
+	  <filename class="directory">/mnt/lfs/tools/</filename>. --></para>
+        </listitem>
+        <listitem>
+          <para>Change to the sources directory.</para>
+        </listitem>
+        <listitem id='buildinstr' xreflabel='Package build instructions'>
+          <para>For each package:</para>
+          <orderedlist numeration="loweralpha" spacing="compact">
+            <listitem>
+              <para>Using the <command>tar</command> program, extract the package
+              to be built.  In Chapter&nbsp;5, ensure you are the <emphasis>lfs</emphasis>
+              user when extracting the package.</para>
+            </listitem>
+            <listitem>
+              <para>Change to the directory created when the package was
+              extracted.</para>
+            </listitem>
+            <listitem>
+              <para>Follow the book's instructions for building the package.</para>
+            </listitem>
+            <listitem>
+              <para>Change back to the sources directory.</para>
+            </listitem>
+            <listitem>
+              <para>Delete the extracted source directory unless instructed otherwise.</para>
+            </listitem>
+          </orderedlist>
+        </listitem>
+      </orderedlist>
+    </important>
+  </listitem>
+
+  </itemizedlist>
+
+</sect1>

+ 25 - 385
chapter06/gettext.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-gettext" role="wrap">
+<sect1 id="ch-tools-gettext" role="wrap">
   <?dbhtml filename="gettext.html"?>
 
   <sect1info condition="script">
@@ -16,25 +16,25 @@
 
   <title>Gettext-&gettext-version;</title>
 
-  <indexterm zone="ch-system-gettext">
+  <indexterm zone="ch-tools-gettext">
     <primary sortas="a-Gettext">Gettext</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Gettext package contains utilities for internationalization and
-    localization. These allow programs to be compiled with NLS (Native Language
-    Support), enabling them to output messages in the user's native
-    language.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/gettext.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&gettext-ch6-sbu;</seg>
-        <seg>&gettext-ch6-du;</seg>
+        <seg>&gettext-ch5-sbu;</seg>
+        <seg>&gettext-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,402 +43,42 @@
   <sect2 role="installation">
     <title>Installation of Gettext</title>
 
-   <!-- This has been fixed in upstream gnulib, when a new version of
-   gettext is released, please check #4055 to see if the change has been
-   picked up in this package 
-   
-   As of April 11, 2018, 'TESTS = test-lock' is in gettext-runtime/tests/Makefile.am
-   Perhaps the test is fixed.
+    <para>For our temporary set of tools, we only need to install
+    three programs from Gettext.</para>
 
-   There is no reference to 'test' or TEST in  gettext-tools/gnulib-tests/Makefile.am
-   -->
-   <!--
-   <para>First, suppress two invocations of test-lock which on some machines
-   can loop forever:</para>
-
-<screen><userinput remap="pre">sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in &amp;&amp;
-sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in</userinput></screen>-->
-
-   <!-- As of April 11, 2018 appdata.* is NOT in git master, but appears
-   to be in metainfo.{its,loc},  When updating, check BLFS gnome-screenshot. -->
-
-<!--
-   <para>Now fix a configuration file:</para>
-
-<screen><userinput remap="pre">sed -e '/AppData/{N;N;p;s/\.appdata\./.metainfo./}' \
-    -i gettext-tools/its/appdata.loc</userinput></screen>
--->
     <para>Prepare Gettext for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr    \
-            --disable-static \
-            --docdir=/usr/share/doc/gettext-&gettext-version;</userinput></screen>
+<screen><userinput remap="configure">./configure --disable-shared</userinput></screen>
 
-    <para>Compile the package:</para>
-
-<screen><userinput remap="make">make BISON_LOCALEDIR=/usr/share/locale</userinput></screen>
-
-   <variablelist>
-      <title>The meaning of the make parameter:</title>
+    <variablelist>
+      <title>The meaning of the configure option:</title>
 
       <varlistentry>
-        <term><parameter>BISON_LOCALEDIR=/usr/share/locale</parameter></term>
+        <term><parameter>--disable-shared</parameter></term>
         <listitem>
-          <para>Since bison is not yet installed in /usr, configure hardcodes
-          the directory containing translations for the bison program (the
-	  "locale" directory) as /tools/share/locale. Passing this variable
-           to make allows overriding the choice made by configure.</para>
+          <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>To test the results (this takes a long time, around 3 SBUs),
-    issue:</para>
+    <para>Compile the package:</para>
 
-<screen><userinput remap="test">make check</userinput></screen>
+<screen><userinput remap="make">make</userinput></screen>
 
-    <para>Install the package:</para>
+    <para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
+    <command>xgettext</command> programs:</para>
 
-<screen><userinput remap="install">make install
-chmod -v 0755 /usr/lib/preloadable_libintl.so</userinput></screen>
+<screen><userinput remap="install">cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-gettext" role="content">
-    <title>Contents of Gettext</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>autopoint, envsubst, gettext, gettext.sh,
-        gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen,
-        msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq,
-        ngettext, recode-sr-latin, and xgettext</seg>
-        <seg>libasprintf.so, libgettextlib.so, libgettextpo.so,
-        libgettextsrc.so, libtextstyle.so, and preloadable_libintl.so</seg>
-        <seg>/usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;,
-        /usr/share/gettext, and /usr/share/gettext-0.19.8</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="autopoint">
-        <term><command>autopoint</command></term>
-        <listitem>
-          <para>Copies standard Gettext infrastructure files into a source
-          package</para>
-          <indexterm zone="ch-system-gettext autopoint">
-            <primary sortas="b-autopoint">autopoint</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="envsubst">
-        <term><command>envsubst</command></term>
-        <listitem>
-          <para>Substitutes environment variables in shell format strings</para>
-          <indexterm zone="ch-system-gettext envsubst">
-            <primary sortas="b-envsubst">envsubst</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gettext">
-        <term><command>gettext</command></term>
-        <listitem>
-          <para>Translates a natural language message into the user's language
-          by looking up the translation in a message catalog</para>
-          <indexterm zone="ch-system-gettext gettext">
-            <primary sortas="b-gettext">gettext</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gettext.sh">
-        <term><command>gettext.sh</command></term>
-        <listitem>
-          <para>Primarily serves as a shell function library for gettext</para>
-          <indexterm zone="ch-system-gettext gettext.sh">
-            <primary sortas="b-gettext.sh">gettext.sh</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gettextize">
-        <term><command>gettextize</command></term>
-        <listitem>
-          <para>Copies all standard Gettext files into the given top-level
-          directory of a package to begin internationalizing it</para>
-          <indexterm zone="ch-system-gettext gettextize">
-            <primary sortas="b-gettextize">gettextize</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgattrib">
-        <term><command>msgattrib</command></term>
-        <listitem>
-          <para>Filters the messages of a translation catalog according to their
-          attributes and manipulates the attributes</para>
-          <indexterm zone="ch-system-gettext msgattrib">
-            <primary sortas="b-msgattrib">msgattrib</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgcat">
-        <term><command>msgcat</command></term>
-        <listitem>
-          <para>Concatenates and merges the given
-          <filename class="extension">.po</filename> files</para>
-          <indexterm zone="ch-system-gettext msgcat">
-            <primary sortas="b-msgcat">msgcat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgcmp">
-        <term><command>msgcmp</command></term>
-        <listitem>
-          <para>Compares two <filename class="extension">.po</filename>
-          files to check that both contain the same set of msgid strings</para>
-          <indexterm zone="ch-system-gettext msgcmp">
-            <primary sortas="b-msgcmp">msgcmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgcomm">
-        <term><command>msgcomm</command></term>
-        <listitem>
-          <para>Finds the messages that are common to the given
-          <filename class="extension">.po</filename> files</para>
-          <indexterm zone="ch-system-gettext msgcomm">
-            <primary sortas="b-msgcomm">msgcomm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgconv">
-        <term><command>msgconv</command></term>
-        <listitem>
-          <para>Converts a translation catalog to a different character
-          encoding</para>
-          <indexterm zone="ch-system-gettext msgconv">
-            <primary sortas="b-msgconv">msgconv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgen">
-        <term><command>msgen</command></term>
-        <listitem>
-          <para>Creates an English translation catalog</para>
-          <indexterm zone="ch-system-gettext msgen">
-            <primary sortas="b-msgen">msgen</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgexec">
-        <term><command>msgexec</command></term>
-        <listitem>
-          <para>Applies a command to all translations of a translation
-          catalog</para>
-          <indexterm zone="ch-system-gettext msgexec">
-            <primary sortas="b-msgexec">msgexec</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgfilter">
-        <term><command>msgfilter</command></term>
-        <listitem>
-          <para>Applies a filter to all translations of a translation
-          catalog</para>
-          <indexterm zone="ch-system-gettext msgfilter">
-            <primary sortas="b-msgfilter">msgfilter</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgfmt">
-        <term><command>msgfmt</command></term>
-        <listitem>
-          <para>Generates a binary message catalog from a translation
-          catalog</para>
-          <indexterm zone="ch-system-gettext msgfmt">
-            <primary sortas="b-msgfmt">msgfmt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msggrep">
-        <term><command>msggrep</command></term>
-        <listitem>
-          <para>Extracts all messages of a translation catalog that match a
-          given pattern or belong to some given source files</para>
-          <indexterm zone="ch-system-gettext msggrep">
-            <primary sortas="b-msggrep">msggrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msginit">
-        <term><command>msginit</command></term>
-        <listitem>
-          <para>Creates a new <filename class="extension">.po</filename> file,
-          initializing the meta information with values from the user's
-          environment</para>
-          <indexterm zone="ch-system-gettext msginit">
-            <primary sortas="b-msginit">msginit</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgmerge">
-        <term><command>msgmerge</command></term>
-        <listitem>
-          <para>Combines two raw translations into a single file</para>
-          <indexterm zone="ch-system-gettext msgmerge">
-            <primary sortas="b-msgmerge">msgmerge</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msgunfmt">
-        <term><command>msgunfmt</command></term>
-        <listitem>
-          <para>Decompiles a binary message catalog into raw translation
-          text</para>
-          <indexterm zone="ch-system-gettext msgunfmt">
-            <primary sortas="b-msgunfmt">msgunfmt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="msguniq">
-        <term><command>msguniq</command></term>
-        <listitem>
-          <para>Unifies duplicate translations in a translation catalog</para>
-          <indexterm zone="ch-system-gettext msguniq">
-            <primary sortas="b-msguniq">msguniq</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ngettext">
-        <term><command>ngettext</command></term>
-        <listitem>
-          <para>Displays native language translations of a textual message whose
-          grammatical form depends on a number</para>
-          <indexterm zone="ch-system-gettext ngettext">
-            <primary sortas="b-ngettext">ngettext</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="recode-sr-latin">
-        <term><command>recode-sr-latin</command></term>
-        <listitem>
-          <para>Recodes Serbian text from Cyrillic to Latin script</para>
-          <indexterm zone="ch-system-gettext recode-sr-latin">
-            <primary sortas="b-recode-sr-latin">recode-sr-latin</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xgettext">
-        <term><command>xgettext</command></term>
-        <listitem>
-          <para>Extracts the translatable message lines from the given source
-          files to make the first translation template</para>
-          <indexterm zone="ch-system-gettext xgettext">
-            <primary sortas="b-xgettext">xgettext</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libasprintf">
-        <term><filename class="libraryfile">libasprintf</filename></term>
-        <listitem>
-          <para>defines the <emphasis>autosprintf</emphasis> class, which makes
-          C formatted output routines usable in C++ programs, for use with the
-          <emphasis>&lt;string&gt;</emphasis> strings and the
-          <emphasis>&lt;iostream&gt;</emphasis> streams</para>
-          <indexterm zone="ch-system-gettext libasprintf">
-            <primary sortas="c-libasprintf">libasprintf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libgettextlib">
-        <term><filename class="libraryfile">libgettextlib</filename></term>
-        <listitem>
-          <para>a private library containing common routines used by the
-          various Gettext programs; these are not intended for general use</para>
-          <indexterm zone="ch-system-gettext libgettextlib">
-            <primary sortas="c-libgettextlib">libgettextlib</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libgettextpo">
-        <term><filename class="libraryfile">libgettextpo</filename></term>
-        <listitem>
-          <para>Used to write specialized programs that process
-          <filename class="extension">.po</filename> files; this library is
-          used when the standard applications shipped with Gettext (such as
-          <command>msgcomm</command>, <command>msgcmp</command>,
-          <command>msgattrib</command>, and <command>msgen</command>) will
-          not suffice</para>
-          <indexterm zone="ch-system-gettext libgettextpo">
-            <primary sortas="c-libgettextpo">libgettextpo</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libgettextsrc">
-        <term><filename class="libraryfile">libgettextsrc</filename></term>
-        <listitem>
-          <para>A private library containing common routines used by the
-          various Gettext programs; these are not intended for general use</para>
-          <indexterm zone="ch-system-gettext libgettextsrc">
-            <primary sortas="c-libgettextsrc">libgettextsrc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libtextstyle">
-        <term><filename class="libraryfile">libtextstyle</filename></term>
-        <listitem>
-          <para>Text styling library</para>
-          <indexterm zone="ch-system-gettext libtextstyle">
-            <primary sortas="c-libtextstyle">libtextstyle</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-      <varlistentry id="preloadable_libintl">
-        <term><filename class="libraryfile">preloadable_libintl</filename></term>
-        <listitem>
-          <para>A library, intended to be used by LD_PRELOAD that assists
-          <filename class="libraryfile">libintl</filename> in logging
-          untranslated messages</para>
-          <indexterm zone="ch-system-gettext preloadable_libintl">
-            <primary sortas="c-preloadable_libintl">preloadable_libintl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-gettext" role="."/></para>
 
   </sect2>
 

+ 120 - 860
chapter06/glibc.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-glibc" role="wrap">
+<sect1 id="ch-tools-glibc" role="wrap">
   <?dbhtml filename="glibc.html"?>
 
   <sect1info condition="script">
@@ -16,25 +16,25 @@
 
   <title>Glibc-&glibc-version;</title>
 
-  <indexterm zone="ch-system-glibc">
+  <indexterm zone="ch-tools-glibc">
     <primary sortas="a-Glibc">Glibc</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Glibc package contains the main C library. This library provides
-    the basic routines for allocating memory, searching directories, opening and
-    closing files, reading and writing files, string handling, pattern matching,
-    arithmetic, and so on.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/glibc.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&glibc-ch6-sbu;</seg>
-        <seg>&glibc-ch6-du;</seg>
+        <seg>&glibc-ch5-sbu;</seg>
+        <seg>&glibc-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,927 +43,187 @@
   <sect2 role="installation">
     <title>Installation of Glibc</title>
 
+    <para>First, create two symbolic links, which are needed for proper
+    operation of the dynamic library loader:</para>
+
+<screen><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
+ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
+
     <para>Some of the Glibc programs use the non-FHS compliant
-    <filename class="directory">/var/db</filename> directory to store
-    their runtime data. Apply the following patch to make such programs
-    store their runtime data in the FHS-compliant locations:</para>
+    <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>
 
-<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
-<!--
-    <para>Fix a minor security issue with glob functions:</para>
-
-<screen><userinput remap="pre">patch -Np1 -i ../&glibc-glob-patch;</userinput></screen>
--->
-<!-- No longer needed
-    <para>Fix a problem introduced with the linux-5.2 kernel:</para>
-
-<screen><userinput remap="pre">sed -i '/asm.socket.h/a# include &lt;linux/sockios.h&gt;' \
-   sysdeps/unix/sysv/linux/bits/socket.h</userinput></screen>
-=== already done ===
-    <para>Create a symlink for LSB
-    compliance. Additionally, for x86_64, create a compatibility symlink
-    required for the dynamic loader to function correctly:</para>
-
-<screen><userinput remap="pre">case $(uname -m) in
-    i?86)   ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3
-    ;;
-    x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64
-            ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
-    ;;
-esac</userinput></screen>
-
-    <para>Remove a file that may be left over from a previous build attempt:
-    </para>
-
-<screen><userinput remap="pre">rm -f /usr/include/limits.h</userinput></screen>
--->
     <para>The Glibc documentation recommends building Glibc 
     in a dedicated build directory:</para>
 
 <screen><userinput remap="pre">mkdir -v build
 cd       build</userinput></screen>
 
-    <para>Prepare Glibc for compilation:</para>
+    <para>Next, prepare Glibc for compilation:</para>
+
+<screen><userinput remap="configure">../configure                             \
+      --prefix=/usr                      \
+      --host=$LFS_TGT                    \
+      --build=$(../scripts/config.guess) \
+      --enable-kernel=&min-kernel;                \
+      --with-headers=$LFS/usr/include    \
+      libc_cv_slibdir=/lib</userinput></screen>
+<!--
+      libc_cv_forced_unwind=yes          \
+      libc_cv_c_cleanup=yes</userinput></screen> -->
 
-<screen><userinput remap="configure">../configure --prefix=/usr                            \
-             --disable-werror                         \
-             --enable-kernel=&min-kernel;                      \
-             --enable-stack-protector=strong          \
-             --with-headers=/usr/include              \
-             libc_cv_slibdir=/lib</userinput></screen>
-  <!-- WIP -->
     <variablelist>
-      <title>The meaning of the options and new configure parameters:</title>
+      <title>The meaning of the configure options:</title>
 
       <varlistentry>
-        <term><parameter>CC="gcc -ffile-prefix-map=$LFS_DIR=$DIR"</parameter></term>
+        <term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
         <listitem>
-          <para>Make GCC record any references to files in <filename
-          class="directory">/usr/lib/gcc/x86_64-lfs-linux-gnu</filename>
-          in result of the compilation as if the files resided in <filename
-          class="directory">/usr/lib/gcc/x86_64-pc-linux-gnu</filename>.
-          This avoids introduction of invalid paths in debugging
-          symbols.</para>
+          <para>The combined effect of these switches is that Glibc's build system
+          configures itself to be cross-compiled, using the cross-linker and
+          cross-compiler in <filename class="directory">/tools</filename>.</para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><parameter>--disable-werror</parameter></term>
+        <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
         <listitem>
-          <para>This option disables the -Werror option passed to 
-          GCC.  This is necessary for running the test suite.</para>
+          <para>This tells Glibc to compile the library with support
+          for &min-kernel; and later Linux kernels.  Workarounds for older
+          kernels are not enabled.</para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><parameter>--enable-stack-protector=strong</parameter></term>
-        <listitem>
-          <para>This option increases system security by adding 
-          extra code to check for buffer overflows, such as stack
-          smashing attacks.</para>
-        </listitem>
-      </varlistentry>
-<!-- do we need this one? -->
-      <varlistentry>
-        <term><parameter>--with-headers=/usr/include</parameter></term>
+        <term><parameter>--with-headers=$LFS/usr/include</parameter></term>
         <listitem>
-          <para>This option tells the build system where to find the
-          kernel API headers.</para>
+          <para>This tells Glibc to compile itself against the headers recently
+          installed to the usr/include directory, so that it knows exactly what
+          features the kernel has and can optimize itself accordingly.</para>
         </listitem>
       </varlistentry>
 
       <varlistentry>
         <term><parameter>libc_cv_slibdir=/lib</parameter></term>
         <listitem>
-          <para>This variable sets the correct library for all
-          systems.  We do not want lib64 to be used.</para>
+          <para>This ensures that the library is installed in /lib instead
+          of the default /lib64 on 64 bit machines.</para>
         </listitem>
       </varlistentry>
-
-    </variablelist>
-
-    <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
-    <important>
-      <para>In this section, the test suite for Glibc is considered critical.
-      Do not skip it under any circumstance.</para>
-    </important>
-
-    <para>Generally a few tests do not pass. The test failures listed below
-    are usually safe to ignore.</para>
-
-<!-- Use remap="make" here to work around a jhalfs issue. -->
-<screen><userinput remap="make">case $(uname -m) in
-  i?86)   ln -sfnv $PWD/elf/ld-linux.so.2        /lib ;;
-  x86_64) ln -sfnv $PWD/elf/ld-linux-x86-64.so.2 /lib ;;
-esac</userinput></screen>
-
-    <note><para>The symbolic link above is needed to run the tests at this
-    stage of building in the chroot environment.  It will be overwritten
-    in the install phase below.</para></note>
-
-<screen><userinput remap="test">make check</userinput></screen>
-
-    <para>You may see some test failures.  The Glibc test suite is
-    somewhat dependent on the host system.  This is a list of the most common
-    issues seen for some versions of LFS:</para>
-
-    <itemizedlist>
-
-      <listitem>
-        <para><emphasis>misc/tst-ttyname</emphasis> 
-        is known to fail in the LFS chroot environment.</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis>inet/tst-idna_name_classify</emphasis> 
-        is known to fail in the LFS chroot environment.</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis>posix/tst-getaddrinfo4</emphasis> and
-        <emphasis>posix/tst-getaddrinfo5</emphasis>
-        may fail on some architectures.</para>
-      </listitem>
-
-      <listitem>
-        <para>The <emphasis>nss/tst-nss-files-hosts-multi</emphasis>
-        test may fail for reasons that have not been determined.</para>
-      </listitem>
-
-      <listitem>
-        <para>The <emphasis>rt/tst-cputimer{1,2,3}</emphasis> tests depend on
-        the host system kernel. Kernels 4.14.91&ndash;4.14.96,
-        4.19.13&ndash;4.19.18, and 4.20.0&ndash;4.20.5 are known to 
-        cause these tests to fail.
-        </para>
-      </listitem>
-
-      <listitem>
-        <para>The math tests sometimes fail when running on
-        systems where the CPU is not a relatively new Intel or
-        AMD processor.</para>
-      </listitem>
 <!--
-      <listitem>
-        <para>The
-        <emphasis>nptl/tst-thread-affinity-{pthread,pthread2,sched}</emphasis>
-        tests may fail for reasons that have not been determined.  </para>
-      </listitem>
-
-      <listitem>
-        <para>Other tests known to fail on some architectures are
-        malloc/tst-malloc-usable and nptl/tst-cleanupx4. </para>
-      </listitem>
--->
-    </itemizedlist>
-
-    <para>Though it is a harmless message, the install stage of Glibc will
-    complain about the absence of <filename>/etc/ld.so.conf</filename>.
-    Prevent this warning with:</para>
-
-<screen><userinput remap="install">touch /etc/ld.so.conf</userinput></screen>
-
-    <para>Fix the generated Makefile to skip an unneeded sanity check
-    that fails in the LFS partial environment:
-    </para>
-
-<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile</userinput></screen>
-
-    <para>Install the package:</para>
-
-<screen><userinput remap="install">make install</userinput></screen>
-
-    <para>Install the configuration file and runtime directory for
-    <command>nscd</command>:</para>
-
-<screen><userinput remap="install">cp -v ../nscd/nscd.conf /etc/nscd.conf
-mkdir -pv /var/cache/nscd</userinput></screen>
-
-    <para revision="systemd">Install the systemd support files for 
-    <command>nscd</command>:</para>
-
-    <screen revision="systemd"><userinput remap="install">install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf
-install -v -Dm644 ../nscd/nscd.service /lib/systemd/system/nscd.service</userinput></screen>
-
-    <para>Next, install the locales that can make the system respond in a
-    different language.  None of the locales are required, but if some of them
-    are missing, the test suites of future packages would skip important
-    testcases.</para>
-
-    <para>Individual locales can be installed using the
-    <command>localedef</command> program. E.g., the first
-    <command>localedef</command> command below combines the
-    <filename>/usr/share/i18n/locales/cs_CZ</filename>
-    charset-independent locale definition with the
-    <filename>/usr/share/i18n/charmaps/UTF-8.gz</filename>
-    charmap definition and appends the result to the
-    <filename>/usr/lib/locale/locale-archive</filename> file.
-    The following instructions will install the minimum set of
-    locales necessary for the optimal coverage of tests:</para>
-
-<screen role="nodump"><userinput remap="locale-test">mkdir -pv /usr/lib/locale
-localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
-localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
-localedef -i de_DE -f ISO-8859-1 de_DE
-localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
-localedef -i de_DE -f UTF-8 de_DE.UTF-8
-localedef -i el_GR -f ISO-8859-7 el_GR
-localedef -i en_GB -f UTF-8 en_GB.UTF-8
-localedef -i en_HK -f ISO-8859-1 en_HK
-localedef -i en_PH -f ISO-8859-1 en_PH
-localedef -i en_US -f ISO-8859-1 en_US
-localedef -i en_US -f UTF-8 en_US.UTF-8
-localedef -i es_MX -f ISO-8859-1 es_MX
-localedef -i fa_IR -f UTF-8 fa_IR
-localedef -i fr_FR -f ISO-8859-1 fr_FR
-localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
-localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
-localedef -i it_IT -f ISO-8859-1 it_IT
-localedef -i it_IT -f UTF-8 it_IT.UTF-8
-localedef -i ja_JP -f EUC-JP ja_JP
-localedef -i ja_JP -f SHIFT_JIS ja_JP.SIJS 2> /dev/null || true
-localedef -i ja_JP -f UTF-8 ja_JP.UTF-8
-localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
-localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
-localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
-localedef -i zh_CN -f GB18030 zh_CN.GB18030
-localedef -i zh_HK -f BIG5-HKSCS zh_HK.BIG5-HKSCS</userinput></screen>
-
-    <para>In addition, install the locale for your own country, language and
-    character set.</para>
-
-    <para>Alternatively, install all locales listed in the
-    <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
-    (it includes every locale listed above and many more) at once with the
-    following time-consuming command:</para>
-
-<screen><userinput remap="locale-full">make localedata/install-locales</userinput></screen>
-
-    <para>Then use the <command>localedef</command> command to create and
-    install locales not listed in the
-    <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
-    in the unlikely case you need them.</para>
-
-    <note><para>Glibc now uses libidn2 when resolving internationalized 
-    domain names.  This is a run time dependency.  If this capability
-    is needed, the instructions for installing libidn2 are in the 
-    <ulink url="&blfs-book;general/libidn2.html">BLFS libidn2 page</ulink>.
-    </para></note>
-
-  </sect2>
-
-  <sect2 id="conf-glibc" role="configuration">
-    <title>Configuring Glibc</title>
-
-    <indexterm zone="conf-glibc">
-      <primary sortas="e-/etc/nsswitch.conf">/etc/nsswitch.conf</primary>
-    </indexterm>
-
-    <indexterm zone="conf-glibc">
-      <primary sortas="e-/etc/localtime">/etc/localtime</primary>
-    </indexterm>
-
-  <sect3>
-  <title>Adding nsswitch.conf</title>
-
-    <para>The <filename>/etc/nsswitch.conf</filename> file needs to be created
-    because the Glibc defaults do not work well in a networked environment.
-    </para>
-
-    <para>Create a new file <filename>/etc/nsswitch.conf</filename> by running the
-    following:</para>
-
-<screen><userinput>cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"
-<literal># Begin /etc/nsswitch.conf
-
-passwd: files
-group: files
-shadow: files
-
-hosts: files dns
-networks: files
-
-protocols: files
-services: files
-ethers: files
-rpc: files
-
-# End /etc/nsswitch.conf</literal>
-EOF</userinput></screen>
-
-    </sect3>
-
-    <sect3>
-    <title>Adding time zone data</title>
-
-    <para>Install and set up the time zone data with the following:</para>
-<screen><userinput>tar -xf ../../tzdata&tzdata-version;.tar.gz
-
-ZONEINFO=/usr/share/zoneinfo
-mkdir -pv $ZONEINFO/{posix,right}
-
-for tz in etcetera southamerica northamerica europe africa antarctica  \
-          asia australasia backward pacificnew systemv; do
-    zic -L /dev/null   -d $ZONEINFO       ${tz}
-    zic -L /dev/null   -d $ZONEINFO/posix ${tz}
-    zic -L leapseconds -d $ZONEINFO/right ${tz}
-done
-
-cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
-zic -d $ZONEINFO -p America/New_York
-unset ZONEINFO</userinput></screen>
-
-    <variablelist>
-      <title>The meaning of the zic commands:</title>
-
-      <varlistentry>
-        <term><parameter>zic -L /dev/null ...</parameter></term>
-        <listitem>
-          <para>This creates posix time zones, without any leap seconds.  It is
-          conventional to put these in both
-          <filename class="directory">zoneinfo</filename> and
-          <filename class="directory">zoneinfo/posix</filename>. It is
-          necessary to put the POSIX time zones in
-          <filename class="directory">zoneinfo</filename>, otherwise various
-          test-suites will report errors. On an embedded system, where space is
-          tight and you do not intend to ever update the time zones, you could save
-          1.9MB by not using the <filename class="directory">posix</filename>
-          directory, but some applications or test-suites might produce some
-          failures.</para>
-        </listitem>
-      </varlistentry>
-      <varlistentry>
-        <term><parameter>zic -L leapseconds ...</parameter></term>
-        <listitem>
-          <para>This creates right time zones, including leap seconds. On an
-          embedded system, where space is tight and you do not intend to
-          ever update the time zones, or care about the correct time, you could
-          save 1.9MB by omitting the <filename class="directory">right</filename>
-          directory.</para>
-        </listitem>
-      </varlistentry>
       <varlistentry>
-        <term><parameter>zic ... -p ...</parameter></term>
-        <listitem>
-          <para>This creates the <filename>posixrules</filename> file. We use
-          New York because POSIX requires the daylight savings time rules
-          to be in accordance with US rules.</para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-
-
-    <para>One way to determine the local time zone is to run the following
-    script:</para>
-
-<screen role="nodump"><userinput>tzselect</userinput></screen>
-
-    <para>After answering a few questions about the location, the script will
-    output the name of the time zone (e.g.,
-    <emphasis>America/Edmonton</emphasis>). There are also some other possible
-    time zones listed in <filename
-    class='directory'>/usr/share/zoneinfo</filename> such as
-    <emphasis>Canada/Eastern</emphasis> or <emphasis>EST5EDT</emphasis> that
-    are not identified by the script but can be used.</para>
-
-    <para>Then create the <filename>/etc/localtime</filename> file by
-    running:</para>
-
-<screen><userinput>ln -sfv /usr/share/zoneinfo/<replaceable>&lt;xxx&gt;</replaceable> /etc/localtime</userinput></screen>
-
-    <para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the name of the
-    time zone selected (e.g., Canada/Eastern).</para>
-
-  </sect3>
-
-  <sect3 id="conf-ld" role="configuration">
-    <title>Configuring the Dynamic Loader</title>
-
-    <indexterm zone="conf-ld">
-      <primary sortas="e-/etc/ld.so.conf">/etc/ld.so.conf</primary>
-    </indexterm>
-
-    <para>By default, the dynamic loader (<filename
-    class="libraryfile">/lib/ld-linux.so.2</filename>) searches through
-    <filename class="directory">/lib</filename> and <filename
-    class="directory">/usr/lib</filename> for dynamic libraries that are
-    needed by programs as they are run. However, if there are libraries in
-    directories other than <filename class="directory">/lib</filename> and
-    <filename class="directory">/usr/lib</filename>, these need to be added
-    to the <filename>/etc/ld.so.conf</filename> file in order for the
-    dynamic loader to find them. Two directories that are commonly known
-    to contain additional libraries are <filename
-    class="directory">/usr/local/lib</filename> and <filename
-    class="directory">/opt/lib</filename>, so add those directories to the
-    dynamic loader's search path.</para>
-
-    <para>Create a new file <filename>/etc/ld.so.conf</filename> by running the
-    following:</para>
-
-<screen><userinput>cat &gt; /etc/ld.so.conf &lt;&lt; "EOF"
-<literal># Begin /etc/ld.so.conf
-/usr/local/lib
-/opt/lib
-</literal>
-EOF</userinput></screen>
-
-  <para>If desired, the dynamic loader can also search a directory and
-  include the contents of files found there.  Generally the files in
-  this include directory are one line specifying the desired library path.
-  To add this capability run the following commands:</para>
-
-<screen role="nodump"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; "EOF"
-<literal># Add an include directory
-include /etc/ld.so.conf.d/*.conf
-</literal>
-EOF
-mkdir -pv /etc/ld.so.conf.d</userinput></screen>
-
-  </sect3>
-  </sect2>
-
-  <sect2 id="contents-glibc" role="content">
-    <title>Contents of Glibc</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>catchsegv, gencat, getconf, getent, iconv, iconvconfig, ldconfig,
-        ldd, lddlibc4, locale, localedef, makedb, mtrace, nscd, 
-        pcprofiledump, pldd, sln, sotruss, sprof, tzselect, xtrace,
-        zdump, and zic</seg>
-        <seg>ld-&glibc-version;.so, libBrokenLocale.{a,so}, libSegFault.so, libanl.{a,so},
-        libc.{a,so}, libc_nonshared.a,
-        libcrypt.{a,so}, libdl.{a,so}, libg.a, libm.{a,so},
-        libmcheck.a, libmemusage.so, libmvec.{a,so}, libnsl.{a,so},
-        libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so,
-        libpcprofile.so, libpthread.{a,so},
-        libpthread_nonshared.a, libresolv.{a,so}, librt.{a,so},
-        libthread_db.so, and libutil.{a,so}</seg>
-        <seg>/usr/include/arpa, /usr/include/bits, /usr/include/gnu,
-        /usr/include/net, /usr/include/netash, /usr/include/netatalk,
-        /usr/include/netax25, /usr/include/neteconet, /usr/include/netinet,
-        /usr/include/netipx, /usr/include/netiucv, /usr/include/netpacket,
-        /usr/include/netrom, /usr/include/netrose, /usr/include/nfs,
-        /usr/include/protocols, /usr/include/rpc,
-        /usr/include/sys, /usr/lib/audit, /usr/lib/gconv, /usr/lib/locale,
-        /usr/libexec/getconf, /usr/share/i18n, /usr/share/zoneinfo,
-        /var/cache/nscd, and /var/lib/nss_db</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="catchsegv">
-        <term><command>catchsegv</command></term>
-        <listitem>
-          <para>Can be used to create a stack trace when a program
-          terminates with a segmentation fault</para>
-          <indexterm zone="ch-system-glibc catchsegv">
-            <primary sortas="b-catchsegv">catchsegv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gencat">
-        <term><command>gencat</command></term>
-        <listitem>
-          <para>Generates message catalogues</para>
-          <indexterm zone="ch-system-glibc gencat">
-            <primary sortas="b-gencat">gencat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="getconf">
-        <term><command>getconf</command></term>
-        <listitem>
-          <para>Displays the system configuration values for file system
-          specific variables</para>
-          <indexterm zone="ch-system-glibc getconf">
-            <primary sortas="b-getconf">getconf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="getent">
-        <term><command>getent</command></term>
-        <listitem>
-          <para>Gets entries from an administrative database</para>
-          <indexterm zone="ch-system-glibc getent">
-            <primary sortas="b-getent">getent</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="iconv">
-        <term><command>iconv</command></term>
-        <listitem>
-          <para>Performs character set conversion</para>
-          <indexterm zone="ch-system-glibc iconv">
-            <primary sortas="b-iconv">iconv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="iconvconfig">
-        <term><command>iconvconfig</command></term>
-        <listitem>
-          <para>Creates fastloading <command>iconv</command> module configuration
-          files</para>
-          <indexterm zone="ch-system-glibc iconvconfig">
-            <primary sortas="b-iconvconfig">iconvconfig</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ldconfig">
-        <term><command>ldconfig</command></term>
-        <listitem>
-          <para>Configures the dynamic linker runtime bindings</para>
-          <indexterm zone="ch-system-glibc ldconfig">
-            <primary sortas="b-ldconfig">ldconfig</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ldd">
-        <term><command>ldd</command></term>
-        <listitem>
-          <para>Reports which shared libraries are required
-          by each given program or shared library</para>
-          <indexterm zone="ch-system-glibc ldd">
-            <primary sortas="b-ldd">ldd</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lddlibc4">
-        <term><command>lddlibc4</command></term>
-        <listitem>
-          <para>Assists <command>ldd</command> with object files</para>
-          <indexterm zone="ch-system-glibc lddlibc4">
-            <primary sortas="b-lddlibc4">lddlibc4</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="locale">
-        <term><command>locale</command></term>
+        <term><parameter>libc_cv_c_cleanup=yes</parameter></term>
         <listitem>
-          <para>Prints various information about the current locale</para>
-          <indexterm zone="ch-system-glibc locale">
-            <primary sortas="b-locale">locale</primary>
-          </indexterm>
+          <para>Similarly, we pass libc_cv_c_cleanup=yes through to the
+          <command>configure</command> script so that the test is skipped and C
+          cleanup handling support is configured.</para>
         </listitem>
       </varlistentry>
 
-      <varlistentry id="localedef">
-        <term><command>localedef</command></term>
-        <listitem>
-          <para>Compiles locale specifications</para>
-          <indexterm zone="ch-system-glibc localedef">
-            <primary sortas="b-localedef">localedef</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="makedb">
-        <term><command>makedb</command></term>
-        <listitem>
-          <para>Creates a simple database from textual input</para>
-          <indexterm zone="ch-system-glibc makedb">
-            <primary sortas="b-makedb">makedb</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mtrace">
-        <term><command>mtrace</command></term>
-        <listitem>
-          <para>Reads and interprets a memory trace file and displays a summary
-          in human-readable format</para>
-          <indexterm zone="ch-system-glibc mtrace">
-            <primary sortas="b-mtrace">mtrace</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="nscd">
-        <term><command>nscd</command></term>
-        <listitem>
-          <para>A daemon that provides a cache for the most common name
-          service requests</para>
-          <indexterm zone="ch-system-glibc nscd">
-            <primary sortas="b-nscd">nscd</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pcprofiledump">
-        <term><command>pcprofiledump</command></term>
+      <varlistentry>
+        <term><parameter>libc_cv_ctors_header=yes</parameter></term>
         <listitem>
-          <para>Dump information generated by PC profiling</para>
-          <indexterm zone="ch-system-glibc pcprofiledump">
-            <primary sortas="b-pcprofiledump">pcprofiledump</primary>
-          </indexterm>
+          <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>
+      </varlistentry>-->
 
-      <varlistentry id="pldd">
-        <term><command>pldd</command></term>
-        <listitem>
-          <para>Lists dynamic shared objects used by running processes</para>
-          <indexterm zone="ch-system-glibc pldd">
-            <primary sortas="b-pldd">pldd</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="sln">
-        <term><command>sln</command></term>
-        <listitem>
-          <para>A statically linked <command>ln</command> program</para>
-          <indexterm zone="ch-system-glibc sln">
-            <primary sortas="b-sln">sln</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    </variablelist>
 
-      <varlistentry id="sotruss">
-        <term><command>sotruss</command></term>
-        <listitem>
-          <para>Traces shared library procedure calls of a specified command</para>
-          <indexterm zone="ch-system-glibc sotruss">
-            <primary sortas="b-sotruss">sotruss</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>During this stage the following warning might appear:</para>
 
-      <varlistentry id="sprof">
-        <term><command>sprof</command></term>
-        <listitem>
-          <para>Reads and displays shared object profiling data</para>
-          <indexterm zone="ch-system-glibc sprof">
-            <primary sortas="b-sprof">sprof</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <blockquote>
+<screen><computeroutput>configure: WARNING:
+*** These auxiliary programs are missing or
+*** incompatible versions: msgfmt
+*** some features will be disabled.
+*** Check the INSTALL file for required versions.</computeroutput></screen>
+    </blockquote>
 
-      <varlistentry id="tzselect">
-        <term><command>tzselect</command></term>
-        <listitem>
-          <para>Asks the user about the location of the system and reports
-          the corresponding time zone description</para>
-          <indexterm zone="ch-system-glibc tzselect">
-            <primary sortas="b-tzselect">tzselect</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>The missing or incompatible <command>msgfmt</command> program is
+    generally harmless. This <command>msgfmt</command> program is part of the
+    Gettext package which the host distribution should provide.</para>
 
-      <varlistentry id="xtrace">
-        <term><command>xtrace</command></term>
-        <listitem>
-          <para>Traces the execution of a program by printing the currently
-          executed function</para>
-          <indexterm zone="ch-system-glibc xtrace">
-            <primary sortas="b-xtrace">xtrace</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <note><para>There have been reports that this package may fail when 
+    building as a "parallel make".  If this occurs, rerun the make command
+    with a "-j1" option.</para></note>
 
-      <varlistentry id="zdump">
-        <term><command>zdump</command></term>
-        <listitem>
-          <para>The time zone dumper</para>
-          <indexterm zone="ch-system-glibc zdump">
-            <primary sortas="b-zdump">zdump</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>Compile the package:</para>
 
-      <varlistentry id="zic">
-        <term><command>zic</command></term>
-        <listitem>
-          <para>The time zone compiler</para>
-          <indexterm zone="ch-system-glibc zic">
-            <primary sortas="b-zic">zic</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput remap="make">make</userinput></screen>
 
-      <varlistentry id="ld.so">
-        <term><filename class="libraryfile">ld-&glibc-version;.so</filename></term>
-        <listitem>
-          <para>The helper program for shared library executables</para>
-          <indexterm zone="ch-system-glibc ld.so">
-            <primary sortas="c-ld.so">ld-&glibc-version;.so</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>Install the package:</para>
 
-      <varlistentry id="libBrokenLocale">
-        <term><filename class="libraryfile">libBrokenLocale</filename></term>
-        <listitem>
-          <para>Used internally by Glibc as a gross hack to get broken programs
-          (e.g., some Motif applications) running. See comments in
-          <filename>glibc-&glibc-version;/locale/broken_cur_max.c</filename>
-          for more information</para>
-          <indexterm zone="ch-system-glibc libBrokenLocale">
-            <primary sortas="c-libBrokenLocale">libBrokenLocale</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
-      <varlistentry id="libSegFault">
-        <term><filename class="libraryfile">libSegFault</filename></term>
-        <listitem>
-          <para>The segmentation fault signal handler, used by
-          <command>catchsegv</command></para>
-          <indexterm zone="ch-system-glibc libSegFault">
-            <primary sortas="c-libSegFault">libSegFault</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <variablelist>
+      <title>The meaning of the <command>make install</command> option:</title>
 
-      <varlistentry id="libanl">
-        <term><filename class="libraryfile">libanl</filename></term>
+      <varlistentry>
+        <term><parameter>DESTDIR=$LFS</parameter></term>
         <listitem>
-          <para>An asynchronous name lookup library</para>
-          <indexterm zone="ch-system-glibc libanl">
-            <primary sortas="c-libanl">libanl</primary>
-          </indexterm>
+          <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>
 
-      <varlistentry id="libc">
-        <term><filename class="libraryfile">libc</filename></term>
-        <listitem>
-          <para>The main C library</para>
-          <indexterm zone="ch-system-glibc libc">
-            <primary sortas="c-libc">libc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    </variablelist>
 
-      <varlistentry id="libcrypt">
-        <term><filename class="libraryfile">libcrypt</filename></term>
-        <listitem>
-          <para>The cryptography library</para>
-          <indexterm zone="ch-system-glibc libcrypt">
-            <primary sortas="c-libcrypt">libcrypt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <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>
 
-      <varlistentry id="libdl">
-        <term><filename class="libraryfile">libdl</filename></term>
-        <listitem>
-          <para>The dynamic linking interface library</para>
-          <indexterm zone="ch-system-glibc libdl">
-            <primary sortas="c-libdl">libdl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc dummy.c
+readelf -l a.out | grep '/ld-linux'</userinput></screen>
 
-      <varlistentry id="libg">
-        <term><filename class="libraryfile">libg</filename></term>
-        <listitem>
-          <para>Dummy library containing no functions. Previously was a runtime
-          library for <command>g++</command></para>
-          <indexterm zone="ch-system-glibc libg">
-            <primary sortas="c-libg">libg</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+      <para>If everything is working correctly, there should be no errors,
+      and the output of the last command will be of the form:</para>
 
-      <varlistentry id="libm">
-        <term><filename class="libraryfile">libm</filename></term>
-        <listitem>
-          <para>The mathematical library</para>
-          <indexterm zone="ch-system-glibc libm">
-            <primary sortas="c-libm">libm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
 
-      <varlistentry id="libmcheck">
-        <term><filename class="libraryfile">libmcheck</filename></term>
-        <listitem>
-          <para>Turns on memory allocation checking when linked to</para>
-          <indexterm zone="ch-system-glibc libmcheck">
-            <primary sortas="c-libmcheck">libmcheck</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+      <para>Note that for 32-bit machines, the interpreter name will be
+      <filename>/lib/ld-linux.so.2</filename>.</para>
 
-      <varlistentry id="libmemusage">
-        <term><filename class="libraryfile">libmemusage</filename></term>
-        <listitem>
-          <para>Used by <command>memusage</command> to help collect
-          information about the memory usage of a program</para>
-          <indexterm zone="ch-system-glibc libmemusage">
-            <primary sortas="c-libmemusage">libmemusage</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+      <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>
 
-      <varlistentry id="libnsl">
-        <term><filename class="libraryfile">libnsl</filename></term>
-        <listitem>
-          <para>The network services library</para>
-          <indexterm zone="ch-system-glibc libnsl">
-            <primary sortas="c-libnsl">libnsl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+      <para>Once all is well, clean up the test files:</para>
 
-      <varlistentry id="libnss">
-        <term><filename class="libraryfile">libnss</filename></term>
-        <listitem>
-          <para>The Name Service Switch libraries, containing functions for
-          resolving host names, user names, group names, aliases, services,
-          protocols, etc.</para>
-          <indexterm zone="ch-system-glibc libnss">
-            <primary sortas="c-libnss">libnss</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
 
-      <varlistentry id="libpcprofile">
-        <term><filename class="libraryfile">libpcprofile</filename></term>
-        <listitem>
-          <para>Can be preloaded to PC profile an executable</para>
-          <indexterm zone="ch-system-glibc libpcprofile">
-            <primary sortas="c-libpcprofile">libpcprofile</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    </caution>
 
-      <varlistentry id="libpthread">
-        <term><filename class="libraryfile">libpthread</filename></term>
-        <listitem>
-          <para>The POSIX threads library</para>
-          <indexterm zone="ch-system-glibc libpthread">
-            <primary sortas="c-libpthread">libpthread</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <note><para>Building packages in the next sections will serve as an
+    additional check that the toolchain has been built properly. If some
+    package, especially binutils-pass2 or gcc-pass2, fails to build, it is
+    an indication that something has gone wrong with the
+    previous Binutils, GCC, or Glibc installations.</para></note>
 
-      <varlistentry id="libresolv">
-        <term><filename class="libraryfile">libresolv</filename></term>
-        <listitem>
-          <para>Contains functions for creating, sending, and interpreting
-          packets to the Internet domain name servers</para>
-          <indexterm zone="ch-system-glibc libresolv">
-            <primary sortas="c-libresolv">libresolv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>Now that our cross-toolchain is complete, finalize the installation
+    of the limits.h header. For doing so, run an utility provided by the GCC
+    developers:</para>
 
-      <varlistentry id="librt">
-        <term><filename class="libraryfile">librt</filename></term>
-        <listitem>
-          <para>Contains functions providing most of the interfaces specified
-          by the POSIX.1b Realtime Extension</para>
-          <indexterm zone="ch-system-glibc librt">
-            <primary sortas="c-librt">librt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
 
-      <varlistentry id="libthread_db">
-        <term><filename class="libraryfile">libthread_db</filename></term>
-        <listitem>
-          <para>Contains functions useful for building debuggers for
-          multi-threaded programs</para>
-          <indexterm zone="ch-system-glibc libthread_db">
-            <primary sortas="c-libthread_db">libthread_db</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  </sect2>
 
-      <varlistentry id="libutil">
-        <term><filename class="libraryfile">libutil</filename></term>
-        <listitem>
-          <para>Contains code for <quote>standard</quote> functions used in
-          many different Unix utilities</para>
-          <indexterm zone="ch-system-glibc libutil">
-            <primary sortas="c-libutil">libutil</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-glibc" role="."/></para>
 
   </sect2>
 

+ 16 - 57
chapter06/grep.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-grep" role="wrap">
+<sect1 id="ch-tools-grep" role="wrap">
   <?dbhtml filename="grep.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>Grep-&grep-version;</title>
 
-  <indexterm zone="ch-system-grep">
+  <indexterm zone="ch-tools-grep">
     <primary sortas="a-Grep">Grep</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Grep package contains programs for searching through files.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/grep.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&grep-ch6-sbu;</seg>
-        <seg>&grep-ch6-du;</seg>
+        <seg>&grep-ch5-sbu;</seg>
+        <seg>&grep-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -42,69 +45,25 @@
 
     <para>Prepare Grep for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --bindir=/bin</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-grep" role="content">
-    <title>Contents of Grep</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-
-      <seglistitem>
-        <seg>egrep, fgrep, and grep</seg>
-      </seglistitem>
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="egrep">
-        <term><command>egrep</command></term>
-        <listitem>
-          <para>Prints lines matching an extended regular expression</para>
-          <indexterm zone="ch-system-grep egrep">
-            <primary sortas="b-egrep">egrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fgrep">
-        <term><command>fgrep</command></term>
-        <listitem>
-          <para>Prints lines matching a list of fixed strings</para>
-          <indexterm zone="ch-system-grep fgrep">
-            <primary sortas="b-fgrep">fgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grep">
-        <term><command>grep</command></term>
-        <listitem>
-          <para>Prints lines matching a basic regular expression</para>
-          <indexterm zone="ch-system-grep grep">
-            <primary sortas="b-grep">grep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-grep" role="."/></para>
 
   </sect2>
 

+ 0 - 374
chapter06/grub.xml

@@ -1,374 +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-system-grub" role="wrap">
-  <?dbhtml filename="grub.html"?>
-
-  <sect1info condition="script">
-    <productname>grub</productname>
-    <productnumber>&grub-version;</productnumber>
-    <address>&grub-url;</address>
-  </sect1info>
-
-  <title>GRUB-&grub-version;</title>
-
-  <indexterm zone="ch-system-grub">
-    <primary sortas="a-Grub">GRUB</primary>
-  </indexterm>
-
-  <sect2 role="package">
-    <title/>
-
-    <para>The GRUB package contains the GRand Unified Bootloader.</para>
-
-    <segmentedlist>
-      <segtitle>&buildtime;</segtitle>
-      <segtitle>&diskspace;</segtitle>
-
-      <seglistitem>
-        <seg>&grub-ch6-sbu;</seg>
-        <seg>&grub-ch6-du;</seg>
-      </seglistitem>
-    </segmentedlist>
-
-  </sect2>
-
-  <sect2 role="installation">
-    <title>Installation of GRUB</title>
-
-    <para>Prepare GRUB for compilation:</para>
-
-<screen><userinput remap="configure">./configure --prefix=/usr          \
-            --sbindir=/sbin        \
-            --sysconfdir=/etc      \
-            --disable-efiemu       \
-            --disable-werror</userinput></screen>
-
-    <variablelist>
-      <title>The meaning of the new configure options:</title>
-
-      <varlistentry>
-        <term><parameter>--disable-werror</parameter></term>
-        <listitem>
-          <para>This allows the build to complete with warnings introduced
-          by more recent Flex versions.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><parameter>--disable-efiemu</parameter></term>
-        <listitem>
-          <para>This option minimizes what is built by disabling a feature and
-          testing programs not needed for LFS.</para>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
-
-    <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
-    <para>This package does not come with a test suite.</para>
-
-    <para>Install the package:</para>
-
-<screen><userinput remap="install">make install
-mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
-
-  <para>Using GRUB to make your LFS system bootable will be discussed in
-  <xref linkend="ch-bootable-grub"/>.</para>
-
-  </sect2>
-
-  <sect2 id="contents-gRUB" role="content">
-    <title>Contents of GRUB</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-
-       <seg>grub-bios-setup,      grub-editenv,    grub-file,        grub-fstest,
-            grub-glue-efi,        grub-install,    grub-kbdcomp,     grub-macbless,   
-            grub-menulst2cfg,     grub-mkconfig,
-                                  grub-mkimage,    grub-mklayout,    grub-mknetdir,
-            grub-mkpasswd-pbkdf2, grub-mkrelpath,  grub-mkrescue,    grub-mkstandalone,
-            grub-ofpathname,      grub-probe,      grub-reboot,      grub-render-label, 
-            grub-script-check,
-            grub-set-default,     grub-sparc64-setup, and grub-syslinux2cfg</seg>
-
-        <seg>/usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install
-        is first run)</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="grub-bios-setup">
-        <term><command>grub-bios-setup</command></term>
-        <listitem>
-          <para>Is a helper program for grub-install</para>
-          <indexterm zone="ch-system-grub grub-bios-setup">
-            <primary sortas="b-grub-bios-setup">grub-bios-setup</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-editenv">
-        <term><command>grub-editenv</command></term>
-        <listitem>
-          <para>A tool to edit the environment block</para>
-          <indexterm zone="ch-system-grub grub-editenv">
-            <primary sortas="b-grub-editenv">grub-editenv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-file">
-        <term><command>grub-file</command></term>
-        <listitem>
-          <para>Checks if FILE is of the specified type.</para>
-          <indexterm zone="ch-system-grub grub-file">
-            <primary sortas="b-grub-file">grub-file</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-fstest">
-        <term><command>grub-fstest</command></term>
-        <listitem>
-          <para>Tool to debug the filesystem driver</para>
-          <indexterm zone="ch-system-grub grub-fstest">
-            <primary sortas="b-grub-fstest">grub-fstest</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-glue-efi">
-        <term><command>grub-glue-efi</command></term>
-        <listitem>
-          <para>Processes ia32 and amd64 EFI images and glues them
-          according to Apple format.</para>
-          <indexterm zone="ch-system-grub grub-glue-efi">
-            <primary sortas="b-grub-glue-efi">grub-glue-efi</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-install">
-        <term><command>grub-install</command></term>
-        <listitem>
-          <para>Install GRUB on your drive</para>
-          <indexterm zone="ch-system-grub grub-install">
-            <primary sortas="b-grub-install">grub-install</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-kbdcomp">
-        <term><command>grub-kbdcomp</command></term>
-        <listitem>
-          <para>Script that converts an xkb layout into one recognized by
-          GRUB</para>
-          <indexterm zone="ch-system-grub grub-kbdcomp">
-            <primary sortas="b-grub-kbdcomp">grub-kbdcomp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-macbless">
-        <term><command>grub-macbless</command></term>
-        <listitem>
-          <para>Mac-style bless on HFS or HFS+ files</para>
-          <indexterm zone="ch-system-grub grub-macbless">
-            <primary sortas="b-grub-macbless">grub-macbless</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-menulst2cfg">
-        <term><command>grub-menulst2cfg</command></term>
-        <listitem>
-          <para>Converts a GRUB Legacy <filename>menu.lst</filename>
-          into a <filename>grub.cfg</filename> for use with GRUB 2</para>
-          <indexterm zone="ch-system-grub grub-menulst2cfg">
-            <primary sortas="b-grub-menulst2cfg">grub-menulst2cfg</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mkconfig">
-        <term><command>grub-mkconfig</command></term>
-        <listitem>
-          <para>Generate a grub config file</para>
-          <indexterm zone="ch-system-grub grub-mkconfig">
-            <primary sortas="b-grub-mkconfig">grub-mkconfig</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mkimage">
-        <term><command>grub-mkimage</command></term>
-        <listitem>
-          <para>Make a bootable image of GRUB</para>
-          <indexterm zone="ch-system-grub grub-mkimage">
-            <primary sortas="b-grub-mkimage">grub-mkimage</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mklayout">
-        <term><command>grub-mklayout</command></term>
-        <listitem>
-          <para>Generates a GRUB keyboard layout file</para>
-          <indexterm zone="ch-system-grub grub-mklayout">
-            <primary sortas="b-grub-mklayout">grub-mklayout</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mknetdir">
-        <term><command>grub-mknetdir</command></term>
-        <listitem>
-          <para>Prepares a GRUB netboot directory</para>
-          <indexterm zone="ch-system-grub grub-mknetdir">
-            <primary sortas="b-grub-mknetdir">grub-mknetdir</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mkpasswd-pbkdf2">
-        <term><command>grub-mkpasswd-pbkdf2</command></term>
-        <listitem>
-          <para>Generates an encrypted PBKDF2 password for use in the boot
-          menu</para>
-          <indexterm zone="ch-system-grub grub-mkpasswd-pbkdf2">
-            <primary sortas="b-grub-mkpasswd-pbkdf2">grub-mkpasswd-pbkdf2</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mkrelpath">
-        <term><command>grub-mkrelpath</command></term>
-        <listitem>
-          <para>Makes a system pathname relative to its root</para>
-          <indexterm zone="ch-system-grub grub-mkrelpath">
-            <primary sortas="b-grub-mkrelpath">grub-mkrelpath</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mkrescue">
-        <term><command>grub-mkrescue</command></term>
-        <listitem>
-          <para>Make a bootable image of GRUB suitable for a floppy disk or CDROM/DVD</para>
-          <indexterm zone="ch-system-grub grub-mkrescue">
-            <primary sortas="b-grub-mkrescue">grub-mkrescue</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-mkstandalone">
-        <term><command>grub-mkstandalone</command></term>
-        <listitem>
-          <para>Generates a standalone image</para>
-          <indexterm zone="ch-system-grub grub-mkstandalone">
-            <primary sortas="b-grub-mkstandalone">grub-mkstandalone</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-ofpathname">
-        <term><command>grub-ofpathname</command></term>
-        <listitem>
-          <para>Is a helper program that prints the path of a GRUB device</para>
-          <indexterm zone="ch-system-grub grub-ofpathname">
-            <primary sortas="b-grub-ofpathname">grub-ofpathname</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-probe">
-        <term><command>grub-probe</command></term>
-        <listitem>
-          <para>Probe device information for a given path or device</para>
-          <indexterm zone="ch-system-grub grub-probe">
-            <primary sortas="b-grub-probe">grub-probe</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-reboot">
-        <term><command>grub-reboot</command></term>
-        <listitem>
-          <para>Sets the default boot entry for GRUB for the next boot only</para>
-          <indexterm zone="ch-system-grub grub-reboot">
-            <primary sortas="b-grub-reboot">grub-reboot</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-render-label">
-        <term><command>grub-render-label</command></term>
-        <listitem>
-          <para>Render Apple .disk_label for Apple Macs</para>
-          <indexterm zone="ch-system-grub grub-render-label">
-            <primary sortas="b-grub-render-label">grub-render-label</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-script-check">
-        <term><command>grub-script-check</command></term>
-        <listitem>
-          <para>Checks GRUB configuration script for syntax errors</para>
-          <indexterm zone="ch-system-grub grub-script-check">
-            <primary sortas="b-grub-script-check">grub-script-check</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-set-default">
-        <term><command>grub-set-default</command></term>
-        <listitem>
-          <para>Sets the default boot entry for GRUB</para>
-          <indexterm zone="ch-system-grub grub-set-default">
-            <primary sortas="b-grub-set-default">grub-set-default</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-sparc64-setup">
-        <term><command>grub-sparc64-setup</command></term>
-        <listitem>
-          <para>Is a helper program for grub-setup</para>
-          <indexterm zone="ch-system-grub grub-sparc64-setup">
-            <primary sortas="b-grub-sparc64-setup">grub-setup</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="grub-syslinux2cfg">
-        <term><command>grub-syslinux2cfg</command></term>
-        <listitem>
-          <para>Transform a syslinux config file into grub.cfg format</para>
-          <indexterm zone="ch-system-grub grub-syslinux2cfg">
-            <primary sortas="b-grub-syslinux2cfg">grub-syslinux2cfg</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
-
-  </sect2>
-
-</sect1>

+ 16 - 180
chapter06/gzip.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-gzip" role="wrap">
+<sect1 id="ch-tools-gzip" role="wrap">
   <?dbhtml filename="gzip.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>Gzip-&gzip-version;</title>
 
-  <indexterm zone="ch-system-gzip">
+  <indexterm zone="ch-tools-gzip">
     <primary sortas="a-Gzip">Gzip</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Gzip package contains programs for compressing and decompressing
-    files.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/gzip.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&gzip-ch6-sbu;</seg>
-        <seg>&gzip-ch6-du;</seg>
+        <seg>&gzip-ch5-sbu;</seg>
+        <seg>&gzip-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,193 +45,27 @@
 
     <para>Prepare Gzip for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results, issue:</para>
-
-<screen><userinput remap="test">make check</userinput></screen>
-
-    <para>Two tests are known to fail in the LFS environment:
-    help-version and zmore.</para>
-
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make install</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
-    <para>Move a program that needs to be on the root filesystem:</para>
+    <para>Move the excutable to its final expected location:</para>
 
-<screen><userinput remap="install">mv -v /usr/bin/gzip /bin</userinput></screen>
+<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-gzip" role="content">
-    <title>Contents of Gzip</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-
-      <seglistitem>
-        <seg>gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp, 
-        zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew</seg>
-      </seglistitem>
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="gunzip">
-        <term><command>gunzip</command></term>
-        <listitem>
-          <para>Decompresses gzipped files</para>
-          <indexterm zone="ch-system-gzip gunzip">
-            <primary sortas="b-gunzip">gunzip</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gzexe">
-        <term><command>gzexe</command></term>
-        <listitem>
-          <para>Creates self-decompressing executable files</para>
-          <indexterm zone="ch-system-gzip gzexe">
-            <primary sortas="b-gzexe">gzexe</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="gzip">
-        <term><command>gzip</command></term>
-        <listitem>
-          <para>Compresses the given files using Lempel-Ziv (LZ77) coding</para>
-          <indexterm zone="ch-system-gzip gzip">
-            <primary sortas="b-gzip">gzip</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uncompress">
-        <term><command>uncompress</command></term>
-        <listitem>
-          <para>Decompresses compressed files</para>
-          <indexterm zone="ch-system-gzip uncompress">
-            <primary sortas="b-uncompress">uncompress</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zcat">
-        <term><command>zcat</command></term>
-        <listitem>
-          <para>Decompresses the given gzipped files to standard output</para>
-          <indexterm zone="ch-system-gzip zcat">
-            <primary sortas="b-zcat">zcat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zcmp">
-        <term><command>zcmp</command></term>
-        <listitem>
-          <para>Runs <command>cmp</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zcmp">
-            <primary sortas="b-zcmp">zcmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zdiff">
-        <term><command>zdiff</command></term>
-        <listitem>
-          <para>Runs <command>diff</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zdiff">
-            <primary sortas="b-zdiff">zdiff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zegrep">
-        <term><command>zegrep</command></term>
-        <listitem>
-          <para>Runs <command>egrep</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zegrep">
-            <primary sortas="b-zegrep">zegrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zfgrep">
-        <term><command>zfgrep</command></term>
-        <listitem>
-          <para>Runs <command>fgrep</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zfgrep">
-            <primary sortas="b-zfgrep">zfgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zforce">
-        <term><command>zforce</command></term>
-        <listitem>
-          <para>Forces a <filename class="extension">.gz</filename> extension on
-          all given files that are gzipped files, so that <command>gzip</command>
-          will not compress them again; this can be useful when file names were
-          truncated during a file transfer</para>
-          <indexterm zone="ch-system-gzip zforce">
-            <primary sortas="b-zforce">zforce</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zgrep">
-        <term><command>zgrep</command></term>
-        <listitem>
-          <para>Runs <command>grep</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zgrep">
-            <primary sortas="b-zgrep">zgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zless">
-        <term><command>zless</command></term>
-        <listitem>
-          <para>Runs <command>less</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zless">
-            <primary sortas="b-zless">zless</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zmore">
-        <term><command>zmore</command></term>
-        <listitem>
-          <para>Runs <command>more</command> on gzipped files</para>
-          <indexterm zone="ch-system-gzip zmore">
-            <primary sortas="b-zmore">zmore</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="znew">
-        <term><command>znew</command></term>
-        <listitem>
-          <para>Re-compresses files from <command>compress</command> format to
-          <command>gzip</command> format&mdash;<filename
-          class="extension">.Z</filename> to <filename
-          class="extension">.gz</filename></para>
-          <indexterm zone="ch-system-gzip znew">
-            <primary sortas="b-znew">znew</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-gzip" role="."/></para>
 
   </sect2>
 

+ 17 - 62
chapter06/introduction.xml

@@ -5,70 +5,25 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-introduction">
+<sect1 id="ch-tools-introduction">
   <?dbhtml filename="introduction.html"?>
 
   <title>Introduction</title>
 
-  <para>In this chapter, we enter the building site and start constructing the
-  LFS system in earnest. That is, we chroot into the temporary mini Linux system,
-  make a few final preparations, and then begin installing the packages.</para>
-
-  <para>The installation of this software is straightforward. Although in many
-  cases the installation instructions could be made shorter and more generic,
-  we have opted to provide the full instructions for every package to minimize
-  the possibilities for mistakes.  The key to learning what makes a Linux system
-  work is to know what each package is used for and why you (or the system)
-  may need it.</para>
-
-  <para>We do not recommend using optimizations.  They can make
-  a program run slightly faster, but they may also cause compilation
-  difficulties and problems when running the program.  If a package refuses to
-  compile when using optimization, try to compile it without optimization and
-  see if that fixes the problem. Even if the package does compile when using
-  optimization, there is the risk it may have been compiled incorrectly because
-  of the complex interactions between the code and build tools.  Also note that
-  the <option>-march</option> and <option>-mtune</option> options using values
-  not specified in the book have not been tested. This may cause problems with
-  the toolchain packages (Binutils, GCC and Glibc).  The small potential gains
-  achieved in using compiler optimizations are often outweighed by the risks.
-  First-time builders of LFS are encouraged to build without custom
-  optimizations. The subsequent system will still run very fast and be stable
-  at the same time.</para>
-
-  <para>Before the installation instructions, each installation page provides
-  information about the package, including a concise description of what it
-  contains, approximately how long it will take to build, and how much disk
-  space is required during this building process. Following the installation
-  instructions, there is a list of programs and libraries (along with brief
-  descriptions of these) that the package installs.</para>
-
-  <note><para>The SBU values and required disk space includes
-  test suite data for all applicable packages in Chapter&nbsp;6.</para></note>
-
-  <sect2>
-    <title>About libraries</title>
-
-    <para>In general, the LFS editors discourage building and installing static
-    libraries.  The original purpose for most static libraries has been made
-    obsolete in a modern Linux system.  In addition linking a static library
-    into a program can be detrimental.  If an update to the library is needed
-    to remove a security problem, all programs that use the static library will
-    need to be relinked to the new library.  Since the use of static libraries
-    is not always obvious, the relevant programs (and the procedures needed to
-    do the linking) may not even be known.</para>
-
-    <para>In the procedures in Chapter&nbsp;6, we remove or disable installation of
-    most static libraries. Usually this is done by passing a
-    <option>--disable-static</option> option to <command>configure</command>.
-    In other cases, alternate means are needed. In a few cases, especially
-    glibc and gcc, the use of static libraries remains essential to the general
-    package building process. </para>
-
-    <para>For a more complete discussion of libraries, see the discussion
-    <ulink url="&blfs-root;/view/&short-version;/introduction/libraries.html">
-    Libraries: Static or shared?</ulink> in the BLFS book.</para>
-
-  </sect2>
-
+  <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>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
+  <filename class="directory">$LFS</filename> directory to keep them
+  separate from the files installed in the next chapter and the host
+  production directories. Since the packages compiled here are temporary,
+  we do not want them to pollute the soon-to-be LFS system.</para>
+-->
 </sect1>

+ 115 - 0
chapter06/kernfs.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-kernfs">
+  <?dbhtml filename="kernfs.html"?>
+
+  <title>Preparing Virtual Kernel File Systems</title>
+
+  <indexterm zone="ch-tools-kernfs">
+    <primary sortas="e-/dev/">/dev/*</primary>
+  </indexterm>
+
+    <para>Various file systems exported by the kernel are used to communicate to
+    and from the kernel itself. These file systems are virtual in that no disk
+    space is used for them. The content of the file systems resides in
+    memory.</para>
+
+    <para>Begin by creating directories onto which the file systems will be
+    mounted:</para>
+
+<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
+
+  <sect2>
+    <title>Creating Initial Device Nodes</title>
+
+    <para>When the kernel boots the system, it requires the presence of a few
+    device nodes, in particular the <filename
+    class="devicefile">console</filename> and <filename
+    class="devicefile">null</filename> devices. The device nodes must be created
+    on the hard disk so that they are available before <command>udevd</command>
+    has been started, and additionally when Linux is started with
+    <parameter>init=/bin/bash</parameter>. Create the devices by running the
+    following commands:</para>
+
+<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
+mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="ch-system-bindmount">
+    <title>Mounting and Populating /dev</title>
+
+      <para>The recommended method of populating the <filename
+      class="directory">/dev</filename> directory with devices is to mount a
+      virtual filesystem (such as <systemitem
+      class="filesystem">tmpfs</systemitem>) on the <filename
+      class="directory">/dev</filename> directory, and allow the devices to be
+      created dynamically on that virtual filesystem as they are detected or
+      accessed. Device creation is generally done during the boot process
+      by Udev. Since this new system does not yet have Udev and has not yet
+      been booted, it is necessary to mount and populate <filename
+      class="directory">/dev</filename> manually. This is accomplished by bind
+      mounting the host system's <filename class="directory">/dev</filename>
+      directory. A bind mount is a special type of mount that allows you to
+      create a mirror of a directory or mount point to some other location. Use
+      the following command to achieve this:</para>
+
+<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="ch-system-kernfsmount">
+    <title>Mounting Virtual Kernel File Systems</title>
+
+      <para>Now mount the remaining virtual kernel filesystems:</para>
+
+<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
+mount -vt proc proc $LFS/proc
+mount -vt sysfs sysfs $LFS/sys
+mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the mount options for devpts:</title>
+
+      <varlistentry>
+        <term><parameter>gid=5</parameter></term>
+        <listitem>
+          <para>This ensures that all devpts-created device nodes are owned by
+          group ID 5.  This is the ID we will use later on for the <systemitem
+          class="groupname">tty</systemitem> group.  We use the group ID instead
+          of a name, since the host system might use a different ID for its
+          <systemitem class="groupname">tty</systemitem> group.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>mode=0620</parameter></term>
+        <listitem>
+          <para>This ensures that all devpts-created device nodes have mode 0620
+          (user readable and writable, group writable).  Together with the
+          option above, this ensures that devpts will create device nodes that
+          meet the requirements of grantpt(), meaning the Glibc
+          <command>pt_chown</command> helper binary (which is not installed by
+          default) is not necessary.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+      <para>In some host systems, <filename>/dev/shm</filename> is a
+      symbolic link to <filename class="directory">/run/shm</filename>.
+      The /run tmpfs was mounted above so in this case only a 
+      directory needs to be created.</para>
+
+<screen><userinput>if [ -h $LFS/dev/shm ]; then
+  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+fi</userinput></screen>
+
+  </sect2>
+
+</sect1>

+ 114 - 0
chapter06/libstdc++-pass2.xml

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-libstdcpp-pass2" role="wrap">
+  <?dbhtml filename="gcc-libstdc++-pass2.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-libstdc++</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>Libstdc++ from GCC-&gcc-version;, Pass 2</title>
+
+  <indexterm zone="ch-tools-libstdcpp-pass2">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, libstdc++ pass 2</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to
+    defer the installation of the C++ standard library, because no suitable
+    compiler was available to compile it: we could not use the compiler
+    installed, because this compiler is a native
+    compiler, and should not be used outside of chroot without being at
+    risk of polluting the build with some host components.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+        <!-- TODO -->
+      <seglistitem>
+        <seg>&libstdcpp-ch5-sbu;</seg>
+        <seg>&libstdcpp-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Target Libstdc++</title>
+
+    <note>
+      <para><application>Libstdc++</application> is part of the GCC sources.
+      You should first unpack the GCC tarball and change to the
+      <filename>gcc-&gcc-version;</filename> directory.</para>
+    </note>
+
+    <para>Create a link which exists when building Libstdc++ in the gcc
+    tree:</para>
+
+<screen><userinput remap="pre">ln -s gthr-posix.h libgcc/gthr-default.h</userinput></screen>
+
+    <para>Create a separate build directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../libstdc++-v3/configure           \
+    CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
+    --prefix=/usr                   \
+    --disable-multilib              \
+    --disable-nls                   \
+    --disable-libstdcxx-pch</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>CXXFLAGS="-g -O2 -D_GNU_SOURCE"</parameter></term>
+        <listitem>
+          <para>Those flags are passed by the top level Makefile when doing
+	  a full build of GCC.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-libstdcxx-pch</parameter></term>
+        <listitem>
+          <para>This switch prevents the installation of precompiled
+          include files, which are not needed at this stage.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile libstdc++ by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the library:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 122 - 0
chapter06/libstdc++.xml

@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
+  <?dbhtml filename="gcc-libstdc++-pass1.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-libstdc++</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
+
+  <indexterm zone="ch-tools-libstdcpp-pass1">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, libstdc++ pass 1</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>Libstdc++ is the standard C++ library. It is needed 
+    to compile C++ code
+    (part of GCC is written in C++), but we had to defer its installation
+    when we built <xref linkend="ch-tools-gcc-pass1"/>
+    because it depends on glibc, which was not yet available in the target
+    directory.
+    </para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&libstdcpp-ch5-sbu;</seg>
+        <seg>&libstdcpp-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Target Libstdc++</title>
+
+    <note>
+      <para><application>Libstdc++</application> is part of the GCC sources.
+      You should first unpack the GCC tarball and change to the
+      <filename>gcc-&gcc-version;</filename> directory.</para>
+    </note>
+
+    <para>Create a separate build directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../libstdc++-v3/configure           \
+    --host=$LFS_TGT                 \
+    --build=$(../config.guess)      \
+    --prefix=/usr                   \
+    --disable-multilib              \
+    --disable-nls                   \
+    --disable-libstdcxx-pch         \
+    --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--host=...</parameter></term>
+        <listitem>
+          <para>Indicates to use the cross compiler we have just built
+          instead of the one in <filename>/usr/bin</filename>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-libstdcxx-pch</parameter></term>
+        <listitem>
+          <para>This switch prevents the installation of precompiled
+          include files, which are not needed at this stage.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
+        <listitem>
+          <para>This is the location where the standard include files are
+          searched by the C++ compiler. In a normal build, this information
+          is automatically passed to the Libstdc++ <command>configure</command>
+          options from the top level directory. In our case, this information
+          must be explicitly given.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile libstdc++ by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the library:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 207 - 0
chapter06/linux-headers.xml

@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-linux-headers" role="wrap">
+  <?dbhtml filename="linux-headers.html"?>
+
+  <sect1info condition="script">
+    <productname>linux-headers</productname>
+    <productnumber>&linux-version;</productnumber>
+    <address>&linux-url;</address>
+  </sect1info>
+
+  <title>Linux-&linux-version; API Headers</title>
+
+  <indexterm zone="ch-tools-linux-headers">
+    <primary sortas="a-Linux">Linux</primary>
+    <secondary>tools, API headers</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
+    kernel's API for use by Glibc.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&linux-headers-ch5-sbu;</seg>
+        <seg>&linux-headers-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Linux API Headers</title>
+
+    <para>The Linux kernel needs to expose an Application Programming Interface
+    (API) for the system's C library (Glibc in LFS) to use.  This is done
+    by way of sanitizing various C header files that are shipped in the Linux
+    kernel source tarball.</para>
+
+    <para>Make sure there are no stale files embedded in the package:</para>
+
+<screen><userinput remap="pre">make mrproper</userinput></screen>
+
+    <para>Now extract the user-visible kernel headers from the source.
+    The recommended make target <quote>headers_install</quote> cannot be
+    used, because it requires <application>rsync</application>, which may not
+    be available. The headers are first placed in
+    <filename class="directory">./usr</filename>, then copied to the needed
+    location.</para>
+
+<screen><userinput remap="make">make headers
+find usr/include -name '.*' -delete
+rm usr/include/Makefile
+</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-linux-headers" role="content">
+    <title>Contents of Linux API Headers</title>
+
+    <segmentedlist>
+      <segtitle>Installed headers</segtitle>
+      <segtitle>Installed directories</segtitle>
+
+      <seglistitem>
+        <seg>/usr/include/asm/*.h, /usr/include/asm-generic/*.h,
+        /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h,
+        /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, 
+        /usr/include/sound/*.h, /usr/include/video/*.h, 
+        and /usr/include/xen/*.h</seg>
+        <seg>/usr/include/asm, /usr/include/asm-generic, /usr/include/drm,
+        /usr/include/linux, /usr/include/misc, /usr/include/mtd, 
+        /usr/include/rdma, /usr/include/scsi, /usr/include/sound, 
+        /usr/include/video, and /usr/include/xen</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="asm">
+        <term><filename class="headerfile">/usr/include/asm/*.h</filename></term>
+        <listitem>
+          <para>The Linux API ASM Headers</para>
+          <indexterm zone="ch-tools-linux-headers asm">
+            <primary sortas="e-/usr/include/asm/*.h">/usr/include/asm/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+     <varlistentry id="asm-generic">
+        <term><filename class="headerfile">/usr/include/asm-generic/*.h</filename></term>
+        <listitem>
+          <para>The Linux API ASM Generic Headers</para>
+          <indexterm zone="ch-tools-linux-headers asm-generic">
+            <primary sortas="e-/usr/include/asm-generic/*.h">/usr/include/asm-generic/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="drm">
+        <term><filename class="headerfile">/usr/include/drm/*.h</filename></term>
+        <listitem>
+          <para>The Linux API DRM Headers</para>
+          <indexterm zone="ch-tools-linux-headers drm">
+            <primary sortas="e-/usr/include/drm/*.h">/usr/include/drm/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="linux">
+        <term><filename class="headerfile">/usr/include/linux/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Linux Headers</para>
+          <indexterm zone="ch-tools-linux-headers linux">
+            <primary sortas="e-/usr/include/linux/*.h">/usr/include/linux/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="misc">
+        <term><filename class="headerfile">/usr/include/misc/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Miscellaneous Headers</para>
+          <indexterm zone="ch-tools-linux-headers misc">
+            <primary sortas="e-/usr/include/misc/*.h">/usr/include/misc/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="mtd">
+        <term><filename class="headerfile">/usr/include/mtd/*.h</filename></term>
+        <listitem>
+          <para>The Linux API MTD Headers</para>
+          <indexterm zone="ch-tools-linux-headers mtd">
+            <primary sortas="e-/usr/include/mtd/*.h">/usr/include/mtd/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="rdma">
+        <term><filename class="headerfile">/usr/include/rdma/*.h</filename></term>
+        <listitem>
+          <para>The Linux API RDMA Headers</para>
+          <indexterm zone="ch-tools-linux-headers rdma">
+            <primary sortas="e-/usr/include/rdma/*.h">/usr/include/rdma/*.h</primary>
+         </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="scsi">
+        <term><filename class="headerfile">/usr/include/scsi/*.h</filename></term>
+        <listitem>
+          <para>The Linux API SCSI Headers</para>
+          <indexterm zone="ch-tools-linux-headers scsi">
+            <primary sortas="e-/usr/include/scsi/*.h">/usr/include/scsi/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="sound">
+        <term><filename class="headerfile">/usr/include/sound/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Sound Headers</para>
+          <indexterm zone="ch-tools-linux-headers sound">
+           <primary sortas="e-/usr/include/sound/*.h">/usr/include/sound/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="video">
+        <term><filename class="headerfile">/usr/include/video/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Video Headers</para>
+          <indexterm zone="ch-tools-linux-headers video">
+            <primary sortas="e-/usr/include/video/*.h">/usr/include/video/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="xen">
+        <term><filename class="headerfile">/usr/include/xen/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Xen Headers</para>
+          <indexterm zone="ch-tools-linux-headers xen">
+            <primary sortas="e-/usr/include/xen/*.h">/usr/include/xen/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 17 - 47
chapter06/m4.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-m4" role="wrap">
+<sect1 id="ch-tools-m4" role="wrap">
   <?dbhtml filename="m4.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>M4-&m4-version;</title>
 
-  <indexterm zone="ch-system-m4">
+  <indexterm zone="ch-tools-m4">
     <primary sortas="a-M4">M4</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The M4 package contains a macro processor.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/m4.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&m4-ch6-sbu;</seg>
-        <seg>&m4-ch6-du;</seg>
+        <seg>&m4-ch5-sbu;</seg>
+        <seg>&m4-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -40,64 +43,31 @@
   <sect2 role="installation">
     <title>Installation of M4</title>
 
-    <para>First, make some fixes required by glibc-2.28:</para>
+    <para>First, make some fixes introduced by glibc-2.28:</para>
 
 <screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
 echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h</userinput></screen>
 
     <para>Prepare M4 for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-m4" role="content">
-    <title>Contents of M4</title>
-
-    <segmentedlist>
-      <segtitle>Installed program</segtitle>
-
-      <seglistitem>
-        <seg>m4</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="m4">
-         <!-- Don't remove the extra space, it prevet a FOP warning. -->
-        <term><command>m4 </command></term>
-        <listitem>
-          <para>Copies the given files while expanding the macros that they
-          contain [These macros are either built-in or user-defined and can
-          take any number of arguments. Besides performing macro expansion,
-          <command>m4</command> has built-in functions for including named
-          files, running Unix commands, performing integer arithmetic,
-          manipulating text, recursion, etc. The <command>m4</command> program
-          can be used either as a front-end to a compiler or as a macro processor
-          in its own right.]</para>
-          <indexterm zone="ch-system-m4 m4">
-            <primary sortas="b-m4">m4</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in
+    <xref linkend="contents-m4" role="."/></para>
 
   </sect2>
 

+ 30 - 46
chapter06/make.xml

@@ -4,8 +4,7 @@
   <!ENTITY % general-entities SYSTEM "../general.ent">
   %general-entities;
 ]>
-
-<sect1 id="ch-system-make" role="wrap">
+<sect1 id="ch-tools-make" role="wrap">
   <?dbhtml filename="make.html"?>
 
   <sect1info condition="script">
@@ -16,22 +15,25 @@
 
   <title>Make-&make-version;</title>
 
-  <indexterm zone="ch-system-make">
+  <indexterm zone="ch-tools-make">
     <primary sortas="a-Make">Make</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Make package contains a program for compiling packages.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/make.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&make-ch6-sbu;</seg>
-        <seg>&make-ch6-du;</seg>
+        <seg>&make-ch5-sbu;</seg>
+        <seg>&make-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -39,60 +41,42 @@
 
   <sect2 role="installation">
     <title>Installation of Make</title>
-<!--
-    <para>Again, 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=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --without-guile \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
 
-    <para>Compile the package:</para>
+    <variablelist>
+      <title>The meaning of the new configure option:</title>
 
-<screen><userinput remap="make">make</userinput></screen>
+      <varlistentry>
+        <term><parameter>--without-guile</parameter></term>
+        <listitem>
+          <para>Although we are cross-compiling, configure tries to use
+          guile from the build host if it finds it. This makes compilation
+          fail, so this switch prevents using it.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
 
-    <para>The test suite needs to know where supporting perl files are located.
-    We use an environment variable to accomplish this.  To test the 
-    results, issue:</para>
+    <para>Compile the package:</para>
 
-<screen><userinput remap="test">make check</userinput></screen>
+<screen><userinput remap="make">make</userinput></screen>
 
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make install</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
+  <sect2 role="content">
+    <title/>
 
-  <sect2 id="contents-make" role="content">
-    <title>Contents of Make</title>
-
-    <segmentedlist>
-      <segtitle>Installed program</segtitle>
-
-      <seglistitem>
-        <seg>make</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="make">
-        <term><command>make</command></term>
-        <listitem>
-          <para>Automatically determines which pieces of a package need to
-          be (re)compiled and then issues the relevant commands</para>
-          <indexterm zone="ch-system-make make">
-            <primary sortas="b-make">make</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-make" role="."/></para>
 
   </sect2>
 

+ 58 - 281
chapter06/ncurses.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-ncurses" role="wrap">
+<sect1 id="ch-tools-ncurses" role="wrap">
   <?dbhtml filename="ncurses.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>Ncurses-&ncurses-version;</title>
 
-  <indexterm zone="ch-system-ncurses">
+  <indexterm zone="ch-tools-ncurses">
     <primary sortas="a-Ncurses">Ncurses</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Ncurses package contains libraries for terminal-independent
-    handling of character screens.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/ncurses.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&ncurses-ch6-sbu;</seg>
-        <seg>&ncurses-ch6-du;</seg>
+        <seg>&ncurses-ch5-sbu;</seg>
+        <seg>&ncurses-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -41,23 +43,45 @@
   <sect2 role="installation">
     <title>Installation of Ncurses</title>
 
-    <para>Don't install a static library that is not handled by configure:</para>
+    <para>First, ensure that <command>gawk</command> is found first during configuration:</para>
 
-<screen><userinput remap="pre">sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in</userinput></screen>
+<screen><userinput remap="pre">sed -i s/mawk// configure</userinput></screen>
+
+    <para>Then, run the following commands to build the <quote>tic</quote>
+    program on the build host:</para>
+
+<screen><userinput remap="pre">mkdir build
+cd build
+../configure
+make -C include
+make -C progs tic
+cd ..</userinput></screen>
 
     <para>Prepare Ncurses for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr           \
-            --mandir=/usr/share/man \
-            --with-shared           \
-            --without-debug         \
-            --without-normal        \
-            --enable-pc-files       \
-            --enable-widec</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr             \
+            --host=$LFS_TGT           \
+            --build=$(./config.guess) \
+            --mandir=/usr/share/man   \
+            --with-shared             \
+            --without-debug           \
+            --without-ada             \
+            --without-normal          \
+            --enable-widec            \
+            --enable-pc-files</userinput></screen>
 
     <variablelist>
       <title>The meaning of the new configure options:</title>
 
+      <varlistentry>
+        <term><parameter>--without-ada</parameter></term>
+        <listitem>
+          <para>This ensures that Ncurses does not build support for the Ada
+          compiler which may be present on the host but will not be available
+          once we enter the <command>chroot</command> environment.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><parameter>--enable-widec</parameter></term>
         <listitem>
@@ -87,293 +111,46 @@
           </para>
         </listitem>
       </varlistentry>
-
+      <!--
+      <varlistentry>
+        <term><parameter>- -disable-db-install</parameter></term>
+        <listitem>
+          <para>This switch disables building the terminfo database: it is not
+          needed at this stage, and if <command>tic</command> is too old,
+          it cannot compile recent databases.</para>
+        </listitem>
+      </varlistentry>
+      -->
     </variablelist>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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</userinput></screen>
+<!-- TODO: check and document -->
+<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
+ln -s libncursesw.so $LFS/usr/lib/libncurses.so</userinput></screen>
 
     <para>Move the shared libraries to the
     <filename class="directory">/lib</filename> directory, where they are
     expected to reside:</para>
 
-<screen><userinput remap="install">mv -v /usr/lib/libncursesw.so.6* /lib</userinput></screen>
+<screen><userinput remap="install">mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib</userinput></screen>
 
     <para>Because the libraries have been moved, one symlink points to
     a non-existent file. Recreate it:</para>
 
-<screen><userinput remap="install">ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so</userinput></screen>
-
-    <para>Many applications still expect the linker to be able to find
-    non-wide-character Ncurses libraries. Trick such applications into linking with
-    wide-character libraries by means of symlinks and linker scripts:</para>
-
-<screen><userinput remap="install">for lib in ncurses form panel menu ; do
-    rm -vf                    /usr/lib/lib${lib}.so
-    echo "INPUT(-l${lib}w)" &gt; /usr/lib/lib${lib}.so
-    ln -sfv ${lib}w.pc        /usr/lib/pkgconfig/${lib}.pc
-done</userinput></screen>
-
-    <para>Finally, make sure that old applications that look for
-    <filename class="libraryfile">-lcurses</filename> at build time are still
-    buildable:</para>
-
-<screen><userinput remap="install">rm -vf                     /usr/lib/libcursesw.so
-echo "INPUT(-lncursesw)" &gt; /usr/lib/libcursesw.so
-ln -sfv libncurses.so      /usr/lib/libcurses.so</userinput></screen>
+<screen><userinput remap="install">ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so</userinput></screen>
 
-    <para>If desired, install the Ncurses documentation:</para>
-
-<screen><userinput remap="install">mkdir -v       /usr/share/doc/ncurses-&ncurses-version;
-cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen>
-
-    <note>
-
-      <para>The instructions above don't create non-wide-character Ncurses
-      libraries since no package installed by compiling from sources would link
-      against them at runtime. However, the only known binary-only
-      applications that link against non-wide-character Ncurses libraries 
-      require version 5.  If you must have such libraries because of some binary-only
-      application or to be compliant with LSB, build the package again with the
-      following commands:</para>
-
-<screen role="nodump"><userinput>make distclean
-./configure --prefix=/usr    \
-            --with-shared    \
-            --without-normal \
-            --without-debug  \
-            --without-cxx-binding \
-            --with-abi-version=5 
-make sources libs
-cp -av lib/lib*.so.5* /usr/lib</userinput></screen>
-    </note>
 
   </sect2>
 
-  <sect2 id="contents-ncurses" role="content">
-    <title>Contents of Ncurses</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>
-           captoinfo (link to tic), 
-           clear, 
-           infocmp, 
-           infotocap (link to tic),
-           ncursesw6-config, 
-           reset (link to tset), 
-           tabs, 
-           tic, 
-           toe, 
-           tput, and 
-           tset
-        </seg>
-        <seg>
-           libcursesw.so (symlink and linker script to libncursesw.so),
-           libformw.so, 
-           libmenuw.so, 
-           libncursesw.so,
-           libncurses++w.a,
-           libpanelw.so, and their non-wide-character counterparts without "w"
-              in the library names.</seg>
-        <seg>
-           /usr/share/tabset, 
-           /usr/share/terminfo, and
-           /usr/share/doc/ncurses-&ncurses-version;
-        </seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="captoinfo">
-        <term><command>captoinfo</command></term>
-        <listitem>
-          <para>Converts a termcap description into a terminfo description</para>
-          <indexterm zone="ch-system-ncurses captoinfo">
-            <primary sortas="b-captoinfo">captoinfo</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="clear">
-        <term><command>clear</command></term>
-        <listitem>
-          <para>Clears the screen, if possible</para>
-          <indexterm zone="ch-system-ncurses clear">
-            <primary sortas="b-clear">clear</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="infocmp">
-        <term><command>infocmp</command></term>
-        <listitem>
-          <para>Compares or prints out terminfo descriptions</para>
-          <indexterm zone="ch-system-ncurses infocmp">
-            <primary sortas="b-infocmp">infocmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="infotocap">
-        <term><command>infotocap</command></term>
-        <listitem>
-          <para>Converts a terminfo description into a termcap description</para>
-          <indexterm zone="ch-system-ncurses infotocap">
-            <primary sortas="b-infotocap">infotocap</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ncursesw6-config">
-        <term><command>ncursesw6-config</command></term>
-        <listitem>
-          <para>Provides configuration information for ncurses</para>
-          <indexterm zone="ch-system-ncurses ncursesw6-config">
-            <primary sortas="b-ncursesw6-config">ncursesw6-config</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="reset">
-        <term><command>reset</command></term>
-        <listitem>
-          <para>Reinitializes a terminal to its default values</para>
-          <indexterm zone="ch-system-ncurses reset">
-            <primary sortas="b-reset">reset</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tabs">
-        <term><command>tabs</command></term>
-        <listitem>
-          <para>Clears and sets tab stops on a terminal</para>
-          <indexterm zone="ch-system-ncurses tabs">
-            <primary sortas="b-tabs">tabs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tic">
-        <term><command>tic</command></term>
-        <listitem>
-          <para>The terminfo entry-description compiler that translates a
-          terminfo file from source format into the binary format needed for the
-          ncurses library routines [A terminfo file contains information on the
-          capabilities of a certain terminal.]</para>
-          <indexterm zone="ch-system-ncurses tic">
-            <primary sortas="b-tic">tic</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="toe">
-        <term><command>toe</command></term>
-        <listitem>
-          <para>Lists all available terminal types, giving the primary name and
-          description for each</para>
-          <indexterm zone="ch-system-ncurses toe">
-            <primary sortas="b-toe">toe</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tput">
-        <term><command>tput</command></term>
-        <listitem>
-          <para>Makes the values of terminal-dependent capabilities available to
-          the shell; it can also be used to reset or initialize a terminal or
-          report its long name</para>
-          <indexterm zone="ch-system-ncurses tput">
-            <primary sortas="b-tput">tput</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tset">
-        <term><command>tset</command></term>
-        <listitem>
-          <para>Can be used to initialize terminals</para>
-          <indexterm zone="ch-system-ncurses tset">
-            <primary sortas="b-tset">tset</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libcursesw">
-        <term><filename class="libraryfile">libcursesw</filename></term>
-        <listitem>
-          <para>A link to <filename>libncursesw</filename></para>
-          <indexterm zone="ch-system-ncurses libcursesw">
-            <primary sortas="c-libcursesw">libcursesw</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libncursesw">
-        <term><filename class="libraryfile">libncursesw</filename></term>
-        <listitem>
-          <para>Contains functions to display text in many complex ways on a
-          terminal screen; a good example of the use of these functions is the
-          menu displayed during the kernel's <command>make
-          menuconfig</command></para>
-          <indexterm zone="ch-system-ncurses libncursesw">
-            <primary sortas="c-libncursesw">libncursesw</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libformw">
-        <term><filename class="libraryfile">libformw</filename></term>
-        <listitem>
-          <para>Contains functions to implement forms</para>
-          <indexterm zone="ch-system-ncurses libformw">
-            <primary sortas="c-libformw">libformw</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libmenuw">
-        <term><filename class="libraryfile">libmenuw</filename></term>
-        <listitem>
-          <para>Contains functions to implement menus</para>
-          <indexterm zone="ch-system-ncurses libmenuw">
-            <primary sortas="c-libmenuw">libmenuw</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libpanelw">
-        <term><filename class="libraryfile">libpanelw</filename></term>
-        <listitem>
-          <para>Contains functions to implement panels</para>
-          <indexterm zone="ch-system-ncurses libpanelw">
-            <primary sortas="c-libpanelw">libpanelw</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-ncurses" role="."/></para>
 
   </sect2>
 

+ 16 - 42
chapter06/patch.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-patch" role="wrap">
+<sect1 id="ch-tools-patch" role="wrap">
   <?dbhtml filename="patch.html"?>
 
   <sect1info condition="script">
@@ -16,24 +16,25 @@
 
   <title>Patch-&patch-version;</title>
 
-  <indexterm zone="ch-system-patch">
+  <indexterm zone="ch-tools-patch">
     <primary sortas="a-Patch">Patch</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Patch package contains a program for modifying or creating files
-    by applying a <quote>patch</quote> file typically created by the
-    <command>diff</command> program.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/patch.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&patch-ch6-sbu;</seg>
-        <seg>&patch-ch6-du;</seg>
+        <seg>&patch-ch5-sbu;</seg>
+        <seg>&patch-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -44,52 +45,25 @@
 
     <para>Prepare Patch for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
 
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>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>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-patch" role="content">
-    <title>Contents of Patch</title>
-
-    <segmentedlist>
-      <segtitle>Installed program</segtitle>
-
-      <seglistitem>
-        <seg>patch</seg>
-      </seglistitem>
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="patch">
-        <term><command>patch</command></term>
-        <listitem>
-          <para>Modifies files according to a patch file [A patch file is
-          normally a difference listing created with the <command>diff</command>
-          program. By applying these differences to the original files,
-          <command>patch</command> creates the patched versions.]</para>
-          <indexterm zone="ch-system-patch patch">
-            <primary sortas="b-patch">patch</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-patch" role="."/></para>
 
   </sect2>
 

+ 21 - 464
chapter06/perl.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-perl" role="wrap">
+<sect1 id="ch-tools-perl" role="wrap">
   <?dbhtml filename="perl.html"?>
 
   <sect1info condition="script">
@@ -16,23 +16,25 @@
 
   <title>Perl-&perl-version;</title>
 
-  <indexterm zone="ch-system-perl">
+  <indexterm zone="ch-tools-perl">
     <primary sortas="a-Perl">Perl</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Perl package contains the Practical Extraction and Report
-    Language.</para>
+    <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-ch6-sbu;</seg>
-        <seg>&perl-ch6-du;</seg>
+        <seg>&perl-ch5-sbu;</seg>
+        <seg>&perl-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -41,481 +43,36 @@
   <sect2 role="installation">
     <title>Installation of Perl</title>
 
-    <para>First create a basic <filename>/etc/hosts</filename> file to be
-    referenced in one of Perl's configuration files as well as the optional
-    test suite:</para>
+    <para>Prepare Perl for compilation:</para>
 
-<screen><userinput remap="pre">echo "127.0.0.1 localhost $(hostname)" &gt; /etc/hosts</userinput></screen>
-
-    <para>This version of Perl now builds the Compress::Raw::Zlib and 
-    Compress::Raw::BZip2 modules. By
-    default Perl will use an internal copy of the sources for the build.
-    Issue the following command so that Perl will use the libraries
-    installed on the system:</para>
-
-<screen><userinput remap="pre">export BUILD_ZLIB=False
-export BUILD_BZIP2=0</userinput></screen>
-<!--
-    <para>Apply a patch to allow the Errno.pm module and the h2ph
-    program to build correctly when building with GCC 5:</para>
-
-<screen><userinput remap="pre">patch -Np1 -i ../&perl-gcc5-fixes-patch;</userinput></screen>
--->
-
-    <para>To have full control over the way Perl is set up, you can remove the
-    <quote>-des</quote> options from the following command and hand-pick the way
-    this package is built. Alternatively, use the command exactly as below to
-    use the defaults that Perl auto-detects:</para>
-
-<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr                 \
-                  -Dvendorprefix=/usr           \
-                  -Dman1dir=/usr/share/man/man1 \
-                  -Dman3dir=/usr/share/man/man3 \
-                  -Dpager="/usr/bin/less -isR"  \
-                  -Duseshrplib                  \
-                  -Dusethreads</userinput></screen>
+<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr</userinput></screen>
 
     <variablelist>
-      <title>The meaning of the configure options:</title>
-
-      <varlistentry>
-        <term><parameter>-Dvendorprefix=/usr</parameter></term>
-        <listitem>
-          <para>This ensures <command>perl</command> knows how to
-          tell packages where they should install their perl modules.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><parameter>-Dpager="/usr/bin/less -isR"</parameter></term>
-        <listitem>
-          <para>This ensures that <userinput>less</userinput> is used instead 
-          of <userinput>more</userinput>.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><parameter>-Dman1dir=/usr/share/man/man1
-        -Dman3dir=/usr/share/man/man3</parameter></term>
-        <listitem>
-          <para>Since Groff is not installed yet, <command>Configure</command>
-          thinks that we do not want man pages for Perl.  Issuing these
-          parameters overrides this decision.</para>
-        </listitem>
-      </varlistentry>
-
+      <title>The meaning of the new Configure options:</title>
       <varlistentry>
-        <term><parameter>-Duseshrplib</parameter></term>
+        <term><parameter>-des</parameter></term>
         <listitem>
-          <para>Build a shared libperl needed by some perl modules.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><parameter>-Dusethreads</parameter></term>
-        <listitem>
-          <para>Build perl with support for threads.</para>
+          <para>This is a combination of three options: -d uses defaults for 
+          all items; -e ensures completion of all tasks; -s silences
+          non-essential output.</para>
         </listitem>
       </varlistentry>
 
     </variablelist>
 
-    <para>Compile the package:</para>
+    <para>Build the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results (approximately 11 SBU), issue:</para>
-
-<screen><userinput remap="test">make test</userinput></screen>
-
-    <!--note><para>One test fails due to using the most recent version of gdbm.
-    </para></note-->
-
-    <para>Install the package and clean up:</para>
-
-<screen><userinput remap="install">make install
-unset BUILD_ZLIB BUILD_BZIP2</userinput></screen>
+<screen><userinput remap="install">make install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-perl" role="content">
-    <title>Contents of Perl</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh,
-        json_pp, libnetcfg, perl, perl&perl-version; (hard link to perl),
-        perlbug, perldoc, perlivp, perlthanks (hard link to perlbug), piconv,
-        pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, podselect,
-        prove, ptar, ptardiff, ptargrep, shasum,
-        splain, xsubpp, and zipdetails</seg>
-        <seg>Many which cannot all be listed here</seg>
-        <seg>/usr/lib/perl5</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-<!--
-      <varlistentry id="c2ph">
-        <term><command>c2ph</command></term>
-        <listitem>
-          <para>Dumps C structures as generated from
-          <command>cc -g -S</command></para>
-          <indexterm zone="ch-system-perl c2ph">
-            <primary sortas="b-c2ph">c2ph</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
--->
-      <varlistentry id="corelist">
-        <term><command>corelist</command></term>
-        <listitem>
-          <para>A commandline frontend to Module::CoreList</para>
-          <indexterm zone="ch-system-perl corelist">
-            <primary sortas="b-corelist">corelist</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cpan">
-        <term><command>cpan</command></term>
-        <listitem>
-          <para>Interact with the Comprehensive Perl Archive Network (CPAN)
-          from the command line</para>
-          <indexterm zone="ch-system-perl cpan">
-            <primary sortas="b-cpan">cpan</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="enc2xs">
-        <term><command>enc2xs</command></term>
-        <listitem>
-          <para>Builds a Perl extension for the Encode module from either
-          Unicode Character Mappings or Tcl Encoding Files</para>
-          <indexterm zone="ch-system-perl enc2xs">
-            <primary sortas="b-enc2xs">enc2xs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="encguess">
-        <term><command>encguess</command></term>
-        <listitem>
-          <para>Guess the encoding type of one or several files</para>
-          <indexterm zone="ch-system-perl encguess">
-            <primary sortas="b-encguess">encguess</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="h2ph">
-        <term><command>h2ph</command></term>
-        <listitem>
-          <para>Converts <filename class="extension">.h</filename> C header
-          files to <filename class="extension">.ph</filename> Perl header
-          files</para>
-          <indexterm zone="ch-system-perl h2ph">
-            <primary sortas="b-h2ph">h2ph</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="h2xs">
-        <term><command>h2xs</command></term>
-        <listitem>
-          <para>Converts <filename class="extension">.h</filename> C header
-          files to Perl extensions</para>
-          <indexterm zone="ch-system-perl h2xs">
-            <primary sortas="b-h2xs">h2xs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="instmodsh">
-        <term><command>instmodsh</command></term>
-        <listitem>
-          <para>Shell script for examining installed Perl modules,
-          and can create a tarball from an installed module</para>
-          <indexterm zone="ch-system-perl instmodsh">
-            <primary sortas="b-instmodsh">instmodsh</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="json_pp">
-        <term><command>json_pp</command></term>
-        <listitem>
-          <para>Converts data between certain input and output formats</para>
-          <indexterm zone="ch-system-perl json_pp">
-            <primary sortas="b-json_pp">json_pp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="libnetcfg">
-        <term><command>libnetcfg</command></term>
-        <listitem>
-          <para>Can be used to configure the
-          <filename class="libraryfile">libnet</filename> Perl module</para>
-          <indexterm zone="ch-system-perl libnetcfg">
-            <primary sortas="b-libnetcfg">libnetcfg</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="perl">
-        <term><command>perl</command></term>
-        <listitem>
-          <para>Combines some of the best features of C, <command>sed</command>,
-          <command>awk</command> and <command>sh</command> into a single
-          swiss-army language</para>
-          <indexterm zone="ch-system-perl perl">
-            <primary sortas="b-perl">perl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="perl-version">
-        <term><command>perl&perl-version;</command></term>
-        <listitem>
-          <para>A hard link to <command>perl</command></para>
-          <indexterm zone="ch-system-perl perl-version">
-            <primary sortas="b-perl&perl-version;">perl&perl-version;</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="perlbug">
-        <term><command>perlbug</command></term>
-        <listitem>
-          <para>Used to generate bug reports about Perl, or the modules that come
-          with it, and mail them</para>
-          <indexterm zone="ch-system-perl perlbug">
-            <primary sortas="b-perlbug">perlbug</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="perldoc">
-        <term><command>perldoc</command></term>
-        <listitem>
-          <para>Displays a piece of documentation in pod format that is embedded
-          in the Perl installation tree or in a Perl script</para>
-          <indexterm zone="ch-system-perl perldoc">
-            <primary sortas="b-perldoc">perldoc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="perlivp">
-        <term><command>perlivp</command></term>
-        <listitem>
-          <para>The Perl Installation Verification Procedure; it can be used to
-          verify that Perl and its libraries have been installed
-          correctly</para>
-          <indexterm zone="ch-system-perl perlivp">
-            <primary sortas="b-perlivp">perlivp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="perlthanks">
-        <term><command>perlthanks</command></term>
-        <listitem>
-          <para>Used to generate thank you messages to mail to the Perl
-          developers</para>
-          <indexterm zone="ch-system-perl perlthanks">
-            <primary sortas="b-perlthanks">perlthanks</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="piconv">
-        <term><command>piconv</command></term>
-        <listitem>
-          <para>A Perl version of the character encoding converter
-          <command>iconv</command></para>
-          <indexterm zone="ch-system-perl piconv">
-            <primary sortas="b-piconv">piconv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pl2pm">
-        <term><command>pl2pm</command></term>
-        <listitem>
-          <para>A rough tool for converting Perl4
-          <filename class="extension">.pl</filename> files to Perl5
-          <filename class="extension">.pm</filename> modules</para>
-          <indexterm zone="ch-system-perl pl2pm">
-            <primary sortas="b-pl2pm">pl2pm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pod2html">
-        <term><command>pod2html</command></term>
-        <listitem>
-          <para>Converts files from pod format to HTML format</para>
-          <indexterm zone="ch-system-perl pod2html">
-            <primary sortas="b-pod2html">pod2html</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pod2man">
-        <term><command>pod2man</command></term>
-        <listitem>
-          <para>Converts pod data to formatted *roff input</para>
-          <indexterm zone="ch-system-perl pod2man">
-            <primary sortas="b-pod2man">pod2man</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pod2text">
-        <term><command>pod2text</command></term>
-        <listitem>
-          <para>Converts pod data to formatted ASCII text</para>
-          <indexterm zone="ch-system-perl pod2text">
-            <primary sortas="b-pod2text">pod2text</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pod2usage">
-        <term><command>pod2usage</command></term>
-        <listitem>
-          <para>Prints usage messages from embedded pod docs in files</para>
-          <indexterm zone="ch-system-perl pod2usage">
-            <primary sortas="b-pod2usage">pod2usage</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="podchecker">
-        <term><command>podchecker</command></term>
-        <listitem>
-          <para>Checks the syntax of pod format documentation files</para>
-          <indexterm zone="ch-system-perl podchecker">
-            <primary sortas="b-podchecker">podchecker</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="podselect">
-        <term><command>podselect</command></term>
-        <listitem>
-          <para>Displays selected sections of pod documentation</para>
-          <indexterm zone="ch-system-perl podselect">
-            <primary sortas="b-podselect">podselect</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="prove">
-        <term><command>prove</command></term>
-        <listitem>
-          <para>Command line tool for running tests against the Test::Harness
-          module</para>
-          <indexterm zone="ch-system-perl prove">
-            <primary sortas="b-prove">prove</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-<!--
-      <varlistentry id="pstruct">
-        <term><command>pstruct</command></term>
-        <listitem>
-          <para>Dumps C structures as generated from <command>cc -g -S</command>
-          stabs</para>
-          <indexterm zone="ch-system-perl pstruct">
-            <primary sortas="b-pstruct">pstruct</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
--->
-      <varlistentry id="ptar">
-        <term><command>ptar</command></term>
-        <listitem>
-          <para>A <command>tar</command>-like program written in Perl</para>
-          <indexterm zone="ch-system-perl ptar">
-            <primary sortas="b-ptar">ptar</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ptardiff">
-        <term><command>ptardiff</command></term>
-        <listitem>
-          <para>A Perl program that compares an extracted archive with an
-          unextracted one</para>
-          <indexterm zone="ch-system-perl ptardiff">
-            <primary sortas="b-ptardiff">ptardiff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ptargrep">
-        <term><command>ptargrep</command></term>
-        <listitem>
-          <para>A Perl program that applies pattern matching to the contents
-          of files in a tar archive</para>
-          <indexterm zone="ch-system-perl ptargrep">
-            <primary sortas="b-ptargrep">ptargrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="shasum">
-        <term><command>shasum</command></term>
-        <listitem>
-          <para>Prints or checks SHA checksums</para>
-          <indexterm zone="ch-system-perl shasum">
-            <primary sortas="b-shasum">shasum</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="splain">
-        <term><command>splain</command></term>
-        <listitem>
-          <para>Is used to force verbose warning diagnostics in Perl</para>
-          <indexterm zone="ch-system-perl splain">
-            <primary sortas="b-splain">splain</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xsubpp">
-        <term><command>xsubpp</command></term>
-        <listitem>
-          <para>Converts Perl XS code into C code</para>
-          <indexterm zone="ch-system-perl xsubpp">
-            <primary sortas="b-xsubpp">xsubpp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zipdetails">
-        <term><command>zipdetails</command></term>
-        <listitem>
-          <para>Displays details about the internal structure of a Zip file</para>
-          <indexterm zone="ch-system-perl zipdetails">
-            <primary sortas="b-zipdetails">zipdetails</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-perl" role="."/></para>
 
   </sect2>
 

+ 34 - 199
chapter06/python.xml

@@ -5,8 +5,8 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-Python" role="wrap">
-  <?dbhtml filename="Python.html"?>
+<sect1 id="ch-system-Python-temp" role="wrap">
+  <?dbhtml filename="Python-temp.html"?>
 
   <sect1info condition="script">
     <productname>Python</productname>
@@ -16,66 +16,54 @@
 
   <title>Python-&python-version;</title>
 
-  <indexterm zone="ch-system-Python">
-    <primary sortas="a-python">python</primary>
+  <indexterm zone="ch-system-Python-temp">
+    <primary sortas="a-Python">Python</primary>
+    <secondary>temporary</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Python 3 package contains the Python development environment. It
-    is useful for object-oriented programming, writing scripts, prototyping
-    large programs or developing entire applications.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/python.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
-      <segtitle>&buildtime;</segtitle>
+    <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&python-ch6-sbu;</seg>
-        <seg>&python-ch6-du;</seg>
+        <seg>&python-ch5-sbu;</seg>
+        <seg>&python-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
   </sect2>
 
   <sect2 role="installation">
-    <title>Installation of Python 3</title>
+    <title>Installation of Python</title>
+
+    <note>
+      <para>There are two package files whose name starts with
+      <quote>python</quote>. The one to extract from is
+      <filename>Python-&python-version;.tar.xz</filename> (notice the
+      uppercase first letter).</para>
+    </note>
 
     <para>Prepare Python for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr       \
-            --enable-shared     \
-            --with-system-expat \
-            --with-system-ffi   \
-            --with-ensurepip=yes</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen>
 
     <variablelist>
-      <title>The meaning of the configure options:</title>
-
-    <varlistentry>
-      <term><parameter>--with-system-expat</parameter></term>
-      <listitem>
-        <para>This switch enables linking against system version of
-        <application>Expat</application>.</para>
-       </listitem>
-     </varlistentry>
-
-    <varlistentry>
-      <term><parameter>--with-system-ffi</parameter></term>
-      <listitem>
-        <para>This switch enables linking against system version of
-        <application>libffi</application>.</para>
-      </listitem>
-    </varlistentry>
-
-    <varlistentry>
-      <term><parameter>--with-ensurepip=yes</parameter></term>
-      <listitem>
-        <para>This switch enables building <command>pip</command> and
-        <command>setuptools</command> packaging programs.</para>
-      </listitem>
-    </varlistentry>
+      <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>
 
@@ -83,171 +71,18 @@
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results, issue <command>make test</command>.
-    Some tests requiring network connection or additional packages are
-    skipped.  The test named test_normalization fails because network
-    configuration is not completed yet.  For more comprehensive results,
-    the test can be rerun when Python 3 is reinstalled in BLFS.</para>
-
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make install
-chmod -v 755 /usr/lib/libpython&python-minor;.so
-chmod -v 755 /usr/lib/libpython3.so
-ln -sfv pip&python-minor; /usr/bin/pip3</userinput></screen>
-
-    <variablelist>
-      <title>The meaning of the install commands:</title>
-<!-- ======  Change 8m if Python minor version changes ======= -->
-    <varlistentry>
-      <term><command>chmod -v 755 /usr/lib/libpython3.{8.,}so</command></term>
-      <listitem>
-        <para>Fix permissions for libraries to be consistent with other
-        libraries.</para>
-      </listitem>
-    </varlistentry>
-
-    </variablelist>
-
-    <para>If desired, install the preformatted documentation:</para>
-
-<screen><userinput remap="install">install -v -dm755 /usr/share/doc/python-&python-version;/html 
-
-tar --strip-components=1  \
-    --no-same-owner       \
-    --no-same-permissions \
-    -C /usr/share/doc/python-&python-version;/html \
-    -xvf ../python-&python-version;-docs-html.tar.bz2</userinput></screen>
-
-    <variablelist>
-      <title>The meaning of the documentation install commands:</title>
-
-    <varlistentry>
-      <term><option>--no-same-owner</option> and <option>--no-same-permissions</option></term>
-      <listitem>
-        <para>Ensure the installed files have the correct ownership and 
-        permissions.  Without these options, using <application>tar</application>
-        will install the package files with the upstream creator's values. 
-        </para>
-      </listitem>
-    </varlistentry>
-
-    </variablelist>
+<screen><userinput remap="install">make install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-python" role="content">
-    <title>Contents of Python 3</title>
-
-    <segmentedlist>
-      <segtitle>Installed Programs</segtitle>
-      <segtitle>Installed Library</segtitle>
-      <segtitle>Installed Directories</segtitle>
-
-      <seglistitem>
-        <seg>
-          2to3, idle3, pip3, pydoc3, python3, and python3-config
-        </seg>
-        <seg>
-          libpython&python-minor;.so and libpython3.so
-        </seg>
-        <seg>
-          /usr/include/python&python-minor;, 
-          /usr/lib/python3, and
-          /usr/share/doc/python-&python-version;
-        </seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="python-2to3">
-        <term><command>2to3</command></term>
-        <listitem>
-          <para>
-            is a <application>Python</application> program that reads
-            <application>Python 2.x</application> source code and applies a
-            series of fixes to transform it into valid
-            <application>Python 3.x</application> code.
-          </para>
-          <indexterm zone="ch-system-Python">
-            <primary sortas="b-2to3">2to3</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="idle3">
-        <term><command>idle3</command></term>
-        <listitem>
-          <para>
-            is a wrapper script that opens a <application>Python</application>
-            aware GUI editor. For this script to run, you must have installed
-            <application>Tk</application> before Python so that the Tkinter
-            Python module is built.
-          </para>
-          <indexterm zone="ch-system-Python">
-            <primary sortas="b-idle3">idle3</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pip3">
-        <term><command>pip3</command></term>
-        <listitem>
-          <para>
-            The package installer for Python. You can use pip to install
-            packages from Python Package Index and other indexes.
-          </para>
-          <indexterm zone="ch-system-Python">
-            <primary sortas="b-pip3">pip3</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pydoc3">
-        <term><command>pydoc3</command></term>
-        <listitem>
-          <para>
-            is the <application>Python</application> documentation tool.
-          </para>
-          <indexterm zone="ch-system-Python">
-            <primary sortas="b-pydoc3">pydoc3</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-      <varlistentry id="python3">
-        <term><command>python3</command></term>
-        <listitem>
-          <para>
-            is an interpreted, interactive, object-oriented programming
-            language.
-          </para>
-          <indexterm zone="ch-system-Python">
-            <primary sortas="b-python3">python3</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-<!--
-      <varlistentry id="pyvenv">
-        <term><command>pyvenv</command></term>
-        <listitem>
-          <para>
-            creates virtual <application>Python</application> environments in
-            one or more target directories.
-          </para>
-          <indexterm zone="ch-system-Python">
-            <primary sortas="b-pyvenv">pyvenv</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
--->
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-python" role="."/></para>
 
   </sect2>
 
 </sect1>
-

+ 20 - 47
chapter06/sed.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-sed" role="wrap">
+<sect1 id="ch-tools-sed" role="wrap">
   <?dbhtml filename="sed.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>Sed-&sed-version;</title>
 
-  <indexterm zone="ch-system-sed">
+  <indexterm zone="ch-tools-sed">
     <primary sortas="a-Sed">Sed</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Sed package contains a stream editor.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/sed.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
-      <segtitle>&buildtime;</segtitle>
+    <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&sed-ch6-sbu;</seg>
-        <seg>&sed-ch6-du;</seg>
+        <seg>&sed-ch5-sbu;</seg>
+        <seg>&sed-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -42,55 +45,25 @@
 
     <para>Prepare Sed for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --bindir=/bin</userinput></screen>
 
-    <para>Compile the package and generate the HTML documentation:</para>
+    <para>Compile the package:</para>
 
-<screen><userinput remap="make">make
-make html</userinput></screen>
+<screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results, issue:</para>
+    <para>Install the package:</para>
 
-<screen><userinput remap="test">chown -Rv tester .
-su tester -c "PATH=$PATH make check"</userinput></screen>
-
-    <para>Install the package and its documentation:</para>
-
-<screen><userinput remap="install">make install
-install -d -m755           /usr/share/doc/sed-&sed-version;
-install -m644 doc/sed.html /usr/share/doc/sed-&sed-version;</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-sed" role="content">
-    <title>Contents of Sed</title>
-
-    <segmentedlist>
-      <segtitle>Installed program</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>sed</seg>
-        <seg>/usr/share/doc/sed-&sed-version;</seg>
-      </seglistitem>
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="sed">
-        <term><command>sed</command></term>
-        <listitem>
-          <para>Filters and transforms text files in a single pass</para>
-          <indexterm zone="ch-system-sed sed">
-            <primary sortas="b-sed">sed</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-sed" role="."/></para>
 
   </sect2>
 

+ 53 - 0
chapter06/stripping.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-stripping">
+  <?dbhtml filename="stripping.html"?>
+
+  <title>Stripping</title>
+
+  <para>The steps in this section are optional, but if the LFS partition is
+  rather small, it is beneficial to learn that unnecessary items can be removed.
+  The executables and libraries built so far contain about 70 MB of unneeded
+  debugging symbols. Remove those symbols with:</para>
+
+<screen><userinput>$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
+$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*</userinput></screen>
+
+  <para>These commands will skip a number of files, reporting that it does not
+  recognize their file format. Most of these are scripts instead of binaries.
+  Note that we use the <command>strip</command> program built in
+  <quote>Binutils pass 1</quote>, since it is the one that knows how to strip
+  our cross-compiled programs.</para>
+<!-- Normally, the host "strip" could be used too, since it is actually the
+same computer. But Some old versions of binutils may generate buggy crt1.o
+and the like, because they do not know about recently introduced symbol
+types. For more details,
+see https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
+
+  <para>Take care <emphasis>not</emphasis> to use
+  <parameter>--strip-unneeded</parameter> on the libraries. The static
+  ones would be destroyed and the toolchain packages would need to be
+  built all over again.</para>
+
+  <para>To save more, remove the documentation:</para>
+
+<screen><userinput>rm -rf $LFS/usr/{,share}/{info,man,doc}</userinput></screen>
+
+  <para>The libtool .la files are only useful when linking with static
+  libraries. They are unneeded, and potentially harmful, when using dynamic
+  shared libraries, specially when using also non-autotools build systems.
+  Remove those files now:</para>
+
+<screen><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
+
+  <para>At this point, you should have at least 3 GB of free space in
+  <envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
+  the next phase. If you can build and install Glibc, you can build and install
+  the rest too.</para>
+
+</sect1>

+ 16 - 61
chapter06/tar.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-tar" role="wrap">
+<sect1 id="ch-tools-tar" role="wrap">
   <?dbhtml filename="tar.html"?>
 
   <sect1info condition="script">
@@ -16,22 +16,25 @@
 
   <title>Tar-&tar-version;</title>
 
-  <indexterm zone="ch-system-tar">
+  <indexterm zone="ch-tools-tar">
     <primary sortas="a-Tar">Tar</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Tar package contains an archiving program.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/tar.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&tar-ch6-sbu;</seg>
-        <seg>&tar-ch6-du;</seg>
+        <seg>&tar-ch5-sbu;</seg>
+        <seg>&tar-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -42,74 +45,26 @@
 
     <para>Prepare Tar for compilation:</para>
 
-<screen><userinput remap="configure">FORCE_UNSAFE_CONFIGURE=1  \
-./configure --prefix=/usr \
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --host=$LFS_TGT                   \
+            --build=$(build-aux/config.guess) \
             --bindir=/bin</userinput></screen>
 
-    <variablelist>
-      <title>The meaning of the configure options:</title>
-
-      <varlistentry>
-        <term><envar>FORCE_UNSAFE_CONFIGURE=1</envar></term>
-        <listitem>
-          <para>This forces the test for <function>mknod</function> to be run
-          as root.  It is generally considered dangerous to run this test as
-          the root user, but as it is being run on a system that has only been
-          partially built, overriding it is OK.</para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-
     <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results (about 3 SBU), issue:</para>
-
-<screen><userinput remap="test">make check</userinput></screen>
-
-<!-- Seems to pass for version 1.31. Keeping as a comment just in case...
-    <para>One test, link mismatch, is known to fail.</para>
--->
-
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make install
-make -C doc install-html docdir=/usr/share/doc/tar-&tar-version;</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
   </sect2>
 
+  <sect2 role="content">
+    <title/>
 
-  <sect2 id="contents-tar" role="content">
-    <title>Contents of Tar</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed directory</segtitle>
-
-      <seglistitem>
-        <seg>tar</seg>
-        <seg>/usr/share/doc/tar-&tar-version;</seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="tar">
-        <term><command>tar</command></term>
-        <listitem>
-          <para>Creates, extracts files from, and lists the contents of archives,
-          also known as tarballs</para>
-          <indexterm zone="ch-system-tar tar">
-            <primary sortas="b-tar">tar</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-tar" role="."/></para>
 
   </sect2>
 

+ 191 - 0
chapter06/tcl.xml

@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+  <!ENTITY tdbc-ver          "1.1.1">
+  <!ENTITY itcl-ver          "4.2.0">
+]>
+
+<sect1 id="ch-tools-tcl" role="wrap">
+  <?dbhtml filename="tcl.html"?>
+
+  <sect1info condition="script">
+    <productname>tcl</productname>
+    <productnumber>&tcl-version;</productnumber>
+    <address>&tcl-url;</address>
+  </sect1info>
+
+  <title>Tcl-&tcl-version;</title>
+
+  <indexterm zone="ch-tools-tcl">
+    <primary sortas="a-Tcl">Tcl</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The <application>Tcl</application> package contains the Tool Command Language,
+    a robust general-purpose scripting language. The <application>Expect</application> package
+    is written in the <application>Tcl</application> language.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&tcl-ch5-sbu;</seg>
+        <seg>&tcl-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Tcl</title>
+
+    <para>This package and the next two (Expect and DejaGNU) are
+    installed to support running the test suites for GCC and Binutils and other
+    packages.  Installing three packages for testing purposes may seem
+    excessive, but it is very reassuring, if not essential, to know that the
+    most important tools are working properly. These packages are required
+    to run the test suites in <xref linkend="chapter-building-system"/>.</para>
+
+    <para>Note that the Tcl package used here is a minimal version needed
+    to run the LFS tests.  For the full package, see the  
+    <ulink url='&blfs-book;general/tcl.html'>BLFS Tcl procedures</ulink>.</para>
+
+    <para>Prepare Tcl for compilation:</para>
+
+<screen><userinput remap="configure">SRCDIR=$(pwd)
+cd unix
+./configure --prefix=/usr           \
+            --mandir=/usr/share/man \
+            $([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</parameter></term>
+        <listitem>
+          <para>The construct <parameter>$(&lt;shell command&gt;)</parameter>
+          is replaced by the output of the chell command.  Here this output is
+          empty if running on a 32 bit machine, and is
+          <parameter>--enable-64bit</parameter> if running on a 64 bit machine.
+          </para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Build the package:</para>
+
+<screen><userinput remap="make">make
+
+sed -e "s|$SRCDIR/unix|/usr/lib|" \
+    -e "s|$SRCDIR|/usr/include|"  \
+    -i tclConfig.sh
+
+sed -e "s|$SRCDIR/unix/pkgs/tdbc&tdbc-ver;|/usr/lib/tdbc&tdbc-ver;|" \
+    -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/generic|/usr/include|"    \
+    -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/library|/usr/lib/tcl8.6|" \
+    -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;|/usr/include|"            \
+    -i pkgs/tdbc&tdbc-ver;/tdbcConfig.sh
+
+sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \
+    -e "s|$SRCDIR/pkgs/itcl&itcl-ver;/generic|/usr/include|"    \
+    -e "s|$SRCDIR/pkgs/itcl&itcl-ver;|/usr/include|"            \
+    -i pkgs/itcl&itcl-ver;/itclConfig.sh
+
+unset SRCDIR</userinput></screen>
+
+    <para>The various <quote>sed</quote> after the <quote>make</quote> command
+    remove references to the build directory from various configuration files,
+    and replaces them with the install directory. This is not mandatory
+    for the remaining of LFS, but may be needed in case a package built later
+    uses Tcl.</para>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+    <para>Make the installed library writable so debugging symbols can
+    be removed later:</para>
+
+<screen><userinput remap="install">chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so</userinput></screen>
+
+    <para>Install Tcl's headers. The next package, Expect, requires them
+    to build.</para>
+
+<screen><userinput remap="install">make install-private-headers</userinput></screen>
+
+    <para>Now make a necessary symbolic link:</para>
+
+<screen><userinput remap="install">ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-tcl" role="content">
+    <title>Contents of Tcl</title>
+
+    <segmentedlist>
+      <segtitle>Installed programs</segtitle>
+      <segtitle>Installed library</segtitle>
+
+      <seglistitem>
+        <seg>tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;</seg>
+        <seg>libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="tclsh&tcl-major-version;">
+        <term><command>tclsh&tcl-major-version;</command></term>
+        <listitem>
+          <para>The Tcl command shell</para>
+          <indexterm zone="ch-tools-tcl tclsh&tcl-major-version;">
+            <primary sortas="b-tclsh&tcl-major-version;">tclsh&tcl-major-version;</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="tclsh">
+        <term><command>tclsh</command></term>
+        <listitem>
+          <para>A link to tclsh&tcl-major-version;</para>
+          <indexterm zone="ch-tools-tcl tclsh">
+            <primary sortas="b-tclsh">tclsh</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="libtcl&tcl-major-version;.so">
+        <term><filename class="libraryfile">libtcl&tcl-major-version;.so</filename></term>
+        <listitem>
+          <para>The Tcl library</para>
+          <indexterm zone="ch-tools-tcl libtcl&tcl-major-version;.so">
+            <primary sortas="c-libtcl&tcl-major-version;.so">libtcl&tcl-major-version;.so</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="libtclstub&tcl-major-version;.a">
+        <term><filename class="libraryfile">libtclstub&tcl-major-version;.a</filename></term>
+        <listitem>
+          <para>The Tcl Stub library</para>
+          <indexterm zone="ch-tools-tcl libtclstub&tcl-major-version;.a">
+            <primary sortas="c-libtclstub&tcl-major-version;.a">libtclstub&tcl-major-version;.a</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 19 - 182
chapter06/texinfo.xml

@@ -5,8 +5,8 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-texinfo" role="wrap">
-  <?dbhtml filename="texinfo.html"?>
+<sect1 id="ch-system-texinfo-temp" role="wrap">
+  <?dbhtml filename="texinfo-temp.html"?>
 
   <sect1info condition="script">
     <productname>texinfo</productname>
@@ -16,23 +16,25 @@
 
   <title>Texinfo-&texinfo-version;</title>
 
-  <indexterm zone="ch-system-texinfo">
+  <indexterm zone="ch-system-texinfo-temp">
     <primary sortas="a-Texinfo">Texinfo</primary>
+    <secondary>temporary</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Texinfo package contains programs for reading, writing, and
-    converting info pages.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/texinfo.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&texinfo-ch6-sbu;</seg>
-        <seg>&texinfo-ch6-du;</seg>
+        <seg>&texinfo-ch5-sbu;</seg>
+        <seg>&texinfo-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -43,194 +45,29 @@
 
     <para>Prepare Texinfo for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr --disable-static</userinput></screen>
+<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
 
-    <variablelist>
-      <title>The meaning of the configure options:</title>
-
-      <varlistentry>
-        <term><parameter>--disable-static</parameter></term>
-        <listitem>
-          <para>In this case, the top-level configure script will complain that
-          this is an unrecognized option, but the configure script for
-          XSParagraph recognizes it and uses it to disable installing a static
-          <filename class="libraryfile">XSParagraph.a</filename> to <filename
-          class="directory">/usr/lib/texinfo</filename>.</para>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <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>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>
 
-    <para>Optionally, install the components belonging in a TeX
-    installation:</para>
-    <!-- FIXME: doesn't the TeX installation in BLFS overwrite files there? -->
-
-<screen><userinput remap="install">make TEXMF=/usr/share/texmf install-tex</userinput></screen>
-
-    <variablelist>
-      <title>The meaning of the make parameter:</title>
-
-      <varlistentry>
-        <term><parameter>TEXMF=/usr/share/texmf</parameter></term>
-        <listitem>
-          <para>The <envar>TEXMF</envar> makefile variable holds the location
-          of the root of the TeX tree if, for example, a TeX package will be
-          installed later.</para>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
-
-    <para>The Info documentation system uses a plain text file to hold its list of
-    menu entries. The file is located at <filename>/usr/share/info/dir</filename>.
-    Unfortunately, due to occasional problems in the Makefiles of various packages,
-    it can sometimes get out of sync with the info pages installed on the system.
-    If the <filename>/usr/share/info/dir</filename> file ever needs to be
-    recreated, the following optional commands will accomplish the task:</para>
-
-<screen role="nodump"><userinput>pushd /usr/share/info
-rm -v dir
-for f in *
-  do install-info $f dir 2&gt;/dev/null
-done
-popd</userinput></screen>
-
   </sect2>
 
-  <sect2 id="contents-texinfo" role="content">
-    <title>Contents of Texinfo</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed library</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>info, install-info, makeinfo (link to texi2any),
-        pdftexi2dvi, pod2texi, texi2any, texi2dvi, texi2pdf, and texindex</seg>
-        <seg>MiscXS.so, Parsetexi.so, and XSParagraph.so
-        (all in /usr/lib/texinfo)</seg>
-        <seg>/usr/share/texinfo and /usr/lib/texinfo</seg>
-      </seglistitem>
-    </segmentedlist>
+  <sect2 role="content">
+    <title/>
 
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="info">
-        <term><command>info</command></term>
-        <listitem>
-          <para>Used to read info pages which are similar to man pages, but
-          often go much deeper than just explaining all the available command
-          line options [For example, compare <command>man bison</command> and
-          <command>info bison</command>.]</para>
-          <indexterm zone="ch-system-texinfo info">
-            <primary sortas="b-info">info</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="install-info">
-        <term><command>install-info</command></term>
-        <listitem>
-          <para>Used to install info pages; it updates entries in the
-          <command>info</command> index file</para>
-          <indexterm zone="ch-system-texinfo install-info">
-            <primary sortas="b-install-info">install-info</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="makeinfo">
-        <term><command>makeinfo</command></term>
-        <listitem>
-          <para>Translates the given Texinfo source documents into
-          info pages, plain text, or HTML</para>
-          <indexterm zone="ch-system-texinfo makeinfo">
-            <primary sortas="b-makeinfo">makeinfo</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pdftexi2dvi">
-        <term><command>pdftexi2dvi</command></term>
-        <listitem>
-          <para>Used to format the given Texinfo document into a
-          Portable Document Format (PDF) file</para>
-          <indexterm zone="ch-system-texinfo pdftexi2dvi">
-            <primary sortas="b-pdftexi2dvi">pdftexi2dvi</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pod2texi">
-        <term><command>pod2texi</command></term>
-        <listitem>
-          <para>Converts Pod to Texinfo format</para>
-          <indexterm zone="ch-system-texinfo pod2texi">
-            <primary sortas="b-pod2texi">pod2texi</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="texi2any">
-        <term><command>texi2any</command></term>
-        <listitem>
-          <para>Translate Texinfo source documentation to 
-          various other formats</para>
-          <indexterm zone="ch-system-texinfo texi2any">
-            <primary sortas="b-texiany">texi2any</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="texi2dvi">
-        <term><command>texi2dvi</command></term>
-        <listitem>
-          <para>Used to format the given Texinfo document into a
-          device-independent file that can be printed</para>
-          <indexterm zone="ch-system-texinfo texi2dvi">
-            <primary sortas="b-texi2dvi">texi2dvi</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="texi2pdf">
-        <term><command>texi2pdf</command></term>
-        <listitem>
-          <para>Used to format the given Texinfo document into a
-          Portable Document Format (PDF) file</para>
-          <indexterm zone="ch-system-texinfo texi2pdf">
-            <primary sortas="b-texi2pdf">texi2pdf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="texindex">
-        <term><command>texindex</command></term>
-        <listitem>
-          <para>Used to sort Texinfo index files</para>
-          <indexterm zone="ch-system-texinfo texindex">
-            <primary sortas="b-texindex">texindex</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-texinfo" role="."/></para>
 
   </sect2>
 

+ 335 - 0
chapter06/toolchaintechnotes.xml

@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-toolchaintechnotes">
+  <?dbhtml filename="toolchaintechnotes.html"?>
+
+  <title>Toolchain Technical Notes</title>
+
+  <para>This section explains some of the rationale and technical details
+  behind the overall build method. It is not essential to immediately
+  understand everything in this section. Most of this information will be
+  clearer after performing an actual build. This section can be referred
+  to at any time during the process.</para>
+
+  <para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
+  produce a temporary area that contains a known-good set of tools that can be
+  isolated from the host system. By using <command>chroot</command>, the
+  commands in the remaining chapters will be contained within that environment,
+  ensuring a clean, trouble-free build of the target LFS system. The build
+  process has been designed to minimize the risks for new readers and to provide
+  the most educational value at the same time.</para>
+
+  <para>The build process is based on the process of
+  <emphasis>cross-compilation</emphasis>. Cross-compilation is normally used
+  for building a compiler and its toolchain for a machine different from
+  the one that is used for the build. This is not strictly needed for LFS,
+  since the machine where the new system will run is the same as the one
+  used for the build. But cross-compilation has the great advantage that
+  anything that is cross-compiled cannot depend on the host environment.</para>
+
+  <sect2 id="cross-compile" xreflabel="About Cross-Compilation">
+
+    <title>About Cross-Compilation</title>
+
+    <para>Cross-compilation involves some concepts that deserve a section on
+    their own. Although this section may be omitted in a first reading, it
+    is strongly suggested to come back to it later in order to get a full
+    grasp of the build process.</para>
+
+    <para>Let us first define some terms used in this context:</para>
+
+    <variablelist>
+      <varlistentry><term>build</term><listitem>
+        <para>is the machine where we build programs. Note that this machine
+        is referred to as the <quote>host</quote> in other
+        sections.</para></listitem>
+      </varlistentry>
+
+      <varlistentry><term>host</term><listitem>
+        <para>is the machine/system where the built programs will run. Note
+        that this use of <quote>host</quote> is not the same as in other
+        sections.</para></listitem>
+      </varlistentry>
+
+      <varlistentry><term>target</term><listitem>
+        <para>is only used for compilers. It is the machine the compiler
+        produces code for. It may be different from both build and
+        host.</para></listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>As an example, let us imagine the following scenario: we may have a
+    compiler on a slow machine only, let's call the machine A, and the compiler
+    ccA. We may have also a fast machine (B), but with no compiler, and we may
+    want to produce code for a another slow machine (C). Then, to build a
+    compiler for machine C, we would have three stages:</para>
+
+    <informaltable align="center">
+      <tgroup cols="5">
+        <colspec colnum="1" align="center"/>
+        <colspec colnum="2" align="center"/>
+        <colspec colnum="3" align="center"/>
+        <colspec colnum="4" align="center"/>
+        <colspec colnum="5" align="left"/>
+        <thead>
+          <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+               <entry>Target</entry><entry>Action</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>1</entry><entry>A</entry><entry>A</entry><entry>B</entry>
+            <entry>build cross-compiler cc1 using ccA on machine A</entry>
+          </row>
+          <row>
+            <entry>2</entry><entry>A</entry><entry>B</entry><entry>B</entry>
+            <entry>build cross-compiler cc2 using cc1 on machine A</entry>
+          </row>
+          <row>
+            <entry>3</entry><entry>B</entry><entry>C</entry><entry>C</entry>
+            <entry>build compiler ccC using cc2 on machine B</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+    <para>Then, all the other programs needed by machine C can be compiled
+    using cc2 on the fast machine B. Note that unless B can run programs
+    produced for C, there is no way to test the built programs until machine
+    C itself is running. For example, for testing ccC, we may want to add a
+    fourth stage:</para>
+
+    <informaltable align="center">
+      <tgroup cols="5">
+        <colspec colnum="1" align="center"/>
+        <colspec colnum="2" align="center"/>
+        <colspec colnum="3" align="center"/>
+        <colspec colnum="4" align="center"/>
+        <colspec colnum="5" align="left"/>
+        <thead>
+          <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+               <entry>Target</entry><entry>Action</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>4</entry><entry>C</entry><entry>C</entry><entry>C</entry>
+            <entry>rebuild  and test ccC using itself on machine C</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+    <para>In the example above, only cc1 and cc2 are cross-compilers, that is,
+    they produce code for a machine different from the one they are run on.
+    The other compilers ccA and ccC produce code for the machine they are run
+    on. Such compilers are called <emphasis>native</emphasis> compilers.</para>
+
+  </sect2>
+
+  <sect2 id="lfs-cross">
+    <title>Implementation of Cross-Compilation for LFS</title>
+
+    <note>
+      <para>Almost all the build systems use names of the form
+      cpu-vendor-kernel-os referred to as the machine triplet. An astute
+      reader may wonder why a <quote>triplet</quote> refers to a four component
+      name. The reason is history: initially, three component names were enough
+      to designate unambiguously a machine, but with new machines and systems
+      appearing, that proved insufficient. The word <quote>triplet</quote>
+      remained. A simple way to determine your machine triplet is to run
+      the <command>config.guess</command>
+      script that comes with the source for many packages. Unpack the Binutils
+      sources and run the script: <userinput>./config.guess</userinput> and note
+      the output. For example, for a 32-bit Intel processor the
+      output will be <emphasis>i686-pc-linux-gnu</emphasis>. On a 64-bit
+      system it will be <emphasis>x86_64-pc-linux-gnu</emphasis>.</para>
+
+      <para>Also be aware of the name of the platform's dynamic linker, often
+      referred to as the dynamic loader (not to be confused with the standard
+      linker <command>ld</command> that is part of Binutils). The dynamic linker
+      provided by Glibc finds and loads the shared libraries needed by a
+      program, prepares the program to run, and then runs it. The name of the
+      dynamic linker for a 32-bit Intel machine will be <filename
+      class="libraryfile">ld-linux.so.2</filename> (<filename
+      class="libraryfile">ld-linux-x86-64.so.2</filename> for 64-bit systems). A
+      sure-fire way to determine the name of the dynamic linker is to inspect a
+      random binary from the host system by running: <userinput>readelf -l
+      &lt;name of binary&gt; | grep interpreter</userinput> and noting the
+      output. The authoritative reference covering all platforms is in the
+      <filename>shlib-versions</filename> file in the root of the Glibc source
+      tree.</para>
+    </note>
+
+    <para>In order to fake a cross compilation, the name of the host triplet
+    is slightly adjusted by changing the &quot;vendor&quot; field in the
+    <envar>LFS_TGT</envar> variable. We also use the
+    <parameter>--with-sysroot</parameter> when building the cross linker and
+    cross compiler, to tell them where to find the needed host files. This
+    ensures none of the other programs built in <xref
+    linkend="chapter-temporary-tools"/> can link to libraries on the build
+    machine. Only two stages are mandatory, and one more for tests:</para>
+
+    <informaltable align="center">
+      <tgroup cols="5">
+        <colspec colnum="1" align="center"/>
+        <colspec colnum="2" align="center"/>
+        <colspec colnum="3" align="center"/>
+        <colspec colnum="4" align="center"/>
+        <colspec colnum="5" align="left"/>
+        <thead>
+          <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+               <entry>Target</entry><entry>Action</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>1</entry><entry>pc</entry><entry>pc</entry><entry>lfs</entry>
+            <entry>build cross-compiler cc1 using cc-pc on pc</entry>
+          </row>
+          <row>
+            <entry>2</entry><entry>pc</entry><entry>lfs</entry><entry>lfs</entry>
+            <entry>build compiler cc-lfs using cc1 on pc</entry>
+          </row>
+          <row>
+            <entry>3</entry><entry>lfs</entry><entry>lfs</entry><entry>lfs</entry>
+            <entry>rebuild and test cc-lfs using itself on lfs</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+    <para>In the above table, <quote>on pc</quote> means the commands are run
+    on a machine using the already installed distribution. <quote>On
+    lfs</quote> means the commands are run in a chrooted environment.</para>
+
+    <para>Now, there is more about cross-compiling: the C language is not
+    just a compiler, but also defines a standard library. In this book, the
+    GNU C library, named glibc, is used. This library must
+    be compiled for the lfs machine, that is, using the cross compiler cc1. 
+    But the compiler itself uses an internal library implementing complex
+    instructions not available in the assembler instruction set. This
+    internal library is named libgcc, and must be linked to the glibc
+    library to be fully functional! Furthermore, the standard library for
+    C++ (libstdc++) also needs being linked to glibc. The solution
+    to this chicken and egg problem is to first build a degraded cc1+libgcc,
+    lacking some fuctionalities such as threads and exception handling, then
+    build glibc using this degraded compiler (glibc itself is not
+    degraded), then build libstdc++. But this last library will lack the
+    same functionalities as libgcc.</para>
+
+    <para>This is not the end of the story: the conclusion of the preceding
+    paragraph is that cc1 is unable to build a fully functional libstdc++, but
+    this is the only compiler available for building the C/C++ libraries
+    during stage 2! Of course, the compiler built during stage 2, cc-lfs,
+    would be able to build those libraries, but (i) the build system of
+    gcc does not know that it is usable on pc, and (ii) using it on pc
+    would be at risk of linking to the pc libraries, since cc-lfs is a native
+    compiler. So we have to build libstdc++ later, in chroot.</para>
+
+  </sect2>
+
+  <sect2 id="other-details">
+
+    <title>Other procedural details</title>
+
+    <para>The cross-compiler will be installed in a separate <filename
+    class="directory">$LFS/tools</filename> directory, since it will not
+    be part of the final system.</para>
+
+    <para>Binutils is installed first because the <command>configure</command>
+    runs of both GCC and Glibc perform various feature tests on the assembler
+    and linker to determine which software features to enable or disable. This
+    is more important than one might first realize. An incorrectly configured
+    GCC or Glibc can result in a subtly broken toolchain, where the impact of
+    such breakage might not show up until near the end of the build of an
+    entire distribution. A test suite failure will usually highlight this error
+    before too much additional work is performed.</para>
+
+    <para>Binutils installs its assembler and linker in two locations,
+    <filename class="directory">$LFS/tools/bin</filename> and <filename
+    class="directory">$LFS/tools/$LFS_TGT/bin</filename>. The tools in one
+    location are hard linked to the other. An important facet of the linker is
+    its library search order. Detailed information can be obtained from
+    <command>ld</command> by passing it the <parameter>--verbose</parameter>
+    flag. For example, <command>$LFS_TGT-ld --verbose | grep SEARCH</command>
+    will illustrate the current search paths and their order. It shows which
+    files are linked by <command>ld</command> by compiling a dummy program and
+    passing the <parameter>--verbose</parameter> switch to the linker. For
+    example,
+    <command>$LFS_TGT-gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</command>
+    will show all the files successfully opened during the linking.</para>
+
+    <para>The next package installed is GCC. An example of what can be
+    seen during its run of <command>configure</command> is:</para>
+
+<screen><computeroutput>checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as
+checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
+
+    <para>This is important for the reasons mentioned above. It also
+    demonstrates that GCC's configure script does not search the PATH
+    directories to find which tools to use. However, during the actual
+    operation of <command>gcc</command> itself, the same search paths are not
+    necessarily used. To find out which standard linker <command>gcc</command>
+    will use, run: <command>$LFS_TGT-gcc -print-prog-name=ld</command>.</para>
+
+    <para>Detailed information can be obtained from <command>gcc</command> by
+    passing it the <parameter>-v</parameter> command line option while compiling
+    a dummy program. For example, <command>gcc -v dummy.c</command> will show
+    detailed information about the preprocessor, compilation, and assembly
+    stages, including <command>gcc</command>'s included search paths and their
+    order.</para>
+
+    <para>Next installed are sanitized Linux API headers. These allow the
+    standard C library (Glibc) to interface with features that the Linux
+    kernel will provide.</para>
+
+    <para>The next package installed is Glibc. The most important
+    considerations for building Glibc are the compiler, binary tools, and
+    kernel headers. The compiler is generally not an issue since Glibc will
+    always use the compiler relating to the <parameter>--host</parameter>
+    parameter passed to its configure script; e.g. in our case, the compiler
+    will be <command>$LFS_TGT-gcc</command>. The binary tools and kernel
+    headers can be a bit more complicated. Therefore, take no risks and use
+    the available configure switches to enforce the correct selections. After
+    the run of <command>configure</command>, check the contents of the
+    <filename>config.make</filename> file in the <filename
+    class="directory">build</filename> directory for all important details.
+    Note the use of <parameter>CC="$LFS_TGT-gcc"</parameter> (with
+    <envar>$LFS_TGT</envar> expanded) to control which binary tools are used
+    and the use of the <parameter>-nostdinc</parameter> and
+    <parameter>-isystem</parameter> flags to control the compiler's include
+    search path. These items highlight an important aspect of the Glibc
+    package&mdash;it is very self-sufficient in terms of its build machinery
+    and generally does not rely on toolchain defaults.</para>
+
+    <para>As said above, the standard C++ library is compiled next, followed
+    by all the programs that need themselves to be built. The install step
+    uses the <envar>DESTDIR</envar> variable to have the programs land into
+    the LFS filesystem.</para>
+
+    <para>Then the native lfs compiler is built. First Binutils Pass 2, with
+    the same <envar>DESTDIR</envar> install as the other programs, then the
+    second pass of GCC, omitting libstdc++ and other non-important libraries.
+    Due to some weird logic in GCC's configure script,
+    <envar>CC_FOR_TARGET</envar> ends up as <command>cc</command> when host
+    is the same as target, but is different from build. This is why
+    <parameter>CC_FOR_TARGET=$LFS_TGT-gcc</parameter> is put explicitely into
+    the configure options.</para>
+
+    <para>Upon entering the chroot environment in <xref
+    linkend="chapter-building-system"/>, the first task is to install
+    libstdc++. Then temporary installations of programs needed for the proper
+    operation of the toolchain are performed. Programs needed for testing
+    other programs are also built. From this point onwards, the
+    core toolchain is self-contained and self-hosted.  In the remainder of
+    the <xref linkend="chapter-building-system"/>, final versions of all the
+    packages needed for a fully functional system are built, tested and
+    installed.</para>
+
+  </sect2>
+
+</sect1>

+ 36 - 1242
chapter06/util-linux.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-util-linux" role="wrap">
+<sect1 id="ch-tools-util-linux" role="wrap">
   <?dbhtml filename="util-linux.html"?>
 
   <sect1info condition="script">
@@ -16,24 +16,23 @@
 
   <title>Util-linux-&util-linux-version;</title>
 
-  <indexterm zone="ch-system-util-linux">
+  <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.
-    Among them are utilities for handling file systems, consoles, partitions,
-    and messages.</para>
+    <para>The Util-linux package contains miscellaneous utility programs.</para>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&util-linux-ch6-sbu;</seg>
-        <seg>&util-linux-ch6-du;</seg>
+        <seg>&util-linux-ch5-sbu;</seg>
+        <seg>&util-linux-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -42,31 +41,14 @@
   <sect2 role="installation">
     <title>Installation of Util-linux</title>
 
-    <para>The FHS recommends using the <filename
-    class="directory">/var/lib/hwclock</filename> directory instead of the
-    usual <filename class="directory">/etc</filename> directory as the
-    location for the <filename>adjtime</filename> file. Create this directory
-    with:</para>
+    <para>First create a directory
+    to enable storage for the <command>hwclock</command> program:</para>
 
 <screen><userinput remap="pre">mkdir -pv /var/lib/hwclock</userinput></screen>
 
     <para>Prepare Util-linux for compilation:</para>
 
-<screen revision="sysv"><userinput remap="configure">./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
-            --docdir=/usr/share/doc/util-linux-&util-linux-version; \
-            --disable-chfn-chsh  \
-            --disable-login      \
-            --disable-nologin    \
-            --disable-su         \
-            --disable-setpriv    \
-            --disable-runuser    \
-            --disable-pylibmount \
-            --disable-static     \
-            --without-python     \
-            --without-systemd    \
-            --without-systemdsystemunitdir</userinput></screen>
-
-<screen revision="systemd"><userinput remap="configure">./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
+<screen><userinput remap="configure">./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
             --docdir=/usr/share/doc/util-linux-&util-linux-version; \
             --disable-chfn-chsh  \
             --disable-login      \
@@ -78,1241 +60,53 @@
             --disable-static     \
             --without-python</userinput></screen>
 
-    <para>The --disable and --without options prevent warnings about
-    building components that require packages not in LFS or are 
-    inconsistent with programs installed by other packages.</para>
-
-    <para>Compile the package:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
-    <para>If desired, run the test suite as a non-root user:</para>
-
-    <warning><para>Running the test suite as the root user can be harmful to
-    your system.  To run it, the CONFIG_SCSI_DEBUG option for the kernel must
-    be available in the currently running system, and must be built as a
-    module.  Building it into the kernel will prevent booting.  For complete
-    coverage, other BLFS packages must be installed.  If desired, this test can
-    be run after rebooting into the completed LFS system and running:</para>
-
-<screen role="nodump"><userinput>bash tests/run.sh --srcdir=$PWD --builddir=$PWD</userinput></screen>
-    </warning>
-
-<screen><userinput remap="test">chown -Rv tester .
-su tester -c "make -k check"</userinput></screen>
-
-    <para>Install the package:</para>
-
-<screen><userinput remap="install">make install</userinput></screen>
-
-  </sect2>
-
-  <sect2 id="contents-utillinux" role="content">
-    <title>Contents of Util-linux</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>addpart, agetty, blkdiscard, blkid, blkzone, blockdev, cal, cfdisk, chcpu,
-        chmem, choom, chrt, col, colcrt, colrm, column, ctrlaltdel, delpart, dmesg,
-        eject, fallocate, fdformat, fdisk, fincore, findfs, findmnt, flock, fsck,
-        fsck.cramfs, fsck.minix, fsfreeze, fstrim, getopt, hexdump, hwclock,
-        i386, ionice, ipcmk, ipcrm, ipcs, isosize, kill, last, lastb (link to
-        last), ldattach, linux32, linux64, logger, look, losetup, lsblk, lscpu,
-        lsipc, lslocks, lslogins, lsmem, lsns, mcookie, mesg, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap,
-        more, mount, mountpoint, namei, nsenter, partx, pivot_root, prlimit, raw,
-        readprofile, rename, renice, resizepart, rev, rfkill, rtcwake, script,
-        scriptreplay, setarch, setsid, setterm, sfdisk, sulogin, swaplabel,
-        swapoff (link to swapon), swapon, switch_root, taskset, ul,
-        umount, uname26, unshare, utmpdump, uuidd, uuidgen, uuidparse, wall, wdctl, whereis,
-        wipefs, x86_64, and zramctl</seg>
-        <seg>libblkid.so, libfdisk.so, libmount.so, 
-        libsmartcols.so, and libuuid.so</seg>
-        <seg>/usr/include/blkid, 
-             /usr/include/libfdisk, 
-             /usr/include/libmount, 
-             /usr/include/libsmartcols, 
-             /usr/include/uuid, 
-             /usr/share/doc/util-linux-&util-linux-version;, 
-         and /var/lib/hwclock</seg>
-      </seglistitem>
-    </segmentedlist>
-
     <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="addpart">
-        <term><command>addpart</command></term>
-        <listitem>
-          <para>Informs the Linux kernel of new partitions</para>
-          <indexterm zone="ch-system-util-linux addpart">
-            <primary sortas="b-addpart">addpart</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="agetty">
-        <term><command>agetty</command></term>
-        <listitem>
-          <para>Opens a tty port, prompts for a login name,
-          and then invokes the <command>login</command> program</para>
-          <indexterm zone="ch-system-util-linux agetty">
-            <primary sortas="b-agetty">agetty</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="blkdiscard">
-        <term><command>blkdiscard</command></term>
-        <listitem>
-          <para>Discards sectors on a device</para>
-          <indexterm zone="ch-system-util-linux blkdiscard">
-            <primary sortas="b-blkdiscard">blkdiscard</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="blkid">
-        <term><command>blkid</command></term>
-        <listitem>
-          <para>A command line utility to locate and print block device
-          attributes</para>
-          <indexterm zone="ch-system-util-linux blkid">
-            <primary sortas="b-blkid">blkid</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="blkzone">
-        <term><command>blkzone</command></term>
-        <listitem>
-          <para>Runs zone command on the given block device</para>
-          <indexterm zone="ch-system-util-linux blkzone">
-            <primary sortas="b-blkzone">blkzone</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="blockdev">
-        <term><command>blockdev</command></term>
-        <listitem>
-          <para>Allows users to call block device ioctls from the command
-          line</para>
-          <indexterm zone="ch-system-util-linux blockdev">
-            <primary sortas="b-blockdev">blockdev</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cal">
-        <term><command>cal</command></term>
-        <listitem>
-          <para>Displays a simple calendar</para>
-          <indexterm zone="ch-system-util-linux cal">
-            <primary sortas="b-cal">cal</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="cfdisk">
-        <term><command>cfdisk</command></term>
-        <listitem>
-          <para>Manipulates the partition table of the given device</para>
-          <indexterm zone="ch-system-util-linux cfdisk">
-            <primary sortas="b-cfdisk">cfdisk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chcpu">
-        <term><command>chcpu</command></term>
-        <listitem>
-          <para>Modifies the state of CPUs</para>
-          <indexterm zone="ch-system-util-linux chcpu">
-            <primary sortas="b-chcpu">chcpu</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chmem">
-        <term><command>chmem</command></term>
-        <listitem>
-          <para>Configures memory</para>
-          <indexterm zone="ch-system-util-linux chmem">
-            <primary sortas="b-chmem">chmem</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="choom">
-        <term><command>choom</command></term>
-        <listitem>
-          <para>Displays and adjusts OOM-killer score</para>
-          <indexterm zone="ch-system-util-linux choom">
-            <primary sortas="b-choom">choom</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="chrt">
-        <term><command>chrt</command></term>
-        <listitem>
-          <para>Manipulates real-time attributes of a process</para>
-          <indexterm zone="ch-system-util-linux chrt">
-            <primary sortas="b-chrt">chrt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="col">
-        <term><command>col</command></term>
-        <listitem>
-          <para>Filters out reverse line feeds</para>
-          <indexterm zone="ch-system-util-linux col">
-            <primary sortas="b-col">col</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="colcrt">
-        <term><command>colcrt</command></term>
-        <listitem>
-          <para>Filters <command>nroff</command> output for terminals
-          that lack some capabilities, such as overstriking and half-lines</para>
-          <indexterm zone="ch-system-util-linux colcrt">
-            <primary sortas="b-colcrt">colcrt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="colrm">
-        <term><command>colrm</command></term>
-        <listitem>
-          <para>Filters out the given columns</para>
-          <indexterm zone="ch-system-util-linux colrm">
-            <primary sortas="b-colrm">colrm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="column">
-        <term><command>column</command></term>
-        <listitem>
-          <para>Formats a given file into multiple columns</para>
-          <indexterm zone="ch-system-util-linux column">
-            <primary sortas="b-column">column</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ctrlaltdel">
-        <term><command>ctrlaltdel</command></term>
-        <listitem>
-          <para>Sets the function of the Ctrl+Alt+Del key combination to a
-          hard or a soft reset</para>
-          <indexterm zone="ch-system-util-linux ctrlaltdel">
-            <primary sortas="b-ctrlaltdel">ctrlaltdel</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="delpart">
-        <term><command>delpart</command></term>
-        <listitem>
-          <para>Asks the Linux kernel to remove a partition</para>
-          <indexterm zone="ch-system-util-linux delpart">
-            <primary sortas="b-delpart">delpart</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="dmesg">
-        <term><command>dmesg</command></term>
-        <listitem>
-          <para>Dumps the kernel boot messages</para>
-          <indexterm zone="ch-system-util-linux dmesg">
-            <primary sortas="b-dmesg">dmesg</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="eject">
-        <term><command>eject</command></term>
-        <listitem>
-          <para>Ejects removable media</para>
-          <indexterm zone="ch-system-util-linux eject">
-            <primary sortas="b-eject">eject</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fallocate">
-        <term><command>fallocate</command></term>
-        <listitem>
-          <para>Preallocates space to a file</para>
-          <indexterm zone="ch-system-util-linux fallocate">
-            <primary sortas="b-fallocate">fallocate</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fdformat">
-        <term><command>fdformat</command></term>
-        <listitem>
-          <para>Low-level formats a floppy disk</para>
-          <indexterm zone="ch-system-util-linux fdformat">
-            <primary sortas="b-fdformat">fdformat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fdisk">
-        <term><command>fdisk</command></term>
-        <listitem>
-          <para>Manipulates the partition table of the given device</para>
-          <indexterm zone="ch-system-util-linux fdisk">
-            <primary sortas="b-fdisk">fdisk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fincore">
-        <term><command>fincore</command></term>
-        <listitem>
-          <para>Counts pages of file contents in core</para>
-          <indexterm zone="ch-system-util-linux fincore">
-            <primary sortas="b-fincore">fincore</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="findfs">
-        <term><command>findfs</command></term>
-        <listitem>
-          <para>Finds a file system by label or Universally Unique Identifier
-          (UUID)</para>
-          <indexterm zone="ch-system-util-linux findfs">
-            <primary sortas="b-findfs">findfs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="findmnt">
-        <term><command>findmnt</command></term>
-        <listitem>
-          <para>Is a command line interface to the libmount library
-          for work with mountinfo, fstab and mtab files</para>
-          <indexterm zone="ch-system-util-linux findmnt">
-            <primary sortas="b-findmnt">findmnt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="flock">
-        <term><command>flock</command></term>
-        <listitem>
-          <para>Acquires a file lock and then executes a command with the lock
-          held</para>
-          <indexterm zone="ch-system-util-linux flock">
-            <primary sortas="b-flock">flock</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fsck">
-        <term><command>fsck</command></term>
-        <listitem>
-          <para>Is used to check, and optionally repair, file systems</para>
-          <indexterm zone="ch-system-util-linux fsck">
-            <primary sortas="b-fsck">fsck</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fsck.cramfs">
-        <term><command>fsck.cramfs</command></term>
-        <listitem>
-          <para>Performs a consistency check on the Cramfs file system on the
-          given device</para>
-          <indexterm zone="ch-system-util-linux fsck.cramfs">
-            <primary sortas="b-fsck.cramfs">fsck.cramfs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fsck.minix">
-        <term><command>fsck.minix</command></term>
-        <listitem>
-          <para>Performs a consistency check on the Minix file system on the
-          given device</para>
-          <indexterm zone="ch-system-util-linux fsck.minix">
-            <primary sortas="b-fsck.minix">fsck.minix</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fsfreeze">
-        <term><command>fsfreeze</command></term>
-        <listitem>
-          <para>Is a very simple wrapper around FIFREEZE/FITHAW ioctl
-          kernel driver operations</para>
-          <indexterm zone="ch-system-util-linux fsfreeze">
-            <primary sortas="b-fsfreeze">fsfreeze</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="fstrim">
-        <term><command>fstrim</command></term>
-        <listitem>
-          <para>Discards unused blocks on a mounted filesystem</para>
-          <indexterm zone="ch-system-util-linux fstrim">
-            <primary sortas="b-fstrim">fstrim</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="getopt">
-        <term><command>getopt</command></term>
-        <listitem>
-          <para>Parses options in the given command line</para>
-          <indexterm zone="ch-system-util-linux getopt">
-            <primary sortas="b-getopt">getopt</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="hexdump">
-        <term><command>hexdump</command></term>
-        <listitem>
-          <para>Dumps the given file in hexadecimal or in another given
-          format</para>
-          <indexterm zone="ch-system-util-linux hexdump">
-            <primary sortas="b-hexdump">hexdump</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="hwclock">
-        <term><command>hwclock</command></term>
-        <listitem>
-          <para>Reads or sets the system's hardware clock, also called
-          the Real-Time Clock (RTC) or Basic Input-Output System (BIOS)
-          clock</para>
-          <indexterm zone="ch-system-util-linux hwclock">
-            <primary sortas="b-hwclock">hwclock</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="i386">
-        <term><command>i386</command></term>
-        <listitem>
-          <para>A symbolic link to setarch</para>
-          <indexterm zone="ch-system-util-linux i386">
-            <primary sortas="b-i386">i386</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ionice">
-        <term><command>ionice</command></term>
-        <listitem>
-          <para>Gets or sets the io scheduling class and priority for a program</para>
-          <indexterm zone="ch-system-util-linux ionice">
-            <primary sortas="b-ionice">ionice</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ipcmk">
-        <term><command>ipcmk</command></term>
-        <listitem>
-          <para>Creates various IPC resources</para>
-          <indexterm zone="ch-system-util-linux ipcmk">
-            <primary sortas="b-ipcmk">ipcmk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ipcrm">
-        <term><command>ipcrm</command></term>
-        <listitem>
-          <para>Removes the given Inter-Process Communication (IPC) resource</para>
-          <indexterm zone="ch-system-util-linux ipcrm">
-            <primary sortas="b-ipcrm">ipcrm</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ipcs">
-        <term><command>ipcs</command></term>
-        <listitem>
-          <para>Provides IPC status information</para>
-          <indexterm zone="ch-system-util-linux ipcs">
-            <primary sortas="b-ipcs">ipcs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="isosize">
-        <term><command>isosize</command></term>
-        <listitem>
-          <para>Reports the size of an iso9660 file system</para>
-          <indexterm zone="ch-system-util-linux isosize">
-            <primary sortas="b-isosize">isosize</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="kill">
-        <term><command>kill</command></term>
-        <listitem>
-          <para>Sends signals to processes</para>
-          <indexterm zone="ch-system-util-linux kill">
-            <primary sortas="b-kill">kill</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="last">
-        <term><command>last</command></term>
-        <listitem>
-          <para>Shows which users last logged in (and out), searching back 
-          through the <filename>/var/log/wtmp</filename> file; it also shows 
-          system boots, shutdowns, and run-level changes</para>
-          <indexterm zone="ch-system-util-linux last">
-            <primary sortas="b-last">last</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lastb">
-        <term><command>lastb</command></term>
-        <listitem>
-          <para>Shows the failed login attempts, as logged in 
-          <filename>/var/log/btmp</filename></para>
-          <indexterm zone="ch-system-util-linux lastb">
-            <primary sortas="b-lastb">lastb</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ldattach">
-        <term><command>ldattach</command></term>
-        <listitem>
-          <para>Attaches a line discipline to a serial line</para>
-          <indexterm zone="ch-system-util-linux ldattach">
-            <primary sortas="b-ldattach">ldattach</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="linux32">
-        <term><command>linux32</command></term>
-        <listitem>
-          <para>A symbolic link to setarch</para>
-          <indexterm zone="ch-system-util-linux linux32">
-            <primary sortas="b-linux32">linux32</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="linux64">
-        <term><command>linux64</command></term>
-        <listitem>
-          <para>A symbolic link to setarch</para>
-          <indexterm zone="ch-system-util-linux linux64">
-            <primary sortas="b-linux64">linux64</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="logger">
-        <term><command>logger</command></term>
-        <listitem>
-          <para>Enters the given message into the system log</para>
-          <indexterm zone="ch-system-util-linux logger">
-            <primary sortas="b-logger">logger</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="look">
-        <term><command>look</command></term>
-        <listitem>
-          <para>Displays lines that begin with the given string</para>
-          <indexterm zone="ch-system-util-linux look">
-            <primary sortas="b-look">look</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="losetup">
-        <term><command>losetup</command></term>
-        <listitem>
-          <para>Sets up and controls loop devices</para>
-          <indexterm zone="ch-system-util-linux losetup">
-            <primary sortas="b-losetup">losetup</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lsblk">
-        <term><command>lsblk</command></term>
-        <listitem>
-          <para>Lists information about all or selected block devices in
-           a tree-like format</para>
-          <indexterm zone="ch-system-util-linux lsblk">
-            <primary sortas="b-lsblk">lsblk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lscpu">
-        <term><command>lscpu</command></term>
-        <listitem>
-          <para>Prints CPU architecture information</para>
-          <indexterm zone="ch-system-util-linux lscpu">
-            <primary sortas="b-lscpu">lscpu</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lsipc">
-        <term><command>lsipc</command></term>
-        <listitem>
-          <para>Prints information on IPC facilities currently employed
-          in the system</para>
-          <indexterm zone="ch-system-util-linux lsipc">
-            <primary sortas="b-lsipc">lsipc</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lslocks">
-        <term><command>lslocks</command></term>
-        <listitem>
-          <para>Lists local system locks</para>
-          <indexterm zone="ch-system-util-linux lslocks">
-            <primary sortas="b-lslocks">lslocks</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lslogins">
-        <term><command>lslogins</command></term>
-        <listitem>
-          <para>Lists information about users, groups and system accounts</para>
-          <indexterm zone="ch-system-util-linux lslogins">
-            <primary sortas="b-lslogins">lslogins</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lsmem">
-        <term><command>lsmem</command></term>
-        <listitem>
-          <para>Lists the ranges of available memory with their online
-          status</para>
-          <indexterm zone="ch-system-util-linux lsmem">
-            <primary sortas="b-lsmem">lsmem</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lsns">
-        <term><command>lsns</command></term>
-        <listitem>
-          <para>Lists namespaces</para>
-          <indexterm zone="ch-system-util-linux lsns">
-            <primary sortas="b-lsns">lsns</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mcookie">
-        <term><command>mcookie</command></term>
-        <listitem>
-          <para>Generates magic cookies (128-bit random hexadecimal numbers) for
-          <command>xauth</command></para>
-          <indexterm zone="ch-system-util-linux mcookie">
-            <primary sortas="b-mcookie">mcookie</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mesg">
-        <term><command>mesg</command></term>
-        <listitem>
-          <para>Controls whether other users can send messages to the current 
-          user's terminal</para>
-          <indexterm zone="ch-system-util-linux mesg">
-            <primary sortas="b-mesg">mesg</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkfs">
-        <term><command>mkfs</command></term>
-        <listitem>
-          <para>Builds a file system on a device (usually a hard disk
-          partition)</para>
-          <indexterm zone="ch-system-util-linux mkfs">
-            <primary sortas="b-mkfs">mkfs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkfs.bfs">
-        <term><command>mkfs.bfs</command></term>
-        <listitem>
-          <para>Creates a Santa Cruz Operations (SCO) bfs file system</para>
-          <indexterm zone="ch-system-util-linux mkfs.bfs">
-            <primary sortas="b-mkfs.bfs">mkfs.bfs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkfs.cramfs">
-        <term><command>mkfs.cramfs</command></term>
-        <listitem>
-          <para>Creates a cramfs file system</para>
-          <indexterm zone="ch-system-util-linux mkfs.cramfs">
-            <primary sortas="b-mkfs.cramfs">mkfs.cramfs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkfs.minix">
-        <term><command>mkfs.minix</command></term>
-        <listitem>
-          <para>Creates a Minix file system</para>
-          <indexterm zone="ch-system-util-linux mkfs.minix">
-            <primary sortas="b-mkfs.minix">mkfs.minix</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mkswap">
-        <term><command>mkswap</command></term>
-        <listitem>
-          <para>Initializes the given device or file to be used as a swap
-          area</para>
-          <indexterm zone="ch-system-util-linux mkswap">
-            <primary sortas="b-mkswap">mkswap</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="more">
-        <term><command>more</command></term>
-        <listitem>
-          <para>A filter for paging through text one screen at a time</para>
-          <indexterm zone="ch-system-util-linux more">
-            <primary sortas="b-more">more</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mount">
-        <term><command>mount</command></term>
-        <listitem>
-          <para>Attaches the file system on the given device to a specified
-          directory in the file-system tree</para>
-          <indexterm zone="ch-system-util-linux mount">
-            <primary sortas="b-mount">mount</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="mountpoint">
-        <term><command>mountpoint</command></term>
-        <listitem>
-          <para>Checks if the directory is a mountpoint</para>
-          <indexterm zone="ch-system-util-linux mountpoint">
-            <primary sortas="b-mountpoint">mountpoint</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="namei">
-        <term><command>namei</command></term>
-        <listitem>
-          <para>Shows the symbolic links in the given pathnames</para>
-          <indexterm zone="ch-system-util-linux namei">
-            <primary sortas="b-namei">namei</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="nsenter">
-        <term><command>nsenter</command></term>
-        <listitem>
-          <para>Runs a program with namespaces of other processes</para>
-          <indexterm zone="ch-system-util-linux nsenter">
-            <primary sortas="b-nsenter">nsenter</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="partx">
-        <term><command>partx</command></term>
-        <listitem>
-          <para>Tells the kernel about the presence and numbering of on-disk
-          partitions</para>
-          <indexterm zone="ch-system-util-linux partx">
-            <primary sortas="b-partx">partx</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="pivot_root">
-        <term><command>pivot_root</command></term>
-        <listitem>
-          <para>Makes the given file system the new root file system of the
-          current process</para>
-          <indexterm zone="ch-system-util-linux pivot_root">
-            <primary sortas="b-pivot_root">pivot_root</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="prlimit">
-        <term><command>prlimit</command></term>
-        <listitem>
-          <para>Get and set a process' resource limits</para>
-          <indexterm zone="ch-system-util-linux prlimit">
-            <primary sortas="b-prlimit">prlimit</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="raw">
-        <term><command>raw</command></term>
-        <listitem>
-          <para>Bind a Linux raw character device to a block device</para>
-          <indexterm zone="ch-system-util-linux raw">
-            <primary sortas="b-raw">raw</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="readprofile">
-        <term><command>readprofile</command></term>
-        <listitem>
-          <para>Reads kernel profiling information</para>
-          <indexterm zone="ch-system-util-linux readprofile">
-            <primary sortas="b-readprofile">readprofile</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="rename">
-        <term><command>rename</command></term>
-        <listitem>
-          <para>Renames the given files, replacing a given string with
-          another</para>
-          <indexterm zone="ch-system-util-linux rename">
-            <primary sortas="b-rename">rename</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="renice">
-        <term><command>renice</command></term>
-        <listitem>
-          <para>Alters the priority of running processes</para>
-          <indexterm zone="ch-system-util-linux renice">
-            <primary sortas="b-renice">renice</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="resizepart">
-        <term><command>resizepart</command></term>
-        <listitem>
-          <para>Asks the Linux kernel to resize a partition</para>
-          <indexterm zone="ch-system-util-linux resizepart">
-            <primary sortas="b-resizepart">resizepart</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="rev">
-        <term><command>rev</command></term>
-        <listitem>
-          <para>Reverses the lines of a given file</para>
-          <indexterm zone="ch-system-util-linux rev">
-            <primary sortas="b-rev">rev</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="rkfill">
-        <term><command>rkfill</command></term>
-        <listitem>
-          <para>Tool for enabling and disabling wireless devices</para>
-          <indexterm zone="ch-system-util-linux rkfill">
-            <primary sortas="b-rkfill">rkfill</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="rtcwake">
-        <term><command>rtcwake</command></term>
-        <listitem>
-          <para>Used to enter a system sleep state until specified wakeup
-          time</para>
-          <indexterm zone="ch-system-util-linux rtcwake">
-            <primary sortas="b-rtcwake">rtcwake</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="script">
-        <term><command>script</command></term>
-        <listitem>
-          <para>Makes a typescript of a terminal session</para>
-          <indexterm zone="ch-system-util-linux script">
-            <primary sortas="b-script">script</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="scriptreplay">
-        <term><command>scriptreplay</command></term>
-        <listitem>
-          <para>Plays back typescripts using timing information</para>
-          <indexterm zone="ch-system-util-linux scriptreplay">
-            <primary sortas="b-scriptreplay">scriptreplay</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="setarch">
-        <term><command>setarch</command></term>
-        <listitem>
-          <para>Changes reported architecture in a new program environment and
-          sets personality flags</para>
-          <indexterm zone="ch-system-util-linux setarch">
-            <primary sortas="b-setarch">setarch</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="setsid">
-        <term><command>setsid</command></term>
-        <listitem>
-          <para>Runs the given program in a new session</para>
-          <indexterm zone="ch-system-util-linux setsid">
-            <primary sortas="b-setsid">setsid</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="setterm">
-        <term><command>setterm</command></term>
+      <title>The meaning of the configure options:</title>
+<!-- TODO -->
+      <varlistentry>
+        <term><parameter>ADJTIME_PATH=/var/lib/hwclock/adjtime</parameter></term>
         <listitem>
-          <para>Sets terminal attributes</para>
-          <indexterm zone="ch-system-util-linux setterm">
-            <primary sortas="b-setterm">setterm</primary>
-          </indexterm>
+          <para>This sets the location of the file recording information about
+          the hardware clock, in accordance to the FHS. This is not stricly
+          needed fot his temporary tool, but it prevent creating a file
+          at another location, which would not be overwritten or removed
+          when building the final util-linux.</para>
         </listitem>
       </varlistentry>
 
-      <varlistentry id="sfdisk">
-        <term><command>sfdisk</command></term>
+      <varlistentry>
+        <term><parameter>--disable-*</parameter></term>
         <listitem>
-          <para>A disk partition table manipulator</para>
-          <indexterm zone="ch-system-util-linux sfdisk">
-            <primary sortas="b-sfdisk">sfdisk</primary>
-          </indexterm>
+          <para>Those switches prevent warnings about building components
+          that require packages not in LFS or not installed yet.</para>
         </listitem>
       </varlistentry>
 
-      <varlistentry id="sulogin">
-        <term><command>sulogin</command></term>
+      <varlistentry>
+        <term><parameter>--without-python</parameter></term>
         <listitem>
-          <para>Allows <systemitem class="username">root</systemitem> to log in;
-          it is normally invoked by <command>init</command> when the system goes
-          into single user mode</para>
-          <indexterm zone="ch-system-util-linux sulogin">
-            <primary sortas="b-sulogin">sulogin</primary>
-          </indexterm>
+          <para>This switch disables using <application>Python</application>.
+          It avoids trying to build unneeded bindings.</para>
         </listitem>
       </varlistentry>
 
-      <varlistentry id="swaplabel">
-        <term><command>swaplabel</command></term>
-        <listitem>
-          <para>Allows to change swaparea UUID and label</para>
-          <indexterm zone="ch-system-util-linux swaplabel">
-            <primary sortas="b-swaplabel">swaplabel</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+     </variablelist>
 
-      <varlistentry id="swapoff">
-        <term><command>swapoff</command></term>
-        <listitem>
-          <para>Disables devices and files for paging and swapping</para>
-          <indexterm zone="ch-system-util-linux swapoff">
-            <primary sortas="b-swapoff">swapoff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="swapon">
-        <term><command>swapon</command></term>
-        <listitem>
-          <para>Enables devices and files for paging and swapping and
-          lists the devices and files currently in use</para>
-          <indexterm zone="ch-system-util-linux swapon">
-            <primary sortas="b-swapon">swapon</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="switch_root">
-        <term><command>switch_root</command></term>
-        <listitem>
-          <para>Switches to another filesystem as the root of the mount tree</para>
-          <indexterm zone="ch-system-util-linux switch_root">
-            <primary sortas="b-switch_root">switch_root</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="tailf">
-        <term><command>tailf</command></term>
-        <listitem>
-          <para>Tracks the growth of a log file; displays the last 10 lines
-          of a log file, then continues displaying any new entries in the
-          log file as they are created</para>
-          <indexterm zone="ch-system-util-linux tailf">
-            <primary sortas="b-tailf">tailf</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="taskset">
-        <term><command>taskset</command></term>
-        <listitem>
-          <para>Retrieves or sets a process' CPU affinity</para>
-          <indexterm zone="ch-system-util-linux taskset">
-            <primary sortas="b-taskset">taskset</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="ul">
-        <term><command>ul</command></term>
-        <listitem>
-          <para>A filter for translating underscores into escape sequences
-          indicating underlining for the terminal in use</para>
-          <indexterm zone="ch-system-util-linux ul">
-            <primary sortas="b-ul">ul</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="umount">
-        <term><command>umount</command></term>
-        <listitem>
-          <para>Disconnects a file system from the system's file tree</para>
-          <indexterm zone="ch-system-util-linux umount">
-            <primary sortas="b-umount">umount</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uname26">
-        <term><command>uname26</command></term>
-        <listitem>
-          <para>A symbolic link to setarch</para>
-          <indexterm zone="ch-system-util-linux uname26">
-            <primary sortas="b-uname26">uname26</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="unshare">
-        <term><command>unshare</command></term>
-        <listitem>
-          <para>Runs a program with some namespaces unshared from parent</para>
-          <indexterm zone="ch-system-util-linux unshare">
-            <primary sortas="b-unshare">unshare</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="utmpdump">
-        <term><command>utmpdump</command></term>
-        <listitem>
-          <para>Displays the content of the given login file in a more
-          user-friendly format</para>
-          <indexterm zone="ch-system-util-linux utmpdump">
-            <primary sortas="b-utmpdump">utmpdump</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uuidd">
-        <term><command>uuidd</command></term>
-        <listitem>
-          <para>A daemon used by the UUID library to generate time-based
-          UUIDs in a secure and guaranteed-unique fashion</para>
-          <indexterm zone="ch-system-util-linux uuidd">
-            <primary sortas="b-uuidd">uuidd</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uuidgen">
-        <term><command>uuidgen</command></term>
-        <listitem>
-          <para>Creates new UUIDs. Each new UUID can reasonably be considered
-          unique among all UUIDs created, on the local system and on other
-          systems, in the past and in the future</para>
-          <indexterm zone="ch-system-util-linux uuidgen">
-            <primary sortas="b-uuidgen">uuidgen</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="uuidparse">
-        <term><command>uuidparse</command></term>
-        <listitem>
-          <para>An utility to parse unique identifiers</para>
-          <indexterm zone="ch-system-util-linux uuidparse">
-            <primary sortas="b-uuidparse">uuidparse</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="wall">
-        <term><command>wall</command></term>
-        <listitem>
-          <para>Displays the contents of a file or, by default, its standard
-          input, on the terminals of all currently logged in users</para>
-          <indexterm zone="ch-system-util-linux wall">
-            <primary sortas="b-wall">wall</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="wdctl">
-        <term><command>wdctl</command></term>
-        <listitem>
-          <para>Shows hardware watchdog status</para>
-          <indexterm zone="ch-system-util-linux wdctl">
-            <primary sortas="b-wdctl">wdctl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="whereis">
-        <term><command>whereis</command></term>
-        <listitem>
-          <para>Reports the location of the binary, source, and man page
-          for the given command</para>
-          <indexterm zone="ch-system-util-linux whereis">
-            <primary sortas="b-whereis">whereis</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="wipefs">
-        <term><command>wipefs</command></term>
-        <listitem>
-          <para>Wipes a filesystem signature from a device</para>
-          <indexterm zone="ch-system-util-linux wipefs">
-            <primary sortas="b-wipefs">wipefs</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="x86_64">
-        <term><command>x86_64</command></term>
-        <listitem>
-          <para>A symbolic link to setarch</para>
-          <indexterm zone="ch-system-util-linux x86_64">
-            <primary sortas="b-x86_64">x86_64</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="zramctl">
-        <term><command>zramctl</command></term>
-        <listitem>
-          <para>A program to set up and control zram (compressed ram disk) 
-          devices</para>
-          <indexterm zone="ch-system-util-linux zramctl">
-            <primary sortas="b-zramctl">zramctl</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>Compile the package:</para>
 
-      <varlistentry id="libblkid">
-        <term><filename class="libraryfile">libblkid</filename></term>
-        <listitem>
-          <para>Contains routines for device identification and token
-          extraction</para>
-          <indexterm zone="ch-system-util-linux libblkid">
-            <primary sortas="c-libblkid">libblkid</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput remap="make">make</userinput></screen>
 
-      <varlistentry id="libfdisk">
-        <term><filename class="libraryfile">libfdisk</filename></term>
-        <listitem>
-          <para>Contains routines for manipulating partition tables</para>
-          <indexterm zone="ch-system-util-linux libfdisk">
-            <primary sortas="c-libfdisk">libfdisk</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+    <para>Install the package:</para>
 
-      <varlistentry id="libmount">
-        <term><filename class="libraryfile">libmount</filename></term>
-        <listitem>
-          <para>Contains routines for block device mounting and
-          unmounting</para>
-          <indexterm zone="ch-system-util-linux libmount">
-            <primary sortas="c-libmount">libmount</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+<screen><userinput remap="install">make install</userinput></screen>
 
-      <varlistentry id="libsmartcols">
-        <term><filename class="libraryfile">libsmartcols</filename></term>
-        <listitem>
-          <para>Contains routines for aiding screen output in tabular form</para>
-          <indexterm zone="ch-system-util-linux libsmartcols">
-            <primary sortas="c-libsmartcols">libsmartcols</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  </sect2>
 
-      <varlistentry id="libuuid">
-        <term><filename class="libraryfile">libuuid</filename></term>
-        <listitem>
-          <para>Contains routines for generating unique identifiers for objects
-          that may be accessible beyond the local system</para>
-          <indexterm zone="ch-system-util-linux libuuid">
-            <primary sortas="c-libuuid">libuuid</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
+  <sect2 role="content">
+    <title/>
 
-    </variablelist>
+    <para>Details on this package are located in
+    <xref linkend="contents-utillinux" role="."/></para>
 
   </sect2>
 

+ 24 - 311
chapter06/xz.xml

@@ -5,7 +5,7 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-system-xz" role="wrap">
+<sect1 id="ch-tools-xz" role="wrap">
   <?dbhtml filename="xz.html"?>
 
   <sect1info condition="script">
@@ -16,26 +16,25 @@
 
   <title>Xz-&xz-version;</title>
 
-  <indexterm zone="ch-system-xz">
+  <indexterm zone="ch-tools-xz">
     <primary sortas="a-xz">Xz</primary>
+    <secondary>tools</secondary>
   </indexterm>
 
   <sect2 role="package">
     <title/>
 
-    <para>The Xz package contains programs for compressing and decompressing
-    files. It provides capabilities for the lzma and the newer xz compression
-    formats.  Compressing text files with <command>xz</command> yields a better
-    compression percentage than with the traditional <command>gzip</command> or
-    <command>bzip2</command> commands.</para>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/xz.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
 
     <segmentedlist>
       <segtitle>&buildtime;</segtitle>
       <segtitle>&diskspace;</segtitle>
 
       <seglistitem>
-        <seg>&xz-ch6-sbu;</seg>
-        <seg>&xz-ch6-du;</seg>
+        <seg>&xz-ch5-sbu;</seg>
+        <seg>&xz-ch5-du;</seg>
       </seglistitem>
     </segmentedlist>
 
@@ -44,320 +43,34 @@
   <sect2 role="installation">
     <title>Installation of Xz</title>
 
-    <para>Prepare Xz for compilation with:</para>
+    <para>Prepare Xz for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr    \
-            --disable-static \
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --host=$LFS_TGT                   \
+            --build=$(build-aux/config.guess) \
+            --disable-static                  \
             --docdir=/usr/share/doc/xz-&xz-version;</userinput></screen>
 
-    <para>Compile the package:</para>
+   <para>Compile the package:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
-    <para>To test the results, issue:</para>
+    <para>Install the package:</para>
 
-<screen><userinput remap="test">make check</userinput></screen>
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
 
-  <para>Install the package and make sure that all essential files are in the
-  correct directory:</para>
+    <para>Make sure that all essential files are in the correct directory:</para>
 
-<screen><userinput remap="install">make install
-mv -v   /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin
-mv -v /usr/lib/liblzma.so.* /lib
-ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so</userinput></screen>
+<screen><userinput remap="install">mv -v   $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
+mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
+ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so</userinput></screen>
 
   </sect2>
 
-  <sect2 id="contents-xz" role="content">
-    <title>Contents of Xz</title>
-
-    <segmentedlist>
-      <segtitle>Installed programs</segtitle>
-      <segtitle>Installed libraries</segtitle>
-      <segtitle>Installed directories</segtitle>
-
-      <seglistitem>
-        <seg>
-          lzcat (link to xz), 
-          lzcmp (link to xzdiff), 
-          lzdiff (link to xzdiff), 
-          lzegrep (link to xzgrep), 
-          lzfgrep (link to xzgrep),
-          lzgrep (link to xzgrep), 
-          lzless (link to xzless), 
-          lzma (link to xz),
-          lzmadec, 
-          lzmainfo, 
-          lzmore (link to xzmore),
-          unlzma (link to xz), 
-          unxz (link to xz), 
-          xz, 
-          xzcat (link to xz),
-          xzcmp (link to xzdiff), 
-          xzdec, 
-          xzdiff, 
-          xzegrep (link to xzgrep),
-          xzfgrep (link to xzgrep), 
-          xzgrep, 
-          xzless, and 
-          xzmore</seg>
-        <seg>
-          liblzma.so
-        </seg>
-        <seg>
-          /usr/include/lzma and 
-          /usr/share/doc/xz-&xz-version;
-         </seg>
-      </seglistitem>
-    </segmentedlist>
-
-    <variablelist>
-      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
-      <?dbfo list-presentation="list"?>
-      <?dbhtml list-presentation="table"?>
-
-      <varlistentry id="lzcat">
-        <term><command>lzcat</command></term>
-        <listitem>
-          <para>Decompresses to standard output</para>
-          <indexterm zone="ch-system-xz lzcat">
-            <primary sortas="b-lzcat">lzcat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzcmp">
-        <term><command>lzcmp</command></term>
-        <listitem>
-          <para>Runs <command>cmp</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzcmp">
-            <primary sortas="b-lzcmp">lzcmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzdiff">
-        <term><command>lzdiff</command></term>
-        <listitem>
-          <para>Runs <command>diff</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzdiff">
-            <primary sortas="b-lzdiff">lzdiff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzegrep">
-        <term><command>lzegrep</command></term>
-        <listitem>
-          <para>Runs <command>egrep</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzegrep">
-            <primary sortas="b-lzegrep">lzegrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzfgrep">
-        <term><command>lzfgrep</command></term>
-        <listitem>
-          <para>Runs <command>fgrep</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzfgrep">
-            <primary sortas="b-lzfgrep">lzfgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzgrep">
-        <term><command>lzgrep</command></term>
-        <listitem>
-          <para>Runs <command>grep</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzgrep">
-            <primary sortas="b-lzgrep">lzgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzless">
-        <term><command>lzless</command></term>
-        <listitem>
-          <para>Runs <command>less</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzless">
-            <primary sortas="b-lzless">lzless</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzma">
-        <term><command>lzma</command></term>
-        <listitem>
-          <para>Compresses or decompresses files using the LZMA format</para>
-          <indexterm zone="ch-system-xz lzma">
-            <primary sortas="b-lzma">lzma</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzmadec">
-        <term><command>lzmadec</command></term>
-        <listitem>
-          <para>A small and fast decoder for LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzmadec">
-            <primary sortas="b-lzmadec">lzmadec</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzmainfo">
-        <term><command>lzmainfo</command></term>
-        <listitem>
-          <para>Shows information stored in the LZMA compressed file header</para>
-          <indexterm zone="ch-system-xz lzmainfo">
-            <primary sortas="b-lzmainfo">lzmainfo</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="lzmore">
-        <term><command>lzmore</command></term>
-        <listitem>
-          <para>Runs <command>more</command> on LZMA compressed files</para>
-          <indexterm zone="ch-system-xz lzmore">
-            <primary sortas="b-lzmamore">lzmore</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="unlzma">
-        <term><command>unlzma</command></term>
-        <listitem>
-          <para>Decompresses files using the LZMA format</para>
-          <indexterm zone="ch-system-xz unlzma">
-            <primary sortas="b-unlzma">unlzma</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="unxz">
-        <term><command>unxz</command></term>
-        <listitem>
-          <para>Decompresses files using the XZ format</para>
-          <indexterm zone="ch-system-xz unxz">
-            <primary sortas="b-unxz">unxz</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xz">
-        <term><command>xz</command></term>
-        <listitem>
-          <para>Compresses or decompresses files using the XZ format</para>
-          <indexterm zone="ch-system-xz xz">
-            <primary sortas="b-xz">xz</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzcat">
-        <term><command>xzcat</command></term>
-        <listitem>
-          <para>Decompresses to standard output</para>
-          <indexterm zone="ch-system-xz xzcat">
-            <primary sortas="b-xzcat">xzcat</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzcmp">
-        <term><command>xzcmp</command></term>
-        <listitem>
-          <para>Runs <command>cmp</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzcmp">
-            <primary sortas="b-xzcmp">xzcmp</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzdec">
-        <term><command>xzdec</command></term>
-        <listitem>
-          <para>A small and fast decoder for XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzdec">
-            <primary sortas="b-xzdec">xzdec</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzdiff">
-        <term><command>xzdiff</command></term>
-        <listitem>
-          <para>Runs <command>diff</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzdiff">
-            <primary sortas="b-xzdiff">xzdiff</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzegrep">
-        <term><command>xzegrep</command></term>
-        <listitem>
-          <para>Runs <command>egrep</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzegrep">
-            <primary sortas="b-xzegrep">xzegrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzfgrep">
-        <term><command>xzfgrep</command></term>
-        <listitem>
-          <para>Runs <command>fgrep</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzfgrep">
-            <primary sortas="b-xzfgrep">xzfgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzgrep">
-        <term><command>xzgrep</command></term>
-        <listitem>
-          <para>Runs <command>grep</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzgrep">
-            <primary sortas="b-xzgrep">xzgrep</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzless">
-        <term><command>xzless</command></term>
-        <listitem>
-          <para>Runs <command>less</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzless">
-            <primary sortas="b-xzless">xzless</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="xzmore">
-        <term><command>xzmore</command></term>
-        <listitem>
-          <para>Runs <command>more</command> on XZ compressed files</para>
-          <indexterm zone="ch-system-xz xzmore">
-            <primary sortas="b-xzmore">xzmore</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry id="liblzma">
-        <term><filename class="libraryfile">liblzma</filename></term>
-        <listitem>
-          <para>The library implementing lossless, block-sorting data
-          compression, using the Lempel-Ziv-Markov chain algorithm</para>
-          <indexterm zone="ch-system-xz liblzma">
-            <primary sortas="c-liblzma">liblzma</primary>
-          </indexterm>
-        </listitem>
-      </varlistentry>
-
-    </variablelist>
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in<!-- TODO
+    <xref linkend="contents-xz" role="."/>      --></para>
 
   </sect2>
 

+ 96 - 0
chapter07/bash.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-bash" role="wrap">
+  <?dbhtml filename="bash.html"?>
+
+  <sect1info condition="script">
+    <productname>bash</productname>
+    <productnumber>&bash-version;</productnumber>
+    <address>&bash-url;</address>
+  </sect1info>
+
+  <title>Bash-&bash-version;</title>
+
+  <indexterm zone="ch-tools-bash">
+    <primary sortas="a-Bash">Bash</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/bash.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&bash-ch5-sbu;</seg>
+        <seg>&bash-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Bash</title>
+
+    <para>Prepare Bash for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr                   \
+            --build=$(support/config.guess) \
+            --host=$LFS_TGT                 \
+            --without-bash-malloc</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--without-bash-malloc</parameter></term>
+        <listitem>
+          <para>This option turns off the use of Bash's memory allocation
+          (<function>malloc</function>) function which is known to cause
+          segmentation faults. By turning this option off, Bash will use
+          the <function>malloc</function> functions from Glibc which are
+          more stable.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <para>Move the excutable to where it is expected to be:</para>
+
+<screen><userinput remap="install">mv $LFS/usr/bin/bash $LFS/bin/bash</userinput></screen>
+
+    <para>Make a link for the programs that use <command>sh</command> for
+    a shell:</para>
+
+<screen><userinput remap="install">ln -sv bash $LFS/bin/sh</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-bash" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 156 - 0
chapter07/binutils-pass1.xml

@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-binutils-pass1" role="wrap">
+  <?dbhtml filename="binutils-pass1.html"?>
+
+  <sect1info condition="script">
+    <productname>binutils-pass1</productname>
+    <productnumber>&binutils-version;</productnumber>
+    <address>&binutils-url;</address>
+  </sect1info>
+
+  <title>Binutils-&binutils-version; - Pass 1</title>
+
+  <indexterm zone="ch-tools-binutils-pass1">
+    <primary sortas="a-Binutils">Binutils</primary>
+    <secondary>tools, pass 1</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/binutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&binutils-ch5p1-sbu;</seg>
+        <seg>&binutils-ch5p1-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Cross Binutils</title>
+
+    <note><para>Go back and re-read the notes in the previous section.
+    Understanding the notes labeled important will save you a lot
+    of problems later.</para></note>
+
+    <para>It is important that Binutils be the first package compiled
+    because both Glibc and GCC perform various tests on the available
+    linker and assembler to determine which of their own features to
+    enable.</para>
+
+    <para>The Binutils documentation recommends building Binutils 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <note>
+      <para>In order for the SBU values listed in the rest of the book
+      to be of any use, measure the time it takes to build this package from
+      the configuration, up to and including the first install. To achieve
+      this easily, wrap the commands in a <command>time</command>
+      command like this: <userinput>time { ./configure ... &amp;&amp; ...
+      &amp;&amp; make install; }</userinput>.</para>
+    </note>
+<!--
+    <note><para>The approximate build SBU values and required disk space
+    in Chapter&nbsp;5 does not include test suite data.</para></note>
+-->
+    <para>Now prepare Binutils for compilation:</para>
+
+<screen><userinput remap="configure">../configure --prefix=$LFS/tools       \
+             --with-sysroot=$LFS        \
+             --target=$LFS_TGT          \
+             --disable-nls              \
+             --disable-werror</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--prefix=$LFS/tools</parameter></term>
+        <listitem>
+          <para>This tells the configure script to prepare to install the
+          Binutils programs in the <filename
+          class="directory">$LFS/tools</filename> directory.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-sysroot=$LFS</parameter></term>
+        <listitem>
+          <para>For cross compilation, this tells the build system to look in
+          $LFS for the target system libraries as needed.</para>
+        </listitem>
+      </varlistentry>
+ <!--
+      <varlistentry>
+        <term><parameter>- -with-lib-path=/tools/lib</parameter></term>
+        <listitem>
+          <para>This specifies which library path the linker should be
+          configured to use.</para>
+        </listitem>
+      </varlistentry>
+  -->
+      <varlistentry>
+        <term><envar>--target=$LFS_TGT</envar></term>
+        <listitem>
+          <para>Because the machine description in the <envar>LFS_TGT</envar>
+          variable is slightly different than the value returned by the
+          <command>config.guess</command> script, this switch will tell the
+          <command>configure</command> script to adjust Binutil's build system
+          for building a cross linker.  </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-nls</parameter></term>
+        <listitem>
+          <para>This disables internationalization as i18n is not needed for the
+          temporary tools.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-werror</parameter></term>
+        <listitem>
+          <para>This prevents the build from stopping in the event that there
+          are warnings from the host's compiler.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Continue with compiling the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-binutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 94 - 0
chapter07/binutils-pass2.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-binutils-pass2" role="wrap">
+  <?dbhtml filename="binutils-pass2.html"?>
+
+  <sect1info condition="script">
+    <productname>binutils-pass2</productname>
+    <productnumber>&binutils-version;</productnumber>
+    <address>&binutils-url;</address>
+  </sect1info>
+
+  <title>Binutils-&binutils-version; - Pass 2</title>
+
+  <indexterm zone="ch-tools-binutils-pass2">
+    <primary sortas="a-Binutils">Binutils</primary>
+    <secondary>tools, pass 2</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/binutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&binutils-ch5p2-sbu;</seg>
+        <seg>&binutils-ch5p2-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Binutils</title>
+
+    <para>Create a separate build directory again:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Binutils for compilation:</para>
+
+<screen><userinput remap="configure">../configure                   \
+    --prefix=/usr              \
+    --build=$(../config.guess) \
+    --host=$LFS_TGT            \
+    --disable-nls              \
+    --enable-shared            \
+    --disable-werror</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--host=$LFS_TGT</parameter></term>
+        <listitem>
+          <para>This tells the configure script that we want to build
+          this pass of binutils for the $LFS_TGT machine, using our just
+          built cross-compiler.  This prevents the linker from searching
+          through library directories on the host.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-binutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 82 - 0
chapter07/bison.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-bison" role="wrap">
+  <?dbhtml filename="bison.html"?>
+
+  <sect1info condition="script">
+    <productname>bison</productname>
+    <productnumber>&bison-version;</productnumber>
+    <address>&bison-url;</address>
+  </sect1info>
+
+  <title>Bison-&bison-version;</title>
+
+  <indexterm zone="ch-tools-bison">
+    <primary sortas="a-Bison">Bison</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/bison.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&bison-ch5-sbu;</seg>
+        <seg>&bison-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Bison</title>
+
+    <para>Prepare Bison for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure option:</title>
+
+      <varlistentry>
+        <term><parameter>--docdir=/usr/share/doc/bison-&bison-version;</parameter></term>
+        <listitem>
+          <para>This tells the build system to install bison documentation
+	  into a versioned directory.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-bison" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 112 - 0
chapter07/bzip2.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-bzip2" role="wrap">
+  <?dbhtml filename="bzip2.html"?>
+
+  <sect1info condition="script">
+    <productname>bzip2</productname>
+    <productnumber>&bzip2-version;</productnumber>
+    <address>&bzip2-url;</address>
+  </sect1info>
+
+  <title>Bzip2-&bzip2-version;</title>
+
+  <indexterm zone="ch-tools-bzip2">
+    <primary sortas="a-Bzip2">Bzip2</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/bzip2.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&bzip2-ch5-sbu;</seg>
+        <seg>&bzip2-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Bzip2</title>
+
+    <para>Apply a patch that will install the documentation for this
+    package:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&bzip2-docs-patch;</userinput></screen>
+
+    <para>The following command ensures installation of symbolic links are
+    relative:</para>
+
+<screen><userinput remap="pre">sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile</userinput></screen>
+
+    <para>Ensure the man pages are installed into the correct location:</para>
+
+<screen><userinput remap="pre">sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile</userinput></screen>
+
+    <para>The Bzip2 package does not contain a <command>configure</command>
+    script. There are two <filename>Makefile</filename>, one for the shared
+    library, and the other for the static library. Since we need both, We
+    do the compilation in two stages. First the shared library:</para>
+
+<screen><userinput remap="make">make CC=$LFS_TGT-gcc -f Makefile-libbz2_so
+make clean</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the make parameter:</title>
+
+      <varlistentry>
+        <term><parameter>-f Makefile-libbz2_so</parameter></term>
+        <listitem>
+          <para>This will cause Bzip2 to be built using a different
+          <filename>Makefile</filename> file, in this case the
+          <filename>Makefile-libbz2_so</filename> file, which creates a dynamic
+          <filename class="libraryfile">libbz2.so</filename> library and links
+          the Bzip2 utilities against it.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile and test the package with:</para>
+
+<screen><userinput remap="make">make CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make PREFIX=$LFS/usr install</userinput></screen>
+
+    <para>Install the shared <command>bzip2</command> binary into the
+    <filename class="directory">/bin</filename> directory, make some necessary
+    symbolic links, and clean up:</para>
+
+<screen><userinput remap="install">cp -v bzip2-shared $LFS/bin/bzip2
+cp -av libbz2.so* $LFS/lib
+ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
+rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
+ln -sv bzip2 $LFS/bin/bunzip2
+ln -sv bzip2 $LFS/bin/bzcat</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in
+    <xref linkend="contents-bzip2" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 41 - 0
chapter07/changingowner.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-changingowner">
+  <?dbhtml filename="changingowner.html"?>
+
+  <title>Changing Ownership</title>
+
+  <note>
+    <para>The commands in the remainder of this book must be performed while
+    logged in as user <systemitem class="username">root</systemitem> and no
+    longer as user <systemitem class="username">lfs</systemitem>. Also, double
+    check that <envar>$LFS</envar> is set in <systemitem
+    class="username">root</systemitem>'s environment.</para>
+  </note>
+
+  <para>Currently, the whole directory hierarchy in <filename
+  class="directory">$LFS</filename>
+  is owned by the user <systemitem class="username">lfs</systemitem>, a user
+  that exists only on the host system. If the directories under <filename
+  class="directory">$LFS</filename> are kept as they are, the files are
+  owned by a user ID without a corresponding account. This is dangerous because
+  a user account created later could get this same user ID and would own all
+  the files under <filename class="directory">$LFS</filename>, thus exposing
+  these files to possible malicious manipulation.</para>
+
+  <para>To avoid this issue, you could add the <systemitem
+  class="username">lfs</systemitem> user to the new LFS system later when
+  creating the <filename>/etc/passwd</filename> file, taking care to assign it
+  the same user and group IDs as on the host system. Better yet, change the
+  ownership of the <filename class="directory">$LFS/*</filename> directories to
+  user <systemitem class="username">root</systemitem> by running the following
+  command:</para>
+
+<screen><userinput>chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}</userinput></screen>
+
+</sect1>

+ 17 - 31
chapter07/chapter07.xml

@@ -5,39 +5,25 @@
   %general-entities;
 ]>
 
-<chapter id="chapter-config" xreflabel="Chapter&nbsp;7">
+<chapter id="chapter-chroot-temporary-tools" xreflabel="Chapter&nbsp;7">
   <?dbhtml dir="chapter07"?>
   <?dbhtml filename="chapter07.html"?>
 
-  <title>System Configuration</title>
-
-  <!-- sysv -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
-
-  <!-- systemd -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introductiond.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="networkd.xml"/>
-
-  <!-- common -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
-
-  <!-- sysv -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
-
-  <!-- systemd -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="clock.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="consoled.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/>
-
-  <!-- common -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="etcshells.xml"/>
-
-  <!-- systemd -->
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd-custom.xml"/>
+  <title>Entering Chroot and Building Additional Tools</title>
+
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingdirs.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="createfiles.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++-pass2.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dejagnu.xml"/>
 
 </chapter>

+ 65 - 0
chapter07/chroot.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-chroot">
+  <?dbhtml filename="chroot.html"?>
+
+  <title>Entering the Chroot Environment</title>
+
+  <para>Now that all the packages which depend on themselves for being built
+  are on the system, it is time to enter the chroot environment to finish
+  installing the remaining temporary tools. This environment will be in use
+  also for installing the final system. As user <systemitem
+  class="username">root</systemitem>, run the following command to enter the
+  realm that is, at the moment, populated with only the temporary tools:</para>
+
+<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
+    HOME=/root                  \
+    TERM="$TERM"                \
+    PS1='(lfs chroot) \u:\w\$ ' \
+    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
+    /bin/bash --login +h</userinput></screen>
+
+  <para>The <parameter>-i</parameter> option given to the <command>env</command>
+  command will clear all variables of the chroot environment. After that, only
+  the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
+  <envar>PATH</envar> variables are set again. The
+  <parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
+  variable inside chroot to the same value as outside chroot. This variable is
+  needed for programs like <command>vim</command> and <command>less</command>
+  to operate properly.  If other variables are needed, such as
+  <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
+  them again.</para>
+
+  <para>From this point on, there is no need to use the
+  <envar>LFS</envar> variable anymore, because all work will be restricted
+  to the LFS file system.  This is because the Bash shell is told that
+  <filename class="directory">$LFS</filename> is now the root
+  (<filename class="directory">/</filename>) directory.</para>
+
+  <para>Notice that <filename class="directory">/tools/bin</filename> is not
+  anymore in the <envar>PATH</envar>. This means that a temporary tool will no longer be
+  used once its final version is installed. This occurs when the shell does not
+  <quote>remember</quote> the locations of executed binaries&mdash;for this
+  reason, hashing is switched off by passing the <parameter>+h</parameter> option
+  to <command>bash</command>.</para>
+
+  <para>Note that the <command>bash</command> prompt will say
+  <computeroutput>I have no name!</computeroutput> This is normal because the
+  <filename>/etc/passwd</filename> file has not been created yet.</para>
+
+  <note>
+    <para>It is important that all the commands throughout the remainder of this
+    chapter and the following chapters are run from within the chroot
+    environment. If you leave this environment for any reason (rebooting for
+    example), ensure that the virtual kernel filesystems are mounted as
+    explained in <xref linkend="ch-system-bindmount"/> and <xref
+    linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
+    with the installation.</para>
+  </note>
+
+</sect1>

+ 105 - 0
chapter07/coreutils.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-coreutils" role="wrap">
+  <?dbhtml filename="coreutils.html"?>
+
+  <sect1info condition="script">
+    <productname>coreutils</productname>
+    <productnumber>&coreutils-version;</productnumber>
+    <address>&coreutils-url;</address>
+  </sect1info>
+
+  <title>Coreutils-&coreutils-version;</title>
+
+  <indexterm zone="ch-tools-coreutils">
+    <primary sortas="a-Coreutils">Coreutils</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/coreutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&coreutils-ch5-sbu;</seg>
+        <seg>&coreutils-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Coreutils</title>
+
+    <para>Prepare Coreutils for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --host=$LFS_TGT                   \
+            --build=$(build-aux/config.guess) \
+            --enable-install-program=hostname \
+            --enable-no-install-program=kill,uptime</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><envar>--enable-install-program=hostname</envar></term>
+        <listitem>
+          <para>This enables the <command>hostname</command> binary to be built
+          and installed &ndash; it is disabled by default but is required by the
+          Perl test suite.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+<!--
+    <para>The above command refuses to install <filename>su</filename>
+    because the program cannot be installed setuid root as a non-privileged
+    user. By manually installing it, we can use it for running tests in the
+    final system as a non-privileged user. Install it with:</para>
+
+<screen><userinput remap="install">cp -v src/su /tools/bin</userinput></screen>
+-->
+    <para>Move programs to their final expected locations. Although this is
+    not necessary in this temporary environment, we must do so because some
+    programs harcode executable locations:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin
+mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin
+mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin
+mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
+mkdir -pv $LFS/usr/share/man/man8
+mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
+sed -i s/\"1\"/\"8\"/1 $LFS/usr/share/man/man8/chroot.8
+mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-coreutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 204 - 0
chapter07/createfiles.xml

@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-createfiles">
+  <?dbhtml filename="createfiles.html"?>
+
+  <title>Creating Essential Files and Symlinks</title>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/etc/passwd">/etc/passwd</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/etc/group">/etc/group</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
+  </indexterm>
+
+  <indexterm zone="ch-tools-createfiles">
+    <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
+  </indexterm>
+
+  <para>Historically, Linux maintains a list of the mounted file systems in the
+  file <filename>/etc/mtab</filename>. Modern kernels maintain this list
+  internally and exposes it to the user via the <filename
+  class="directory">/proc</filename> filesystem. To satisfy utilities that
+  expect the presence of <filename>/etc/mtab</filename>, create the following
+  symbolic link:</para>
+
+<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
+
+  <para>In order for user <systemitem class="username">root</systemitem> to be
+  able to login and for the name <quote>root</quote> to be recognized, there
+  must be relevant entries in the <filename>/etc/passwd</filename> and
+  <filename>/etc/group</filename> files.</para>
+
+  <para>Create the <filename>/etc/passwd</filename> file by running the following
+  command:</para>
+
+<screen revision="sysv"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
+EOF</userinput></screen>
+
+<screen revision="systemd"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
+systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false
+systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false
+systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false
+systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false
+systemd-network:x:76:76:systemd Network Management:/:/bin/false
+systemd-resolve:x:77:77:systemd Resolver:/:/bin/false
+systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false
+systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
+EOF</userinput></screen>
+
+  <para>The actual password for <systemitem class="username">root</systemitem>
+  (the <quote>x</quote> used here is just a placeholder) will be set later.</para>
+
+  <para>Create the <filename>/etc/group</filename> file by running the following
+  command:</para>
+
+<screen revision="sysv"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
+<literal>root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:</literal>
+EOF</userinput></screen>
+
+<screen revision="systemd"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
+<literal>root:x:0:
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+systemd-journal:x:23:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+systemd-bus-proxy:x:72:
+systemd-journal-gateway:x:73:
+systemd-journal-remote:x:74:
+systemd-journal-upload:x:75:
+systemd-network:x:76:
+systemd-resolve:x:77:
+systemd-timesync:x:78:
+systemd-coredump:x:79:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:</literal>
+EOF</userinput></screen>
+
+  <para>The created groups are not part of any standard&mdash;they are groups
+  decided on in part by the requirements of the Udev configuration in the next
+  chapter, and in part by common convention employed by a number of existing
+  Linux distributions. In addition, some test suites rely on specific users
+  or groups.  The Linux Standard Base (LSB, available at <ulink
+  url="http://www.linuxbase.org"/>) recommends only that, besides the group
+  <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
+  a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
+  present. All other group names and GIDs can be chosen freely by the system
+  administrator since well-written programs do not depend on GID numbers, but
+  rather use the group's name.</para>
+
+  <para>Some tests in <xref linkend="chapter-building-system"/> need a regular
+  user. We add this user here and delete this account at the end of that
+  chapter.</para>
+
+<screen><userinput>echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" &gt;&gt; /etc/passwd
+echo "tester:x:101:" &gt;&gt; /etc/group
+install -o tester -d /home/tester</userinput></screen>
+
+  <para>To remove the <quote>I have no name!</quote> prompt, start a new
+  shell. Since the
+  <filename>/etc/passwd</filename> and <filename>/etc/group</filename>
+  files have been created, user name and group name resolution will now
+  work:</para>
+
+<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
+
+  <para>Note the use of the <parameter>+h</parameter> directive. This tells
+  <command>bash</command> not to use its internal path hashing. Without this
+  directive, <command>bash</command> would remember the paths to binaries it has
+  executed. To ensure the use of the newly compiled binaries as soon as they are
+  installed, the <parameter>+h</parameter> directive will be used for the duration
+  of this chapter.</para>
+
+  <para>The <command>login</command>, <command>agetty</command>, and
+  <command>init</command> programs (and others) use a number of log
+  files to record information such as who was logged into the system and
+  when. However, these programs will not write to the log files if they
+  do not already exist. Initialize the log files and give them
+  proper permissions:</para>
+
+<screen><userinput>touch /var/log/{btmp,lastlog,faillog,wtmp}
+chgrp -v utmp /var/log/lastlog
+chmod -v 664  /var/log/lastlog
+chmod -v 600  /var/log/btmp</userinput></screen>
+
+  <para>The <filename>/var/log/wtmp</filename> file records all logins and
+  logouts. The <filename>/var/log/lastlog</filename> file records when each
+  user last logged in. The <filename>/var/log/faillog</filename> file records
+  failed login attempts.  The <filename>/var/log/btmp</filename> file records
+  the bad login attempts.</para>
+
+  <note><para>The <filename>/run/utmp</filename> file records the users that
+  are currently logged in.  This file is created dynamically in the boot
+  scripts.</para></note>
+
+</sect1>

+ 59 - 0
chapter07/creatingdirs.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-creatingdirs">
+  <?dbhtml filename="creatingdirs.html"?>
+
+  <title>Creating Directories</title>
+
+  <para>It is time to create the full structure in the LFS file system. Create
+  a standard directory tree by issuing the following commands:</para>
+
+<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
+mkdir -pv /{media/{floppy,cdrom},srv,var}
+install -dv -m 0750 /root
+install -dv -m 1777 /tmp /var/tmp
+mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
+mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
+mkdir -pv  /usr/{,local/}share/{misc,terminfo,zoneinfo}
+mkdir -pv /usr/{,local/}share/man/man{1..8}
+
+mkdir -v /var/{log,mail,spool}
+ln -sv /run /var/run
+ln -sv /run/lock /var/lock
+mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
+
+  <para>Directories are, by default, created with permission mode 755, but
+  this is not desirable for all directories. In the commands above, two
+  changes are made&mdash;one to the home directory of user <systemitem
+  class="username">root</systemitem>, and another to the directories for
+  temporary files.</para>
+
+  <para>The first mode change ensures that not just anybody can enter
+  the <filename class="directory">/root</filename> directory&mdash;the
+  same as a normal user would do with his or her home directory. The
+  second mode change makes sure that any user can write to the
+  <filename class="directory">/tmp</filename> and <filename
+  class="directory">/var/tmp</filename> directories, but cannot remove
+  another user's files from them. The latter is prohibited by the so-called
+  <quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
+
+  <sect2>
+    <title>FHS Compliance Note</title>
+
+    <para>The directory tree is based on the Filesystem Hierarchy Standard
+    (FHS) (available at <ulink
+    url="https://refspecs.linuxfoundation.org/fhs.shtml"/>).  The FHS also specifies
+    the optional existence of some directories such as <filename
+    class="directory">/usr/local/games</filename> and <filename
+    class="directory">/usr/share/games</filename>.  We create only the
+    directories that are needed. However, feel free to create these
+    directories.  </para>
+
+  </sect2>
+
+</sect1>

+ 96 - 0
chapter07/dejagnu.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-dejagnu" role="wrap">
+  <?dbhtml filename="dejagnu.html"?>
+
+  <sect1info condition="script">
+    <productname>dejagnu</productname>
+    <productnumber>&dejagnu-version;</productnumber>
+    <address>&dejagnu-url;</address>
+  </sect1info>
+
+  <title>DejaGNU-&dejagnu-version;</title>
+
+  <indexterm zone="ch-tools-dejagnu">
+    <primary sortas="a-DejaGNU">DejaGNU</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The <application>DejaGnu</application> package contains a framework for running test
+      suites on GNU tools. It is written in <command>expect</command>, which itself
+      uses <application>Tcl</application> (Tool Command Language).</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&dejagnu-ch5-sbu;</seg>
+        <seg>&dejagnu-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of DejaGNU</title>
+
+    <para>Prepare DejaGNU for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr
+makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi
+makeinfo --plaintext       -o doc/dejagnu.txt  doc/dejagnu.texi</userinput></screen>
+
+    <para>Build and install the package:</para>
+
+<screen><userinput remap="install">make install
+install -v -dm755  /usr/share/doc/dejagnu-&dejagnu-version;
+install -v -m644   doc/dejagnu.{html,txt} \
+                   /usr/share/doc/dejagnu-&dejagnu-version;</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+  </sect2>
+
+
+  <sect2 id="contents-dejagnu" role="content">
+    <title>Contents of DejaGNU</title>
+
+    <segmentedlist>
+      <segtitle>Installed program</segtitle>
+
+      <seglistitem>
+        <seg>runtest</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="runtest">
+        <term><command>runtest</command></term>
+        <listitem>
+          <para>A wrapper script that locates the proper
+          <command>expect</command> shell and then runs DejaGNU</para>
+          <indexterm zone="ch-tools-dejagnu runtest">
+            <primary sortas="b-runtest">runtest</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 68 - 0
chapter07/diffutils.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-diffutils" role="wrap">
+  <?dbhtml filename="diffutils.html"?>
+
+  <sect1info condition="script">
+    <productname>diffutils</productname>
+    <productnumber>&diffutils-version;</productnumber>
+    <address>&diffutils-url;</address>
+  </sect1info>
+
+  <title>Diffutils-&diffutils-version;</title>
+
+  <indexterm zone="ch-tools-diffutils">
+    <primary sortas="a-Diffutils">Diffutils</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/diffutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&diffutils-ch5-sbu;</seg>
+        <seg>&diffutils-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Diffutils</title>
+
+    <para>Prepare Diffutils for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-diffutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 139 - 0
chapter07/expect.xml

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-expect" role="wrap">
+  <?dbhtml filename="expect.html"?>
+
+  <sect1info condition="script">
+    <productname>expect</productname>
+    <productnumber>&expect-version;</productnumber>
+    <address>&expect-url;</address>
+  </sect1info>
+
+  <title>Expect-&expect-version;</title>
+
+  <indexterm zone="ch-tools-expect">
+    <primary sortas="a-Expect">Expect</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The <application>Expect</application> package contains tools for
+    automating, via scripted dialogues, interactive applications such as
+    <command>telnet</command>, <command>ftp</command>,
+    <command>passwd</command>, <command>fsck</command>,
+    <command>rlogin</command>, and <command>tip</command>.
+    <application>Expect</application> is also useful for testing these same
+    applications as well as easing all sorts of tasks that are prohibitively
+    difficult with anything else. The <application>DejaGnu</application>
+    framework is written in <application>Expect</application>.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&expect-ch5-sbu;</seg>
+        <seg>&expect-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Expect</title>
+
+    <para>Prepare Expect for compilation:</para>
+
+<screen><userinput remap="configure">
+./configure --prefix=/usr           \
+            --with-tcl=/usr/lib     \
+            --enable-shared         \
+            --mandir=/usr/share/man \
+            --with-tclinclude=/usr/include</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--with-tcl=/usr/lib</parameter></term>
+        <listitem>
+          <para>This parameter is needed to tell the
+          <command>configure</command> where the
+          <command>tclConfig.sh</command> is located.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-tclinclude=/usr/include</parameter></term>
+        <listitem>
+          <para>This explicitly tells Expect where to find Tcl's internal
+          headers. Using this option avoids conditions where
+          <command>configure</command> fails because it cannot automatically
+          discover the location of Tcl's headers.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Build the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install
+ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-expect" role="content">
+    <title>Contents of Expect</title>
+
+    <segmentedlist>
+      <segtitle>Installed program</segtitle>
+      <segtitle>Installed library</segtitle>
+
+      <seglistitem>
+        <seg>expect</seg>
+        <seg>libexpect-&expect-lib-version;.so</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="expect">
+        <term><command>expect</command></term>
+        <listitem>
+          <para>Communicates with other interactive programs according
+          to a script</para>
+          <indexterm zone="ch-tools-expect expect">
+            <primary sortas="b-expect">expect</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="libexpect">
+        <term><filename class="libraryfile">libexpect-&expect-lib-version;.so</filename></term>
+        <listitem>
+          <para>Contains functions that allow Expect to be used as a Tcl
+          extension or to be used directly from C or C++ (without Tcl)</para>
+          <indexterm zone="ch-tools-expect libexpect">
+            <primary sortas="c-libexpect-&expect-lib-version;">libexpect-&expect-lib-version;</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 73 - 0
chapter07/file.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-file" role="wrap">
+  <?dbhtml filename="file.html"?>
+
+  <sect1info condition="script">
+    <productname>file</productname>
+    <productnumber>&file-version;</productnumber>
+    <address>&file-url;</address>
+  </sect1info>
+
+  <title>File-&file-version;</title>
+
+  <indexterm zone="ch-tools-file">
+    <primary sortas="a-File">File</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/file.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&file-ch5-sbu;</seg>
+        <seg>&file-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of File</title>
+
+    <para>Prepare File for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT</userinput></screen>
+
+<!-- devs: if using - -build here, the build system wants to compile
+     the signature file with "file" on the build system, but stops if it is not
+     the same version. One possibility would be to build "file" on the build
+     system first, but it is simpler to have the system think it is not
+     cross-compiling, and use the just built "file". -->
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in<!-- TODO
+    <xref linkend="contents-file" role="."/>      --></para>
+
+  </sect2>
+
+</sect1>

+ 75 - 0
chapter07/findutils.xml

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-findutils" role="wrap">
+  <?dbhtml filename="findutils.html"?>
+
+  <sect1info condition="script">
+    <productname>findutils</productname>
+    <productnumber>&findutils-version;</productnumber>
+    <address>&findutils-url;</address>
+  </sect1info>
+
+  <title>Findutils-&findutils-version;</title>
+
+  <indexterm zone="ch-tools-findutils">
+    <primary sortas="a-Findutils">Findutils</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/findutils.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&findutils-ch5-sbu;</seg>
+        <seg>&findutils-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Findutils</title>
+
+    <para>Prepare Findutils for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <para>Move the excutable to its final expected location:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/find $LFS/bin
+sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-findutils" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 88 - 0
chapter07/flex.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-flex" role="wrap">
+  <?dbhtml filename="flex.html"?>
+
+  <sect1info condition="script">
+    <productname>flex</productname>
+    <productnumber>&flex-version;</productnumber>
+    <address>&flex-url;</address>
+  </sect1info>
+
+  <title>Flex-&flex-version;</title>
+
+  <indexterm zone="ch-tools-flex">
+    <primary sortas="a-Flex">Flex</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/flex.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&flex-ch5-sbu;</seg>
+        <seg>&flex-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Flex</title>
+
+    <para>Prepare Flex for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
+
+    <!--
+    <variablelist>
+      <title>The meaning of the new configure option:</title>
+
+      <varlistentry>
+        <term><parameter>- -disable-bootstrap</parameter></term>
+	<listitem>
+          <para>Normally, building flex is done in two stages. A first
+	  programs, which is used to generate the source of a second one,
+	  which is then compiled. When using cross-compilation, the first
+	  program is generated on the build system. However, due to a bug
+	  in configure, the presence of some function is tested only on the
+	  host system. If this function is not found on the build system, the
+	  build fails. This can be prevented by disabling the two stage
+	  build.</para>
+	</listitem>
+      </varlistentry>
+    </variablelist>
+    -->
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-flex" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 74 - 0
chapter07/gawk.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gawk" role="wrap">
+  <?dbhtml filename="gawk.html"?>
+
+  <sect1info condition="script">
+    <productname>gawk</productname>
+    <productnumber>&gawk-version;</productnumber>
+    <address>&gawk-url;</address>
+  </sect1info>
+
+  <title>Gawk-&gawk-version;</title>
+
+  <indexterm zone="ch-tools-gawk">
+    <primary sortas="a-Gawk">Gawk</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/gawk.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gawk-ch5-sbu;</seg>
+        <seg>&gawk-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Gawk</title>
+
+    <para>First, ensure some unneeded files are not installed:</para>
+
+<screen><userinput remap="pre">sed -i 's/extras//' Makefile.in</userinput></screen>
+
+    <para>Prepare Gawk for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(./config.guess)</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gawk" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 208 - 0
chapter07/gcc-pass1.xml

@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
+  <?dbhtml filename="gcc-pass1.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-pass1</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>GCC-&gcc-version; - Pass 1</title>
+
+  <indexterm zone="ch-tools-gcc-pass1">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, pass 1</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/gcc.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gcc-ch5p1-sbu;</seg>
+        <seg>&gcc-ch5p1-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Cross GCC</title>
+
+    <para>GCC requires the GMP, MPFR and MPC packages. As these packages may
+    not be included in your host distribution, they will be built with
+    GCC.  Unpack each package into the GCC source directory and rename the
+    resulting directories so the GCC build procedures will automatically
+    use them:</para>
+
+    <note><para>There are frequent misunderstandings about this chapter.  The
+    procedures are the same as every other chapter as explained earlier (<xref
+    linkend='buildinstr'/>).  First extract the gcc tarball from the sources
+    directory and then change to the directory created.  Only then should you
+    proceed with the instructions below.</para></note>
+
+<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc</userinput></screen>
+
+    <para>On x86_64 hosts, set the default directory name for
+    64-bit libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+  x86_64)
+    sed -e '/m64=/s/lib64/lib/' \
+        -i.orig gcc/config/i386/t-linux64
+ ;;
+esac</userinput></screen>
+
+    <para>The GCC documentation recommends building GCC 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare GCC for compilation:</para>
+
+<screen><userinput remap="configure">../configure                                       \
+    --target=$LFS_TGT                              \
+    --prefix=$LFS/tools                            \
+    --with-glibc-version=2.11                      \
+    --with-sysroot=$LFS                            \
+    --with-newlib                                  \
+    --without-headers                              \
+    --enable-initfini-array                        \
+    --disable-nls                                  \
+    --disable-shared                               \
+    --disable-multilib                             \
+    --disable-decimal-float                        \
+    --disable-threads                              \
+    --disable-libatomic                            \
+    --disable-libgomp                              \
+    --disable-libquadmath                          \
+    --disable-libssp                               \
+    --disable-libvtv                               \
+    --disable-libstdcxx                            \
+    --enable-languages=c,c++</userinput></screen>
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--with-glibc-version=2.11</parameter></term>
+        <listitem>
+          <para>This option ensures the package will be compatible with the host's
+          version of glibc.  It is set to the minimum glibc requirement 
+          specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-newlib</parameter></term>
+        <listitem>
+          <para>Since a working C library is not yet available, this ensures
+          that the inhibit_libc constant is defined when building libgcc. This prevents
+          the compiling of any code that requires libc support.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-headers</parameter></term>
+        <listitem>
+          <para>When creating a complete cross-compiler, GCC requires
+          standard headers compatible with the target system. For our
+          purposes these headers will not be needed. This switch prevents
+          GCC from looking for them.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-shared</parameter></term>
+        <listitem>
+          <para>This switch forces GCC to link its internal libraries
+	  statically. We need this because the shared libraries require glibc,
+	  which is not yet installed on the target system.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-decimal-float, --disable-threads,
+              --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
+        --disable-libquadmath, --disable-libssp, --disable-libvtv,
+        --disable-libstdcxx</parameter></term>
+        <listitem>
+          <para>These switches disable support for the decimal floating point
+          extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
+          libvtv, and the C++ standard library respectively. These features
+          will fail to compile when building a cross-compiler and are not
+          necessary for the task of cross-compiling the temporary libc.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-multilib</parameter></term>
+        <listitem>
+          <para>On x86_64, LFS does not yet support a multilib configuration.
+          This switch is harmless for x86.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-languages=c,c++</parameter></term>
+        <listitem>
+          <para>This option ensures that only the C and C++ compilers are built.
+          These are the only languages needed now.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile GCC by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+    <screen><userinput remap="install">make install</userinput></screen>
+
+    <para>This build of GCC has installed a couple of internal system
+    headers.  Normally one of them, <filename>limits.h</filename>, would in turn
+    include the corresponding system <filename>limits.h</filename> header, in
+    this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
+    time of this build of gcc <filename>$LFS/usr/include/limits.h</filename>
+    does not exist, so the internal header that has just been installed is a
+    partial, self-contained file and does not include the extended features of
+    the system header. This is adequate for building glibc, but the full
+    internal header will be needed later.  Create a full version of the internal
+    header using a command that is identical to what the GCC build system does
+    in normal circumstances:</para>
+
+<screen><userinput remap="install">cd ..
+cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
+  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 160 - 0
chapter07/gcc-pass2.xml

@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gcc-pass2" role="wrap">
+  <?dbhtml filename="gcc-pass2.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-pass2</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>GCC-&gcc-version; - Pass 2</title>
+
+  <indexterm zone="ch-tools-gcc-pass2">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, pass 2</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/gcc.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gcc-ch5p2-sbu;</seg>
+        <seg>&gcc-ch5p2-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of GCC</title>
+
+    <para>As in the first build of GCC, the GMP, MPFR, and MPC packages are
+    required. Unpack the tarballs and move them into the required directory
+    names:</para>
+
+<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc</userinput></screen>
+
+    <para>If building on x86_64, change the default directory name for 64-bit
+    libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+  x86_64)
+    sed -e '/m64=/s/lib64/lib/' \
+        -i.orig gcc/config/i386/t-linux64
+  ;;
+esac</userinput></screen>
+
+    <para>Fix an issue with GCC-10.1 when building with a cross
+    compiler:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
+
+    <para>Create a separate build directory again:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Create a symlink that allos libgcc to be built with posix threads
+    support:</para>
+
+<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
+ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
+
+    <para>Before starting to build GCC, remember to unset any environment
+    variables that override the default optimization flags.</para>
+
+    <para>Now prepare GCC for compilation:</para>
+
+<screen><userinput remap="configure">../configure                                       \
+    --build=$(../config.guess)                     \
+    --host=$LFS_TGT                                \
+    --prefix=/usr                                  \
+    CC_FOR_TARGET=$LFS_TGT-gcc                     \
+    --with-build-sysroot=$LFS                      \
+    --enable-initfini-array                        \
+    --disable-nls                                  \
+    --disable-multilib                             \
+    --disable-decimal-float                        \
+    --disable-libatomic                            \
+    --disable-libgomp                              \
+    --disable-libquadmath                          \
+    --disable-libssp                               \
+    --disable-libvtv                               \
+    --disable-libstdcxx                            \
+    --enable-languages=c,c++</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title><!-- WIP -->
+
+      <varlistentry>
+        <term><parameter>-with-build-sysroot=$LFS</parameter></term>
+        <listitem>
+          <para>Normally, using <parameter>--host=</parameter> ensures that
+          a cross-compiler is used for building gcc, and that compiler knows
+          that it has to look for headers and libraries in <filename
+          class="directory">$LFS</filename>. But the build system of GCC uses
+          other tools, which are not aware of this location. This switch is
+          needed to have them find the needed files in <filename
+          class="directory">$LFS</filename>, and not on the host.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-initfini-array</parameter></term>
+        <listitem>
+          <para>This option is automatically enabled when building a native
+          compiler with a native compiler on x86. But here, we build with
+          a cross compiler, so we need to explicitely set this option.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <para>As a finishing touch, create a symlink. Many programs and scripts
+    run <command>cc</command> instead of <command>gcc</command>, which is
+    used to keep programs generic and therefore usable on all kinds of UNIX
+    systems where the GNU C compiler is not always installed. Running
+    <command>cc</command> leaves the system administrator free to decide
+    which C compiler to install:</para>
+
+<screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 120 - 0
chapter07/generalinstructions.xml

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-generalinstructions">
+  <?dbhtml filename="generalinstructions.html"?>
+
+  <title>General Compilation Instructions</title>
+
+  <para>When building packages there are several assumptions made within
+  the instructions:</para>
+
+  <itemizedlist>
+
+  <listitem>
+    <para>Several of the packages are patched before compilation, but only when
+    the patch is needed to circumvent a problem. A patch is often needed in
+    both this and the next chapter, but sometimes in only one or the other.
+    Therefore, do not be concerned if instructions for a downloaded patch seem
+    to be missing.  Warning messages about <emphasis>offset</emphasis> or
+    <emphasis>fuzz</emphasis> may also be encountered when applying a patch. Do
+    not worry about these warnings, as the patch was still successfully
+    applied.</para>
+  </listitem>
+
+  <listitem>
+    <para>During the compilation of most packages, there will be several
+    warnings that scroll by on the screen. These are normal and can safely be
+    ignored.  These warnings are as they appear&mdash;warnings about
+    deprecated, but not invalid, use of the C or C++ syntax. C standards change
+    fairly often, and some packages still use the older standard. This is not a
+    problem, but does prompt the warning.</para>
+  </listitem>
+
+  <listitem>
+    <para>Check one last time that the <envar>LFS</envar> environment variable
+    is set up properly:</para>
+
+<screen role="nodump"><userinput>echo $LFS</userinput></screen>
+
+    <para>Make sure the output shows the path to the LFS partition's mount
+    point, which is <filename class="directory">/mnt/lfs</filename>, using our
+    example.</para>
+  </listitem>
+
+  <listitem>
+
+    <para>Finally, two important items must be emphasized:</para>
+
+    <important>
+
+      <para>The build instructions assume that the <xref
+      linkend='ch-partitioning-hostreqs'/>, including symbolic links, have
+      been set properly:</para>
+
+      <itemizedlist role='important'>
+
+        <listitem override='bullet'><para><command>bash</command> is the shell
+        in use.</para></listitem>
+
+        <listitem override='bullet'><para><command>sh</command> is a symbolic
+        link to <command>bash</command>.</para></listitem>
+
+        <listitem override='bullet'><para><command>/usr/bin/awk</command> is a
+        symbolic link to <command>gawk</command>.</para></listitem>
+
+        <listitem override='bullet'><para><command>/usr/bin/yacc</command> is a
+        symbolic link to <command>bison</command> or a small script that
+        executes bison.</para></listitem>
+
+      </itemizedlist>
+    </important>
+
+    <important>
+      <para>To re-emphasize the build process:</para>
+
+      <orderedlist numeration="arabic" spacing="compact">
+        <listitem>
+          <para>Place all the sources and patches in a directory that will be
+          accessible from the chroot environment such as
+      	  <filename class="directory">/mnt/lfs/sources/</filename>.<!-- Do
+          <emphasis>not</emphasis> put sources in
+	  <filename class="directory">/mnt/lfs/tools/</filename>. --></para>
+        </listitem>
+        <listitem>
+          <para>Change to the sources directory.</para>
+        </listitem>
+        <listitem id='buildinstr' xreflabel='Package build instructions'>
+          <para>For each package:</para>
+          <orderedlist numeration="loweralpha" spacing="compact">
+            <listitem>
+              <para>Using the <command>tar</command> program, extract the package
+              to be built.  In Chapter&nbsp;5, ensure you are the <emphasis>lfs</emphasis>
+              user when extracting the package.</para>
+            </listitem>
+            <listitem>
+              <para>Change to the directory created when the package was
+              extracted.</para>
+            </listitem>
+            <listitem>
+              <para>Follow the book's instructions for building the package.</para>
+            </listitem>
+            <listitem>
+              <para>Change back to the sources directory.</para>
+            </listitem>
+            <listitem>
+              <para>Delete the extracted source directory unless instructed otherwise.</para>
+            </listitem>
+          </orderedlist>
+        </listitem>
+      </orderedlist>
+    </important>
+  </listitem>
+
+  </itemizedlist>
+
+</sect1>

+ 85 - 0
chapter07/gettext.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gettext" role="wrap">
+  <?dbhtml filename="gettext.html"?>
+
+  <sect1info condition="script">
+    <productname>gettext</productname>
+    <productnumber>&gettext-version;</productnumber>
+    <address>&gettext-url;</address>
+  </sect1info>
+
+  <title>Gettext-&gettext-version;</title>
+
+  <indexterm zone="ch-tools-gettext">
+    <primary sortas="a-Gettext">Gettext</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/gettext.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gettext-ch5-sbu;</seg>
+        <seg>&gettext-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Gettext</title>
+
+    <para>For our temporary set of tools, we only need to install
+    three programs from Gettext.</para>
+
+    <para>Prepare Gettext for compilation:</para>
+
+<screen><userinput remap="configure">./configure --disable-shared</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure option:</title>
+
+      <varlistentry>
+        <term><parameter>--disable-shared</parameter></term>
+        <listitem>
+          <para>We do not need to install any of the shared Gettext libraries at
+          this time, therefore there is no need to build them.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
+    <command>xgettext</command> programs:</para>
+
+<screen><userinput remap="install">cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gettext" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 230 - 0
chapter07/glibc.xml

@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-glibc" role="wrap">
+  <?dbhtml filename="glibc.html"?>
+
+  <sect1info condition="script">
+    <productname>glibc</productname>
+    <productnumber>&glibc-version;</productnumber>
+    <address>&glibc-url;</address>
+  </sect1info>
+
+  <title>Glibc-&glibc-version;</title>
+
+  <indexterm zone="ch-tools-glibc">
+    <primary sortas="a-Glibc">Glibc</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/glibc.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&glibc-ch5-sbu;</seg>
+        <seg>&glibc-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Glibc</title>
+
+    <para>First, create two symbolic links, which are needed for proper
+    operation of the dynamic library loader:</para>
+
+<screen><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
+ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
+
+    <para>Some of the Glibc programs use the non-FHS compliant
+    <filename class="directory">/var/db</filename> directory to store their
+    runtime data. Apply the following patch to make such programs store their
+    runtime data in the FHS-compliant locations:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen>
+
+    <para>The Glibc documentation recommends building Glibc 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Next, prepare Glibc for compilation:</para>
+
+<screen><userinput remap="configure">../configure                             \
+      --prefix=/usr                      \
+      --host=$LFS_TGT                    \
+      --build=$(../scripts/config.guess) \
+      --enable-kernel=&min-kernel;                \
+      --with-headers=$LFS/usr/include    \
+      libc_cv_slibdir=/lib</userinput></screen>
+<!--
+      libc_cv_forced_unwind=yes          \
+      libc_cv_c_cleanup=yes</userinput></screen> -->
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
+        <listitem>
+          <para>The combined effect of these switches is that Glibc's build system
+          configures itself to be cross-compiled, using the cross-linker and
+          cross-compiler in <filename class="directory">/tools</filename>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
+        <listitem>
+          <para>This tells Glibc to compile the library with support
+          for &min-kernel; and later Linux kernels.  Workarounds for older
+          kernels are not enabled.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-headers=$LFS/usr/include</parameter></term>
+        <listitem>
+          <para>This tells Glibc to compile itself against the headers recently
+          installed to the usr/include directory, so that it knows exactly what
+          features the kernel has and can optimize itself accordingly.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>libc_cv_slibdir=/lib</parameter></term>
+        <listitem>
+          <para>This ensures that the library is installed in /lib instead
+          of the default /lib64 on 64 bit machines.</para>
+        </listitem>
+      </varlistentry>
+<!--
+      <varlistentry>
+        <term><parameter>libc_cv_c_cleanup=yes</parameter></term>
+        <listitem>
+          <para>Similarly, we pass libc_cv_c_cleanup=yes through to the
+          <command>configure</command> script so that the test is skipped and C
+          cleanup handling support is configured.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>libc_cv_ctors_header=yes</parameter></term>
+        <listitem>
+          <para>Similarly, we pass libc_cv_ctors_header=yes through to the
+          <command>configure</command> script so that the test is skipped and
+          gcc constructor support is configured.</para>
+        </listitem>
+      </varlistentry>-->
+
+    </variablelist>
+
+    <para>During this stage the following warning might appear:</para>
+
+    <blockquote>
+<screen><computeroutput>configure: WARNING:
+*** These auxiliary programs are missing or
+*** incompatible versions: msgfmt
+*** some features will be disabled.
+*** Check the INSTALL file for required versions.</computeroutput></screen>
+    </blockquote>
+
+    <para>The missing or incompatible <command>msgfmt</command> program is
+    generally harmless. This <command>msgfmt</command> program is part of the
+    Gettext package which the host distribution should provide.</para>
+
+    <note><para>There have been reports that this package may fail when 
+    building as a "parallel make".  If this occurs, rerun the make command
+    with a "-j1" option.</para></note>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the <command>make install</command> option:</title>
+
+      <varlistentry>
+        <term><parameter>DESTDIR=$LFS</parameter></term>
+        <listitem>
+          <para>The <envar>DESTDIR</envar> make variable is used by almost all
+          packages to define the location where the package should be
+          installed. If it is not set, it defaults to the root (<filename
+          class="directory">/</filename>) directory. Here we specify that
+          the package be installed in <filename class="directory">$LFS
+          </filename>, which will become the root after <xref linkend=
+          "ch-tools-chroot"/>.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <caution>
+      <para>At this point, it is imperative to stop and ensure that the basic
+      functions (compiling and linking) of the new toolchain are working as
+      expected. To perform a sanity check, run the following commands:</para>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc dummy.c
+readelf -l a.out | grep '/ld-linux'</userinput></screen>
+
+      <para>If everything is working correctly, there should be no errors,
+      and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
+
+      <para>Note that for 32-bit machines, the interpreter name will be
+      <filename>/lib/ld-linux.so.2</filename>.</para>
+
+      <para>If the output is not shown as above or there was no output at all,
+      then something is wrong. Investigate and retrace the steps to find out
+      where the problem is and correct it. This issue must be resolved before
+      continuing on.</para>
+
+      <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+    </caution>
+
+    <note><para>Building packages in the next sections will serve as an
+    additional check that the toolchain has been built properly. If some
+    package, especially binutils-pass2 or gcc-pass2, fails to build, it is
+    an indication that something has gone wrong with the
+    previous Binutils, GCC, or Glibc installations.</para></note>
+
+    <para>Now that our cross-toolchain is complete, finalize the installation
+    of the limits.h header. For doing so, run an utility provided by the GCC
+    developers:</para>
+
+<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-glibc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 70 - 0
chapter07/grep.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-grep" role="wrap">
+  <?dbhtml filename="grep.html"?>
+
+  <sect1info condition="script">
+    <productname>grep</productname>
+    <productnumber>&grep-version;</productnumber>
+    <address>&grep-url;</address>
+  </sect1info>
+
+  <title>Grep-&grep-version;</title>
+
+  <indexterm zone="ch-tools-grep">
+    <primary sortas="a-Grep">Grep</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/grep.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&grep-ch5-sbu;</seg>
+        <seg>&grep-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Grep</title>
+
+    <para>Prepare Grep for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --bindir=/bin</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-grep" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 72 - 0
chapter07/gzip.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-gzip" role="wrap">
+  <?dbhtml filename="gzip.html"?>
+
+  <sect1info condition="script">
+    <productname>gzip</productname>
+    <productnumber>&gzip-version;</productnumber>
+    <address>&gzip-url;</address>
+  </sect1info>
+
+  <title>Gzip-&gzip-version;</title>
+
+  <indexterm zone="ch-tools-gzip">
+    <primary sortas="a-Gzip">Gzip</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/gzip.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&gzip-ch5-sbu;</seg>
+        <seg>&gzip-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Gzip</title>
+
+    <para>Prepare Gzip for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <para>Move the excutable to its final expected location:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gzip" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 14 - 210
chapter07/introduction.xml

@@ -5,221 +5,25 @@
   %general-entities;
 ]>
 
-<sect1 id="ch-config-introduction" revision="sysv">
+<sect1 id="ch-tools-introduction">
   <?dbhtml filename="introduction.html"?>
 
   <title>Introduction</title>
 
-    <para>Booting a Linux system involves several tasks.  The process must
-    mount both virtual and real file systems, initialize devices, activate swap,
-    check file systems for integrity, mount any swap partitions or files, set
-    the system clock, bring up networking, start any daemons required by the
-    system, and accomplish any other custom tasks needed by the user.  This
-    process must be organized to ensure the tasks are performed in the correct
-    order but, at the same time, be executed as fast as possible.</para>
+  <para>This chapter shows how to build a minimal Linux system.
+  This system will contain just enough tools to start constructing the final
+  LFS system in <xref linkend="chapter-building-system"/> and allow a working
+  environment with more user convenience than a minimum environment would.</para>
 
-<!--    <para>In the packages that were installed in Chapter&nbsp;6, there were two
-    different boot systems installed.  LFS provides the ability to easily
-    select which system the user wants to use and to compare and contrast the
-    two systems by actually running each system on the local computer.  The
-    advantages and disadvantages of these systems is presented below.</para>-->
-
-  <sect2 id='sysv-desc'>
-    <title>System V</title>
-
-    <para>System V is the classic boot process that has been used in Unix and
-    Unix-like systems such as Linux since about 1983.  It consists of a small
-    program, <command>init</command>, that sets up basic programs such as
-    <command>login</command> (via getty) and runs a script.  This script,
-    usually named <command>rc</command>,  controls the execution of a set of
-    additional scripts that perform the tasks required to initialize the
-    system.</para>
-
-    <para>The <command>init</command> program is controlled by the 
-    <filename>/etc/inittab</filename> file and is organized into run levels that
-    can be run by the user:</para>
-
-<literallayout>
-0 &mdash; halt
-1 &mdash; Single user mode
-2 &mdash; Multiuser, without networking
-3 &mdash; Full multiuser mode
-4 &mdash; User definable
-5 &mdash; Full multiuser mode with display manager
-6 &mdash; reboot
-</literallayout>
-
-    <para>The usual default run level is 3 or 5.</para>
-
-    <bridgehead renderas="sect3">Advantages</bridgehead>
-
-    <itemizedlist>
-      <listitem>
-          <para>Established, well understood system.</para>
-      </listitem>
-
-      <listitem>
-          <para>Easy to customize.</para>
-      </listitem>
-
-    </itemizedlist>
-
-
-    <bridgehead renderas="sect3">Disadvantages</bridgehead>
-
-    <itemizedlist>
-      <listitem>
-          <para>Slower to boot.  A medium speed base LFS system 
-          takes 8-12 seconds where the boot time is measured from the 
-          first kernel message to the login prompt.  Network 
-          connectivity is typically established about 2 seconds 
-          after the login prompt.</para>
-      </listitem>
-
-      <listitem>
-          <para>Serial processing of boot tasks. This is related to the previous
-          point.  A delay in any process such as a file system check, will
-          delay the entire boot process.</para>
-      </listitem>
-
-      <listitem>
-          <para>Does not directly support advanced features like
-          control groups (cgroups), and per-user fair share scheduling.</para>
-      </listitem>
-
-      <listitem>
-          <para>Adding scripts requires manual, static sequencing decisions.</para>
-      </listitem>
-
-    </itemizedlist>
-
-  </sect2>
-<!--
-  <sect2 id='sysd-desc'>
-    <title>Systemd</title>
-
-    <para>Systemd is a group of interconnected programs that handles system and
-    individual process requests.  It provides a dependency system between
-    various entities called "units".  It automatically addresses dependencies
-    between units and can execute several startup tasks in parallel.  It
-    provides login, inetd, logging, time, and networking services. </para>
-
-    <bridgehead renderas="sect3">Advantages</bridgehead>
-
-    <itemizedlist>
-      <listitem>
-          <para>Used on many established distributions by default.</para>
-      </listitem>
-
-      <listitem>
-          <para>There is extensive documentation. 
-          See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>
-      </listitem>
-
-      <listitem>
-          <para>Parallel execution of boot processes. A medium speed
-          base LFS system takes 6-10 seconds from kernel start to a 
-          login prompt.  Network connectivity is typically established 
-          about 2 seconds after the login prompt.  More complex startup
-          procedures may show a greater speedup when compared to System V.</para>
-      </listitem>
-
-      <listitem>
-          <para>Implements advanced features such as control groups to 
-          manage related processes.</para>
-      </listitem>
-
-      <listitem>
-          <para>Maintains backward compatibility with System V programs 
-          and scripts.</para>
-      </listitem>
-    </itemizedlist>
-
-    <bridgehead renderas="sect3">Disadvantages</bridgehead>
-
-    <itemizedlist>
-      <listitem>
-          <para>There is a substantial learning curve.</para>
-      </listitem>
-
-      <listitem>
-          <para>Some advanced features such as dbus or cgroups cannot be
-          disabled if they are not otherwise needed.</para>
-      </listitem>
-
-      <listitem>
-          <para>Although implemented as several executable programs
-          the user cannot choose to implement only the portions desired.</para>
-      </listitem>
-
-      <listitem>
-          <para>Due to the nature of using compiled programs, systemd is
-          more difficult to debug.</para>
-      </listitem>
-
-      <listitem>
-          <para>Logging is done in a binary format.  Extra tools must
-          be used to process logs or additional processes must be implemented
-          to duplicate traditional logging programs.</para>
-      </listitem>
-
-    </itemizedlist>
-
-  </sect2>
--->
+  <para>There are two steps in building this minimal system. The first step
+  is to build a new and host-independent toolchain (compiler, assembler,
+  linker, libraries, and a few useful utilities).  The second step uses this
+  toolchain to build the other essential tools.</para>
 <!--
-  <sect2 id='sysv'>
-    <title>Selecting a Boot Method</title>
-
-    <para>Selecting a boot method in LFS is relatively easy.  
-    Both systems are installed side-by-side.  The only task needed is to
-    ensure the files that are needed by the system have the correct names.
-    The following scripts do that.</para>
-
-<screen><userinput remap="install">cat &gt; /usr/sbin/set-systemd &lt;&lt; "EOF"
-#! /bin/bash
-
-ln -svfn init-systemd   /sbin/init
-ln -svfn init.d-systemd /etc/init.d
-
-for tool in halt poweroff reboot runlevel shutdown telinit; do
-  ln -sfvn  ${tool}-systemd   /sbin/${tool}
-  ln -svfn  ${tool}-systemd.8 /usr/share/man/man8/${tool}.8
-done
-
-echo "Now reboot with /sbin/reboot-sysv"
-EOF
-
-chmod 0744 /usr/sbin/set-systemd
-
-cat &gt; /usr/sbin/set-sysv &lt;&lt; "EOF"
-#! /bin/bash
-
-ln -sfvn init-sysv    /sbin/init
-ln -svfn init.d-sysv  /etc/init.d
-
-for tool in halt poweroff reboot runlevel shutdown telinit; do
-  ln -sfvn  ${tool}-sysv   /sbin/${tool}
-  ln -svfn  ${tool}-sysv.8 /usr/share/man/man8/${tool}.8
-done
-
-echo "Now reboot with /sbin/reboot-systemd"
-EOF
-
-chmod 0744 /usr/sbin/set-sysv</userinput></screen>
-
-  <note><para>The comment about the correct command to reboot in the 
-  above scripts is correct.  The reboot command for the current boot
-  system must be used after the script changes the default reboot command.
-  </para></note>
-
-  <para>Now set the desired boot system.  The default is System V:</para>
-
-<screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>
-
-  <para>Changing the boot system can be done at any time by running the 
-  appropriate script above and rebooting.</para>
-
-  </sect2>
+  <para>The files compiled in this chapter will be installed under the
+  <filename class="directory">$LFS</filename> directory to keep them
+  separate from the files installed in the next chapter and the host
+  production directories. Since the packages compiled here are temporary,
+  we do not want them to pollute the soon-to-be LFS system.</para>
 -->
 </sect1>

+ 115 - 0
chapter07/kernfs.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-kernfs">
+  <?dbhtml filename="kernfs.html"?>
+
+  <title>Preparing Virtual Kernel File Systems</title>
+
+  <indexterm zone="ch-tools-kernfs">
+    <primary sortas="e-/dev/">/dev/*</primary>
+  </indexterm>
+
+    <para>Various file systems exported by the kernel are used to communicate to
+    and from the kernel itself. These file systems are virtual in that no disk
+    space is used for them. The content of the file systems resides in
+    memory.</para>
+
+    <para>Begin by creating directories onto which the file systems will be
+    mounted:</para>
+
+<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
+
+  <sect2>
+    <title>Creating Initial Device Nodes</title>
+
+    <para>When the kernel boots the system, it requires the presence of a few
+    device nodes, in particular the <filename
+    class="devicefile">console</filename> and <filename
+    class="devicefile">null</filename> devices. The device nodes must be created
+    on the hard disk so that they are available before <command>udevd</command>
+    has been started, and additionally when Linux is started with
+    <parameter>init=/bin/bash</parameter>. Create the devices by running the
+    following commands:</para>
+
+<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
+mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="ch-system-bindmount">
+    <title>Mounting and Populating /dev</title>
+
+      <para>The recommended method of populating the <filename
+      class="directory">/dev</filename> directory with devices is to mount a
+      virtual filesystem (such as <systemitem
+      class="filesystem">tmpfs</systemitem>) on the <filename
+      class="directory">/dev</filename> directory, and allow the devices to be
+      created dynamically on that virtual filesystem as they are detected or
+      accessed. Device creation is generally done during the boot process
+      by Udev. Since this new system does not yet have Udev and has not yet
+      been booted, it is necessary to mount and populate <filename
+      class="directory">/dev</filename> manually. This is accomplished by bind
+      mounting the host system's <filename class="directory">/dev</filename>
+      directory. A bind mount is a special type of mount that allows you to
+      create a mirror of a directory or mount point to some other location. Use
+      the following command to achieve this:</para>
+
+<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="ch-system-kernfsmount">
+    <title>Mounting Virtual Kernel File Systems</title>
+
+      <para>Now mount the remaining virtual kernel filesystems:</para>
+
+<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
+mount -vt proc proc $LFS/proc
+mount -vt sysfs sysfs $LFS/sys
+mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the mount options for devpts:</title>
+
+      <varlistentry>
+        <term><parameter>gid=5</parameter></term>
+        <listitem>
+          <para>This ensures that all devpts-created device nodes are owned by
+          group ID 5.  This is the ID we will use later on for the <systemitem
+          class="groupname">tty</systemitem> group.  We use the group ID instead
+          of a name, since the host system might use a different ID for its
+          <systemitem class="groupname">tty</systemitem> group.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>mode=0620</parameter></term>
+        <listitem>
+          <para>This ensures that all devpts-created device nodes have mode 0620
+          (user readable and writable, group writable).  Together with the
+          option above, this ensures that devpts will create device nodes that
+          meet the requirements of grantpt(), meaning the Glibc
+          <command>pt_chown</command> helper binary (which is not installed by
+          default) is not necessary.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+      <para>In some host systems, <filename>/dev/shm</filename> is a
+      symbolic link to <filename class="directory">/run/shm</filename>.
+      The /run tmpfs was mounted above so in this case only a 
+      directory needs to be created.</para>
+
+<screen><userinput>if [ -h $LFS/dev/shm ]; then
+  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+fi</userinput></screen>
+
+  </sect2>
+
+</sect1>

+ 114 - 0
chapter07/libstdc++-pass2.xml

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-libstdcpp-pass2" role="wrap">
+  <?dbhtml filename="gcc-libstdc++-pass2.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-libstdc++</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>Libstdc++ from GCC-&gcc-version;, Pass 2</title>
+
+  <indexterm zone="ch-tools-libstdcpp-pass2">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, libstdc++ pass 2</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to
+    defer the installation of the C++ standard library, because no suitable
+    compiler was available to compile it: we could not use the compiler
+    installed, because this compiler is a native
+    compiler, and should not be used outside of chroot without being at
+    risk of polluting the build with some host components.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+        <!-- TODO -->
+      <seglistitem>
+        <seg>&libstdcpp-ch5-sbu;</seg>
+        <seg>&libstdcpp-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Target Libstdc++</title>
+
+    <note>
+      <para><application>Libstdc++</application> is part of the GCC sources.
+      You should first unpack the GCC tarball and change to the
+      <filename>gcc-&gcc-version;</filename> directory.</para>
+    </note>
+
+    <para>Create a link which exists when building Libstdc++ in the gcc
+    tree:</para>
+
+<screen><userinput remap="pre">ln -s gthr-posix.h libgcc/gthr-default.h</userinput></screen>
+
+    <para>Create a separate build directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../libstdc++-v3/configure           \
+    CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
+    --prefix=/usr                   \
+    --disable-multilib              \
+    --disable-nls                   \
+    --disable-libstdcxx-pch</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>CXXFLAGS="-g -O2 -D_GNU_SOURCE"</parameter></term>
+        <listitem>
+          <para>Those flags are passed by the top level Makefile when doing
+	  a full build of GCC.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-libstdcxx-pch</parameter></term>
+        <listitem>
+          <para>This switch prevents the installation of precompiled
+          include files, which are not needed at this stage.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile libstdc++ by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the library:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 122 - 0
chapter07/libstdc++.xml

@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
+  <?dbhtml filename="gcc-libstdc++-pass1.html"?>
+
+  <sect1info condition="script">
+    <productname>gcc-libstdc++</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
+
+  <indexterm zone="ch-tools-libstdcpp-pass1">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, libstdc++ pass 1</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>Libstdc++ is the standard C++ library. It is needed 
+    to compile C++ code
+    (part of GCC is written in C++), but we had to defer its installation
+    when we built <xref linkend="ch-tools-gcc-pass1"/>
+    because it depends on glibc, which was not yet available in the target
+    directory.
+    </para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&libstdcpp-ch5-sbu;</seg>
+        <seg>&libstdcpp-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Target Libstdc++</title>
+
+    <note>
+      <para><application>Libstdc++</application> is part of the GCC sources.
+      You should first unpack the GCC tarball and change to the
+      <filename>gcc-&gcc-version;</filename> directory.</para>
+    </note>
+
+    <para>Create a separate build directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../libstdc++-v3/configure           \
+    --host=$LFS_TGT                 \
+    --build=$(../config.guess)      \
+    --prefix=/usr                   \
+    --disable-multilib              \
+    --disable-nls                   \
+    --disable-libstdcxx-pch         \
+    --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--host=...</parameter></term>
+        <listitem>
+          <para>Indicates to use the cross compiler we have just built
+          instead of the one in <filename>/usr/bin</filename>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-libstdcxx-pch</parameter></term>
+        <listitem>
+          <para>This switch prevents the installation of precompiled
+          include files, which are not needed at this stage.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
+        <listitem>
+          <para>This is the location where the standard include files are
+          searched by the C++ compiler. In a normal build, this information
+          is automatically passed to the Libstdc++ <command>configure</command>
+          options from the top level directory. In our case, this information
+          must be explicitly given.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile libstdc++ by running:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the library:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-gcc" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 207 - 0
chapter07/linux-headers.xml

@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-linux-headers" role="wrap">
+  <?dbhtml filename="linux-headers.html"?>
+
+  <sect1info condition="script">
+    <productname>linux-headers</productname>
+    <productnumber>&linux-version;</productnumber>
+    <address>&linux-url;</address>
+  </sect1info>
+
+  <title>Linux-&linux-version; API Headers</title>
+
+  <indexterm zone="ch-tools-linux-headers">
+    <primary sortas="a-Linux">Linux</primary>
+    <secondary>tools, API headers</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
+    kernel's API for use by Glibc.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&linux-headers-ch5-sbu;</seg>
+        <seg>&linux-headers-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Linux API Headers</title>
+
+    <para>The Linux kernel needs to expose an Application Programming Interface
+    (API) for the system's C library (Glibc in LFS) to use.  This is done
+    by way of sanitizing various C header files that are shipped in the Linux
+    kernel source tarball.</para>
+
+    <para>Make sure there are no stale files embedded in the package:</para>
+
+<screen><userinput remap="pre">make mrproper</userinput></screen>
+
+    <para>Now extract the user-visible kernel headers from the source.
+    The recommended make target <quote>headers_install</quote> cannot be
+    used, because it requires <application>rsync</application>, which may not
+    be available. The headers are first placed in
+    <filename class="directory">./usr</filename>, then copied to the needed
+    location.</para>
+
+<screen><userinput remap="make">make headers
+find usr/include -name '.*' -delete
+rm usr/include/Makefile
+</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-linux-headers" role="content">
+    <title>Contents of Linux API Headers</title>
+
+    <segmentedlist>
+      <segtitle>Installed headers</segtitle>
+      <segtitle>Installed directories</segtitle>
+
+      <seglistitem>
+        <seg>/usr/include/asm/*.h, /usr/include/asm-generic/*.h,
+        /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h,
+        /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, 
+        /usr/include/sound/*.h, /usr/include/video/*.h, 
+        and /usr/include/xen/*.h</seg>
+        <seg>/usr/include/asm, /usr/include/asm-generic, /usr/include/drm,
+        /usr/include/linux, /usr/include/misc, /usr/include/mtd, 
+        /usr/include/rdma, /usr/include/scsi, /usr/include/sound, 
+        /usr/include/video, and /usr/include/xen</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="asm">
+        <term><filename class="headerfile">/usr/include/asm/*.h</filename></term>
+        <listitem>
+          <para>The Linux API ASM Headers</para>
+          <indexterm zone="ch-tools-linux-headers asm">
+            <primary sortas="e-/usr/include/asm/*.h">/usr/include/asm/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+     <varlistentry id="asm-generic">
+        <term><filename class="headerfile">/usr/include/asm-generic/*.h</filename></term>
+        <listitem>
+          <para>The Linux API ASM Generic Headers</para>
+          <indexterm zone="ch-tools-linux-headers asm-generic">
+            <primary sortas="e-/usr/include/asm-generic/*.h">/usr/include/asm-generic/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="drm">
+        <term><filename class="headerfile">/usr/include/drm/*.h</filename></term>
+        <listitem>
+          <para>The Linux API DRM Headers</para>
+          <indexterm zone="ch-tools-linux-headers drm">
+            <primary sortas="e-/usr/include/drm/*.h">/usr/include/drm/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="linux">
+        <term><filename class="headerfile">/usr/include/linux/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Linux Headers</para>
+          <indexterm zone="ch-tools-linux-headers linux">
+            <primary sortas="e-/usr/include/linux/*.h">/usr/include/linux/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="misc">
+        <term><filename class="headerfile">/usr/include/misc/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Miscellaneous Headers</para>
+          <indexterm zone="ch-tools-linux-headers misc">
+            <primary sortas="e-/usr/include/misc/*.h">/usr/include/misc/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="mtd">
+        <term><filename class="headerfile">/usr/include/mtd/*.h</filename></term>
+        <listitem>
+          <para>The Linux API MTD Headers</para>
+          <indexterm zone="ch-tools-linux-headers mtd">
+            <primary sortas="e-/usr/include/mtd/*.h">/usr/include/mtd/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="rdma">
+        <term><filename class="headerfile">/usr/include/rdma/*.h</filename></term>
+        <listitem>
+          <para>The Linux API RDMA Headers</para>
+          <indexterm zone="ch-tools-linux-headers rdma">
+            <primary sortas="e-/usr/include/rdma/*.h">/usr/include/rdma/*.h</primary>
+         </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="scsi">
+        <term><filename class="headerfile">/usr/include/scsi/*.h</filename></term>
+        <listitem>
+          <para>The Linux API SCSI Headers</para>
+          <indexterm zone="ch-tools-linux-headers scsi">
+            <primary sortas="e-/usr/include/scsi/*.h">/usr/include/scsi/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="sound">
+        <term><filename class="headerfile">/usr/include/sound/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Sound Headers</para>
+          <indexterm zone="ch-tools-linux-headers sound">
+           <primary sortas="e-/usr/include/sound/*.h">/usr/include/sound/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="video">
+        <term><filename class="headerfile">/usr/include/video/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Video Headers</para>
+          <indexterm zone="ch-tools-linux-headers video">
+            <primary sortas="e-/usr/include/video/*.h">/usr/include/video/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="xen">
+        <term><filename class="headerfile">/usr/include/xen/*.h</filename></term>
+        <listitem>
+          <para>The Linux API Xen Headers</para>
+          <indexterm zone="ch-tools-linux-headers xen">
+            <primary sortas="e-/usr/include/xen/*.h">/usr/include/xen/*.h</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 74 - 0
chapter07/m4.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-m4" role="wrap">
+  <?dbhtml filename="m4.html"?>
+
+  <sect1info condition="script">
+    <productname>m4</productname>
+    <productnumber>&m4-version;</productnumber>
+    <address>&m4-url;</address>
+  </sect1info>
+
+  <title>M4-&m4-version;</title>
+
+  <indexterm zone="ch-tools-m4">
+    <primary sortas="a-M4">M4</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/m4.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&m4-ch5-sbu;</seg>
+        <seg>&m4-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of M4</title>
+
+    <para>First, make some fixes introduced by glibc-2.28:</para>
+
+<screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
+echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h</userinput></screen>
+
+    <para>Prepare M4 for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in
+    <xref linkend="contents-m4" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 83 - 0
chapter07/make.xml

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-tools-make" role="wrap">
+  <?dbhtml filename="make.html"?>
+
+  <sect1info condition="script">
+    <productname>make</productname>
+    <productnumber>&make-version;</productnumber>
+    <address>&make-url;</address>
+  </sect1info>
+
+  <title>Make-&make-version;</title>
+
+  <indexterm zone="ch-tools-make">
+    <primary sortas="a-Make">Make</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/make.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&make-ch5-sbu;</seg>
+        <seg>&make-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Make</title>
+
+    <para>Prepare Make for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --without-guile \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure option:</title>
+
+      <varlistentry>
+        <term><parameter>--without-guile</parameter></term>
+        <listitem>
+          <para>Although we are cross-compiling, configure tries to use
+          guile from the build host if it finds it. This makes compilation
+          fail, so this switch prevents using it.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-make" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 157 - 0
chapter07/ncurses.xml

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-ncurses" role="wrap">
+  <?dbhtml filename="ncurses.html"?>
+
+  <sect1info condition="script">
+    <productname>ncurses</productname>
+    <productnumber>&ncurses-version;</productnumber>
+    <address>&ncurses-url;</address>
+  </sect1info>
+
+  <title>Ncurses-&ncurses-version;</title>
+
+  <indexterm zone="ch-tools-ncurses">
+    <primary sortas="a-Ncurses">Ncurses</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/ncurses.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&ncurses-ch5-sbu;</seg>
+        <seg>&ncurses-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Ncurses</title>
+
+    <para>First, ensure that <command>gawk</command> is found first during configuration:</para>
+
+<screen><userinput remap="pre">sed -i s/mawk// configure</userinput></screen>
+
+    <para>Then, run the following commands to build the <quote>tic</quote>
+    program on the build host:</para>
+
+<screen><userinput remap="pre">mkdir build
+cd build
+../configure
+make -C include
+make -C progs tic
+cd ..</userinput></screen>
+
+    <para>Prepare Ncurses for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr             \
+            --host=$LFS_TGT           \
+            --build=$(./config.guess) \
+            --mandir=/usr/share/man   \
+            --with-shared             \
+            --without-debug           \
+            --without-ada             \
+            --without-normal          \
+            --enable-widec            \
+            --enable-pc-files</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--without-ada</parameter></term>
+        <listitem>
+          <para>This ensures that Ncurses does not build support for the Ada
+          compiler which may be present on the host but will not be available
+          once we enter the <command>chroot</command> environment.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-widec</parameter></term>
+        <listitem>
+          <para>This switch causes wide-character libraries (e.g., <filename
+          class="libraryfile">libncursesw.so.&ncurses-version;</filename>)
+          to be built instead of normal ones (e.g., <filename
+          class="libraryfile">libncurses.so.&ncurses-version;</filename>).
+          These wide-character libraries are usable in both multibyte and
+          traditional 8-bit locales, while normal libraries work properly
+          only in 8-bit locales. Wide-character and normal libraries are
+          source-compatible, but not binary-compatible.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--enable-pc-files</parameter></term>
+        <listitem>
+          <para>This switch generates and installs .pc files for pkg-config.
+          </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-normal</parameter></term>
+        <listitem>
+          <para>This switch disables building and installing most static libraries.
+          </para>
+        </listitem>
+      </varlistentry>
+      <!--
+      <varlistentry>
+        <term><parameter>- -disable-db-install</parameter></term>
+        <listitem>
+          <para>This switch disables building the terminfo database: it is not
+          needed at this stage, and if <command>tic</command> is too old,
+          it cannot compile recent databases.</para>
+        </listitem>
+      </varlistentry>
+      -->
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+<!-- TODO: check and document -->
+<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
+ln -s libncursesw.so $LFS/usr/lib/libncurses.so</userinput></screen>
+
+    <para>Move the shared libraries to the
+    <filename class="directory">/lib</filename> directory, where they are
+    expected to reside:</para>
+
+<screen><userinput remap="install">mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib</userinput></screen>
+
+    <para>Because the libraries have been moved, one symlink points to
+    a non-existent file. Recreate it:</para>
+
+<screen><userinput remap="install">ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so</userinput></screen>
+
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-ncurses" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 70 - 0
chapter07/patch.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-patch" role="wrap">
+  <?dbhtml filename="patch.html"?>
+
+  <sect1info condition="script">
+    <productname>patch</productname>
+    <productnumber>&patch-version;</productnumber>
+    <address>&patch-url;</address>
+  </sect1info>
+
+  <title>Patch-&patch-version;</title>
+
+  <indexterm zone="ch-tools-patch">
+    <primary sortas="a-Patch">Patch</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/patch.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&patch-ch5-sbu;</seg>
+        <seg>&patch-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Patch</title>
+
+    <para>Prepare Patch for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --build=$(build-aux/config.guess)</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-patch" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 79 - 0
chapter07/perl.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-perl" role="wrap">
+  <?dbhtml filename="perl.html"?>
+
+  <sect1info condition="script">
+    <productname>perl</productname>
+    <productnumber>&perl-version;</productnumber>
+    <address>&perl-url;</address>
+  </sect1info>
+
+  <title>Perl-&perl-version;</title>
+
+  <indexterm zone="ch-tools-perl">
+    <primary sortas="a-Perl">Perl</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter08/perl.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&perl-ch5-sbu;</seg>
+        <seg>&perl-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Perl</title>
+
+    <para>Prepare Perl for compilation:</para>
+
+<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new Configure options:</title>
+      <varlistentry>
+        <term><parameter>-des</parameter></term>
+        <listitem>
+          <para>This is a combination of three options: -d uses defaults for 
+          all items; -e ensures completion of all tasks; -s silences
+          non-essential output.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Build the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-perl" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 88 - 0
chapter07/python.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-Python-temp" role="wrap">
+  <?dbhtml filename="Python-temp.html"?>
+
+  <sect1info condition="script">
+    <productname>Python</productname>
+    <productnumber>&python-version;</productnumber>
+    <address>&python-url;</address>
+  </sect1info>
+
+  <title>Python-&python-version;</title>
+
+  <indexterm zone="ch-system-Python-temp">
+    <primary sortas="a-Python">Python</primary>
+    <secondary>temporary</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/python.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+    <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&python-ch5-sbu;</seg>
+        <seg>&python-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Python</title>
+
+    <note>
+      <para>There are two package files whose name starts with
+      <quote>python</quote>. The one to extract from is
+      <filename>Python-&python-version;.tar.xz</filename> (notice the
+      uppercase first letter).</para>
+    </note>
+
+    <para>Prepare Python for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure option:</title>
+
+      <varlistentry>
+        <term><parameter>--without-ensurepip</parameter></term>
+        <listitem>
+          <para>This switch disables the Python package installer, which is not
+          needed at this stage.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-python" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 70 - 0
chapter07/sed.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-sed" role="wrap">
+  <?dbhtml filename="sed.html"?>
+
+  <sect1info condition="script">
+    <productname>sed</productname>
+    <productnumber>&sed-version;</productnumber>
+    <address>&sed-url;</address>
+  </sect1info>
+
+  <title>Sed-&sed-version;</title>
+
+  <indexterm zone="ch-tools-sed">
+    <primary sortas="a-Sed">Sed</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/sed.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+    <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&sed-ch5-sbu;</seg>
+        <seg>&sed-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Sed</title>
+
+    <para>Prepare Sed for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr   \
+            --host=$LFS_TGT \
+            --bindir=/bin</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-sed" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 53 - 0
chapter07/stripping.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-stripping">
+  <?dbhtml filename="stripping.html"?>
+
+  <title>Stripping</title>
+
+  <para>The steps in this section are optional, but if the LFS partition is
+  rather small, it is beneficial to learn that unnecessary items can be removed.
+  The executables and libraries built so far contain about 70 MB of unneeded
+  debugging symbols. Remove those symbols with:</para>
+
+<screen><userinput>$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
+$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*</userinput></screen>
+
+  <para>These commands will skip a number of files, reporting that it does not
+  recognize their file format. Most of these are scripts instead of binaries.
+  Note that we use the <command>strip</command> program built in
+  <quote>Binutils pass 1</quote>, since it is the one that knows how to strip
+  our cross-compiled programs.</para>
+<!-- Normally, the host "strip" could be used too, since it is actually the
+same computer. But Some old versions of binutils may generate buggy crt1.o
+and the like, because they do not know about recently introduced symbol
+types. For more details,
+see https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
+
+  <para>Take care <emphasis>not</emphasis> to use
+  <parameter>--strip-unneeded</parameter> on the libraries. The static
+  ones would be destroyed and the toolchain packages would need to be
+  built all over again.</para>
+
+  <para>To save more, remove the documentation:</para>
+
+<screen><userinput>rm -rf $LFS/usr/{,share}/{info,man,doc}</userinput></screen>
+
+  <para>The libtool .la files are only useful when linking with static
+  libraries. They are unneeded, and potentially harmful, when using dynamic
+  shared libraries, specially when using also non-autotools build systems.
+  Remove those files now:</para>
+
+<screen><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
+
+  <para>At this point, you should have at least 3 GB of free space in
+  <envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
+  the next phase. If you can build and install Glibc, you can build and install
+  the rest too.</para>
+
+</sect1>

+ 71 - 0
chapter07/tar.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-tar" role="wrap">
+  <?dbhtml filename="tar.html"?>
+
+  <sect1info condition="script">
+    <productname>tar</productname>
+    <productnumber>&tar-version;</productnumber>
+    <address>&tar-url;</address>
+  </sect1info>
+
+  <title>Tar-&tar-version;</title>
+
+  <indexterm zone="ch-tools-tar">
+    <primary sortas="a-Tar">Tar</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/tar.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&tar-ch5-sbu;</seg>
+        <seg>&tar-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Tar</title>
+
+    <para>Prepare Tar for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --host=$LFS_TGT                   \
+            --build=$(build-aux/config.guess) \
+            --bindir=/bin</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-tar" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 191 - 0
chapter07/tcl.xml

@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+  <!ENTITY tdbc-ver          "1.1.1">
+  <!ENTITY itcl-ver          "4.2.0">
+]>
+
+<sect1 id="ch-tools-tcl" role="wrap">
+  <?dbhtml filename="tcl.html"?>
+
+  <sect1info condition="script">
+    <productname>tcl</productname>
+    <productnumber>&tcl-version;</productnumber>
+    <address>&tcl-url;</address>
+  </sect1info>
+
+  <title>Tcl-&tcl-version;</title>
+
+  <indexterm zone="ch-tools-tcl">
+    <primary sortas="a-Tcl">Tcl</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The <application>Tcl</application> package contains the Tool Command Language,
+    a robust general-purpose scripting language. The <application>Expect</application> package
+    is written in the <application>Tcl</application> language.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&tcl-ch5-sbu;</seg>
+        <seg>&tcl-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Tcl</title>
+
+    <para>This package and the next two (Expect and DejaGNU) are
+    installed to support running the test suites for GCC and Binutils and other
+    packages.  Installing three packages for testing purposes may seem
+    excessive, but it is very reassuring, if not essential, to know that the
+    most important tools are working properly. These packages are required
+    to run the test suites in <xref linkend="chapter-building-system"/>.</para>
+
+    <para>Note that the Tcl package used here is a minimal version needed
+    to run the LFS tests.  For the full package, see the  
+    <ulink url='&blfs-book;general/tcl.html'>BLFS Tcl procedures</ulink>.</para>
+
+    <para>Prepare Tcl for compilation:</para>
+
+<screen><userinput remap="configure">SRCDIR=$(pwd)
+cd unix
+./configure --prefix=/usr           \
+            --mandir=/usr/share/man \
+            $([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</parameter></term>
+        <listitem>
+          <para>The construct <parameter>$(&lt;shell command&gt;)</parameter>
+          is replaced by the output of the chell command.  Here this output is
+          empty if running on a 32 bit machine, and is
+          <parameter>--enable-64bit</parameter> if running on a 64 bit machine.
+          </para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Build the package:</para>
+
+<screen><userinput remap="make">make
+
+sed -e "s|$SRCDIR/unix|/usr/lib|" \
+    -e "s|$SRCDIR|/usr/include|"  \
+    -i tclConfig.sh
+
+sed -e "s|$SRCDIR/unix/pkgs/tdbc&tdbc-ver;|/usr/lib/tdbc&tdbc-ver;|" \
+    -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/generic|/usr/include|"    \
+    -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/library|/usr/lib/tcl8.6|" \
+    -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;|/usr/include|"            \
+    -i pkgs/tdbc&tdbc-ver;/tdbcConfig.sh
+
+sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \
+    -e "s|$SRCDIR/pkgs/itcl&itcl-ver;/generic|/usr/include|"    \
+    -e "s|$SRCDIR/pkgs/itcl&itcl-ver;|/usr/include|"            \
+    -i pkgs/itcl&itcl-ver;/itclConfig.sh
+
+unset SRCDIR</userinput></screen>
+
+    <para>The various <quote>sed</quote> after the <quote>make</quote> command
+    remove references to the build directory from various configuration files,
+    and replaces them with the install directory. This is not mandatory
+    for the remaining of LFS, but may be needed in case a package built later
+    uses Tcl.</para>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+    <para>Make the installed library writable so debugging symbols can
+    be removed later:</para>
+
+<screen><userinput remap="install">chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so</userinput></screen>
+
+    <para>Install Tcl's headers. The next package, Expect, requires them
+    to build.</para>
+
+<screen><userinput remap="install">make install-private-headers</userinput></screen>
+
+    <para>Now make a necessary symbolic link:</para>
+
+<screen><userinput remap="install">ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-tcl" role="content">
+    <title>Contents of Tcl</title>
+
+    <segmentedlist>
+      <segtitle>Installed programs</segtitle>
+      <segtitle>Installed library</segtitle>
+
+      <seglistitem>
+        <seg>tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;</seg>
+        <seg>libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="tclsh&tcl-major-version;">
+        <term><command>tclsh&tcl-major-version;</command></term>
+        <listitem>
+          <para>The Tcl command shell</para>
+          <indexterm zone="ch-tools-tcl tclsh&tcl-major-version;">
+            <primary sortas="b-tclsh&tcl-major-version;">tclsh&tcl-major-version;</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="tclsh">
+        <term><command>tclsh</command></term>
+        <listitem>
+          <para>A link to tclsh&tcl-major-version;</para>
+          <indexterm zone="ch-tools-tcl tclsh">
+            <primary sortas="b-tclsh">tclsh</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="libtcl&tcl-major-version;.so">
+        <term><filename class="libraryfile">libtcl&tcl-major-version;.so</filename></term>
+        <listitem>
+          <para>The Tcl library</para>
+          <indexterm zone="ch-tools-tcl libtcl&tcl-major-version;.so">
+            <primary sortas="c-libtcl&tcl-major-version;.so">libtcl&tcl-major-version;.so</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="libtclstub&tcl-major-version;.a">
+        <term><filename class="libraryfile">libtclstub&tcl-major-version;.a</filename></term>
+        <listitem>
+          <para>The Tcl Stub library</para>
+          <indexterm zone="ch-tools-tcl libtclstub&tcl-major-version;.a">
+            <primary sortas="c-libtclstub&tcl-major-version;.a">libtclstub&tcl-major-version;.a</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>

+ 74 - 0
chapter07/texinfo.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-texinfo-temp" role="wrap">
+  <?dbhtml filename="texinfo-temp.html"?>
+
+  <sect1info condition="script">
+    <productname>texinfo</productname>
+    <productnumber>&texinfo-version;</productnumber>
+    <address>&texinfo-url;</address>
+  </sect1info>
+
+  <title>Texinfo-&texinfo-version;</title>
+
+  <indexterm zone="ch-system-texinfo-temp">
+    <primary sortas="a-Texinfo">Texinfo</primary>
+    <secondary>temporary</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/texinfo.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&texinfo-ch5-sbu;</seg>
+        <seg>&texinfo-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Texinfo</title>
+
+    <para>Prepare Texinfo for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+
+    <note>
+      <para>As part of the configure process, a test is made that indicates an
+      error for TestXS_la-TestXS.lo.  This is not relevant for LFS and should be
+      ignored.</para>
+    </note>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-texinfo" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 335 - 0
chapter07/toolchaintechnotes.xml

@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-toolchaintechnotes">
+  <?dbhtml filename="toolchaintechnotes.html"?>
+
+  <title>Toolchain Technical Notes</title>
+
+  <para>This section explains some of the rationale and technical details
+  behind the overall build method. It is not essential to immediately
+  understand everything in this section. Most of this information will be
+  clearer after performing an actual build. This section can be referred
+  to at any time during the process.</para>
+
+  <para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
+  produce a temporary area that contains a known-good set of tools that can be
+  isolated from the host system. By using <command>chroot</command>, the
+  commands in the remaining chapters will be contained within that environment,
+  ensuring a clean, trouble-free build of the target LFS system. The build
+  process has been designed to minimize the risks for new readers and to provide
+  the most educational value at the same time.</para>
+
+  <para>The build process is based on the process of
+  <emphasis>cross-compilation</emphasis>. Cross-compilation is normally used
+  for building a compiler and its toolchain for a machine different from
+  the one that is used for the build. This is not strictly needed for LFS,
+  since the machine where the new system will run is the same as the one
+  used for the build. But cross-compilation has the great advantage that
+  anything that is cross-compiled cannot depend on the host environment.</para>
+
+  <sect2 id="cross-compile" xreflabel="About Cross-Compilation">
+
+    <title>About Cross-Compilation</title>
+
+    <para>Cross-compilation involves some concepts that deserve a section on
+    their own. Although this section may be omitted in a first reading, it
+    is strongly suggested to come back to it later in order to get a full
+    grasp of the build process.</para>
+
+    <para>Let us first define some terms used in this context:</para>
+
+    <variablelist>
+      <varlistentry><term>build</term><listitem>
+        <para>is the machine where we build programs. Note that this machine
+        is referred to as the <quote>host</quote> in other
+        sections.</para></listitem>
+      </varlistentry>
+
+      <varlistentry><term>host</term><listitem>
+        <para>is the machine/system where the built programs will run. Note
+        that this use of <quote>host</quote> is not the same as in other
+        sections.</para></listitem>
+      </varlistentry>
+
+      <varlistentry><term>target</term><listitem>
+        <para>is only used for compilers. It is the machine the compiler
+        produces code for. It may be different from both build and
+        host.</para></listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>As an example, let us imagine the following scenario: we may have a
+    compiler on a slow machine only, let's call the machine A, and the compiler
+    ccA. We may have also a fast machine (B), but with no compiler, and we may
+    want to produce code for a another slow machine (C). Then, to build a
+    compiler for machine C, we would have three stages:</para>
+
+    <informaltable align="center">
+      <tgroup cols="5">
+        <colspec colnum="1" align="center"/>
+        <colspec colnum="2" align="center"/>
+        <colspec colnum="3" align="center"/>
+        <colspec colnum="4" align="center"/>
+        <colspec colnum="5" align="left"/>
+        <thead>
+          <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+               <entry>Target</entry><entry>Action</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>1</entry><entry>A</entry><entry>A</entry><entry>B</entry>
+            <entry>build cross-compiler cc1 using ccA on machine A</entry>
+          </row>
+          <row>
+            <entry>2</entry><entry>A</entry><entry>B</entry><entry>B</entry>
+            <entry>build cross-compiler cc2 using cc1 on machine A</entry>
+          </row>
+          <row>
+            <entry>3</entry><entry>B</entry><entry>C</entry><entry>C</entry>
+            <entry>build compiler ccC using cc2 on machine B</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+    <para>Then, all the other programs needed by machine C can be compiled
+    using cc2 on the fast machine B. Note that unless B can run programs
+    produced for C, there is no way to test the built programs until machine
+    C itself is running. For example, for testing ccC, we may want to add a
+    fourth stage:</para>
+
+    <informaltable align="center">
+      <tgroup cols="5">
+        <colspec colnum="1" align="center"/>
+        <colspec colnum="2" align="center"/>
+        <colspec colnum="3" align="center"/>
+        <colspec colnum="4" align="center"/>
+        <colspec colnum="5" align="left"/>
+        <thead>
+          <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+               <entry>Target</entry><entry>Action</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>4</entry><entry>C</entry><entry>C</entry><entry>C</entry>
+            <entry>rebuild  and test ccC using itself on machine C</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+    <para>In the example above, only cc1 and cc2 are cross-compilers, that is,
+    they produce code for a machine different from the one they are run on.
+    The other compilers ccA and ccC produce code for the machine they are run
+    on. Such compilers are called <emphasis>native</emphasis> compilers.</para>
+
+  </sect2>
+
+  <sect2 id="lfs-cross">
+    <title>Implementation of Cross-Compilation for LFS</title>
+
+    <note>
+      <para>Almost all the build systems use names of the form
+      cpu-vendor-kernel-os referred to as the machine triplet. An astute
+      reader may wonder why a <quote>triplet</quote> refers to a four component
+      name. The reason is history: initially, three component names were enough
+      to designate unambiguously a machine, but with new machines and systems
+      appearing, that proved insufficient. The word <quote>triplet</quote>
+      remained. A simple way to determine your machine triplet is to run
+      the <command>config.guess</command>
+      script that comes with the source for many packages. Unpack the Binutils
+      sources and run the script: <userinput>./config.guess</userinput> and note
+      the output. For example, for a 32-bit Intel processor the
+      output will be <emphasis>i686-pc-linux-gnu</emphasis>. On a 64-bit
+      system it will be <emphasis>x86_64-pc-linux-gnu</emphasis>.</para>
+
+      <para>Also be aware of the name of the platform's dynamic linker, often
+      referred to as the dynamic loader (not to be confused with the standard
+      linker <command>ld</command> that is part of Binutils). The dynamic linker
+      provided by Glibc finds and loads the shared libraries needed by a
+      program, prepares the program to run, and then runs it. The name of the
+      dynamic linker for a 32-bit Intel machine will be <filename
+      class="libraryfile">ld-linux.so.2</filename> (<filename
+      class="libraryfile">ld-linux-x86-64.so.2</filename> for 64-bit systems). A
+      sure-fire way to determine the name of the dynamic linker is to inspect a
+      random binary from the host system by running: <userinput>readelf -l
+      &lt;name of binary&gt; | grep interpreter</userinput> and noting the
+      output. The authoritative reference covering all platforms is in the
+      <filename>shlib-versions</filename> file in the root of the Glibc source
+      tree.</para>
+    </note>
+
+    <para>In order to fake a cross compilation, the name of the host triplet
+    is slightly adjusted by changing the &quot;vendor&quot; field in the
+    <envar>LFS_TGT</envar> variable. We also use the
+    <parameter>--with-sysroot</parameter> when building the cross linker and
+    cross compiler, to tell them where to find the needed host files. This
+    ensures none of the other programs built in <xref
+    linkend="chapter-temporary-tools"/> can link to libraries on the build
+    machine. Only two stages are mandatory, and one more for tests:</para>
+
+    <informaltable align="center">
+      <tgroup cols="5">
+        <colspec colnum="1" align="center"/>
+        <colspec colnum="2" align="center"/>
+        <colspec colnum="3" align="center"/>
+        <colspec colnum="4" align="center"/>
+        <colspec colnum="5" align="left"/>
+        <thead>
+          <row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
+               <entry>Target</entry><entry>Action</entry></row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>1</entry><entry>pc</entry><entry>pc</entry><entry>lfs</entry>
+            <entry>build cross-compiler cc1 using cc-pc on pc</entry>
+          </row>
+          <row>
+            <entry>2</entry><entry>pc</entry><entry>lfs</entry><entry>lfs</entry>
+            <entry>build compiler cc-lfs using cc1 on pc</entry>
+          </row>
+          <row>
+            <entry>3</entry><entry>lfs</entry><entry>lfs</entry><entry>lfs</entry>
+            <entry>rebuild and test cc-lfs using itself on lfs</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+    <para>In the above table, <quote>on pc</quote> means the commands are run
+    on a machine using the already installed distribution. <quote>On
+    lfs</quote> means the commands are run in a chrooted environment.</para>
+
+    <para>Now, there is more about cross-compiling: the C language is not
+    just a compiler, but also defines a standard library. In this book, the
+    GNU C library, named glibc, is used. This library must
+    be compiled for the lfs machine, that is, using the cross compiler cc1. 
+    But the compiler itself uses an internal library implementing complex
+    instructions not available in the assembler instruction set. This
+    internal library is named libgcc, and must be linked to the glibc
+    library to be fully functional! Furthermore, the standard library for
+    C++ (libstdc++) also needs being linked to glibc. The solution
+    to this chicken and egg problem is to first build a degraded cc1+libgcc,
+    lacking some fuctionalities such as threads and exception handling, then
+    build glibc using this degraded compiler (glibc itself is not
+    degraded), then build libstdc++. But this last library will lack the
+    same functionalities as libgcc.</para>
+
+    <para>This is not the end of the story: the conclusion of the preceding
+    paragraph is that cc1 is unable to build a fully functional libstdc++, but
+    this is the only compiler available for building the C/C++ libraries
+    during stage 2! Of course, the compiler built during stage 2, cc-lfs,
+    would be able to build those libraries, but (i) the build system of
+    gcc does not know that it is usable on pc, and (ii) using it on pc
+    would be at risk of linking to the pc libraries, since cc-lfs is a native
+    compiler. So we have to build libstdc++ later, in chroot.</para>
+
+  </sect2>
+
+  <sect2 id="other-details">
+
+    <title>Other procedural details</title>
+
+    <para>The cross-compiler will be installed in a separate <filename
+    class="directory">$LFS/tools</filename> directory, since it will not
+    be part of the final system.</para>
+
+    <para>Binutils is installed first because the <command>configure</command>
+    runs of both GCC and Glibc perform various feature tests on the assembler
+    and linker to determine which software features to enable or disable. This
+    is more important than one might first realize. An incorrectly configured
+    GCC or Glibc can result in a subtly broken toolchain, where the impact of
+    such breakage might not show up until near the end of the build of an
+    entire distribution. A test suite failure will usually highlight this error
+    before too much additional work is performed.</para>
+
+    <para>Binutils installs its assembler and linker in two locations,
+    <filename class="directory">$LFS/tools/bin</filename> and <filename
+    class="directory">$LFS/tools/$LFS_TGT/bin</filename>. The tools in one
+    location are hard linked to the other. An important facet of the linker is
+    its library search order. Detailed information can be obtained from
+    <command>ld</command> by passing it the <parameter>--verbose</parameter>
+    flag. For example, <command>$LFS_TGT-ld --verbose | grep SEARCH</command>
+    will illustrate the current search paths and their order. It shows which
+    files are linked by <command>ld</command> by compiling a dummy program and
+    passing the <parameter>--verbose</parameter> switch to the linker. For
+    example,
+    <command>$LFS_TGT-gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</command>
+    will show all the files successfully opened during the linking.</para>
+
+    <para>The next package installed is GCC. An example of what can be
+    seen during its run of <command>configure</command> is:</para>
+
+<screen><computeroutput>checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as
+checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
+
+    <para>This is important for the reasons mentioned above. It also
+    demonstrates that GCC's configure script does not search the PATH
+    directories to find which tools to use. However, during the actual
+    operation of <command>gcc</command> itself, the same search paths are not
+    necessarily used. To find out which standard linker <command>gcc</command>
+    will use, run: <command>$LFS_TGT-gcc -print-prog-name=ld</command>.</para>
+
+    <para>Detailed information can be obtained from <command>gcc</command> by
+    passing it the <parameter>-v</parameter> command line option while compiling
+    a dummy program. For example, <command>gcc -v dummy.c</command> will show
+    detailed information about the preprocessor, compilation, and assembly
+    stages, including <command>gcc</command>'s included search paths and their
+    order.</para>
+
+    <para>Next installed are sanitized Linux API headers. These allow the
+    standard C library (Glibc) to interface with features that the Linux
+    kernel will provide.</para>
+
+    <para>The next package installed is Glibc. The most important
+    considerations for building Glibc are the compiler, binary tools, and
+    kernel headers. The compiler is generally not an issue since Glibc will
+    always use the compiler relating to the <parameter>--host</parameter>
+    parameter passed to its configure script; e.g. in our case, the compiler
+    will be <command>$LFS_TGT-gcc</command>. The binary tools and kernel
+    headers can be a bit more complicated. Therefore, take no risks and use
+    the available configure switches to enforce the correct selections. After
+    the run of <command>configure</command>, check the contents of the
+    <filename>config.make</filename> file in the <filename
+    class="directory">build</filename> directory for all important details.
+    Note the use of <parameter>CC="$LFS_TGT-gcc"</parameter> (with
+    <envar>$LFS_TGT</envar> expanded) to control which binary tools are used
+    and the use of the <parameter>-nostdinc</parameter> and
+    <parameter>-isystem</parameter> flags to control the compiler's include
+    search path. These items highlight an important aspect of the Glibc
+    package&mdash;it is very self-sufficient in terms of its build machinery
+    and generally does not rely on toolchain defaults.</para>
+
+    <para>As said above, the standard C++ library is compiled next, followed
+    by all the programs that need themselves to be built. The install step
+    uses the <envar>DESTDIR</envar> variable to have the programs land into
+    the LFS filesystem.</para>
+
+    <para>Then the native lfs compiler is built. First Binutils Pass 2, with
+    the same <envar>DESTDIR</envar> install as the other programs, then the
+    second pass of GCC, omitting libstdc++ and other non-important libraries.
+    Due to some weird logic in GCC's configure script,
+    <envar>CC_FOR_TARGET</envar> ends up as <command>cc</command> when host
+    is the same as target, but is different from build. This is why
+    <parameter>CC_FOR_TARGET=$LFS_TGT-gcc</parameter> is put explicitely into
+    the configure options.</para>
+
+    <para>Upon entering the chroot environment in <xref
+    linkend="chapter-building-system"/>, the first task is to install
+    libstdc++. Then temporary installations of programs needed for the proper
+    operation of the toolchain are performed. Programs needed for testing
+    other programs are also built. From this point onwards, the
+    core toolchain is self-contained and self-hosted.  In the remainder of
+    the <xref linkend="chapter-building-system"/>, final versions of all the
+    packages needed for a fully functional system are built, tested and
+    installed.</para>
+
+  </sect2>
+
+</sect1>

+ 113 - 0
chapter07/util-linux.xml

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-util-linux" role="wrap">
+  <?dbhtml filename="util-linux.html"?>
+
+  <sect1info condition="script">
+    <productname>util-linux</productname>
+    <productnumber>&util-linux-version;</productnumber>
+    <address>&util-linux-url;</address>
+  </sect1info>
+
+  <title>Util-linux-&util-linux-version;</title>
+
+  <indexterm zone="ch-tools-util-linux">
+    <primary sortas="a-Util-linux">Util-linux</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The Util-linux package contains miscellaneous utility programs.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&util-linux-ch5-sbu;</seg>
+        <seg>&util-linux-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Util-linux</title>
+
+    <para>First create a directory
+    to enable storage for the <command>hwclock</command> program:</para>
+
+<screen><userinput remap="pre">mkdir -pv /var/lib/hwclock</userinput></screen>
+
+    <para>Prepare Util-linux for compilation:</para>
+
+<screen><userinput remap="configure">./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
+            --docdir=/usr/share/doc/util-linux-&util-linux-version; \
+            --disable-chfn-chsh  \
+            --disable-login      \
+            --disable-nologin    \
+            --disable-su         \
+            --disable-setpriv    \
+            --disable-runuser    \
+            --disable-pylibmount \
+            --disable-static     \
+            --without-python</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+<!-- TODO -->
+      <varlistentry>
+        <term><parameter>ADJTIME_PATH=/var/lib/hwclock/adjtime</parameter></term>
+        <listitem>
+          <para>This sets the location of the file recording information about
+          the hardware clock, in accordance to the FHS. This is not stricly
+          needed fot his temporary tool, but it prevent creating a file
+          at another location, which would not be overwritten or removed
+          when building the final util-linux.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-*</parameter></term>
+        <listitem>
+          <para>Those switches prevent warnings about building components
+          that require packages not in LFS or not installed yet.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-python</parameter></term>
+        <listitem>
+          <para>This switch disables using <application>Python</application>.
+          It avoids trying to build unneeded bindings.</para>
+        </listitem>
+      </varlistentry>
+
+     </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in
+    <xref linkend="contents-utillinux" role="."/></para>
+
+  </sect2>
+
+</sect1>

+ 77 - 0
chapter07/xz.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-tools-xz" role="wrap">
+  <?dbhtml filename="xz.html"?>
+
+  <sect1info condition="script">
+    <productname>xz</productname>
+    <productnumber>&xz-version;</productnumber>
+    <address>&xz-url;</address>
+  </sect1info>
+
+  <title>Xz-&xz-version;</title>
+
+  <indexterm zone="ch-tools-xz">
+    <primary sortas="a-xz">Xz</primary>
+    <secondary>tools</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+    href="../chapter06/xz.xml"
+    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&xz-ch5-sbu;</seg>
+        <seg>&xz-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Xz</title>
+
+    <para>Prepare Xz for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr                     \
+            --host=$LFS_TGT                   \
+            --build=$(build-aux/config.guess) \
+            --disable-static                  \
+            --docdir=/usr/share/doc/xz-&xz-version;</userinput></screen>
+
+   <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
+
+    <para>Make sure that all essential files are in the correct directory:</para>
+
+<screen><userinput remap="install">mv -v   $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
+mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
+ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+    <para>Details on this package are located in<!-- TODO
+    <xref linkend="contents-xz" role="."/>      --></para>
+
+  </sect2>
+
+</sect1>

+ 0 - 0
chapter06/aboutdebug.xml → chapter08/aboutdebug.xml


+ 0 - 0
chapter06/acl.xml → chapter08/acl.xml


+ 0 - 0
chapter06/adjusting.xml → chapter08/adjusting.xml


+ 0 - 0
chapter06/attr.xml → chapter08/attr.xml


+ 0 - 0
chapter06/autoconf.xml → chapter08/autoconf.xml


+ 0 - 0
chapter06/automake.xml → chapter08/automake.xml


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.