r671 - trunk/BOOK/chapter06

robert at linuxfromscratch.org robert at linuxfromscratch.org
Wed Jul 26 17:56:18 PDT 2006


Author: robert
Date: 2006-07-26 18:56:10 -0600 (Wed, 26 Jul 2006)
New Revision: 671

Added:
   trunk/BOOK/chapter06/butterfly-toolchain.xml
   trunk/BOOK/chapter06/linux-headers.xml
Removed:
   trunk/BOOK/chapter06/binutils.xml
   trunk/BOOK/chapter06/gcc.xml
   trunk/BOOK/chapter06/linux-libc-headers.xml
Modified:
   trunk/BOOK/chapter06/bash.xml
   trunk/BOOK/chapter06/bison.xml
   trunk/BOOK/chapter06/bzip2.xml
   trunk/BOOK/chapter06/changingowner.xml
   trunk/BOOK/chapter06/chapter06.xml
   trunk/BOOK/chapter06/chroot.xml
   trunk/BOOK/chapter06/coreutils.xml
   trunk/BOOK/chapter06/createfiles.xml
   trunk/BOOK/chapter06/creatingdirs.xml
   trunk/BOOK/chapter06/devices.xml
   trunk/BOOK/chapter06/diffutils.xml
   trunk/BOOK/chapter06/e2fsprogs.xml
   trunk/BOOK/chapter06/findutils.xml
   trunk/BOOK/chapter06/flex.xml
   trunk/BOOK/chapter06/gawk.xml
   trunk/BOOK/chapter06/gettext.xml
   trunk/BOOK/chapter06/glibc.xml
   trunk/BOOK/chapter06/groff.xml
   trunk/BOOK/chapter06/grub.xml
   trunk/BOOK/chapter06/gzip.xml
   trunk/BOOK/chapter06/inetutils.xml
   trunk/BOOK/chapter06/iproute2.xml
   trunk/BOOK/chapter06/kbd.xml
   trunk/BOOK/chapter06/kernfs.xml
   trunk/BOOK/chapter06/less.xml
   trunk/BOOK/chapter06/libtool.xml
   trunk/BOOK/chapter06/m4.xml
   trunk/BOOK/chapter06/make.xml
   trunk/BOOK/chapter06/man.xml
   trunk/BOOK/chapter06/mktemp.xml
   trunk/BOOK/chapter06/module-init-tools.xml
   trunk/BOOK/chapter06/ncurses.xml
   trunk/BOOK/chapter06/patch.xml
   trunk/BOOK/chapter06/procps.xml
   trunk/BOOK/chapter06/psmisc.xml
   trunk/BOOK/chapter06/pwdgroup.xml
   trunk/BOOK/chapter06/readjusting.xml
   trunk/BOOK/chapter06/sed.xml
   trunk/BOOK/chapter06/shadow.xml
   trunk/BOOK/chapter06/sysklogd.xml
   trunk/BOOK/chapter06/sysvinit.xml
   trunk/BOOK/chapter06/tar.xml
   trunk/BOOK/chapter06/texinfo.xml
   trunk/BOOK/chapter06/uclibc.xml
   trunk/BOOK/chapter06/util-linux.xml
   trunk/BOOK/chapter06/vim.xml
Log:
glibc-2.4, gcc-4.1.1 (aka NEO) merger part 3 of 3

Modified: trunk/BOOK/chapter06/bash.xml
===================================================================
--- trunk/BOOK/chapter06/bash.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/bash.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -32,11 +32,6 @@
 
 <screen><userinput>patch -Np1 -i ../&bash-fixes-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' \
-    -i {.,builtins}/Makefile.in</userinput></screen>
-
 <para>Prepare Bash for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --bindir=/bin \

Deleted: trunk/BOOK/chapter06/binutils.xml
===================================================================
--- trunk/BOOK/chapter06/binutils.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/binutils.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -1,268 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-system-binutils" role="wrap">
-<title>Binutils-&binutils-version;</title>
-<?dbhtml filename="binutils.html"?>
-
-<indexterm zone="ch-system-binutils">
-<primary sortas="a-Binutils">Binutils</primary>
-</indexterm>
-
-<sect2 role="package"><title/>
-<para>The Binutils package contains a linker, an assembler, and other tools for
-handling object files.</para>
-
-<segmentedlist>
-<segtitle>&buildtime;</segtitle>
-<segtitle>&diskspace;</segtitle>
-<seglistitem><seg>?? SBU</seg><seg>?? MB</seg></seglistitem>
-</segmentedlist>
-
-<segmentedlist>
-<segtitle>&dependencies;</segtitle>
-<seglistitem><seg>Bash, Bison, Coreutils, Diffutils, Flex, GCC, Gettext,
-Glibc, Grep, M4, Make, Perl, Sed, and Texinfo</seg></seglistitem>
-</segmentedlist>
-
-</sect2>
-
-<sect2 role="installation">
-<title>Installation of Binutils</title>
-
-<para>This package is known to have issues when its default
-optimization flags (including the <parameter>-march</parameter> and
-<parameter>-mcpu</parameter> options) are changed. If any environment
-variables that override default optimizations have been defined, such
-as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
-unset them when building Binutils.</para>
-
-<para condition="uclibc">Apply the next patch to add uClibc support to Binutils.</para>
-
-<screen condition="uclibc"><userinput>patch -Np1 -i ../&binutils-uClibc_conf-patch;</userinput></screen>
-
-<para>Apply a patch to add PAX_FLAGS elf header markings used by PaX kernels.</para>
-
-<screen><userinput>patch -Np1 -i ../&binutils-pt_pax-patch;</userinput></screen>
-
-<para>Apply this patch to make a few utilities use proper syntax during compile and
-testing.</para>
-
-<screen><userinput>patch -Np1 -i ../&binutils-posix-patch;</userinput></screen>
-
-<para>The Binutils documentation recommends building Binutils outside of the
-source directory in a dedicated build directory:</para>
-
-<screen><userinput>mkdir -v ../binutils-build
-cd ../binutils-build</userinput></screen>
-
-<para>Prepare Binutils for compilation:</para>
-
-<screen><userinput>../binutils-&binutils-version;/configure --prefix=/usr \
-    --host=${target} --build=${target} --target=${target} \
-    --enable-shared</userinput></screen>
-
-<para>Compile the package:</para>
-
-<screen><userinput>make tooldir=/usr</userinput></screen>
-
-<para>Run the test suite if you like. The objcopy test have a bug. It is not
-respecting a modified <envar>CC</envar>, <envar>CXX</envar>,
-<envar>CFLAGS</envar>, or <envar>CXXFLAGS</envar> environment,
-and so 3 tests fail due to <parameter>-fpic</parameter> and
-<parameter>-fstack-protector</parameter>. The tests can pass if we
-clear the specs file:</para>
-
-<screen><userinput>gcc -dumpspecs > $(gcc --print-file specs)
-perl -pi -e 's: /tools${ldso}: ${ldso}:g;' \
-    -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/@g;' \
-    $(gcc --print-file specs)
-make check</userinput></screen>
-
-<para>Then restore the hardened specs with the script we made in chapter 5:</para>
-
-<screen><userinput>/tools/bin/hardened-specs.sh</userinput></screen>
-
-<para>Install the package:</para>
-
-<screen><userinput>make tooldir=/usr install
-install -m644 ../binutils-&binutils-version;/include/libiberty.h /usr/include</userinput></screen>
-
-<para>Remove static libs installed by Binutils:</para>
-
-<screen><userinput>rm /usr/lib/{libbfd,libopcodes,libiberty}.a</userinput></screen>
-
-<para>Remove a static lib left over from libc:</para>
-
-<screen><userinput>rm /usr/lib/libdl*.a</userinput></screen>
-
-</sect2>
-
-
-<sect2 id="contents-binutils" role="content"><title>Contents of Binutils</title>
-
-<segmentedlist>
-<segtitle>Installed programs</segtitle>
-<segtitle>Installed libraries</segtitle>
-<seglistitem><seg>addr2line, ar, as, c++filt, gprof, ld, nm, objcopy, objdump,
-ranlib, readelf, size, strings, and strip</seg>
-<seg>libbfd.[a,so], and libopcodes.[a,so]</seg></seglistitem>
-</segmentedlist>
-
-<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
-<?dbfo list-presentation="list"?>
-<?dbhtml list-presentation="table"?>
-
-<varlistentry id="addr2line">
-<term><command>addr2line</command></term>
-<listitem>
-<para>Translates program addresses to file names and line numbers;
-given an address and the name of an executable, it uses the debugging
-information in the executable to determine which source file and line
-number are associated with the address</para>
-<indexterm zone="ch-system-binutils addr2line"><primary sortas="b-addr2line">addr2line</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="ar">
-<term><command>ar</command></term>
-<listitem>
-<para>Creates, modifies, and extracts from archives</para>
-<indexterm zone="ch-system-binutils ar"><primary sortas="b-ar">ar</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="as">
-<term><command>as</command></term>
-<listitem>
-<para>An assembler that assembles the output of <command>gcc</command>
-into object files</para>
-<indexterm zone="ch-system-binutils as"><primary sortas="b-as">as</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="c-filt">
-<term><command>c++filt</command></term>
-<listitem>
-<para>Used by the linker to de-mangle C++ and Java symbols and to keep
-overloaded functions from clashing</para>
-<indexterm zone="ch-system-binutils c-filt"><primary sortas="b-c++filt">c++filt</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="gprof">
-<term><command>gprof</command></term>
-<listitem>
-<para>Displays call graph profile data</para>
-<indexterm zone="ch-system-binutils gprof"><primary sortas="b-gprof">gprof</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="ld">
-<term><command>ld</command></term>
-<listitem>
-<para>A linker that combines a number of object and archive files into a single file,
-relocating their data and tying up symbol references</para>
-<indexterm zone="ch-system-binutils ld"><primary sortas="b-ld">ld</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="nm">
-<term><command>nm</command></term>
-<listitem>
-<para>Lists the symbols occurring in a given object file</para>
-<indexterm zone="ch-system-binutils nm"><primary sortas="b-nm">nm</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="objcopy">
-<term><command>objcopy</command></term>
-<listitem>
-<para>Translates one type of object file into another</para>
-<indexterm zone="ch-system-binutils objcopy"><primary sortas="b-objcopy">objcopy</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="objdump">
-<term><command>objdump</command></term>
-<listitem>
-<para>Displays information about the given object file, with options
-controlling the particular information to display; the information
-shown is useful to programmers who are working on the compilation
-tools</para>
-<indexterm zone="ch-system-binutils objdump"><primary sortas="b-objdump">objdump</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="ranlib">
-<term><command>ranlib</command></term>
-<listitem>
-<para>Generates an index of the contents of an archive and stores it
-in the archive; the index lists all of the symbols defined by archive
-members that are relocatable object files</para>
-<indexterm zone="ch-system-binutils ranlib"><primary sortas="b-ranlib">ranlib</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="readelf">
-<term><command>readelf</command></term>
-<listitem>
-<para>Displays information about ELF type binaries</para>
-<indexterm zone="ch-system-binutils readelf"><primary sortas="b-readelf">readelf</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="size">
-<term><command>size</command></term>
-<listitem>
-<para>Lists the section sizes and the total size for the given object files</para>
-<indexterm zone="ch-system-binutils size"><primary sortas="b-size">size</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="strings">
-<term><command>strings</command></term>
-<listitem>
-<para>Outputs, for each given file, the sequences of printable
-characters that are of at least the specified length (defaulting to
-four); for object files, it prints, by default, only the strings from
-the initializing and loading sections while for other types of files, it
-scans the entire file</para>
-<indexterm zone="ch-system-binutils strings"><primary sortas="b-strings">strings</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="strip">
-<term><command>strip</command></term>
-<listitem>
-<para>Discards symbols from object files</para>
-<indexterm zone="ch-system-binutils strip"><primary sortas="b-strip">strip</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="libbfd">
-<term><filename class="libraryfile">libbfd</filename></term>
-<listitem>
-<para>The Binary File Descriptor library</para>
-<indexterm zone="ch-system-binutils libbfd"><primary sortas="c-libbfd">libbfd</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="libopcodes">
-<term><filename class="libraryfile">libopcodes</filename></term>
-<listitem>
-<para>A library for dealing with opcodes—the <quote>readable
-text</quote> versions of instructions for the processor;
-it is used for building utilities like
-<command>objdump</command>.</para>
-<indexterm zone="ch-system-binutils libopcodes"><primary sortas="c-libopcodes">libopcodes</primary></indexterm>
-</listitem>
-</varlistentry>
-</variablelist>
-
-</sect2>
-
-</sect1>
-

Modified: trunk/BOOK/chapter06/bison.xml
===================================================================
--- trunk/BOOK/chapter06/bison.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/bison.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,10 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Bison</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/Makefile.in</userinput></screen>
-
 <para>Prepare Bison for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Added: trunk/BOOK/chapter06/butterfly-toolchain.xml
===================================================================
--- trunk/BOOK/chapter06/butterfly-toolchain.xml	                        (rev 0)
+++ trunk/BOOK/chapter06/butterfly-toolchain.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -0,0 +1,334 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-system-butterfly-toolchain" role="wrap">
+  <?dbhtml filename="butterfly-toolchain.html"?>
+
+  <title>Butterfly Toolchain</title>
+
+  <indexterm zone="ch-system-butterfly-toolchain">
+    <primary sortas="a-Butterfly Toolchain">Butterfly Toolchain</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The GCC package contains the GNU compiler collection, which includes
+    the C and C++ compilers. The Binutils package contains a linker, an
+    assembler, and other tools for handling object files.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>About 4 SBU</seg><seg>?? MB</seg></seglistitem>
+    </segmentedlist>
+
+    <segmentedlist>
+      <segtitle>&dependencies;</segtitle>
+      <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
+      Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo
+      </seg></seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of GCC</title>
+
+    <para>This package is known to have issues when its default
+    optimization flags (including the <parameter>-march</parameter> and
+    <parameter>-mtune</parameter> options) are changed. If any environment
+    variables that override default optimizations have been defined, such
+    as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
+    unset them when building GCC.</para>
+
+    <para>Unpack the binutils-&binutils-version;, gcc-core-&gcc-version;,
+    gcc-g++-&gcc-version;, and gcc-testsuite-&gcc-version; source packages
+    but do not change directory. Then combine the two packages to the same
+    directory with the following commands:</para>
+
+<screen><userinput>mkdir -v butterfly-toolchain/
+cp -va binutils-&binutils-version;/{bfd,binutils,gas,gprof,include,ld,opcodes} \
+    butterfly-toolchain/
+cp -va gcc-&gcc-version;/* butterfly-toolchain/
+cd butterfly-toolchain/</userinput></screen>
+
+    <para>The binutils-&binutils-version;/ and gcc-&gcc-version;/ directories
+    can be removed.</para>
+
+    <para condition="uclibc">Apply these patches. The locale patch is needed
+    even without locales installed:</para>
+
+<screen condition="uclibc"><userinput>patch -Np1 -i ../&gcc-uClibc_conf-patch;
+patch -Np1 -i ../&gcc-uClibc_libstdc-patch;
+patch -Np1 -i ../&gcc-uClibc_locale-patch;</userinput></screen>
+
+    <para condition="uclibc">Use this command to hardcode
+    <parameter>LIBS="-lintl"</parameter>:</para>
+
+<screen condition="uclibc"><userinput>sed -e 's/%{shared:-lc}/%{!nointl: -lintl} &/' \
+    -i gcc/config/linux.h</userinput></screen>
+
+    <para>Make the <command>head</command> and <command>tail</command> command
+    syntax Posix compliant:</para>
+
+<screen><userinput>sed 's/head -1/head -n 1/g' -i.orig libstdc++-v3/configure
+sed 's/head -1/head -n 1/g' -i.orig ltcf-c.sh.orig
+sed 's/head -1/head -n 1/g' -i.orig ltcf-gcj.sh
+sed 's/tail +16c/tail -c +16/g' -i.orig configure
+sed 's/tail +16c/tail -c +16/g' -i.orig gas/Makefile.in
+sed 's/tail +16c/tail -c +16/g' -i.orig gcc/Makefile.in
+sed 's/tail -3/tail -n 3/g' -i.orig gcc/configure
+sed 's/tail +140/tail -n +140/g' -i.orig \
+    ld/testsuite/ld-bootstrap/bootstrap.exp</userinput></screen>
+
+    <para>Fix the RPATH_ENVVAR for bfd and opcode:</para>
+
+<screen><userinput>
+sed -e 's@/.:$$r@/.libs:$$r@' -e 's@/.:@/.libs:@' -i.orig Makefile.in</userinput></screen>
+
+    <para>Copy over the <filename>hardened-specs.h</filename> file previously
+    installed to <filename class="directory">/tools</filename> from the
+    <xref linkend="ch-tools-cocoon-toolchain" role="."/>
+    page include it in <filename>gcc.c</filename>:</para>
+
+<screen><userinput>cp /tools/hardened-specs.h gcc/
+sed -e '0,/.*config.h can define.*/s//#include "hardened-specs.h"\n&/' \
+    -i.orig gcc/gcc.c</userinput></screen>
+
+    <para>Apply the specs patch:</para>
+
+<screen><userinput>patch -Np1 -i ../&gcc-specs_x86-patch;</userinput></screen>
+
+    <para>Disable the fixincludes script and -Werror option:</para>
+
+<screen><userinput>sed 's@\./fixinc\.sh at -c true@' -i.orig2 gcc/Makefile.in
+sed 's/@WERROR@/-Wno-error/' -i.orig fixincludes/Makefile.in</userinput></screen>
+    <para>Disable <option>-fstack-protector[-all]</option> in
+    <filename class="libraryfile">libssp.[a,so]</filename>:</para>
+
+<screen><userinput>sed 's/^AM_CFLAGS =/& -fno-stack-protector/' \
+    -i.orig libssp/Makefile.in</userinput></screen>
+
+    <para>Disable <option>-fstack-protector[-all]</option> in
+    <filename class="libraryfile">libgcc.[a,so]</filename>:</para>
+
+<screen><userinput>sed 's/^LIBGCC2_CFLAGS =/& -fno-stack-protector/' \
+    -i.orig3 gcc/Makefile.in</userinput></screen>
+
+    <para>Disable <option>-fstack-protector[-all]</option> in
+    <filename class="libraryfile">crtbegin[,S,T].o</filename> and
+    <filename class="libraryfile">crtend[,S].o</filename>:</para>
+
+<screen><userinput>sed 's/^CRTSTUFF_CFLAGS =/& -fno-stack-protector/' \
+    -i.orig4 gcc/Makefile.in</userinput></screen>
+
+    <para>The <command>gccbug</command> script hardcodes the presence of
+    <command>mktemp</command> if it is found. Since we will be installing
+    <command>mktemp</command> later in this chapter, we can modify the GCC
+    source to use <command>mktemp</command> so that
+    <command>gccbug</command> will not use less random temporary filenames:</para>
+
+<screen><userinput>sed 's/@have_mktemp_command@/yes/' -i.orig gcc/gccbug.in</userinput></screen>
+
+    <para>Create a separate build directory again:</para>
+
+<screen><userinput>mkdir -v ../butterfly-build
+cd ../butterfly-build</userinput></screen>
+
+    <para>Prepare for compilation:</para>
+
+<screen><userinput>../butterfly-toolchain/configure --prefix=/usr \
+    --libexecdir=/usr/lib --enable-shared \
+    --enable-threads=posix --enable-__cxa_atexit \
+    --enable-clocale=gnu --enable-languages=c,c++ \
+    --with-dynamic-linker=/lib/<literal condition="glibc">ld-linux.so.2</literal><literal condition="uclibc">ld-uClibc.so.0</literal> \
+    --enable-checking --enable-werror-always</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput>make tooldir=/usr</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the make parameter:</title>
+
+      <varlistentry>
+        <term><parameter>tooldir=/usr</parameter></term>
+        <listitem>
+          <para>Normally, the tooldir (the directory where the executables will
+          ultimately be located) is set to <filename
+          class="directory">$(exec_prefix)/$(target_alias)</filename>. For
+          example, i686 machines would expand that to <filename
+          class="directory">/usr/i686-pc-linux-gnu</filename>. Because this is
+          a custom system, this target-specific directory in <filename
+          class="directory">/usr</filename> is not required. <filename
+          class="directory">$(exec_prefix)/$(target_alias)</filename> would be
+          used if the system was used to cross-compile (for example, compiling a
+          package on an Intel machine that generates code that can be executed
+          on PowerPC machines).</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+<para>To test the results:</para>
+
+<screen><userinput>make -k check</userinput></screen>
+
+<para>There is an SSP test in
+<filename class="directory">gcc.misc-tests/</filename>. The testsuite will be
+very bad. SSP and PIC need to be disabled in CFLAGS_FOR_TARGET, and
+-L/usr/lib/static probably needs to be added so static libraries can be used.</para>
+
+<para>Install the package:</para>
+
+<screen><userinput>make tooldir=/usr install</userinput></screen>
+
+<para>Move the static libraries installed by GCC:</para>
+
+<screen condition="glibc"><userinput>mv -v /usr/lib/{libsupc++,libstdc++}.a /usr/lib/static/
+mv -v /usr/lib/{libbfd,libiberty,libmudflap,libmudflapth}.a /usr/lib/static
+mv -v /usr/lib/{libopcodes,libssp,libssp_nonshared}.a /usr/lib/static
+mv -v /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/libgcov.a /usr/lib/static/</userinput></screen>
+
+<screen condition="uclibc"><userinput>mv -v /usr/lib/{libsupc++,libstdc++}.a /usr/lib/static/
+mv -v /usr/lib/{libbfd,libiberty,libmudflap,libmudflapth}.a /usr/lib/static
+mv -v /usr/lib/{libopcodes,libssp,libssp_nonshared}.a /usr/lib/static
+mv -v /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/libgcov.a /usr/lib/static/
+mv -v /usr/lib/libstdc++_pic.a /usr/lib/static/</userinput></screen>
+
+    <para>Some packages expect the C PreProcessor to be installed in the
+    <filename class="directory">/lib</filename> directory.
+    To support those packages, create this symlink:</para>
+
+<screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
+
+    <para>Many packages use the name <command>cc</command> to call the C
+    compiler. To satisfy those packages, create a symlink:</para>
+
+<screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
+
+    <important><para>Confirm the new compiler is defining PIC, SSP, and
+    FORTIFY_SOURCE:</para>
+
+<screen><userinput>echo | cc -dM -E - | grep -E 'PIC|SSP|FORTIFY'</userinput></screen>
+
+    <para>This should return:</para>
+
+<screen><computeroutput>#define FORTIFY_SOURCE 2
+#define __SSP_ALL__ 2
+#define __PIC__ 1</computeroutput></screen></important>
+
+<!--
+<important><para>Now you must return to <xref linkend="testing-gcc"/> to repeat the
+sanity checks, but removing <parameter>-e ': /tools'</parameter> from the third
+test.</para></important>
+-->
+
+</sect2>
+
+
+<sect2 id="contents-butterfly-toolchain" role="content"><title>Contents of GCC</title>
+
+<segmentedlist>
+<segtitle>Installed programs</segtitle>
+<segtitle>Installed libraries</segtitle>
+<seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
+<seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
+</segmentedlist>
+
+<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
+<?dbfo list-presentation="list"?>
+<?dbhtml list-presentation="table"?>
+
+<varlistentry id="cc">
+<term><command>cc</command></term>
+<listitem>
+<para>The C compiler</para>
+<indexterm zone="ch-system-butterfly-toolchain cc"><primary sortas="b-cc">cc</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="cpp">
+<term><command>cpp</command></term>
+<listitem>
+<para>The C preprocessor; it is used by the compiler to expand the
+#include, #define, and similar statements in the source files</para>
+<indexterm zone="ch-system-butterfly-toolchain cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="c">
+<term><command>c++</command></term>
+<listitem>
+<para>The C++ compiler</para>
+<indexterm zone="ch-system-butterfly-toolchain c"><primary sortas="b-c++">c++</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="g">
+<term><command>g++</command></term>
+<listitem>
+<para>The C++ compiler</para>
+<indexterm zone="ch-system-butterfly-toolchain g"><primary sortas="b-g++">g++</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="gcc">
+<term><command>gcc</command></term>
+<listitem>
+<para>The C compiler</para>
+<indexterm zone="ch-system-butterfly-toolchain gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="gccbug">
+<term><command>gccbug</command></term>
+<listitem>
+<para>A shell script used to help create useful bug reports</para>
+<indexterm zone="ch-system-butterfly-toolchain gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="gcov">
+<term><command>gcov</command></term>
+<listitem>
+<para>A coverage testing tool; it is used to analyze programs to
+determine where optimizations will have the most effect</para>
+<indexterm zone="ch-system-butterfly-toolchain gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="libgcc">
+<term><filename class="libraryfile">libgcc</filename></term>
+<listitem>
+<para>Contains run-time support for <command>gcc</command></para>
+<indexterm zone="ch-system-butterfly-toolchain libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="libstdc">
+<term><filename class="libraryfile">libstdc++</filename></term>
+<listitem>
+<para>The standard C++ library</para>
+<indexterm zone="ch-system-butterfly-toolchain libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
+</listitem>
+</varlistentry>
+
+<varlistentry id="libsupc">
+<term><filename class="libraryfile">libsupc++</filename></term>
+<listitem>
+<para>Provides supporting routines for the C++ programming language</para>
+<indexterm zone="ch-system-butterfly-toolchain libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
+</listitem>
+</varlistentry>
+</variablelist>
+
+</sect2>
+
+</sect1>
+

Modified: trunk/BOOK/chapter06/bzip2.xml
===================================================================
--- trunk/BOOK/chapter06/bzip2.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/bzip2.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -30,10 +30,6 @@
 <sect2 role="installation">
 <title>Installation of Bzip2</title>
 
-<para>Apply a patch to ... EDIT ME</para>
-
-<screen><userinput>patch -Np1 -i ../&bzip2-hardened_cflags-patch;</userinput></screen>
-
 <para>This patch adds documentation for bzip2:</para>
 
 <screen><userinput>patch -Np1 -i ../&bzip2-install_docs-patch;</userinput></screen>

Modified: trunk/BOOK/chapter06/changingowner.xml
===================================================================
--- trunk/BOOK/chapter06/changingowner.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/changingowner.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -26,7 +26,7 @@
 directories to user <emphasis>root</emphasis> by running the following
 command:</para>
 
-<screen><userinput>chown -R 0:0 /{tools,sources}</userinput></screen>
+<screen><userinput>chown -vR 0:0 /tools</userinput></screen>
 
 <para>The command uses <parameter>0:0</parameter> instead of
 <parameter>root:root</parameter>, because <command>chown</command>

Modified: trunk/BOOK/chapter06/chapter06.xml
===================================================================
--- trunk/BOOK/chapter06/chapter06.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/chapter06.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -16,13 +16,12 @@
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="createfiles.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pwdgroup.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="devices.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="linux-libc-headers.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="linux-headers.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="man-pages.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="glibc.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="uclibc.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="readjusting.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="butterfly-toolchain.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="coreutils.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="zlib.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="mktemp.xml"/>

Modified: trunk/BOOK/chapter06/chroot.xml
===================================================================
--- trunk/BOOK/chapter06/chroot.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/chroot.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -16,7 +16,7 @@
 <screen><userinput>chroot "$HLFS" /tools/bin/env -i \
     HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
-    /tools/bin/bash --login +h</userinput></screen>
+    /tools/bin/nice /tools/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
@@ -31,14 +31,6 @@
 <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is
 a good place to set them again.</para>
 
-<para>Export some environment variables used in the build commands:</para>
-
-<screen condition="glibc"><userinput>export target=$(uname -m)-pc-linux-gnu
-export ldso=/lib/ld-linux.so.2</userinput></screen>
-
-<screen condition="uclibc"><userinput>export target=$(uname -m)-pc-linux-uclibc
-export ldso=/lib/ld-uClibc.so.0</userinput></screen>
-
 <para>From this point on, there is no need to use the
 <envar>HLFS</envar> variable anymore, because all work will be
 restricted to the HLFS file system.  This is because the Bash shell is

Modified: trunk/BOOK/chapter06/coreutils.xml
===================================================================
--- trunk/BOOK/chapter06/coreutils.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/coreutils.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -37,13 +37,8 @@
 <para>Prevent Coreutils from installing binaries that will be later be
 installed by other packages:</para>
 
-<screen><userinput>patch -Np1 -i \
-    ../&coreutils-suppress_uptime_kill_su-patch;</userinput></screen>
+<screen><userinput>patch -Np1 -i ../&coreutils-suppress_uptime_kill_su-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/Makefile.in</userinput></screen>
-
 <para>There is a buffer overflow vulnerability in the <command>who -Hu</command> command.
 See: <ulink url="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=158405"/> for more
 information. Fix the bug with the following command:</para>
@@ -90,15 +85,15 @@
 
 <para>Move programs to the proper locations:</para>
 
-<screen><userinput>mv /usr/bin/{[,basename,cat,chgrp,chmod,chown,cp,dd,df} /bin
-mv /usr/bin/{date,echo,false,head,hostname,install,ln} /bin
-mv /usr/bin/{ls,mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin
-mv /usr/bin/{sleep,stty,test,touch,true,uname} /bin
-mv /usr/bin/chroot /usr/sbin</userinput></screen>
+<screen><userinput>mv -v /usr/bin/{[,basename,cat,chgrp,chmod,chown,cp,dd,df} /bin
+mv -v /usr/bin/{date,echo,false,head,hostname,install,ln} /bin
+mv -v /usr/bin/{ls,mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin
+mv -v /usr/bin/{sleep,stty,test,touch,true,uname} /bin
+mv -v /usr/bin/chroot /usr/sbin</userinput></screen>
 
 <para>Finally, create a symlink to be FHS-compliant:</para>
 
-<screen><userinput>ln -s ../../bin/install /usr/bin</userinput></screen>
+<screen><userinput>ln -vs ../../bin/install /usr/bin</userinput></screen>
 
 </sect2>
 

Modified: trunk/BOOK/chapter06/createfiles.xml
===================================================================
--- trunk/BOOK/chapter06/createfiles.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/createfiles.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -12,10 +12,10 @@
 links which will be replaced by real files throughout the course of
 this chapter after the software has been installed.</para>
 
-<screen><userinput>ln -s /tools/bin/{bash,cat,pwd,stty} /bin
-ln -s /tools/bin/perl /usr/bin
-ln -s /tools/lib/libgcc_s.so{,.1} /usr/lib
-ln -s bash /bin/sh</userinput></screen>
+<screen><userinput>ln -vs /tools/bin/{bash,cat,pwd,stty} /bin
+ln -vs /tools/bin/perl /usr/bin
+ln -vs /tools/lib/libgcc_s.so{,.1} /usr/lib
+ln -vs bash /bin/sh</userinput></screen>
 
 </sect1>
 

Modified: trunk/BOOK/chapter06/creatingdirs.xml
===================================================================
--- trunk/BOOK/chapter06/creatingdirs.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/creatingdirs.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -11,23 +11,23 @@
 Create a directory tree. Issuing the following commands will create a
 standard tree:</para>
  
-<screen><userinput>install -d /{bin,boot,dev,etc,home,lib,mnt}
-install -d /{sbin,usr/local,var}
-install -d /root -m 0750
-install -d /tmp /var/tmp -m 1777
-install -d /usr/{bin,include,lib,sbin,share,src}
-ln -s share/{man,doc,info} /usr
-install -d /usr/share/{doc,info,locale,man}
-install -d /usr/share/{misc,terminfo,zoneinfo}
-install -d /usr/share/man/man{1,2,3,4,5,6,7,8}
-install -d /usr/local/{bin,etc,include,lib,sbin,share,src}
-ln -s share/{man,doc,info} /usr/local
-install -d /usr/local/share/{doc,info,locale,man}
-install -d /usr/local/share/{misc,terminfo,zoneinfo}
-install -d /usr/local/share/man/man{1,2,3,4,5,6,7,8}
-install -d /var/{lock,log,mail,run,spool}
-install -d /var/{cache,lib/{misc,locate},local}
-install -d /var/empty -m 0500</userinput></screen>
+<screen><userinput>install -vd /{bin,boot,dev,etc,home,lib,mnt}
+install -vd /{sbin,usr/local,var}
+install -vd /root -m 0750
+install -vd /tmp /var/tmp -m 1777
+install -vd /usr/{bin,include,lib,sbin,share,src}
+ln -vs share/{man,doc,info} /usr
+install -vd /usr/share/{doc,info,locale,man}
+install -vd /usr/share/{misc,terminfo,zoneinfo}
+install -vd /usr/share/man/man{1,2,3,4,5,6,7,8}
+install -vd /usr/local/{bin,etc,include,lib,sbin,share,src}
+ln -vs share/{man,doc,info} /usr/local
+install -vd /usr/local/share/{doc,info,locale,man}
+install -vd /usr/local/share/{misc,terminfo,zoneinfo}
+install -vd /usr/local/share/man/man{1,2,3,4,5,6,7,8}
+install -vd /var/{lock,log,mail,run,spool}
+install -vd /var/{cache,lib/{misc,locate},local}
+install -vd /var/empty -m 0500</userinput></screen>
 
 <para>Directories are, by default, created with permission mode 755,
 but this is not desirable for all directories. In the commands above,

Modified: trunk/BOOK/chapter06/devices.xml
===================================================================
--- trunk/BOOK/chapter06/devices.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/devices.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -34,7 +34,7 @@
 <filename class="directory">/dev</filename>. Begin by mounting
 <filename class="directory">/dev</filename>:</para>
 
-<screen><userinput>mount -n -t tmpfs none /dev</userinput></screen>
+<screen><userinput>mount -v -n -t tmpfs none /dev</userinput></screen>
 
 <para>Since the Udev package will not be installed until later on in the
 process, create a minimal set of device nodes used for building:</para>
@@ -46,25 +46,24 @@
 mknod -m 666 /dev/tty c 5 0
 mknod -m 444 /dev/random c 1 8
 mknod -m 444 /dev/urandom c 1 9
-mknod -m 444 /dev/erandom c 235 12
-chown root:tty /dev/{console,ptmx,tty}</userinput></screen>
+chown -v root:tty /dev/{console,ptmx,tty}</userinput></screen>
 
 <para>There are some symlinks and directories required by HLFS that are
 not created by Udev, so create those here:</para>
 
-<screen><userinput>ln -s /proc/self/fd /dev/fd
-ln -s /proc/self/fd/0 /dev/stdin
-ln -s /proc/self/fd/1 /dev/stdout
-ln -s /proc/self/fd/2 /dev/stderr
-ln -s /proc/kcore /dev/core
-install -d /dev/pts
-install -d /dev/shm</userinput></screen>
+<screen><userinput>ln -vs /proc/self/fd /dev/fd
+ln -vs /proc/self/fd/0 /dev/stdin
+ln -vs /proc/self/fd/1 /dev/stdout
+ln -vs /proc/self/fd/2 /dev/stderr
+ln -vs /proc/kcore /dev/core
+install -vd /dev/pts
+install -vd /dev/shm</userinput></screen>
 
 <para>Finally, mount the proper virtual (kernel) file systems on the
 newly-created directories:</para>
 
-<screen><userinput>mount -t devpts -o gid=4,mode=620 none /dev/pts
-mount -t tmpfs none /dev/shm</userinput></screen>
+<screen><userinput>mount -v -t devpts -o gid=4,mode=620 none /dev/pts
+mount -v -t tmpfs none /dev/shm</userinput></screen>
 
 <para>The <command>mount</command> commands executed above may result
 in the following warning message:</para>

Modified: trunk/BOOK/chapter06/diffutils.xml
===================================================================
--- trunk/BOOK/chapter06/diffutils.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/diffutils.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -29,10 +29,6 @@
 <sect2 role="installation">
 <title>Installation of Diffutils</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/Makefile.in</userinput></screen>
-
 <para>Prepare Diffutils for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/e2fsprogs.xml
===================================================================
--- trunk/BOOK/chapter06/e2fsprogs.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/e2fsprogs.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -30,11 +30,6 @@
 <sect2 role="installation">
 <title>Installation of E2fsprogs</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>find resize/ debugfs/ e2fsck/ misc/ -type f -name Makefile.in \
-    | xargs sed -e 's@\$(ALL_CFLAGS)@& -pie -fpie at g' -i</userinput></screen>
-
 <para>Fix a problem with e2fsprogs testsuite:</para>
 
 <screen><userinput>sed -i -e 's/-DTEST/$(ALL_CFLAGS) &/' lib/e2p/Makefile.in</userinput></screen>

Modified: trunk/BOOK/chapter06/findutils.xml
===================================================================
--- trunk/BOOK/chapter06/findutils.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/findutils.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -31,11 +31,6 @@
 <sect2 role="installation">
 <title>Installation of Findutils</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' \
-    -i {find,locate,xargs}/Makefile.in</userinput></screen>
-
 <para>Prepare Findutils for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --libexecdir=/usr/lib/findutils \

Modified: trunk/BOOK/chapter06/flex.xml
===================================================================
--- trunk/BOOK/chapter06/flex.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/flex.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -29,21 +29,6 @@
 <sect2 role="installation">
 <title>Installation of Flex</title>
 
-<para>Apply a patch to ... EDIT ME</para>
-
-<screen><userinput>patch -Np1 -i ../&flex-hardened_cflags-patch;</userinput></screen>
-
-<para>Flex contains several known bugs. Fix these with the following patch:</para>
-
-<screen><userinput>patch -Np1 -i ../&flex-debian_fixes-patch;</userinput></screen>
-
-<para>The GNU autotools detects that the Flex source code has been
-modified by the previous patch and tries to update the manual page
-accordingly. This does not work correctly on many systems, and the
-default page is fine, so make sure it does not get regenerated:</para>
-
-<screen><userinput>touch doc/flex.1</userinput></screen>
-
 <para>Prepare Flex for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/gawk.xml
===================================================================
--- trunk/BOOK/chapter06/gawk.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/gawk.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -32,10 +32,6 @@
 
 <screen><userinput>patch -Np1 -i ../&gawk-segfault_fix-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>Prepare Gawk for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --libexecdir=/usr/lib</userinput></screen>

Deleted: trunk/BOOK/chapter06/gcc.xml
===================================================================
--- trunk/BOOK/chapter06/gcc.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/gcc.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -1,249 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-system-gcc" role="wrap">
-<title>GCC-&gcc-version;</title>
-<?dbhtml filename="gcc.html"?>
-
-<indexterm zone="ch-system-gcc">
-<primary sortas="a-GCC">GCC</primary>
-</indexterm>
-
-<sect2 role="package"><title/>
-<para>The GCC package contains the GNU compiler collection, which includes
-the C and C++ compilers.</para>
-
-<segmentedlist>
-<segtitle>&buildtime;</segtitle>
-<segtitle>&diskspace;</segtitle>
-<seglistitem><seg>?? SBU</seg><seg>?? MB</seg></seglistitem>
-</segmentedlist>
-
-<segmentedlist>
-<segtitle>&dependencies;</segtitle>
-<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
-Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem>
-</segmentedlist>
-
-</sect2>
-
-<sect2 role="installation">
-<title>Installation of GCC</title>
-
-<para>This package is known to have issues when its default
-optimization flags (including the <parameter>-march</parameter> and
-<parameter>-mcpu</parameter> options) are changed. If any environment
-variables that override default optimizations have been defined, such
-as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
-unset them when building GCC.</para>
-
-<para>Unpack both the gcc-core and the gcc-g++ tarballs—they will
-unpack into the same directory. Likewise, extract the gcc-testsuite
-package.  The full GCC package contains additional compilers.
-Instructions for building these can be found at <ulink
-url="&blfs-root;view/svn/general/gcc.html"/>.</para>
-
-<para condition="uclibc">Apply these patches. The locale patch is needed
-even without locales installed:</para>
-
-<screen condition="uclibc"><userinput>patch -Np1 -i ../&gcc-uClibc_conf-patch;
-patch -Np1 -i ../&gcc-uClibc_libstdc-patch;
-patch -Np1 -i ../&gcc-uClibc_locale-patch;</userinput></screen>
-
-<para condition="uclibc">Use this command to hardcode
-<parameter>LIBS="-lintl"</parameter>:</para>
-
-<screen condition="uclibc"><userinput>sed -e 's/%{shared:-lc}/%{!nointl: -lintl} &/' \
-    -i gcc/config/linux.h</userinput></screen>
-
-<para>Apply this set of patches:</para>
-
-<screen><userinput>patch -Np1 -i ../&gcc-hardened_cflags-patch;
-patch -Np1 -i ../&gcc-specs_x86-patch;
-patch -Np1 -i ../&gcc-no_fixincludes-patch;
-patch -Np1 -i ../&gcc-ssp-patch;
-patch -Np1 -i ../&gcc-linkonce-patch;</userinput></screen>
-
-<para>Fix <filename>libiberty/Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/install_to_$(INSTALL_DEST) //' -i libiberty/Makefile.in</userinput></screen>
-
-<para>The bugs URL and version strings are modified as the comments in
-<filename>version.c</filename> recommends:</para>
-
-<screen><userinput>sed -e 's at gcc.gnu.org/bugs.html at bugs.linuxfromscratch.org/@' \
-        -e 's/&gcc-version;/&gcc-version; (ssp)/' -i gcc/version.c</userinput></screen>
-
-<para>The <command>gccbug</command> script hardcodes the presence <command>mktemp</command>
-if it is found. Since we will be installing <command>mktemp</command> later in this
-chapter, we can modify the GCC source to use <command>mktemp</command> so that
-<command>gccbug</command> will not use less random temporary filenames:</para>
-
-<screen><userinput>sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in</userinput></screen>
-
-<para>Create a separate build directory again:</para>
-
-<screen><userinput>mkdir ../gcc-build
-cd ../gcc-build</userinput></screen>
-
-<para>Prepare GCC for compilation:</para>
-
-<screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
-    --host=${target} --build=${target} --target=${target} \
-    --libexecdir=/usr/lib --enable-threads=posix \
-    --enable-shared --enable-__cxa_atexit \
-    --with-dynamic-linker=${ldso} --enable-clocale \
-    --enable-languages=c,c++ --enable-multilib=no</userinput></screen>
-
-<para>Compile the package:</para>
-
-<screen><userinput>make</userinput></screen>
-
-<para>To test the results, issue: <userinput>make -k check</userinput>.
-The results should be identical to results you would typically get from an LFS build.
-There is an SSP test in <filename class="directory">gcc.misc-tests/</filename>
-which should pass.</para>
-
-<para>Install the package:</para>
-
-<screen><userinput>make install</userinput></screen>
-
-<para>Some packages expect the C PreProcessor to be installed in the
-<filename class="directory">/lib</filename> directory.
-To support those packages, create this symlink:</para>
-
-<screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
-
-<para>Many packages use the name <command>cc</command> to call the C
-compiler. To satisfy those packages, create a symlink:</para>
-
-<screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
-
-<para>And restore the hardened specs:</para>
-
-<screen><userinput>/tools/bin/hardened-specs.sh</userinput></screen>
-
-<para>Remove the statics libs installed by GCC:</para>
-
-<screen condition="glibc"><userinput>rm /usr/lib/{libsupc++,libstdc++}.a
-rm /usr/lib/gcc/${target}/&gcc-version;/libgcov.a</userinput></screen>
-
-<screen condition="uclibc"><userinput>rm /usr/lib/{libsupc++,libstdc++}.a
-rm /usr/lib/gcc/${target}/&gcc-version;/libgcov.a
-rm /usr/lib/libstdc++_pic.a</userinput></screen>
-
-<para><filename class="libraryfile">libc.a</filename> can be removed now too:</para>
-
-<screen condition="glibc"><userinput>rm /usr/lib/libc{,_g}.a</userinput></screen>
-
-<screen condition="uclibc"><userinput>rm /usr/lib/libc.a</userinput></screen>
-
-<important><para>Now you must return to <xref linkend="testing-gcc"/> to repeat the
-sanity checks, but removing <parameter>-e ': /tools'</parameter> from the third
-test.</para></important>
-
-</sect2>
-
-
-<sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
-
-<segmentedlist>
-<segtitle>Installed programs</segtitle>
-<segtitle>Installed libraries</segtitle>
-<seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
-<seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
-</segmentedlist>
-
-<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
-<?dbfo list-presentation="list"?>
-<?dbhtml list-presentation="table"?>
-
-<varlistentry id="cc">
-<term><command>cc</command></term>
-<listitem>
-<para>The C compiler</para>
-<indexterm zone="ch-system-gcc cc"><primary sortas="b-cc">cc</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="cpp">
-<term><command>cpp</command></term>
-<listitem>
-<para>The C preprocessor; it is used by the compiler to expand the
-#include, #define, and similar statements in the source files</para>
-<indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="c">
-<term><command>c++</command></term>
-<listitem>
-<para>The C++ compiler</para>
-<indexterm zone="ch-system-gcc c"><primary sortas="b-c++">c++</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="g">
-<term><command>g++</command></term>
-<listitem>
-<para>The C++ compiler</para>
-<indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="gcc">
-<term><command>gcc</command></term>
-<listitem>
-<para>The C compiler</para>
-<indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="gccbug">
-<term><command>gccbug</command></term>
-<listitem>
-<para>A shell script used to help create useful bug reports</para>
-<indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="gcov">
-<term><command>gcov</command></term>
-<listitem>
-<para>A coverage testing tool; it is used to analyze programs to
-determine where optimizations will have the most effect</para>
-<indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="libgcc">
-<term><filename class="libraryfile">libgcc</filename></term>
-<listitem>
-<para>Contains run-time support for <command>gcc</command></para>
-<indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="libstdc">
-<term><filename class="libraryfile">libstdc++</filename></term>
-<listitem>
-<para>The standard C++ library</para>
-<indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
-</listitem>
-</varlistentry>
-
-<varlistentry id="libsupc">
-<term><filename class="libraryfile">libsupc++</filename></term>
-<listitem>
-<para>Provides supporting routines for the C++ programming language</para>
-<indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
-</listitem>
-</varlistentry>
-</variablelist>
-
-</sect2>
-
-</sect1>
-

Modified: trunk/BOOK/chapter06/gettext.xml
===================================================================
--- trunk/BOOK/chapter06/gettext.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/gettext.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -30,13 +30,6 @@
 <sect2 role="installation">
 <title>Installation of Gettext</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^C\(XX\)\?FLAGS .*$/& -pie -fpie/' -i \
-    gettext-runtime/src/Makefile.in
-sed -e 's/.*_CFLAGS = .*$/& -pie -fpie/' -i \
-    gettext-tools/src/Makefile.in</userinput></screen> 
-
 <para>Prepare Gettext for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --disable-static</userinput></screen>

Modified: trunk/BOOK/chapter06/glibc.xml
===================================================================
--- trunk/BOOK/chapter06/glibc.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/glibc.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -36,64 +36,82 @@
 
 <para>This package is known to have issues when its default
 optimization flags (including the <parameter>-march</parameter> and
-<parameter>-mcpu</parameter> options) are changed. If any environment
+<parameter>-mtune</parameter> options) are changed. If any environment
 variables that override default optimizations have been defined, such
 as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
 unset them when building Glibc.</para>
 
-<important><para>Be sure to unpack both Glibc and Glibc-Libidn packages before starting
-the build. Then, apply the patches:</para></important>
+<para>If you want to install LibIDN then unpack it:</para>
 
-<screen><userinput>patch -Np1 -i ../&glibc-arc4random-patch;
-patch -Np1 -i ../&glibc-ssp-patch;
-patch -Np1 -i ../&glibc-fstack_protector-patch;
-patch -Np1 -i ../&glibc-pt_pax-patch;
-patch -Np1 -i ../&glibc-dl_execstack_PaX-patch;</userinput></screen>
+<screen><userinput>tar vxf ../glibc-libidn-&glibc-version;.tar.bz2
+mv -v glibc-libidn-&glibc-version; libidn</userinput></screen>
 
-<para>The fstack_protector patch adds <parameter>-fstack-protector-all</parameter>
-to selected utilities and libraries. <filename class="libraryfile">libc.so</filename>,
-<filename class="libraryfile">ld.so</filename>, <filename
-class="libraryfile">libbsd-compat.so</filename>, and other libraries which
-do not preload <filename class="libraryfile">libc.so</filename> are skipped. This patch
-will work to override the <parameter>-fno-stack-protector</parameter> option used in
-the <envar>CC</envar> environment variable below.</para>
+<para>Apply the patches:</para>
 
+<screen><userinput>patch -Np1 -i ../&glibc-dl_execstack_PaX-patch;
+patch -Np1 -i ../&glibc-iconv_fix-patch;
+patch -Np1 -i ../&glibc-iconv_unnest-patch;
+patch -Np1 -i ../&glibc-localedef_segfault-patch;
+patch -Np1 -i ../&glibc-pt_pax-patch;</userinput></screen>
+
+<para>Use PIC assembly code in the utility programs:</para>
+
+<screen><userinput>cp -vi sysdeps/unix/sysv/linux/i386/sysdep.h{,.orig}
+sed 's/^# if defined I386_USE_SYSENTER$/& \&\& defined SHARED/' \
+    sysdeps/unix/sysv/linux/i386/sysdep.h.orig \
+        > sysdeps/unix/sysv/linux/i386/sysdep.h</userinput></screen>
+
+<para>Glibc's configure script will fail several tests because
+<option>-fstack-protector[-all]</option> and <option>-nostdlib</option> are
+being used together and the conftest program is not getting linked to
+<filename class="libraryfile">libc.so</filename>, which causes the SSP symbols
+to be missing and the conftest test program fails. This won't be a problem
+after configure is run though. Fix configure so its tests pass correctly:</para>
+
+<screen><userinput>sed 's/-nostdlib/& -fno-stack-protector/g' -i.orig configure</userinput></screen>
+
+<para>The <command>nscd</command> program will be compiled with
+<option>-fstack-protector</option> by Glibc, but this will override
+<option>-fstack-protector-all</option> in our GCC specs. <command>nscd</command>
+can compile with <option>-fstack-protector-all</option>, so fix that:</para>
+
+<screen><userinput>sed 's/fstack-protector/&-all/' -i.orig nscd/Makefile</userinput></screen>
+
 <para>The Glibc documentation recommends building Glibc outside of the source
 directory in a dedicated build directory:</para>
 
-<screen><userinput>mkdir ../glibc-build
+<screen><userinput>mkdir -v ../glibc-build
 cd ../glibc-build</userinput></screen>
 
-<para>While Glibc can be built with <parameter>-pie</parameter> and
-<parameter>-fPIC</parameter> (with a small patch) all of Glibc's utilities have
-non-pic assembly code in them. If they're linked with <parameter>-pie</parameter>
-they will not be able to run on a kernel disallowing text relocation. Hence, there is no
-advantage to using PIE in Glibc's build, but there are disadvantages. For this reason
-the <parameter>-no-pie</parameter> option is added for Glibc so the applications
-will be dynamically linked, this way they will be able to run on a kernel disallowing text
-relocation. Glibc is aware of ld <parameter>-z now</parameter> and
-<parameter>-z relro</parameter> options and it uses them where they are
-appropriate. Prepare Glibc for compilation:</para>
+<para>Prepare Glibc for compilation (you may want to add
+<parameter>--enable-all-warnings</parameter>):</para>
 
-<para>The <parameter>--enable-bind-now</parameter> configure option enables
-a new linker option (<command>ld -z now</command>) for non-lazy run time binding.
-See these URLs for more details:
-<ulink url="http://sources.redhat.com/ml/libc-alpha/2004-03/msg00075.html"/>,
-<ulink url="http://elfsh.segfault.net/papers/elf-rtld.txt"/>.</para>
+<screen><userinput>../glibc-&glibc-version;/configure --prefix=/usr \
+    --libexecdir=/usr/lib/glibc --enable-kernel=2.6.0 \
+    --enable-stackguard-randomization --enable-bind-now \
+    --enable-add-ons --disable-profile</userinput></screen>
 
-<screen><userinput>env CC="gcc -fno-stack-protector -no-pie" \
-    ../glibc-&glibc-version;/configure --prefix=/usr \
-    --disable-profile --enable-add-ons \
-    --enable-kernel=2.6.0 --without-cvs \
-    --libexecdir=/usr/lib/glibc --enable-bind-now</userinput></screen>
-
 <para>Compile the package:</para>
 
 <screen><userinput>make</userinput></screen>
 
-<para>To test the results, issue:
-<userinput>make check</userinput>. They should all pass.</para>
+<para>To test the results, issue:</para>
 
+<screen><userinput>make CC="gcc -fno-stack-protector" -k check \
+    > glibc-check-log 2>&1 ; grep Error glibc-check-log</userinput></screen>
+
+<para>We currently get a ton of failed tests. I suspect adding -no flags
+to CFLAGS only during <command>make check</command> will fix this. It should
+come down to a single expected failure with
+<quote>posix/annexc.out</quote>. Its possible the <command>nice</command> is
+a factor too.</para>
+
+<para>You can also run <command>make check-abi</command> if you like. This
+checks ELF dynamic symbol tables against expected values. See:
+<ulink url="http://sourceware.org/ml/libc-hacker/2002-12/msg00048.html"/>.
+This testsuite produces a long list of errors, which occure even on ideal
+vanilla systems.</para>
+
 <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>
@@ -104,21 +122,23 @@
 
 <screen><userinput>make install</userinput></screen>
 
-<para>Remove the static libs. GCC seems to need <filename
-class="libraryfile">libc_nonshared.a</filename> to compile. <filename
-class="libraryfile">libpthread_nonshared.a</filename> it needed to be able
-to reinstall Glibc in the future. <filename class="libraryfile">libc.a</filename>
-is needed for GCC's test suite, and can be removed later.
-<filename class="libraryfile">libdl.a</filename> is needed for Binutils
-testsuite:</para>
+<para>Move the static libs.:</para>
 
-<screen><userinput>rm /usr/lib/{libbsd-compat,libg,libieee,libmcheck}.a
-rm /usr/lib/{libBrokenLocale,libanl,libcrypt}{,_g}.a
-rm /usr/lib/{libm,libnsl,libpthread,libresolv}{,_g}.a
-rm /usr/lib/{librt,libutil,librpcsvc}{,_g}.a</userinput></screen>
+<screen><userinput>install -d /usr/lib/static/
+mv -v /usr/lib/{libbsd-compat,libg,libieee,libmcheck}.a /usr/lib/static/
+mv -v /usr/lib/{libBrokenLocale,libanl,libcrypt}.a /usr/lib/static/
+mv -v /usr/lib/{libm,libnsl,libpthread,libresolv}.a /usr/lib/static/
+mv -v /usr/lib/{librpcsvc,librt,libutil}.a /usr/lib/static/
+mv -v /usr/lib/{libc,libdl}.a /usr/lib/static/</userinput></screen>
 
-<para>To install all the locales use:</para>
+<para>The <filename class="libraryfile">libc_nonshared.a</filename> library is
+needed to compile just about everything. The
+<filename class="libraryfile">libpthread_nonshared.a</filename> library is
+needed whenever anything links to
+<filename class="libraryfile">libpthread.so.0</filename>.</para>
 
+<para>Install all the locales use:</para>
+
 <screen><userinput>make localedata/install-locales</userinput></screen>
 
 <para>To install just what the GCC test need use the following commands:</para>
@@ -136,10 +156,6 @@
 localedef -i it_IT -f ISO-8859-1 it_IT
 localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen>
 
-<para>Then install the man page for <function>arc4random()</function>:</para>
-
-<screen><userinput>install -m644 ../glibc-&glibc-version;/manual/arc4random.3 /usr/share/man/man3</userinput></screen>
-
 </sect2>
 
 <sect2 id="conf-glibc" role="configuration"><title>Configuring Glibc</title>

Modified: trunk/BOOK/chapter06/groff.xml
===================================================================
--- trunk/BOOK/chapter06/groff.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/groff.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,9 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Groff</title>
 
-<para>Groff has a very bizzare <filename>Makefile</filename> structure. Don't use 
-<parameter>-fpie</parameter> here for now; this will need a patch to use it.</para>
-
 <para>Groff expects the environment variable <envar>PAGE</envar>
 to contain the default paper size. For users in the United States,
 <parameter>PAGE=letter</parameter> is appropriate. Elsewhere,

Modified: trunk/BOOK/chapter06/grub.xml
===================================================================
--- trunk/BOOK/chapter06/grub.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/grub.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -30,7 +30,7 @@
 
 <para>This package is known to have issues when its default
 optimization flags (including the <parameter>-march</parameter> and
-<parameter>-mcpu</parameter> options) are changed. If any environment
+<parameter>-mtune</parameter> options) are changed. If any environment
 variables that override default optimizations have been defined, such
 as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
 unset them when building Grub.</para>

Modified: trunk/BOOK/chapter06/gzip.xml
===================================================================
--- trunk/BOOK/chapter06/gzip.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/gzip.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -32,10 +32,6 @@
 <para>Gzip has two known security bugs. This patch fixes them:</para>
 <screen><userinput>patch -Np1 -i ../&gzip-security_fixes-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>Prepare Gzip for compilation:</para>
 
 <screen><userinput>env DEFS=NO_ASM ./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/inetutils.xml
===================================================================
--- trunk/BOOK/chapter06/inetutils.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/inetutils.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,16 +28,10 @@
 <sect2 role="installation">
 <title>Installation of Inetutils</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
+<para>Apply a patch to Inetutils to enable it to compile with GCC-&gcc-version;:</para>
 
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i \
-    {ftp,ping,talk,telnet,tftp}/Makefile.in</userinput></screen>
+<screen><userinput>patch -Np1 -i ../&inetutils-gcc4_fixes-patch;</userinput></screen>
 
-<para>Inetutils has issues with the Linux 2.6 kernel series. Fix these
-issues by applying the following patch:</para>
-
-<screen><userinput>patch -Np1 -i ../&inetutils-kernel_headers-patch;</userinput></screen>
-
 <para>All programs that come with Inetutils will not be installed.
 However, the Inetutils build system will insist on installing all the
 man pages anyway. The following patch will correct this

Modified: trunk/BOOK/chapter06/iproute2.xml
===================================================================
--- trunk/BOOK/chapter06/iproute2.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/iproute2.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -35,12 +35,6 @@
 <screen><userinput>sed -e 's at linux/socket.h at sys/socket.h@' \
     -i include/linux/netlink.h</userinput></screen>
 
-<para>This sed adds a <envar>CFLAGS</envar> variable, and <parameter>-fpie</parameter>, 
-to first line of two <filename>Makefiles</filename>:</para>
-
-<screen><userinput>sed -e '1,0s/^/CFLAGS+=-pie -fpie\n&/' \
-    -i {ip,misc}/Makefile</userinput></screen>
-
 <para>The <command>arpd</command> binary included in this package is
 dependent on Berkeley DB.  Because <command>arpd</command> is not a very
 common requirement on a base Linux system, remove the dependency on

Modified: trunk/BOOK/chapter06/kbd.xml
===================================================================
--- trunk/BOOK/chapter06/kbd.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/kbd.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -1,293 +1,352 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
   <!ENTITY % general-entities SYSTEM "../general.ent">
   %general-entities;
 ]>
+
 <sect1 id="ch-system-kbd" role="wrap">
-<title>Kbd-&kbd-version;</title>
-<?dbhtml filename="kbd.html"?>
+  <?dbhtml filename="kbd.html"?>
 
-<indexterm zone="ch-system-kbd"><primary sortas="a-Kbd">Kbd</primary></indexterm>
+  <title>Kbd-&kbd-version;</title>
 
-<sect2 role="package"><title/>
-<para>The Kbd package contains key-table files and keyboard utilities.</para>
+  <indexterm zone="ch-system-kbd">
+    <primary sortas="a-Kbd">Kbd</primary>
+  </indexterm>
 
-<segmentedlist>
-<segtitle>&buildtime;</segtitle>
-<segtitle>&diskspace;</segtitle>
-<seglistitem><seg>?? SBU</seg><seg>?? MB</seg></seglistitem>
-</segmentedlist>
+  <sect2 role="package">
+    <title/>
 
-<segmentedlist>
-<segtitle>&dependencies;</segtitle>
-<seglistitem><seg>Bash, Binutils, Bison, Coreutils,
-Diffutils, Flex, GCC, Gettext, Glibc, Grep, Gzip, M4, Make, and Sed</seg></seglistitem>
-</segmentedlist>
-</sect2>
+    <para>The Kbd package contains key-table files and keyboard utilities.</para>
 
-<sect2 role="installation">
-<title>Installation of Kbd</title>
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
+      <seglistitem>
+        <seg>?? SBU</seg>
+        <seg>?? MB</seg>
+      </seglistitem>
+    </segmentedlist>
 
-<screen><userinput>sed -e 's/^CFLAGS.*$/& -pie -fpie/' \
-    -i openvt/Makefile src/Makefile.in</userinput></screen>
+    <segmentedlist>
+      <segtitle>&dependencies;</segtitle>
+        <seglistitem><seg>Bash, Binutils, Bison, Coreutils, Diffutils, Flex,
+        GCC, Gettext, Glibc, Grep, Gzip, M4, Make, and Sed</seg></seglistitem>
+    </segmentedlist>
 
-<para>Prepare Kbd for compilation:</para>
+  </sect2>
 
+  <sect2 role="installation">
+    <title>Installation of Kbd</title>
+
+    <para>The behaviour of the Backspace and Delete keys is not consistent
+    across the keymaps in the Kbd package. The following patch fixes this
+    issue for i386 keymaps:</para>
+
+<screen><userinput>patch -Np1 -i ../&kbd-backspace-patch;</userinput></screen>
+
+    <para>After patching, the Backspace key generates the character with code 127,
+    and the Delete key generates a well-known escape sequence.</para>
+
+    <para>Patch Kbd to fix a bug in <command>setfont</command> that is triggered
+    when compiling with GCC-&gcc-version;:</para>
+
+<screen><userinput>patch -Np1 -i ../&kbd-gcc4_fixes-patch;</userinput></screen>
+
+    <para>Prepare Kbd for compilation:</para>
+
 <screen><userinput>./configure</userinput></screen>
 
-<para>Compile the package:</para>
+    <para>Compile the package:</para>
 
 <screen><userinput>make</userinput></screen>
 
-<para>Install the package:</para>
+    <para>This package does not come with a test suite.</para>
 
+    <para>Install the package:</para>
+
 <screen><userinput>make install</userinput></screen>
 
-</sect2>
+    <note>
+      <para>For some languages (e.g., Belarusian) the Kbd package doesn't
+      provide a useful keymap (the stock <quote>by</quote> keymap assumes the
+      ISO-8859-5 encoding, while everybody uses CP1251 instead). Users of such
+      languages have to download working keymaps separately.</para>
+    </note>
 
-<sect2 id="contents-kbd" role="content"><title>Contents of Kbd</title>
+  </sect2>
 
-<segmentedlist>
-<segtitle>Installed programs</segtitle>
-<seglistitem><seg>chvt, deallocvt, dumpkeys,
-fgconsole, getkeycodes, getunimap, kbd_mode, kbdrate, loadkeys, loadunimap,
-mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to
-psfxtable), psfstriptable (link to psfxtable), psfxtable, resizecons,
-setfont, setkeycodes, setleds, setlogcons, setmetamode, setvesablank,
-showconsolefont, showkey, unicode_start, and unicode_stop</seg></seglistitem>
-</segmentedlist>
+  <sect2 id="contents-kbd" role="content">
+    <title>Contents of Kbd</title>
 
-<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
-<?dbfo list-presentation="list"?>
-<?dbhtml list-presentation="table"?>
+    <segmentedlist>
+      <segtitle>Installed programs</segtitle>
 
-<varlistentry id="chvt">
-<term><command>chvt</command></term>
-<listitem>
-<para>Changes the foreground virtual terminal</para>
-<indexterm zone="ch-system-kbd chvt"><primary sortas="b-chvt">chvt</primary></indexterm>
-</listitem>
-</varlistentry>
+      <seglistitem>
+        <seg>chvt, deallocvt, dumpkeys, fgconsole, getkeycodes, kbd_mode,
+        kbdrate, loadkeys, loadunimap,
+        mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to
+        psfxtable), psfstriptable (link to psfxtable), psfxtable, resizecons,
+        setfont, setkeycodes, setleds, setmetamode,
+        showconsolefont, showkey, unicode_start, and unicode_stop</seg>
+      </seglistitem>
+    </segmentedlist>
 
-<varlistentry id="deallocvt">
-<term><command>deallocvt</command></term>
-<listitem>
-<para>Deallocates unused virtual terminals</para>
-<indexterm zone="ch-system-kbd deallocvt"><primary sortas="b-deallocvt">deallocvt</primary></indexterm>
-</listitem>
-</varlistentry>
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
 
-<varlistentry id="dumpkeys">
-<term><command>dumpkeys</command></term>
-<listitem>
-<para>Dumps the keyboard translation tables</para>
-<indexterm zone="ch-system-kbd dumpkeys"><primary sortas="b-dumpkeys">dumpkeys</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="chvt">
+        <term><command>chvt</command></term>
+        <listitem>
+          <para>Changes the foreground virtual terminal</para>
+          <indexterm zone="ch-system-kbd chvt">
+            <primary sortas="b-chvt">chvt</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="fgconsole">
-<term><command>fgconsole</command></term>
-<listitem>
-<para>Prints the number of the active virtual terminal</para>
-<indexterm zone="ch-system-kbd fgconsole"><primary sortas="b-fgconsole">fgconsole</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="deallocvt">
+        <term><command>deallocvt</command></term>
+        <listitem>
+          <para>Deallocates unused virtual terminals</para>
+          <indexterm zone="ch-system-kbd deallocvt">
+            <primary sortas="b-deallocvt">deallocvt</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="getkeycodes">
-<term><command>getkeycodes</command></term>
-<listitem>
-<para>Prints the kernel scancode-to-keycode mapping table</para>
-<indexterm zone="ch-system-kbd getkeycodes"><primary sortas="b-getkeycodes">getkeycodes</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="dumpkeys">
+        <term><command>dumpkeys</command></term>
+        <listitem>
+          <para>Dumps the keyboard translation tables</para>
+          <indexterm zone="ch-system-kbd dumpkeys">
+            <primary sortas="b-dumpkeys">dumpkeys</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="getunimap">
-<term><command>getunimap</command></term>
-<listitem>
-<para>Prints the currently used unimap</para>
-<indexterm zone="ch-system-kbd getunimap"><primary sortas="b-getunimap">getunimap</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="fgconsole">
+        <term><command>fgconsole</command></term>
+        <listitem>
+          <para>Prints the number of the active virtual terminal</para>
+          <indexterm zone="ch-system-kbd fgconsole">
+            <primary sortas="b-fgconsole">fgconsole</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="kbd_mode">
-<term><command>kbd_mode</command></term>
-<listitem>
-<para>Reports or sets the keyboard mode</para>
-<indexterm zone="ch-system-kbd kbd_mode"><primary sortas="b-kbd_mode">kbd_mode</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="getkeycodes">
+        <term><command>getkeycodes</command></term>
+        <listitem>
+          <para>Prints the kernel scancode-to-keycode mapping table</para>
+          <indexterm zone="ch-system-kbd getkeycodes">
+            <primary sortas="b-getkeycodes">getkeycodes</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="kbdrate">
-<term><command>kbdrate</command></term>
-<listitem>
-<para>Sets the keyboard repeat and delay rates</para>
-<indexterm zone="ch-system-kbd kbdrate"><primary sortas="b-kbdrate">kbdrate</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="kbd_mode">
+        <term><command>kbd_mode</command></term>
+        <listitem>
+          <para>Reports or sets the keyboard mode</para>
+          <indexterm zone="ch-system-kbd kbd_mode">
+            <primary sortas="b-kbd_mode">kbd_mode</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="loadkeys">
-<term><command>loadkeys</command></term>
-<listitem>
-<para>Loads the keyboard translation tables</para>
-<indexterm zone="ch-system-kbd loadkeys"><primary sortas="b-loadkeys">loadkeys</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="kbdrate">
+        <term><command>kbdrate</command></term>
+        <listitem>
+          <para>Sets the keyboard repeat and delay rates</para>
+          <indexterm zone="ch-system-kbd kbdrate">
+            <primary sortas="b-kbdrate">kbdrate</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="loadunimap">
-<term><command>loadunimap</command></term>
-<listitem>
-<para>Loads the kernel unicode-to-font mapping table</para>
-<indexterm zone="ch-system-kbd loadunimap"><primary sortas="b-loadunimap">loadunimap</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="loadkeys">
+        <term><command>loadkeys</command></term>
+        <listitem>
+          <para>Loads the keyboard translation tables</para>
+          <indexterm zone="ch-system-kbd loadkeys">
+            <primary sortas="b-loadkeys">loadkeys</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="mapscrn">
-<term><command>mapscrn</command></term>
-<listitem>
-<para>An obsolete program that used to load
-a user-defined output character mapping table into the console driver; this is
-now done by <command>setfont</command></para>
-<indexterm zone="ch-system-kbd mapscrn"><primary sortas="b-mapscrn">mapscrn</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="loadunimap">
+        <term><command>loadunimap</command></term>
+        <listitem>
+          <para>Loads the kernel unicode-to-font mapping table</para>
+          <indexterm zone="ch-system-kbd loadunimap">
+            <primary sortas="b-loadunimap">loadunimap</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="openvt">
-<term><command>openvt</command></term>
-<listitem>
-<para>Starts a program on a new virtual terminal (VT)</para>
-<indexterm zone="ch-system-kbd openvt"><primary sortas="b-openvt">openvt</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="mapscrn">
+        <term><command>mapscrn</command></term>
+        <listitem>
+          <para>An obsolete program that used to load a user-defined output
+          character mapping table into the console driver; this is now done
+          by <command>setfont</command></para>
+          <indexterm zone="ch-system-kbd mapscrn">
+            <primary sortas="b-mapscrn">mapscrn</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="psfaddtable">
-<term><command>psfaddtable</command></term>
-<listitem>
-<para>A link to <command>psfxtable</command></para>
-<indexterm zone="ch-system-kbd psfaddtable"><primary sortas="b-psfaddtable">psfaddtable</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="openvt">
+        <term><command>openvt</command></term>
+        <listitem>
+          <para>Starts a program on a new virtual terminal (VT)</para>
+          <indexterm zone="ch-system-kbd openvt">
+            <primary sortas="b-openvt">openvt</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="psfgettable">
-<term><command>psfgettable</command></term>
-<listitem>
-<para>A link to <command>psfxtable</command></para>
-<indexterm zone="ch-system-kbd psfgettable"><primary sortas="b-psfgettable">psfgettable</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="psfaddtable">
+        <term><command>psfaddtable</command></term>
+        <listitem>
+          <para>A link to <command>psfxtable</command></para>
+          <indexterm zone="ch-system-kbd psfaddtable">
+            <primary sortas="b-psfaddtable">psfaddtable</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="psfstriptable">
-<term><command>psfstriptable</command></term>
-<listitem>
-<para>A link to <command>psfxtable</command></para>
-<indexterm zone="ch-system-kbd psfstriptable"><primary sortas="b-psfstriptable">psfstriptable</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="psfgettable">
+        <term><command>psfgettable</command></term>
+        <listitem>
+          <para>A link to <command>psfxtable</command></para>
+          <indexterm zone="ch-system-kbd psfgettable">
+            <primary sortas="b-psfgettable">psfgettable</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="psfxtable">
-<term><command>psfxtable</command></term>
-<listitem>
-<para>Handle Unicode character tables for console fonts</para>
-<indexterm zone="ch-system-kbd psfxtable"><primary sortas="b-psfxtable">psfxtable</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="psfstriptable">
+        <term><command>psfstriptable</command></term>
+        <listitem>
+          <para>A link to <command>psfxtable</command></para>
+          <indexterm zone="ch-system-kbd psfstriptable">
+            <primary sortas="b-psfstriptable">psfstriptable</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="resizecons">
-<term><command>resizecons</command></term>
-<listitem>
-<para>Changes the kernel idea of the console size</para>
-<indexterm zone="ch-system-kbd resizecons"><primary sortas="b-resizecons">resizecons</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="psfxtable">
+        <term><command>psfxtable</command></term>
+        <listitem>
+          <para>Handle Unicode character tables for console fonts</para>
+          <indexterm zone="ch-system-kbd psfxtable">
+            <primary sortas="b-psfxtable">psfxtable</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="setfont">
-<term><command>setfont</command></term>
-<listitem>
-<para>Changes the Enhanced Graphic Adapter (EGA) and Video Graphics
-Array (VGA) fonts on the console</para>
-<indexterm zone="ch-system-kbd setfont"><primary sortas="b-setfont">setfont</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="resizecons">
+        <term><command>resizecons</command></term>
+        <listitem>
+          <para>Changes the kernel idea of the console size</para>
+          <indexterm zone="ch-system-kbd resizecons">
+            <primary sortas="b-resizecons">resizecons</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="setkeycodes">
-<term><command>setkeycodes</command></term>
-<listitem>
-<para>Loads kernel scancode-to-keycode mapping table entries; this is
-useful if there are unusual keys on the keyboard</para>
-<indexterm zone="ch-system-kbd setkeycodes"><primary sortas="b-setkeycodes">setkeycodes</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="setfont">
+        <term><command>setfont</command></term>
+        <listitem>
+          <para>Changes the Enhanced Graphic Adapter (EGA) and Video Graphics
+          Array (VGA) fonts on the console</para>
+          <indexterm zone="ch-system-kbd setfont">
+            <primary sortas="b-setfont">setfont</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="setleds">
-<term><command>setleds</command></term>
-<listitem>
-<para>Sets the keyboard flags and Light Emitting Diodes (LEDs)</para>
-<indexterm zone="ch-system-kbd setleds"><primary sortas="b-setleds">setleds</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="setkeycodes">
+        <term><command>setkeycodes</command></term>
+        <listitem>
+          <para>Loads kernel scancode-to-keycode mapping table entries; this is
+          useful if there are unusual keys on the keyboard</para>
+          <indexterm zone="ch-system-kbd setkeycodes">
+            <primary sortas="b-setkeycodes">setkeycodes</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="setlogcons">
-<term><command>setlogcons</command></term>
-<listitem>
-<para>Sends kernel messages to the console</para>
-<indexterm zone="ch-system-kbd setlogcons"><primary sortas="b-setlogcons">setlogcons</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="setleds">
+        <term><command>setleds</command></term>
+        <listitem>
+          <para>Sets the keyboard flags and Light Emitting Diodes (LEDs)</para>
+          <indexterm zone="ch-system-kbd setleds">
+            <primary sortas="b-setleds">setleds</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="setmetamode">
-<term><command>setmetamode</command></term>
-<listitem>
-<para>Defines the keyboard meta-key handling</para>
-<indexterm zone="ch-system-kbd setmetamode"><primary sortas="b-setmetamode">setmetamode</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="setmetamode">
+        <term><command>setmetamode</command></term>
+        <listitem>
+          <para>Defines the keyboard meta-key handling</para>
+          <indexterm zone="ch-system-kbd setmetamode">
+            <primary sortas="b-setmetamode">setmetamode</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="setvesablank">
-<term><command>setvesablank</command></term>
-<listitem>
-<para>Lets the user adjust the built-in hardware screensaver (a blank
-screen)</para>
-<indexterm zone="ch-system-kbd setvesablank"><primary sortas="b-setvesablank">setvesablank</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="showconsolefont">
+        <term><command>showconsolefont</command></term>
+        <listitem>
+          <para>Shows the current EGA/VGA console screen font</para>
+          <indexterm zone="ch-system-kbd showconsolefont">
+            <primary sortas="b-showconsolefont">showconsolefont</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="showconsolefont">
-<term><command>showconsolefont</command></term>
-<listitem>
-<para>Shows the current EGA/VGA console screen font</para>
-<indexterm zone="ch-system-kbd showconsolefont"><primary sortas="b-showconsolefont">showconsolefont</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="showkey">
+        <term><command>showkey</command></term>
+        <listitem>
+          <para>Reports the scancodes, keycodes, and ASCII codes of the keys
+          pressed on the keyboard</para>
+          <indexterm zone="ch-system-kbd showkey">
+            <primary sortas="b-showkey">showkey</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="showkey">
-<term><command>showkey</command></term>
-<listitem>
-<para>Reports the scancodes, keycodes, and ASCII codes of the keys
-pressed on the keyboard</para>
-<indexterm zone="ch-system-kbd showkey"><primary sortas="b-showkey">showkey</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="unicode_start">
+        <term><command>unicode_start</command></term>
+        <listitem>
+          <para>Puts the keyboard and console in UNICODE mode. Don't use this
+          program unless your keymap file is in the ISO-8859-1 encoding. For
+          other encodings, this utility produces incorrect results.</para>
+          <indexterm zone="ch-system-kbd unicode_start">
+            <primary sortas="b-unicode_start">unicode_start</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="unicode_start">
-<term><command>unicode_start</command></term>
-<listitem>
-<para>Puts the keyboard and console in UNICODE mode. Never use it on LFS, 
-because applications are not configured to support UNICODE.</para>
-<indexterm zone="ch-system-kbd unicode_start"><primary sortas="b-unicode_start">unicode_start</primary></indexterm>
-</listitem>
-</varlistentry>
+      <varlistentry id="unicode_stop">
+        <term><command>unicode_stop</command></term>
+        <listitem>
+          <para>Reverts keyboard and console from UNICODE mode</para>
+          <indexterm zone="ch-system-kbd unicode_stop">
+            <primary sortas="b-unicode_stop">unicode_stop</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-<varlistentry id="unicode_stop">
-<term><command>unicode_stop</command></term>
-<listitem>
-<para>Reverts keyboard and console from UNICODE mode</para>
-<indexterm zone="ch-system-kbd unicode_stop"><primary sortas="b-unicode_stop">unicode_stop</primary></indexterm>
-</listitem>
-</varlistentry>
-</variablelist>
+    </variablelist>
 
-</sect2>
+  </sect2>
 
 </sect1>
-

Modified: trunk/BOOK/chapter06/kernfs.xml
===================================================================
--- trunk/BOOK/chapter06/kernfs.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/kernfs.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -18,12 +18,12 @@
 
 <para>Begin by creating directories onto which the file systems will be mounted:</para>
 
-<screen><userinput>install -d $HLFS/{proc,sys}</userinput></screen>
+<screen><userinput>install -vd $HLFS/{proc,sys}</userinput></screen>
 
 <para>Now mount the file systems:</para>
 
-<screen><userinput>mount -t proc proc $HLFS/proc
-mount -t sysfs sysfs $HLFS/sys</userinput></screen>
+<screen><userinput>mount -vt proc proc $HLFS/proc
+mount -vt sysfs sysfs $HLFS/sys</userinput></screen>
 
 <para>Remember that if for any reason you stop working on the HLFS
 system and start again later, it is important to check that these file
@@ -34,9 +34,9 @@
 chroot environment. To keep the host up to date, perform a <quote>fake
 mount</quote> for each of these now:</para>
 
-<screen><userinput>mount -f -t ramfs ramfs $HLFS/dev
-mount -f -t tmpfs tmpfs $HLFS/dev/shm
-mount -f -t devpts -o gid=4,mode=620 devpts $HLFS/dev/pts</userinput></screen>
+<screen><userinput>mount -vf -t ramfs ramfs $HLFS/dev
+mount -vf -t tmpfs tmpfs $HLFS/dev/shm
+mount -vf -t devpts -o gid=4,mode=620 devpts $HLFS/dev/pts</userinput></screen>
 
 <para>If you are running an existing HLFS system with all of the Grsecurity
 options enabled, some will need to be disabled to compile the system in this

Modified: trunk/BOOK/chapter06/less.xml
===================================================================
--- trunk/BOOK/chapter06/less.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/less.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,10 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Less</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>Prepare Less for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --sysconfdir=/etc</userinput></screen>

Modified: trunk/BOOK/chapter06/libtool.xml
===================================================================
--- trunk/BOOK/chapter06/libtool.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/libtool.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -30,9 +30,6 @@
 <sect2 role="installation">
 <title>Installation of Libtool</title>
 
-<para>The only C code in this package is for a library. Libtool is a shell script.
-So <parameter>-fpie</parameter> is not needed here.</para>
-
 <para>Prepare Libtool for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --disable-static</userinput></screen>

Copied: trunk/BOOK/chapter06/linux-headers.xml (from rev 667, trunk/BOOK/chapter06/linux-libc-headers.xml)
===================================================================
--- trunk/BOOK/chapter06/linux-headers.xml	                        (rev 0)
+++ trunk/BOOK/chapter06/linux-headers.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-system-linux-headers" role="wrap">
+<title>Linux-Headers-&linux-headers-version;</title>
+<?dbhtml filename="linux-headers.html"?>
+
+<indexterm zone="ch-system-linux-headers">
+<primary sortas="a-Linux-Headers">Linux-Headers</primary>
+</indexterm>
+
+<sect2 role="package"><title/>
+<para>The Linux-Headers package contains the
+<quote>sanitized</quote> kernel headers.</para>
+
+<segmentedlist>
+<segtitle>&buildtime;</segtitle>
+<segtitle>&diskspace;</segtitle>
+<seglistitem><seg>?? SBU</seg><seg>?? MB</seg></seglistitem>
+</segmentedlist>
+
+<segmentedlist>
+<segtitle>&dependencies;</segtitle>
+<seglistitem><seg>Coreutils</seg></seglistitem>
+</segmentedlist>
+
+</sect2>
+
+<sect2 role="installation">
+<title>Installation of Linux-Headers</title>
+
+<para>Apply the patch:</para>
+
+<screen><userinput>patch --no-backup-if-mismatch -Np1 -i \
+    ../&linux-headers-unistd_x86_PIC-patch;</userinput></screen>
+
+<para>Install the header files:</para>
+
+<screen><userinput>install -vd /usr/include/{asm,asm-generic,linux,net,mtd,scsi,sound}
+cp -va include/asm-generic/* /usr/include/asm-generic
+cp -va include/linux/* /usr/include/linux
+cp -va include/mtd/* /usr/include/mtd
+cp -va include/net/* /usr/include/net
+cp -va include/scsi/* /usr/include/scsi
+cp -va include/sound/* /usr/include/sound
+cp -va include/asm-i386/* /usr/include/asm</userinput></screen>
+
+</sect2>
+
+
+<sect2 id="contents-linux-headers" role="content"><title>Contents of Linux-Headers</title>
+
+<segmentedlist>
+<segtitle>Installed headers</segtitle>
+<seglistitem><seg>/usr/include/{asm,linux}/*.h</seg></seglistitem>
+</segmentedlist>
+
+<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
+<?dbfo list-presentation="list"?>
+<?dbhtml list-presentation="table"?>
+
+<varlistentry id="linux-headers">
+<term><filename class="headerfile">/usr/include/{asm,linux}/*.h</filename></term>
+<listitem>
+<para>The Linux headers API</para>
+<indexterm zone="ch-system-linux-headers linux-headers"><primary sortas="e-/usr/include/{asm,linux}/*.h">/usr/include/{asm,linux}/*.h</primary></indexterm>
+</listitem>
+</varlistentry>
+</variablelist>
+
+</sect2>
+
+</sect1>
+

Deleted: trunk/BOOK/chapter06/linux-libc-headers.xml
===================================================================
--- trunk/BOOK/chapter06/linux-libc-headers.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/linux-libc-headers.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-system-linux-libc-headers" role="wrap">
-<title>Linux-Libc-Headers-&linux-libc-headers-version;</title>
-<?dbhtml filename="linux-libc-headers.html"?>
-
-<indexterm zone="ch-system-linux-libc-headers">
-<primary sortas="a-Linux-Libc-Headers">Linux-Libc-Headers</primary>
-</indexterm>
-
-<sect2 role="package"><title/>
-<para>The Linux-Libc-Headers package contains the
-<quote>sanitized</quote> kernel headers.</para>
-
-<segmentedlist>
-<segtitle>&buildtime;</segtitle>
-<segtitle>&diskspace;</segtitle>
-<seglistitem><seg>?? SBU</seg><seg>?? MB</seg></seglistitem>
-</segmentedlist>
-
-<segmentedlist>
-<segtitle>&dependencies;</segtitle>
-<seglistitem><seg>Coreutils</seg></seglistitem>
-</segmentedlist>
-
-</sect2>
-
-<sect2 role="installation">
-<title>Installation of Linux-Libc-Headers</title>
-
-<para>Apply the patches:</para>
-
-<screen><userinput>patch --no-backup-if-mismatch -Np1 -i \
-    ../&linux-libc-headers-pseudo_random-patch;
-patch --no-backup-if-mismatch -Np1 -i \
-    ../&linux-libc-headers-unistd_x86_PIC-patch;</userinput></screen>
-
-<para>Install the headers files:</para>
-
-<screen><userinput>install -d /usr/include/asm
-cp -R include/asm-i386/* /usr/include/asm
-cp -R include/linux /usr/include</userinput></screen>
-
-<para>Ensure that all the headers are owned by root:</para>
-
-<screen><userinput>chown -R root:root /usr/include/{asm,linux}</userinput></screen>
-
-<para>Make sure the users can read the headers:</para>
-
-<screen><userinput>find /usr/include/{asm,linux} -type d -exec chmod 755 {} \;
-find /usr/include/{asm,linux} -type f -exec chmod 644 {} \;</userinput></screen>
-
-</sect2>
-
-
-<sect2 id="contents-linux-libc-headers" role="content"><title>Contents of Linux-Libc-Headers</title>
-
-<segmentedlist>
-<segtitle>Installed headers</segtitle>
-<seglistitem><seg>/usr/include/{asm,linux}/*.h</seg></seglistitem>
-</segmentedlist>
-
-<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
-<?dbfo list-presentation="list"?>
-<?dbhtml list-presentation="table"?>
-
-<varlistentry id="linux-libc-headers">
-<term><filename class="headerfile">/usr/include/{asm,linux}/*.h</filename></term>
-<listitem>
-<para>The Linux headers API</para>
-<indexterm zone="ch-system-linux-libc-headers linux-libc-headers"><primary sortas="e-/usr/include/{asm,linux}/*.h">/usr/include/{asm,linux}/*.h</primary></indexterm>
-</listitem>
-</varlistentry>
-</variablelist>
-
-</sect2>
-
-</sect1>
-

Modified: trunk/BOOK/chapter06/m4.xml
===================================================================
--- trunk/BOOK/chapter06/m4.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/m4.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,11 +28,6 @@
 <sect2 role="installation">
 <title>Installation of M4</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e "s/^\(MDEFINES.*\)CFLAGS='\$(CFLAGS)' /\1/" -i Makefile.in
-sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/Makefile.in</userinput></screen>
-
 <para>Prepare M4 for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/make.xml
===================================================================
--- trunk/BOOK/chapter06/make.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/make.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,10 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Make</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>Prepare Make for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/man.xml
===================================================================
--- trunk/BOOK/chapter06/man.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/man.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -43,16 +43,6 @@
 
 <screen><userinput>sed -i 's at MANPATH./usr/man@#&@g' src/man.conf.in</userinput></screen>
 
-<para>Add <envar>CFLAGS</envar> to the top of <filename>src/Makefile.in</filename>,
-since it has no default <envar>CFLAGS</envar>:</para>
-
-<screen><userinput>sed -e '1,0s/^/CFLAGS+=-pie -fpie\n&/' -i src/Makefile.in</userinput></screen>
-
-<para>Append <parameter>-fpie</parameter> to the <envar>CFLAGS</envar> in the 
-<filename class="directory">man2html</filename> directory:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i man2html/Makefile.in</userinput></screen>
- 
 <para>Prepare Man for compilation:</para>
 
 <screen><userinput>./configure -confdir=/etc<parameter condition="uclibc"> +lang none</parameter></userinput></screen>

Modified: trunk/BOOK/chapter06/mktemp.xml
===================================================================
--- trunk/BOOK/chapter06/mktemp.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/mktemp.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,10 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Mktemp</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>Many scripts still use the deprecated
 <command>tempfile</command> program, which has functionality similar
 to <command>mktemp</command>. Patch Mktemp to include a

Modified: trunk/BOOK/chapter06/module-init-tools.xml
===================================================================
--- trunk/BOOK/chapter06/module-init-tools.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/module-init-tools.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -34,10 +34,6 @@
 
 <screen><userinput>patch -Np1 -i ../&module-init-tools-nostatic-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>The testsuite for Module-init-utils rewrites the Makefile and resets the install
 prefix. If you wish to run the testsuite, then it must be run first:</para>
 

Modified: trunk/BOOK/chapter06/ncurses.xml
===================================================================
--- trunk/BOOK/chapter06/ncurses.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/ncurses.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -29,15 +29,10 @@
 <sect2 role="installation">
 <title>Installation of Ncurses</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS\t.*$/& -pie -fpie/' \
-    -i {progs,tack}/Makefile.in</userinput></screen>
-
 <para>Prepare Ncurses for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --with-shared \
-    --without-debug --without-normal</userinput></screen>
+    --without-debug --without-normal --enable-warnings</userinput></screen>
 
 <para>Compile the package:</para>
 

Modified: trunk/BOOK/chapter06/patch.xml
===================================================================
--- trunk/BOOK/chapter06/patch.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/patch.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,10 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Patch</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i Makefile.in</userinput></screen>
-
 <para>Prepare Patch for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/procps.xml
===================================================================
--- trunk/BOOK/chapter06/procps.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/procps.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -28,10 +28,6 @@
 <sect2 role="installation">
 <title>Installation of Procps</title>
 
-<para>Apply a patch to ... EDIT ME</para>
-
-<screen><userinput>patch -Np1 -i ../&procps-hardened_cflags-patch;</userinput></screen>
-
 <para>Compile the package:</para>
 
 <screen><userinput>make</userinput></screen>

Modified: trunk/BOOK/chapter06/psmisc.xml
===================================================================
--- trunk/BOOK/chapter06/psmisc.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/psmisc.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -29,15 +29,14 @@
 <sect2 role="installation">
 <title>Installation of Psmisc</title>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/Makefile.in</userinput></screen>
-
 <para>Prepare Psmisc for compilation:</para>
 
 <screen condition="uclibc"><userinput>./configure --prefix=/usr --exec-prefix="" --disable-ipv6</userinput></screen>
 <screen condition="glibc"><userinput>./configure --prefix=/usr --exec-prefix=""</userinput></screen>
 
+<para condition="uclibc">If you configured uClibc with ipv6, you can remove
+--disable-ipv6.</para>
+
 <para>The meaning of the configure option:</para>
 
 <variablelist>

Modified: trunk/BOOK/chapter06/pwdgroup.xml
===================================================================
--- trunk/BOOK/chapter06/pwdgroup.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/pwdgroup.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -70,8 +70,8 @@
 proper permissions:</para>
 
 <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
-chgrp utmp /var/run/utmp /var/log/lastlog
-chmod 664 /var/run/utmp /var/log/lastlog</userinput></screen>
+chgrp -v utmp /var/run/utmp /var/log/lastlog
+chmod -v 664 /var/run/utmp /var/log/lastlog</userinput></screen>
 
 <para>The <filename>/var/run/utmp</filename> file records the users
 that are currently logged in. The <filename>/var/log/wtmp</filename>

Modified: trunk/BOOK/chapter06/readjusting.xml
===================================================================
--- trunk/BOOK/chapter06/readjusting.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/readjusting.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -1,75 +1,122 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
   <!ENTITY % general-entities SYSTEM "../general.ent">
   %general-entities;
 ]>
+
 <sect1 id="ch-system-readjusting">
-<title>Re-adjusting the Toolchain</title>
-<?dbhtml filename="readjusting.html"?>
+  <?dbhtml filename="readjusting.html"?>
 
-<para>Now that the new and final C libraries have been installed, it
-is time to adjust the toolchain again. The toolchain will be adjusted
-so that it will link any newly compiled program against these new
-libraries. This is the same process used in the
-<quote>Adjusting</quote> phase in the beginning of <xref
-linkend="chapter-temporary-tools"/>, even though it looks to be
-reversed. In <xref linkend="chapter-temporary-tools"/>, the chain was
-guided from the host's <filename
-class="directory">/{,usr/}lib</filename> directories to the new
-<filename class="directory">/tools/lib</filename> directory. Now, the
-chain will be guided from that same <filename
-class="directory">/tools/lib</filename> directory to the HLFS
-<filename class="directory">/{,usr/}lib</filename> directories.</para>
+  <title>Re-adjusting the Toolchain</title>
 
-<para>Start by adjusting the linker. Install the new linker compiled
-earlier:</para>
+  <para>Now that the final C libraries have been installed, it is time to adjust
+  the toolchain again. The toolchain will be adjusted so that it will link any
+  newly compiled program against these new libraries. This is a similar process
+  used in the <quote>Adjusting</quote> phase in the beginning of <xref
+  linkend="chapter-temporary-tools"/>, but with the adjustments reversed. In <xref
+  linkend="chapter-temporary-tools"/>, the chain was guided from the host's
+  <filename class="directory">/{,usr/}lib</filename> directories to the new
+  <filename class="directory">/tools/lib</filename> directory. Now, the chain will
+  be guided from that same <filename class="directory">/tools/lib</filename>
+  directory to the LFS <filename class="directory">/{,usr/}lib</filename>
+  directories.</para>
 
-<screen><userinput>install -v /tools/bin/ld{-new,}</userinput></screen>
+  <para>First, backup the <filename class="directory">/tools</filename> linker,
+  and replace it with the adjusted linker we made in chapter 5. We'll also create
+  a link to its counterpart in <filename class="directory">/tools/$(gcc
+  -dumpmachine)/bin</filename>.</para>
 
-<para>From now on, every compiled program will link only against the
-libraries in <filename class="directory">/usr/lib</filename> and
-<filename class="directory">/lib</filename>.</para>
+<screen><userinput>mv -v /tools/bin/{ld,ld-old}
+mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
+mv -v /tools/bin/{ld-new,ld}
+ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld</userinput></screen>
 
-<para>Next, amend the GCC specs file so that it points to the new
-dynamic linker. A perl command accomplishes this:</para>
+  <para>Next, amend the GCC specs file so that it points to the new
+  dynamic linker, and so that GCC knows where to find its start files.
+  A <command>perl</command> command accomplishes this:</para>
 
-<screen><userinput>perl -pi -e 's: /tools${ldso}: ${ldso}:g;' \
-    -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/@g;' \
-    $(gcc --print-file specs)</userinput></screen>
+<screen><userinput>gcc -dumpspecs | \
+perl -p -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2 at g;' \
+    -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' > \
+    `dirname $(gcc --print-libgcc-file-name)`/specs</userinput></screen>
 
-<para>It is a good idea to visually inspect the specs file to verify the intended 
-change was actually made.</para>
+  <para>It is a good idea to visually inspect the specs file to verify the
+  intended change was actually made.</para>
 
-<caution><para>It is imperative at this point to stop and ensure that
-the basic functions (compiling and linking) of the adjusted toolchain
-are working as expected. To do this, perform a sanity
-check:</para>
+  <important>
+    <para>If working on a platform where the name of the dynamic linker is
+    something other than <filename class="libraryfile">ld-linux.so.2</filename>,
+    substitute <quote>ld-linux.so.2</quote> with the name of the platform's
+    dynamic linker in the above commands.</para>
+  </important>
 
-<screen><userinput>echo 'int main(){return 0;}' > dummy.c
-cc dummy.c
+  <para>It is imperative at this point to ensure that the basic
+  functions (compiling and linking) of the adjusted toolchain are working
+  as expected. To do this, perform the following sanity checks:</para>
+
+<screen role="nodump" os="a"><userinput>echo 'main(){return 0;}' > dummy.c
+cc dummy.c -Wl,--verbose &> dummy.log
 readelf -l a.out | grep ': /lib'</userinput></screen>
 
-<para>If everything is working correctly, there should be no errors,
-and the output of the last command will be like:</para>
+  <para os="b">If everything is working correctly, there should be no errors,
+  and the output of the last command will be (allowing for
+  platform-specific differences in dynamic linker name):</para>
 
-<screen><computeroutput>[Requesting program interpreter: /lib/something.so]</computeroutput></screen>
+<screen os="c"><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
 
-<para>Note that <filename class="directory">/lib</filename> is now
-the prefix of our dynamic linker.</para>
+  <para>Note that <filename class="directory">/lib</filename> is now
+  the prefix of our dynamic linker.</para>
 
-<para>If the output does not appear as shown above or is not received
-at all, then something is seriously wrong. Investigate and retrace the
-steps to find out where the problem is and correct it. The most likely
-reason is that something went wrong with the specs file amendment
-above. Any issues will need to be resolved before continuing on with
-the process.</para>
+  <para os="d">Now make sure that we're setup to use the correct startfiles:</para>
 
-<para>Once everything is working correctly, clean up the test file and program:</para>
+<screen role="nodump" os="e"><userinput>grep -o '/usr/lib.*/crt[1in].* .*' dummy.log</userinput></screen>
 
-<screen><userinput>rm dummy.c
-rm a.out</userinput></screen></caution>
+  <para os="f">If everything is working correctly, there should be no errors,
+    and the output of the last command will be:</para>
 
-<para>Remove the Binutils source and build directories now.</para>
+<screen><computeroutput>/usr/lib/crt1.o succeeded
+/usr/lib/crti.o succeeded
+/usr/lib/crtn.o succeeded</computeroutput></screen>
 
+  <para os="g">Next, verify that the new linker is being used with the correct search paths:</para>
+
+<screen role="nodump" os="h"><userinput>grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'</userinput></screen>
+
+  <para os="i">If everything is working correctly, there should be no errors,
+  and the output of the last command will be:</para>
+
+<screen><computeroutput>SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
+SEARCH_DIR("/usr/lib")
+SEARCH_DIR("/lib");</computeroutput></screen>
+
+  <para os="j">Next make sure that we're using the correct libc:</para>
+
+<screen role="nodump" os="k"><userinput>grep "/lib/libc.so.6 " dummy.log</userinput></screen>
+
+  <para os="l">If everything is working correctly, there should be no errors,
+  and the output of the last command will be:</para>
+
+<screen os="m"><computeroutput>attempt to open /lib/libc.so.6 succeeded</computeroutput></screen>
+
+  <para os="n">Lastly, make sure GCC is using the correct dynamic linker:</para>
+
+<screen role="nodump" os="o"><userinput>grep found dummy.log</userinput></screen>
+
+  <para os="p">If everything is working correctly, there should be no errors,
+  and the output of the last command will be (allowing for
+  platform-specific differences in dynamic linker name):</para>
+
+<screen os="q"><computeroutput>found ld-linux.so.2 at /lib/ld-linux.so.2</computeroutput></screen>
+
+  <para os="r">If the output does not appear as shown above or is not received
+  at all, then something is seriously wrong. Investigate and retrace the
+  steps to find out where the problem is and correct it. The most likely
+  reason is that something went wrong with the specs file adjustment. Any
+  issues will need to be resolved before continuing on with the process.</para>
+
+  <para os="s">Once everything is working correctly, clean up the test files:</para>
+
+<screen role="nodump" os="t"><userinput>rm -v dummy.c a.out dummy.log</userinput></screen>
+
 </sect1>
-

Modified: trunk/BOOK/chapter06/sed.xml
===================================================================
--- trunk/BOOK/chapter06/sed.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/sed.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -33,10 +33,6 @@
 
 <screen condition="uclibc"><userinput>patch -Np1 -i ../&sed-uClibc-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i sed/Makefile.in</userinput></screen>
-
 <para>Prepare Sed for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --bindir=/bin</userinput></screen>

Modified: trunk/BOOK/chapter06/shadow.xml
===================================================================
--- trunk/BOOK/chapter06/shadow.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/shadow.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -37,10 +37,6 @@
 
 <screen condition="uclibc"><userinput>patch -Np1 -i ../&shadow-uClibc-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/Makefile.in</userinput></screen>
-
 <para>Prepare Shadow for compilation:</para>
 
 <screen><userinput>./configure --libdir=/lib --enable-shared \

Modified: trunk/BOOK/chapter06/sysklogd.xml
===================================================================
--- trunk/BOOK/chapter06/sysklogd.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/sysklogd.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -33,10 +33,6 @@
 
 <screen><userinput>patch -Np1 -i ../&sysklogd-fixes-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS.*$/& -pie -fpie/' -i Makefile</userinput></screen>
-
 <para>Compile the package:</para>
 
 <screen><userinput>make</userinput></screen>

Modified: trunk/BOOK/chapter06/sysvinit.xml
===================================================================
--- trunk/BOOK/chapter06/sysvinit.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/sysvinit.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -47,10 +47,6 @@
 <screen><userinput>sed -e's at Sending processes@& started by init at g' \
     -i src/init.c</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS.*$/& -pie -fpie/' -i src/Makefile</userinput></screen>
-
 <para>Compile the package:</para>
 
 <screen><userinput>make -C src</userinput></screen>

Modified: trunk/BOOK/chapter06/tar.xml
===================================================================
--- trunk/BOOK/chapter06/tar.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/tar.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -1,91 +1,119 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
   <!ENTITY % general-entities SYSTEM "../general.ent">
   %general-entities;
 ]>
+
 <sect1 id="ch-system-tar" role="wrap">
-<title>Tar-&tar-version;</title>
-<?dbhtml filename="tar.html"?>
+  <?dbhtml filename="tar.html"?>
 
-<indexterm zone="ch-system-tar"><primary sortas="a-Tar">Tar</primary></indexterm>
+  <title>Tar-&tar-version;</title>
 
-<sect2 role="package"><title/>
-<para>The Tar package contains an archiving program.</para>
+  <indexterm zone="ch-system-tar">
+    <primary sortas="a-Tar">Tar</primary>
+  </indexterm>
 
-<segmentedlist>
-<segtitle>&buildtime;</segtitle>
-<segtitle>&diskspace;</segtitle>
-<seglistitem><seg>?? SBU</seg><seg>?? MB</seg></seglistitem>
-</segmentedlist>
+  <sect2 role="package">
+    <title/>
 
-<segmentedlist>
-<segtitle>&dependencies;</segtitle>
-<seglistitem><seg>Bash, Binutils, Coreutils,
-Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed</seg></seglistitem>
-</segmentedlist>
-</sect2>
+    <para>The Tar package contains an archiving program.</para>
 
-<sect2 role="installation">
-<title>Installation of Tar</title>
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
 
-<para>This patch is from upstream and fixes a bug with the -S switch:</para>
+      <seglistitem>
+        <seg>?? SBU</seg>
+        <seg>?? MB</seg>
+      </seglistitem>
+    </segmentedlist>
 
+    <segmentedlist>
+        <segtitle>&dependencies;</segtitle>
+        <seglistitem><seg>Bash, Binutils, Coreutils,Diffutils, GCC,
+        Gettext, Glibc, Grep, Make, and Sed</seg></seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Tar</title>
+
+    <para>Apply a patch to fix some issues with the test suite when using
+    GCC-&gcc-version;:</para>
+
+<screen><userinput>patch -Np1 -i ../&tar-gcc4_fix-patch;</userinput></screen>
+
+    <para>Tar has a bug when the <parameter>-S</parameter> option is used
+    with files larger than 4 GB. The following patch properly fixes this
+    issue:</para>
+
 <screen><userinput>patch -Np1 -i ../&tar-sparse_fix-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
+    <para>Recent versions of Tar are vulnerable to a buffer overflow from
+    specially crafted archives. The following patch addresses this:</para>
 
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' \
-    -i {rmt,src}/Makefile.in</userinput></screen>
+<screen><userinput>patch -Np1 -i ../&tar-security_fixes-patch;</userinput></screen>
 
-<para>Prepare Tar for compilation:</para>
+    <para>Prepare Tar for compilation:</para>
 
-<screen><userinput>./configure --prefix=/usr --bindir=/bin \
-    --libexecdir=/usr/sbin</userinput></screen>
+<screen><userinput>./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin</userinput></screen>
 
-<para>Compile the package:</para>
+    <para>Compile the package:</para>
 
 <screen><userinput>make</userinput></screen>
 
-<para>To test the results, issue:
-<userinput>make check</userinput>.</para>
+    <para>To test the results, issue:
+    <userinput>make check</userinput>.</para>
 
-<para>Install the package:</para>
+    <para>Install the package:</para>
 
 <screen><userinput>make install</userinput></screen>
 
-</sect2>
+  </sect2>
 
 
-<sect2 id="contents-tar" role="content"><title>Contents of Tar</title>
+  <sect2 id="contents-tar" role="content">
+    <title>Contents of Tar</title>
 
-<segmentedlist>
-<segtitle>Installed programs</segtitle>
-<seglistitem><seg>rmt and tar</seg></seglistitem>
-</segmentedlist>
+    <segmentedlist>
+      <segtitle>Installed programs</segtitle>
 
-<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
-<?dbfo list-presentation="list"?>
-<?dbhtml list-presentation="table"?>
+      <seglistitem>
+        <seg>rmt and tar</seg>
+      </seglistitem>
+    </segmentedlist>
 
-<varlistentry id="rmt">
-<term><command>rmt</command></term>
-<listitem>
-<para>Remotely manipulates a magnetic
-tape drive through an interprocess communication connection</para>
-<indexterm zone="ch-system-tar rmt"><primary sortas="b-rmt">rmt</primary></indexterm>
-</listitem>
-</varlistentry>
+    <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 and extracts files from archives, also known as tarballs</para>
-<indexterm zone="ch-system-tar tar"><primary sortas="b-tar">tar</primary></indexterm>
-</listitem>
-</varlistentry>
-</variablelist>
+      <varlistentry id="rmt">
+        <term><command>rmt</command></term>
+        <listitem>
+          <para>Remotely manipulates a magnetic
+          tape drive through an interprocess communication connection</para>
+          <indexterm zone="ch-system-tar rmt">
+            <primary sortas="b-rmt">rmt</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
 
-</sect2>
+      <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>
+
+  </sect2>
+
 </sect1>
-

Modified: trunk/BOOK/chapter06/texinfo.xml
===================================================================
--- trunk/BOOK/chapter06/texinfo.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/texinfo.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -33,11 +33,6 @@
 
 <screen><userinput>patch -Np1 -i ../&texinfo-tempfile_fix-patch;</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' \
-    -i {info,makeinfo,util}/Makefile.in</userinput></screen>
-
 <para>Prepare Texinfo for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr</userinput></screen>

Modified: trunk/BOOK/chapter06/uclibc.xml
===================================================================
--- trunk/BOOK/chapter06/uclibc.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/uclibc.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -30,36 +30,15 @@
 <sect2 role="installation">
 <title>Installation of uClibc</title>
 
-<para>First apply a patch to add arc4random support:</para>
-
-<screen><userinput>patch -Np1 -i ../&uClibc-arc4random-patch;</userinput></screen>
-
 <para>Put the pre-generated locale tarball where uClibc can find it:</para>
 
 <screen><userinput>install -m444 ../uClibc-locale-&uclibc-locale-version;.tgz extra/locale/</userinput></screen>
 
-<para>Use these commands to remove size reducing optimizations, which also tend
-to reduce performance:</para>
-
-<screen><userinput>sed -e '/mpreferred-stack-boundary/d' \
-    -e '/falign-jumps/d' -i Rules.mak
-sed -e 's/-Os,//' -i Rules.mak</userinput></screen>
-
-<para>This will load performance enhancing optimizations. Add to this if you
-want to. Adding -fomit-frame-pointer is reported by uClibc developers to work, however
-has also been reported by users to cause test failures in other packages::</para>
-
-<screen><userinput>sed -e 's/^OPTIMIZATION:=.*$/&-maccumulate-outgoing-args/' \
-    -i Rules.mak</userinput></screen>
-
 <para>This patch will get you started:</para>
 
 <screen><userinput>patch -Np1 -i ../&uClibc-config-patch;</userinput></screen>
 
-<para>Next run menuconfig. This is very similar to the kernel's menuconfig.
-If you want to install locales you will need to fetch the
-<filename>uClibc-locale-030818.tgz</filename> package from the uClibc.org website, and do:
-<userinput>install -m444 ../uClibc-locale-030818.tgz extra/locale/</userinput>.</para>
+<para>Next run menuconfig. This is very similar to the kernel's menuconfig.</para>
 
 <para><envar>UCLIBC_HAS_WCHAR</envar> is needed to build <command>g++</command>.
 <envar>UCLIBC_HAS_RPC</envar> is needed to build Util-Linux
@@ -84,15 +63,14 @@
 
 <screen><userinput>sed -e \
     's at .*SHARED_LIB_LOADER_PREFIX.*@SHARED_LIB_LOADER_PREFIX="/lib"@g' \
-    -i .config
-sed -e 's at .*RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@g' -i .config
-sed -e 's at .*DEVEL_PREFIX.*@DEVEL_PREFIX="/usr/"@g' -i .config
-sed -e 's at .*KERNEL_SOURCE.*@KERNEL_SOURCE="/usr"@g' -i .config</userinput></screen>
+    -e 's at .*RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@g' \
+    -e 's at .*DEVEL_PREFIX.*@DEVEL_PREFIX="/usr/"@g' \
+    -e 's at .*KERNEL_SOURCE.*@KERNEL_SOURCE="/usr"@g' -i.orig .config</userinput></screen>
 
 <para>Compile and install the package:</para>
 
 <screen><userinput>make
-rm include/{asm,asm-generic,linux}
+rm -v include/{asm,asm-generic,linux}
 make install</userinput></screen>
 
 <para>Then make and install the utilities:</para>
@@ -102,20 +80,17 @@
     -C utils
 make -C utils install</userinput></screen>
 
-<para>Install the man page for <function>arc4random()</function>:</para>
-
-<screen><userinput>install -m644 libc/stdlib/man/arc4random.3 /usr/share/man/man3</userinput></screen>
-
 <para>Remove the static libs. Save <filename class="libraryfile">libc.a</filename>
 for GCC's tests. libdl.a is needed for Binutils testsuite:</para>
 
-<screen><userinput>rm /usr/lib/{libcrypt,libm,libnsl,libpthread}.a
-rm /usr/lib/{libresolv,librt,libutil}.a</userinput></screen>
+<screen><userinput>install -vd /usr/lib/static/
+mv -v /usr/lib/{libcrypt,libm,libnsl,libpthread}.a /usr/lib/static
+mv -v /usr/lib/{libresolv,librt,libutil}.a /usr/lib/static/</userinput></screen>
 
 <para>Remove these symlinks:</para>
 
-<screen><userinput>rm /usr/lib/{libc_pic,libcrypt_pic,libm_pic,libnsl_pic}.a
-rm /usr/lib/{libpthread_pic,libresolv_pic,librt_pic,libutil_pic}.a</userinput></screen>
+<screen><userinput>rm -v /usr/lib/{libc_pic,libcrypt_pic,libm_pic,libnsl_pic}.a
+rm -v /usr/lib/{libpthread_pic,libresolv_pic,librt_pic,libutil_pic}.a</userinput></screen>
 
 </sect2>
 
@@ -131,11 +106,11 @@
     --enable-relocatable --disable-rpath
 make -C intl/</userinput></screen>
 
-<para>Install the <filename class="libraryfile">libintl</filename> library and header:</para>
+<para>Install the <filename class="libraryfile">libintl.so</filename> library and header:</para>
 
 <screen><userinput>make -C intl/ install
-rm /lib/libintl.so
-ln -sf ../../lib/libintl.so.3 /usr/lib/libintl.so</userinput></screen>
+rm -v /lib/libintl.so
+ln -vsf ../../lib/libintl.so.3 /usr/lib/libintl.so</userinput></screen>
 
 </sect2>
 
@@ -147,7 +122,7 @@
 following:</para>
 
 <screen><userinput>echo "/usr/local/lib" > ld.so.conf.new
-install -m644 ld.so.conf.new /etc/ld.so.conf</userinput></screen>
+install -v -m644 ld.so.conf.new /etc/ld.so.conf</userinput></screen>
 
 </sect2>
 

Modified: trunk/BOOK/chapter06/util-linux.xml
===================================================================
--- trunk/BOOK/chapter06/util-linux.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/util-linux.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -65,10 +65,6 @@
 
 <screen><userinput>patch -Np1 -i ../&util-linux-nologin-patch;</userinput></screen>
 
-<para>Apply this patch to add -fpie when compiling program executables:</para>
-
-<screen><userinput>patch -Np1 -i ../&util-linux-hardened_cflags-patch;</userinput></screen>
-
 <para>Prepare Util-linux for compilation:</para>
 
 <screen><userinput>./configure</userinput></screen>

Modified: trunk/BOOK/chapter06/vim.xml
===================================================================
--- trunk/BOOK/chapter06/vim.xml	2006-07-27 00:53:48 UTC (rev 670)
+++ trunk/BOOK/chapter06/vim.xml	2006-07-27 00:56:10 UTC (rev 671)
@@ -40,10 +40,6 @@
 
 <screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
 
-<para>Amend <filename>Makefile.in</filename>:</para>
-
-<screen><userinput>sed -e 's/^CFLAGS .*$/& -pie -fpie/' -i src/config.mk.in</userinput></screen>
-
 <para>Now prepare Vim for compilation:</para>
 
 <screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>




More information about the hlfs-book mailing list