Prechádzať zdrojové kódy

First apply of multilib-patch of April 1st, 2019

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11566 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Thomas Trepl 6 rokov pred
rodič
commit
854e6fa587
52 zmenil súbory, kde vykonal 2544 pridanie a 77 odobranie
  1. 13 0
      Makefile
  2. 5 2
      chapter01/askforhelp.xml
  3. 4 2
      chapter01/changelog.xml
  4. 3 0
      chapter01/whatsnew.xml
  5. 18 0
      chapter03/packages.xml
  6. 13 1
      chapter04/settingenviron.xml
  7. 18 3
      chapter05/binutils-pass1.xml
  8. 46 3
      chapter05/binutils-pass2.xml
  9. 1 0
      chapter05/chapter05.xml
  10. 80 12
      chapter05/gcc-pass1.xml
  11. 78 15
      chapter05/gcc-pass2.xml
  12. 125 0
      chapter05/glibc.xml
  13. 54 0
      chapter05/ncurses.xml
  14. 7 2
      chapter05/stripping.xml
  15. 56 0
      chapter05/util-linux.xml
  16. 46 0
      chapter05/xz.xml
  17. 101 0
      chapter05/zlib.xml
  18. 52 0
      chapter06/acl.xml
  19. 55 0
      chapter06/attr.xml
  20. 48 0
      chapter06/bzip2.xml
  21. 7 2
      chapter06/chapter06.xml
  22. 12 1
      chapter06/createfiles.xml
  23. 16 1
      chapter06/creatingdirs.xml
  24. 73 0
      chapter06/eudev.xml
  25. 56 0
      chapter06/expat.xml
  26. 52 0
      chapter06/file.xml
  27. 36 8
      chapter06/gcc.xml
  28. 158 0
      chapter06/glibc-32.xml
  29. 1 0
      chapter06/glibc.xml
  30. 104 0
      chapter06/gmp.xml
  31. 113 0
      chapter06/isl.xml
  32. 64 0
      chapter06/kmod.xml
  33. 38 0
      chapter06/libcap.xml
  34. 54 0
      chapter06/libelf.xml
  35. 68 0
      chapter06/libffi.xml
  36. 54 0
      chapter06/libtool.xml
  37. 50 0
      chapter06/linux-firmware.xml
  38. 132 3
      chapter06/ncurses.xml
  39. 64 0
      chapter06/openssl.xml
  40. 54 0
      chapter06/readline.xml
  41. 3 1
      chapter06/revisedchroot.xml
  42. 35 2
      chapter06/strippingagain.xml
  43. 143 0
      chapter06/systemd.xml
  44. 113 0
      chapter06/util-linux.xml
  45. 55 0
      chapter06/xz.xml
  46. 49 0
      chapter06/zlib.xml
  47. 28 2
      chapter08/grub.xml
  48. 11 4
      chapter08/kernel.xml
  49. 27 4
      chapter09/theend.xml
  50. 16 0
      packages.ent
  51. 26 7
      prologue/architecture.xml
  52. 9 2
      prologue/bookinfo.xml

+ 13 - 0
Makefile

@@ -34,6 +34,15 @@ else
   DUMPDIR         ?= ~/lfs-sysd-commands
 endif
 
+ifndef ARCH
+  ARCH = default
+endif
+ifneq ($(ARCH), default)
+  ifneq ($(ARCH), multilib)
+    $(error ARCH must be either 'default' (default if unset) or 'multilib'.)
+  endif
+endif
+
 book: validate profile-html
 	@echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
 	$(Q)xsltproc --nonet                          \
@@ -130,6 +139,7 @@ validate: tmpdir
                 --xinclude                            \
                 --output $(RENDERTMP)/lfs-html2.xml   \
                 --stringparam profile.revision $(REV) \
+                --stringparam profile.arch $(ARCH)    \
                 stylesheets/lfs-xsl/profile.xsl       \
                 index.xml
 
@@ -160,6 +170,7 @@ $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
 
 #	$(Q)xsltproc --nonet --xinclude                    \
 #                --stringparam profile.revision $(REV) \
+#                --stringparam profile.arch $(ARCH)    \
 #                --output $(RENDERTMP)/sysd-wget.xml   \
 #                stylesheets/lfs-xsl/profile.xsl       \
 #                chapter03/chapter03.xml
@@ -177,6 +188,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
 
 	$(Q)xsltproc --nonet --xinclude                    \
                 --stringparam profile.revision $(REV) \
+                --stringparam profile.arch $(ARCH) \
                 --output $(RENDERTMP)/sysv-md5sum.xml \
                 stylesheets/lfs-xsl/profile.xsl       \
                 chapter03/chapter03.xml
@@ -194,6 +206,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
 #	$(Q)xsltproc --nonet                     \
 #      --output $(RENDERTMP)/lfs-html.xml    \
 #      --stringparam profile.revision $(REV) \
+#      --stringparam profile.arch $(ARCH)    \
 #      stylesheets/lfs-xsl/profile.xsl       \
 #      $(RENDERTMP)/lfs-full.xml
 

+ 5 - 2
chapter01/askforhelp.xml

@@ -39,8 +39,11 @@
     <itemizedlist>
       <listitem>
         <para>The version of the book being used (in this case 
-              <phrase revision="sysv">&version;</phrase>
-              <phrase revision="systemd">&versiond;</phrase>)</para>
+              <phrase arch="default" revision="sysv">&version;</phrase>
+              <phrase arch="multilib" revision="sysv">&version;-multilib</phrase>
+          <phrase arch="default" revision="systemd">&versiond;</phrase>
+          <phrase arch="multilib" revision="systemd">&versiond;-multilib</phrase>)</para>
+
       </listitem>
       <listitem>
         <para>The host distribution and version being used to create LFS</para>

+ 4 - 2
chapter01/changelog.xml

@@ -11,8 +11,10 @@
   <title>Changelog</title>
 
   <para>This is version 
-        <phrase revision="sysv">&version;</phrase>
-        <phrase revision="systemd">&versiond;</phrase>
+        <phrase arch="default" revision="sysv">&version;</phrase>
+        <phrase arch="multilib" revision="sysv">&version;-multilib</phrase>
+        <phrase arch="default" revision="systemd">&versiond;</phrase>
+        <phrase arch="multilib" revision="systemd">&versiond;-multilib</phrase> 
   of the Linux From Scratch book, dated
   &releasedate;. If this book is more than six months old, a newer and better
   version is probably already available. To find out, please check one of the

+ 3 - 0
chapter01/whatsnew.xml

@@ -161,6 +161,9 @@
     <listitem>
       <para>Linux-&linux-version;</para>
     </listitem>
+    <listitem>
+      <para>Linux-Firmware-&linux-firmware-version;</para>
+    </listitem>
     <!--<listitem>
       <para>M4-&m4-version;</para>
     </listitem>-->

+ 18 - 0
chapter03/packages.xml

@@ -355,6 +355,15 @@
       </listitem>
     </varlistentry>
 
+    <varlistentry>
+      <term>ISL (&isl-version;) - <token>&isl-size;</token>:</term>
+      <listitem>
+        <para>Home page: <ulink url="&isl-home;"/></para>
+        <para>Download: <ulink url="&isl-url;"/></para>
+        <para>MD5 sum: <literal>&isl-md5;</literal></para>
+      </listitem>
+    </varlistentry>
+
     <varlistentry>
       <term>Kbd (&kbd-version;) - <token>&kbd-size;</token>:</term>
       <listitem>
@@ -450,6 +459,15 @@
       </listitem>
     </varlistentry>
 
+    <varlistentry>
+      <term>Linux Firmware (&linux-firmware-version;) - <token>&linux-firmware-size;</token>:</term>
+      <listitem>
+        <para>Home page: <ulink url="&linux-firmware-home;"/></para>
+        <para>Download: <ulink url="&linux-firmware-url;"/></para>
+        <para>MD5 sum: <literal>&linux-firmware-md5;</literal></para>
+      </listitem>
+    </varlistentry>
+
     <varlistentry>
       <term>M4 (&m4-version;) - <token>&m4-size;</token>:</term>
       <listitem>

+ 13 - 1
chapter04/settingenviron.xml

@@ -37,7 +37,7 @@ EOF</userinput></screen>
   <filename>.bashrc</filename> file instead. Create the
   <filename>.bashrc</filename> file now:</para>
 
-<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
+<screen arch="default"><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
 <literal>set +h
 umask 022
 LFS=/mnt/lfs
@@ -45,6 +45,18 @@ LC_ALL=POSIX
 LFS_TGT=$(uname -m)-lfs-linux-gnu
 PATH=/tools/bin:/bin:/usr/bin
 export LFS LC_ALL LFS_TGT PATH</literal>
+EOF</userinput></screen>
+
+<screen arch="multilib"><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
+<literal>set +h
+umask 022
+LFS=/mnt/lfs
+LC_ALL=POSIX
+LFS_TGT=x86_64-lfs-linux-gnu
+LFS_TGT32=i686-lfs-linux-gnu
+LFS_TGTX32=x86_64-lfs-linux-gnux32
+PATH=/tools/bin:/bin:/usr/bin
+export LFS LC_ALL LFS_TGT LFS_TGT32 LFS_TGTX32 PATH</literal>
 EOF</userinput></screen>
 
   <para>The <command>set +h</command> command turns off

+ 18 - 3
chapter05/binutils-pass1.xml

@@ -72,13 +72,22 @@ cd       build</userinput></screen>
 
     <para>Now prepare Binutils for compilation:</para>
 
-<screen><userinput remap="configure">../configure --prefix=/tools            \
+<screen arch="default"><userinput remap="configure">../configure --prefix=/tools            \
              --with-sysroot=$LFS        \
              --with-lib-path=/tools/lib \
              --target=$LFS_TGT          \
              --disable-nls              \
              --disable-werror</userinput></screen>
 
+    <screen arch="multilib"><userinput remap="configure">../configure --prefix=/tools \
+             --with-sysroot=$LFS                     \
+             --with-lib-path=/tools/lib:/tools/lib32:/tools/libx32 \
+             --target=$LFS_TGT                       \
+             --disable-nls                           \
+             --disable-werror                        \
+             --enable-64-bit-bfd                     \
+             --enable-multilib</userinput></screen>
+
     <variablelist>
       <title>The meaning of the configure options:</title>
 
@@ -146,13 +155,19 @@ cd       build</userinput></screen>
     tests at this point are minimal since the programs from this
     first pass will soon be replaced by those from the second.</para>
 
-    <para>If building on x86_64, create a symlink to ensure the sanity of
+    <para arch="default">If building on x86_64, create a symlink to ensure the
+    sanity of the toolchain:</para>
+
+    <para arch="multilib">Create a symlink to ensure the sanity of
     the toolchain:</para>
 
-<screen><userinput remap="install">case $(uname -m) in
+<screen arch="default"><userinput remap="install">case $(uname -m) in
   x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
 esac</userinput></screen>
 
+<screen arch="multilib"><userinput remap="install">mkdir -v /tools/lib &amp;&amp;
+ln -sv lib /tools/lib64</userinput></screen>
+
     <para>Install the package:</para>
 
 <screen><userinput remap="install">make install</userinput></screen>

+ 46 - 3
chapter05/binutils-pass2.xml

@@ -50,7 +50,7 @@ cd       build</userinput></screen>
 
     <para>Prepare Binutils for compilation:</para>
 
-<screen><userinput remap="configure">CC=$LFS_TGT-gcc                \
+<screen arch="default"><userinput remap="configure">CC=$LFS_TGT-gcc                \
 AR=$LFS_TGT-ar                 \
 RANLIB=$LFS_TGT-ranlib         \
 ../configure                   \
@@ -60,6 +60,18 @@ RANLIB=$LFS_TGT-ranlib         \
     --with-lib-path=/tools/lib \
     --with-sysroot</userinput></screen>
 
+<screen arch="multilib"><userinput remap="configure">CC=$LFS_TGT-gcc                \
+AR=$LFS_TGT-ar                 \
+RANLIB=$LFS_TGT-ranlib         \
+../configure                   \
+    --prefix=/tools            \
+    --disable-nls              \
+    --disable-werror           \
+    --with-lib-path=/tools/lib:/tools/lib32:/tools/libx32 \
+    --with-sysroot             \
+    --enable-64-bit-bfd        \
+    --enable-multilib</userinput></screen>
+
     <variablelist>
       <title>The meaning of the new configure options:</title>
 
@@ -72,7 +84,7 @@ RANLIB=$LFS_TGT-ranlib         \
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry arch="default">
         <term><parameter>--with-lib-path=/tools/lib</parameter></term>
         <listitem>
           <para>This tells the configure script to specify the library
@@ -83,6 +95,19 @@ RANLIB=$LFS_TGT-ranlib         \
         </listitem>
       </varlistentry>
 
+      <varlistentry arch="multilib">
+        <term><parameter>--with-lib-path=/tools/lib:...</parameter></term>
+        <listitem>
+          <para>This tells the configure script to specify the library
+          search path during the compilation of Binutils, resulting in
+          <filename class="directory">/tools/lib</filename>,
+          <filename class="directory">/tools/lib32</filename> and
+          <filename class="directory">/tools/libx32</filename> being passed
+          to the linker. This prevents the linker from searching through
+          library directories on the host.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><parameter>--with-sysroot</parameter></term>
         <listitem>
@@ -93,6 +118,20 @@ RANLIB=$LFS_TGT-ranlib         \
         </listitem>
       </varlistentry>
 
+      <varlistentry arch="multilib">
+        <term><parameter>--enable-64-bit-bfd</parameter></term>
+        <listitem>
+          <para>TODO</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry arch="multilib">
+        <term><parameter>--enable-multilib</parameter></term>
+        <listitem>
+          <para>TODO</para>
+        </listitem>
+      </varlistentry>
+      
     </variablelist>
 
     <para>Compile the package:</para>
@@ -106,8 +145,12 @@ RANLIB=$LFS_TGT-ranlib         \
     <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
     the next chapter:</para>
 
-<screen><userinput remap="adjust">make -C ld clean
+<screen arch="default"><userinput remap="adjust">make -C ld clean
 make -C ld LIB_PATH=/usr/lib:/lib
+cp -v ld/ld-new /tools/bin</userinput></screen>
+
+<screen arch="multilib"><userinput remap="adjust">make -C ld clean
+make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32:/usr/libx32:/libx32
 cp -v ld/ld-new /tools/bin</userinput></screen>
 
     <variablelist>

+ 1 - 0
chapter05/chapter05.xml

@@ -20,6 +20,7 @@
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass2.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zlib.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>

+ 80 - 12
chapter05/gcc-pass1.xml

@@ -43,11 +43,17 @@
   <sect2 role="installation">
     <title>Installation of Cross GCC</title>
 
-    <para>GCC now requires the GMP, MPFR and MPC packages. As these packages may
-    not be included in your host distribution, they will be built with
-    GCC.  Unpack each package into the GCC source directory and rename the
-    resulting directories so the GCC build procedures will automatically
-    use them:</para>
+    <para arch="default">GCC now requires the GMP, MPFR, and MPC packages. As
+    these packages may not be included in your host distribution, they will be
+    built with GCC.  Unpack each package into the GCC source directory and
+    rename the resulting directories so the GCC build procedures will
+    automatically use them:</para>
+
+    <para arch="multilib">GCC now requires the GMP, ISL, MPFR, and MPC packages.
+    As these packages may not be included in your host distribution, they will
+    be built with GCC.  Unpack each package into the GCC source directory and 
+    rename the resulting directories so the GCC build procedures will 
+    automatically use them:</para>
 
     <note><para>There are frequent misunderstandings about this chapter.  The
     procedures are the same as every other chapter as explained earlier (<xref
@@ -55,12 +61,20 @@
     directory and then change to the directory created.  Only then should you
     proceed with the instructions below.</para></note>
 
-<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+<screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
 mv -v mpfr-&mpfr-version; mpfr
 tar -xf ../gmp-&gmp-version;.tar.xz
 mv -v gmp-&gmp-version; gmp
 tar -xf ../mpc-&mpc-version;.tar.gz
 mv -v mpc-&mpc-version; mpc</userinput></screen>
+<screen arch="multilib"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc
+tar -xf ../isl-&isl-version;.tar.xz
+mv -v isl-&isl-version; isl</userinput></screen>
 
     <para>The following command will change the location of GCC's default
     dynamic linker to use the one installed in <filename
@@ -71,7 +85,7 @@ mv -v mpc-&mpc-version; mpc</userinput></screen>
 <screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
 do
   cp -uv $file{,.orig}
-  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
+  sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
   echo '
 #undef STANDARD_STARTFILE_PREFIX_1
@@ -97,16 +111,27 @@ done</userinput></screen>
     prevents unexpected changes to the original files in case the commands are
     inadvertently run twice.</para>
 
-    <para>Finally, on x86_64 hosts, set the default directory name for
-    64-bit libraries to <quote>lib</quote>:</para>
+    <para arch="default">Finally, on x86_64 hosts, set the default directory
+    name for 64-bit libraries to <quote>lib</quote>:</para>
 
-<screen><userinput remap="pre">case $(uname -m) in
+<screen arch="default"><userinput remap="pre">case $(uname -m) in
   x86_64)
     sed -e '/m64=/s/lib64/lib/' \
         -i.orig gcc/config/i386/t-linux64
  ;;
 esac</userinput></screen>
 
+<screen arch="multilib"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
+    -i.orig gcc/config/i386/t-linux64
+cat > gcc/config/i386/t-linux64 &lt;&lt;"EOF"
+comma=,
+MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
+MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-linux-gnu)
+MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+EOF</userinput></screen>
+
 <!--
     <para>GCC doesn't detect stack protection correctly, which causes problems
     for the build of Glibc-&glibc-version;, so fix that by issuing the following
@@ -120,6 +145,15 @@ esac</userinput></screen>
 
 <screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
 -->
+
+    <!-- Following patch might be obsolete with gcc >= 8.2.1 -->
+    <!-- see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 -->
+    <!-- Fix applied in ch5-gcc-pass{1,2}, ch6-gcc -->
+    <para arch="multilib">Fix an issue with isl-&isl-version;:</para>
+
+<screen arch="multilib"><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
+    -i gcc/graphite.h</userinput></screen>
+
     <para>The GCC documentation recommends building GCC 
     in a dedicated build directory:</para>
 
@@ -128,7 +162,7 @@ cd       build</userinput></screen>
 
     <para>Prepare GCC for compilation:</para>
 
-<screen><userinput remap="configure">../configure                                       \
+<screen arch="default"><userinput remap="configure">../configure                                       \
     --target=$LFS_TGT                              \
     --prefix=/tools                                \
     --with-glibc-version=2.11                      \
@@ -150,6 +184,31 @@ cd       build</userinput></screen>
     --disable-libvtv                               \
     --disable-libstdcxx                            \
     --enable-languages=c,c++</userinput></screen>
+
+<screen arch="multilib"><userinput remap="configure">../configure                                       \
+    --target=$LFS_TGT                              \
+    --prefix=/tools                                \
+    --with-glibc-version=2.11                      \
+    --with-sysroot=$LFS                            \
+    --with-newlib                                  \
+    --without-headers                              \
+    --with-local-prefix=/tools                     \
+    --with-native-system-header-dir=/tools/include \
+    --disable-nls                                  \
+    --disable-shared                               \
+    --enable-multilib                              \
+    --with-multilib-list=m32,m64,mx32              \
+    --disable-decimal-float                        \
+    --disable-threads                              \
+    --disable-libatomic                            \
+    --disable-libgomp                              \
+    --disable-libmpx                               \
+    --disable-libquadmath                          \
+    --disable-libssp                               \
+    --disable-libvtv                               \
+    --disable-libstdcxx                            \
+    --enable-languages=c,c++</userinput></screen>
+
     <variablelist>
       <title>The meaning of the configure options:</title>
 
@@ -219,7 +278,7 @@ cd       build</userinput></screen>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry arch="default">
         <term><parameter>--disable-multilib</parameter></term>
         <listitem>
           <para>On x86_64, LFS does not yet support a multilib configuration.
@@ -227,6 +286,15 @@ cd       build</userinput></screen>
         </listitem>
       </varlistentry>
 
+      <varlistentry arch="multilib">
+        <term><parameter>--enable-multilib,
+                         --with-multilib-list=m32,m64,mx32</parameter></term>
+        <listitem>
+          <para>LFS now supports a multilib configuration. Enable it for the
+          32bit, the 64-bit, and the mixed mode.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><parameter>--enable-languages=c,c++</parameter></term>
         <listitem>

+ 78 - 15
chapter05/gcc-pass2.xml

@@ -73,7 +73,7 @@ esac</userinput></screen>
 <screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
 do
   cp -uv $file{,.orig}
-  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
+  sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
   echo '
 #undef STANDARD_STARTFILE_PREFIX_1
@@ -83,31 +83,59 @@ do
   touch $file.orig
 done</userinput></screen>
 
-    <para>If building on x86_64, change the default directory name for 64-bit
-    libraries to <quote>lib</quote>:</para>
+    <para arch="default">If building on x86_64, change the default directory
+    name for 64-bit libraries to <quote>lib</quote>:</para>
 
-<screen><userinput remap="pre">case $(uname -m) in
+<screen arch="default"><userinput remap="pre">case $(uname -m) in
   x86_64)
     sed -e '/m64=/s/lib64/lib/' \
         -i.orig gcc/config/i386/t-linux64
   ;;
 esac</userinput></screen>
 
-    <para>As in the first build of GCC it requires the GMP, MPFR and MPC
-    packages. Unpack the tarballs and move them into the required directory
-    names:</para>
+    <para arch="multilib">Change the default directory name for 64-bit
+    libraries to <quote>lib</quote>:</para>
 
-<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+<screen arch="multilib"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
+    -i.orig gcc/config/i386/t-linux64
+cat > gcc/config/i386/t-linux64 &lt;&lt;"EOF"
+comma=,
+MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
+MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-linux-gnu)
+MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+EOF</userinput></screen>
+
+    <para arch="default">As in the first build of GCC it requires the GMP,
+    MPFR, and MPC packages. Unpack the tarballs and move them into the
+    required directory names:</para>
+
+    <para arch="multilib">As in the first build of GCC it requires the GMP,
+    ISL, MPFR, and MPC packages. Unpack the tarballs and move them into the
+    required directory names:</para>
+
+<screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
 mv -v mpfr-&mpfr-version; mpfr
 tar -xf ../gmp-&gmp-version;.tar.xz
 mv -v gmp-&gmp-version; gmp
 tar -xf ../mpc-&mpc-version;.tar.gz
 mv -v mpc-&mpc-version; mpc</userinput></screen>
-<!--
-    <para>As in the first build of GCC, fix a problem identified upstream:</para>
+<screen arch="multilib"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
+mv -v mpfr-&mpfr-version; mpfr
+tar -xf ../gmp-&gmp-version;.tar.xz
+mv -v gmp-&gmp-version; gmp
+tar -xf ../mpc-&mpc-version;.tar.gz
+mv -v mpc-&mpc-version; mpc
+tar -xf ../isl-&isl-version;.tar.xz
+mv -v isl-&isl-version; isl</userinput></screen>
+
+    <!-- Following patch might be obsolete with gcc >= 8.2.1 --> 
+    <para arch="multilib">Fix an issue with isl-&isl-version;:</para>
+
+<screen arch="multilib"><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
+    -i gcc/graphite.h</userinput></screen>
 
-<screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
--->
     <para>Create a separate build directory again:</para>
 
 <screen><userinput remap="pre">mkdir -v build
@@ -118,7 +146,7 @@ cd       build</userinput></screen>
 
     <para>Now prepare GCC for compilation:</para>
 
-<screen><userinput remap="configure">CC=$LFS_TGT-gcc                                    \
+<screen arch="default"><userinput remap="configure">CC=$LFS_TGT-gcc                                    \
 CXX=$LFS_TGT-g++                                   \
 AR=$LFS_TGT-ar                                     \
 RANLIB=$LFS_TGT-ranlib                             \
@@ -132,6 +160,22 @@ RANLIB=$LFS_TGT-ranlib                             \
     --disable-bootstrap                            \
     --disable-libgomp</userinput></screen>
 
+<screen arch="multilib"><userinput remap="configure">CC=$LFS_TGT-gcc                                    \
+CXX=$LFS_TGT-g++                                   \
+AR=$LFS_TGT-ar                                     \
+RANLIB=$LFS_TGT-ranlib                             \
+../configure                                       \
+    --prefix=/tools                                \
+    --with-local-prefix=/tools                     \
+    --with-native-system-header-dir=/tools/include \
+    --enable-languages=c,c++                       \
+    --disable-libstdcxx-pch                        \
+    --enable-multilib                              \
+    --with-multilib-list=m32,m64,mx32              \
+    --with-system-zlib                             \
+    --disable-bootstrap                            \
+    --disable-libgomp</userinput></screen>
+
     <variablelist>
       <title>The meaning of the new configure options:</title>
 
@@ -199,8 +243,27 @@ readelf -l a.out | grep ': /tools'</userinput></screen>
 
 <screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
 
-    <para>Note that the dynamic linker will be /tools/lib/ld-linux.so.2 
-    for 32-bit machines.</para>
+
+    <para arch="multilib">Repeat the test for 32-bit:</para>
+
+<screen arch="multilib"><userinput>cc -m32 dummy.c
+readelf -l a.out | grep ': /tools'</userinput></screen>
+
+    <para arch="multilib">In this case, the output shoud be:</para>
+
+<screen arch="multilib"><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
+
+    <para arch="multilib">Repeat the test for x32-bit:</para>
+
+<screen arch="multilib"><userinput>cc -mx32 dummy.c
+readelf -l a.out | grep ': /tools'</userinput></screen>
+
+    <para arch="multilib">In this case, the output shoud be:</para>
+
+<screen arch="multilib"><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux-x32.so.2]</computeroutput></screen>
+
+    <para arch="default">Note that the dynamic linker will be
+    /tools/lib/ld-linux.so.2 for 32-bit machines.</para>
 
     <para>If the output is not shown as above or there was no output at all,
     then something is wrong. Investigate and retrace the steps to find out

+ 125 - 0
chapter05/glibc.xml

@@ -82,6 +82,13 @@ cd       build</userinput></screen>
         </listitem>
       </varlistentry>
 
+      <varlistentry arch="multilib">
+        <term><parameter>--enable-multi-arch</parameter></term>
+        <listitem>
+          <para>Enables glibc for multiarch environments.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><parameter>--with-headers=/tools/include</parameter></term>
         <listitem>
@@ -184,6 +191,124 @@ readelf -l a.out | grep ': /tools'</userinput></screen>
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Glibc 32-bit</title>
+
+    <para>Clean the build directory for redoing glibc for 32-bit:</para>
+<screen><userinput remap="pre">mkdir ../build32
+cd ../build32</userinput></screen>
+
+    <para>Rebuild glibc for 32-bit:</para>
+<screen><userinput remap="configure">echo slibdir=/tools/lib32 &gt; configparms
+BUILD_CC="gcc -m32"               \
+CC="${LFS_TGT}-gcc -m32"          \
+CXX="${LFS_TGT}-g++ -m32"         \
+AR="${LFS_TGT}-ar"                \
+RANLIB="${LFS_TGT}-ranlib"        \
+../configure --prefix=/tools                    \
+             --build=$(../scripts/config.guess) \
+             --host=${LFS_TGT32}                \
+             --enable-kernel=&min-kernel;             \
+             --enable-multi-arch                \
+             --libdir=/tools/lib32              \
+             --libexecdir=/tools/lib32          \
+             --with-headers=/tools/include      \
+             --with-binutils=/tools/bin         \
+             libc_cv_forced_unwind=yes          \
+             libc_cv_c_cleanup=yes</userinput></screen>
+
+    <para>Now compile the 32-bit version of glibc:</para>
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install 32-bit version of glibc:</para>
+<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
+install -vdm755 /tools/lib32
+cp -Rv DESTDIR/tools/lib32/* /tools/lib32
+install -vm644 DESTDIR/tools/include/gnu/{lib-names,stubs}-32.h \
+               /tools/include/gnu/
+ln -svf /tools/lib32/ld-linux.so.2 /tools/lib/
+cd ..</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Glibc x32-bit</title>
+
+    <para>Create a build directory for redoing glibc for x32-bit:</para>
+<screen><userinput remap="pre">mkdir build32x
+cd build32x</userinput></screen>
+
+    <para>Rebuild glibc for x32-bit:</para>
+<screen><userinput remap="configure">echo slibdir=/tools/libx32 &gt; configparms
+BUILD_CC="gcc -mx32"              \
+CC="${LFS_TGT}-gcc -mx32"         \
+CXX="${LFS_TGT}-g++ -mx32"        \
+AR="${LFS_TGT}-ar"                \
+RANLIB="${LFS_TGT}-ranlib"        \
+../configure --prefix=/tools                    \
+             --build=$(../scripts/config.guess) \
+             --host=${LFS_TGTX32}               \
+             --enable-kernel=&min-kernel;             \
+             --enable-multi-arch                \
+             --libdir=/tools/libx32             \
+             --libexecdir=/tools/libx32         \
+             --with-headers=/tools/include      \
+             --with-binutils=/tools/bin         \
+             libc_cv_forced_unwind=yes          \
+             libc_cv_c_cleanup=yes</userinput></screen>
+
+    <para>Now compile the x32-bit version of glibc:</para>
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install x32-bit version of glibc:</para>
+<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
+install -vdm755 /tools/libx32
+cp -Rv DESTDIR/tools/libx32/* /tools/libx32
+install -vm644 DESTDIR/tools/include/gnu/lib-names-x32.h \
+               /tools/include/gnu/
+[ -e DESTDIR/tools/include/gnu/stubs-x32.h ] \
+  &amp;&amp; install -vm644 DESTDIR/tools/include/gnu/stubs-x32.h /tools/include/gnu/ \
+  || ln -v /tools/include/gnu/stubs-64.h /tools/include/gnu/stubs-x32.h
+ln -svf /tools/libx32/ld-linux-x32.so.2 /tools/lib/</userinput></screen>
+<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
+just a "brute force" workaraound - by copying the stubs-64.h file. -->
+
+  <caution>
+    <para>At this point, it is imperative to stop and ensure that the basic
+    functions (compiling and linking) of the new toolchain are working as
+    expected. To perform a sanity check, run the following commands:</para>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc -m32 dummy.c
+readelf -l a.out | grep ': /tools'</userinput></screen>
+
+    <para>If everything is working correctly, there should be no errors,
+    and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
+
+    <para>Redo test for x32-ABI:</para>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc -mx32 dummy.c
+readelf -l a.out | grep ': /tools'</userinput></screen>
+
+    <para>Output should be like:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux-x32.so.2]</computeroutput></screen>
+
+    <para>If the output is not shown as above or there was no output at all,
+    then something is wrong. Investigate and retrace the steps to find out
+    where the problem is and correct it. This issue must be resolved before
+    continuing on.</para>
+
+    <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+  </caution>
+  </sect2>
+  
   <sect2 role="content">
     <title/>
 

+ 54 - 0
chapter05/ncurses.xml

@@ -112,6 +112,60 @@ ln -s libncursesw.so /tools/lib/libncurses.so</userinput></screen>
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Ncurses - 32 bit</title>
+
+    <para>Prepare Ncurses for compilation:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -m32"          \
+./configure --prefix=/tools       \
+            --libdir=/tools/lib32 \
+            --with-shared         \
+            --without-debug       \
+            --without-ada         \
+            --enable-widec        \
+            --enable-overwrite    \
+            --host="${LFS_TGT32}"</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
+cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Ncurses - x32 bit</title>
+
+    <para>Repeat for the x32-ABI:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -mx32"          \
+./configure --prefix=/tools        \
+            --libdir=/tools/libx32 \
+            --with-shared          \
+            --without-debug        \
+            --without-ada          \
+            --enable-widec         \
+            --enable-overwrite     \
+            --host="${LFS_TGTX32}"</userinput></screen>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
+cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
+
+  </sect2>
+
   <sect2 role="content">
     <title/>
 

+ 7 - 2
chapter05/stripping.xml

@@ -15,7 +15,10 @@
   The executables and libraries built so far contain about 70 MB of unneeded
   debugging symbols. Remove those symbols with:</para>
 
-<screen><userinput>strip --strip-debug /tools/lib/*
+<screen arch="default"><userinput>strip --strip-debug /tools/lib/*
+/usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
+
+<screen arch="multilib"><userinput>strip --strip-debug /tools/lib{,{,x}32}/*
 /usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
 
   <para>These commands will skip a number of files, reporting that it does not
@@ -33,7 +36,9 @@
 
   <para>Remove unneeded files:</para>
 
-<screen><userinput>find /tools/{lib,libexec} -name \*.la -delete</userinput></screen>
+<screen arch="default"><userinput>find /tools/{lib,libexec} -name \*.la -delete</userinput></screen>
+
+<screen arch="multilib"><userinput>find /tools/{lib{,{,x}32},libexec} -name \*.la -delete</userinput></screen>
 
   <para>At this point, you should have at least 3 GB of free space in
   <envar>$LFS</envar> that can be used to build and install Glibc and Gcc in

+ 56 - 0
chapter05/util-linux.xml

@@ -121,4 +121,60 @@
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Util-Linux - 32 bit</title>
+
+    <para>Prepare Util-Linux for compilation:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -m32"           \
+./configure                        \
+    --prefix=/tools                \
+    --libdir=/tools/lib32          \
+    --without-python               \
+    --disable-makeinstall-chown    \
+    --without-systemdsystemunitdir \
+    --without-ncurses              \
+    --host="${LFS_TGT32}"          \
+    PKG_CONFIG=""</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
+cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Util-Linux - x32 bit</title>
+
+    <para>Repeat for the x32-ABI:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -mx32"          \
+./configure                        \
+    --prefix=/tools                \
+    --libdir=/tools/libx32         \
+    --without-python               \
+    --disable-makeinstall-chown    \
+    --without-systemdsystemunitdir \
+    --without-ncurses              \
+    --host="${LFS_TGTX32}"         \
+    PKG_CONFIG=""</userinput></screen>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
+cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
+
+  </sect2>
+
 </sect1>

+ 46 - 0
chapter05/xz.xml

@@ -63,6 +63,52 @@
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Xz - 32 bit</title>
+
+    <para>Prepare Xz for compilation:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -m32"  \
+./configure               \
+    --prefix=/tools       \
+    --libdir=/tools/lib32 \
+    --host="${LFS_TGT32}"</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
+cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Xz - x32 bit</title>
+
+    <para>Repeat for the x32-ABI:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -mx32"   \
+./configure                 \
+     --prefix=/tools        \
+     --libdir=/tools/libx32 \
+     --host="${LFS_TGTX32}"</userinput></screen>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
+cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
+
+  </sect2>
+
   <sect2 role="content">
     <title/>
 

+ 101 - 0
chapter05/zlib.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 arch="multilib" id="ch-tools-zlib" role="wrap">
+  <?dbhtml filename="zlib.html"?>
+
+  <sect1info condition="script">
+    <productname>zlib</productname>
+    <productnumber>&zlib-version;</productnumber>
+    <address>&zlib-url;</address>
+  </sect1info>
+
+  <title>Zlib-&zlib-version;</title>
+
+  <indexterm zone="ch-tools-zlib">
+    <primary sortas="a-Zlib">Zlib</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The Zlib package contains compression and decompression routines used by
+    some programs.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&zlib-ch6-sbu;</seg>
+        <seg>&zlib-ch6-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Zlib</title>
+
+    <para>Prepare Zlib for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Zlib - 32 bit</title>
+
+    <para>Prepare Zlib for compilation:</para>
+
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -m32" ./configure --prefix=/tools --libdir=/tools/lib32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
+cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Zlib - x32 bit</title>
+
+    <para>Repeat for the x32-ABI:</para>
+    
+<screen><userinput remap="configure">make distclean &amp;&amp;
+CC="${LFS_TGT}-gcc -mx32" ./configure --prefix=/tools --libdir=/tools/libx32</userinput></screen>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
+cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
+
+  </sect2>
+
+</sect1>
+

+ 52 - 0
chapter06/acl.xml

@@ -79,6 +79,58 @@ ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so</userinput><
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Acl - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Acl for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure              \
+    --prefix=/usr --libdir=/usr/lib32  \
+    --disable-static --libexecdir=/usr/lib32 \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Acl - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Acl for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" ./configure                    \
+    --prefix=/usr --libdir=/usr/libx32        \
+    --disable-static --libexecdir=/usr/libx32 \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-acl" role="content">
     <title>Contents of Acl</title>
 

+ 55 - 0
chapter06/attr.xml

@@ -78,6 +78,61 @@ ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so</userinput
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Attr - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Attr for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure \
+    --prefix=/usr         \
+    --disable-static      \
+    --libdir=/usr/lib32   \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Attr - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Attr for compilation:</para>
+
+<screen><userinput remap="configure">
+CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --disable-static       \
+    --libdir=/usr/libx32   \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-attr" role="content">
     <title>Contents of Attr</title>
 

+ 48 - 0
chapter06/bzip2.xml

@@ -97,6 +97,54 @@ ln -sv bzip2 /bin/bzcat</userinput></screen>
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Bzip2 - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make clean</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">sed -e "s/^CC=.*/CC=gcc -m32/" \
+    -i Makefile{,-libbz2_so}
+make -f Makefile-libbz2_so
+make libbz2.a</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">install -Dm755 libbz2.so.1.0.6 /usr/lib32/libbz2.so.1.0.6
+ln -sf libbz2.so.1.0.6 /usr/lib32/libbz2.so
+ln -sf libbz2.so.1.0.6 /usr/lib32/libbz2.so.1
+ln -sf libbz2.so.1.0.6 /usr/lib32/libbz2.so.1.0
+install -Dm644 libbz2.a /usr/lib32/libbz2.a</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Bzip2 - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make clean</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">sed -e "s/^CC=.*/CC=gcc -mx32/" \
+    -i Makefile{,-libbz2_so}
+make -f Makefile-libbz2_so
+make libbz2.a</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">install -Dm755 libbz2.so.1.0.6 /usr/libx32/libbz2.so.1.0.6
+ln -sf libbz2.so.1.0.6 /usr/libx32/libbz2.so
+ln -sf libbz2.so.1.0.6 /usr/libx32/libbz2.so.1
+ln -sf libbz2.so.1.0.6 /usr/libx32/libbz2.so.1.0
+install -Dm644 libbz2.a /usr/libx32/libbz2.a</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-bzip2" role="content">
     <title>Contents of Bzip2</title>
 

+ 7 - 2
chapter06/chapter06.xml

@@ -21,6 +21,10 @@
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="man-pages.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="adjusting.xml"/>
+
+  <!-- arch="multilib" only -->
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc-32.xml"/>
+
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zlib.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="readline.xml"/>
@@ -30,6 +34,7 @@
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gmp.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpfr.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpc.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="isl.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="shadow.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bzip2.xml"/>
@@ -82,12 +87,11 @@
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tar.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="vim.xml"/>
-
   <!-- systemd only -->
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dbus.xml"/>
 
-  <!-- these packages libsystemd on systemd builds -->
+  <!-- these programs will use libsystemd if available -->
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="procps.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="e2fsprogs.xml"/>
@@ -97,6 +101,7 @@
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysvinit.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="eudev.xml"/>
 
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="linux-firmware.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutdebug.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="strippingagain.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="revisedchroot.xml"/>

+ 12 - 1
chapter06/createfiles.xml

@@ -39,13 +39,24 @@
   will be replaced by real files throughout the course of this chapter after the
   software has been installed:</para>
 
-<screen><userinput>ln -sv /tools/bin/{bash,cat,chmod,dd,echo,ln,mkdir,pwd,rm,stty,touch} /bin
+<screen arch="default"><userinput>ln -sv /tools/bin/{bash,cat,chmod,dd,echo,ln,mkdir,pwd,rm,stty,touch} /bin
 ln -sv /tools/bin/{env,install,perl,printf}         /usr/bin
 ln -sv /tools/lib/libgcc_s.so{,.1}                  /usr/lib
 ln -sv /tools/lib/libstdc++.{a,so{,.6}}             /usr/lib
 
 install -vdm755 /usr/lib/pkgconfig
 
+ln -sv bash /bin/sh</userinput></screen>
+<screen arch="multilib"><userinput>ln -sv /tools/bin/{bash,cat,chmod,dd,echo,ln,mkdir,pwd,rm,stty,touch} /bin
+ln -sv /tools/bin/{env,install,perl,printf}         /usr/bin
+for lib in lib{,32,x32}; do
+  ln -sv /tools/$lib/libgcc_s.so{,.1}               /usr/$lib
+  ln -sv /tools/$lib/libstdc++.{a,so{,.6}}          /usr/$lib
+done
+ln -sv /usr/libx32 /
+
+install -vdm755 /usr/lib{,32,x32}/pkgconfig
+
 ln -sv bash /bin/sh</userinput></screen>
 
 <!--for lib in blkid lzma mount uuid

+ 16 - 1
chapter06/creatingdirs.xml

@@ -13,7 +13,7 @@
   <para>It is time to create some structure in the LFS file system. Create a
   standard directory tree by issuing the following commands:</para>
 
-<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
+<screen arch="default"><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
 mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
 install -dv -m 0750 /root
 install -dv -m 1777 /tmp /var/tmp
@@ -31,6 +31,21 @@ mkdir -v /var/{log,mail,spool}
 ln -sv /run /var/run
 ln -sv /run/lock /var/lock
 mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
+<screen arch="multilib"><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig,ld.so.conf.d},home,lib/firmware,mnt,opt}
+mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
+install -dv -m 0750 /root
+install -dv -m 1777 /tmp /var/tmp
+mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
+mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
+mkdir -v  /usr/{,local/}share/{misc,terminfo,zoneinfo}
+mkdir -v  /usr/libexec
+mkdir -pv /usr/{,local/}share/man/man{1..8}
+mkdir -v /lib64
+mkdir -v /var/{log,mail,spool}
+ln -sv /run /var/run
+ln -sv /run/lock /var/lock
+mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}
+mkdir -pv /usr/lib{,x}32</userinput></screen>
 
   <para>Directories are, by default, created with permission mode 755, but
   this is not desirable for all directories. In the commands above, two

+ 73 - 0
chapter06/eudev.xml

@@ -104,6 +104,79 @@ make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen>
 
   </sect2>
 
+  <!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
+  
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Eudev - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Eudev for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" \
+./configure --host=i686-pc-linux-gnu     \
+            --prefix=/usr                \
+            --bindir=/sbin               \
+            --sbindir=/sbin              \
+            --libdir=/usr/lib32          \
+            --sysconfdir=/etc            \
+            --libexecdir=/lib32          \
+            --with-rootprefix=           \
+            --with-rootlibdir=/usr/lib32 \
+            --disable-manpages           \
+            --disable-static             \
+            --config-cache</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+  
+  <!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
+  
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Eudev - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Eudev for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" \
+./configure --prefix=/usr                 \
+            --bindir=/sbin                \
+            --sbindir=/sbin               \
+            --libdir=/usr/libx32          \
+            --sysconfdir=/etc             \
+            --libexecdir=/libx32          \
+            --with-rootprefix=            \
+            --with-rootlibdir=/usr/libx32 \
+            --disable-manpages            \
+            --disable-static              \
+            --config-cache</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+  
   <sect2 id="conf-eudev" role="configuration">
     <title>Configuring Eudev</title>
 

+ 56 - 0
chapter06/expat.xml

@@ -69,6 +69,62 @@
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Expat - 32-bit</title>
+
+    <para>Clean previous build but keep precompiled doc because it
+    cannot be rebuilt in this stage of the system:</para>
+
+<screen><userinput remap="pre">sed -e "/^am__append_1/ s/doc//" -i Makefile
+make clean</userinput></screen>
+
+    <para>Prepare Expat for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure \
+    --prefix=/usr         \
+    --libdir=/usr/lib32   \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Zlib - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">sed -e "/^am__append_1/ s/doc//" -i Makefile
+make clean</userinput></screen>
+
+    <para>Prepare Expat for compilation:</para>
+
+<screen><userinput remap="configure">
+CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --libdir=/usr/libx32   \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-expat" role="content">
     <title>Contents of Expat</title>
 

+ 52 - 0
chapter06/file.xml

@@ -59,6 +59,58 @@
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of File - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare File for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure \
+    --prefix=/usr         \
+    --libdir=/usr/lib32   \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of File - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare File for compilation:</para>
+
+<screen><userinput remap="configure">
+CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --libdir=/usr/libx32   \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
 
   <sect2 id="contents-file" role="content">
     <title>Contents of File</title>

+ 36 - 8
chapter06/gcc.xml

@@ -41,21 +41,41 @@
   <sect2 role="installation">
     <title>Installation of GCC</title>
 
-    <para>If building on x86_64, change the default directory name for 64-bit
-    libraries to <quote>lib</quote>:</para>
+    <para arch="default">If building on x86_64, change the default directory
+    name for 64-bit libraries to <quote>lib</quote>:</para>
 
-<screen><userinput remap="pre">case $(uname -m) in
+<screen arch="default"><userinput remap="pre">case $(uname -m) in
   x86_64)
     sed -e '/m64=/s/lib64/lib/' \
         -i.orig gcc/config/i386/t-linux64
   ;;
 esac</userinput></screen>
 
+    <para arch="multilib">Change the default directory name for 64-bit
+    libraries to <quote>lib</quote>:</para>
+
+<screen arch="multilib"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
+    -i.orig gcc/config/i386/t-linux64
+cat &gt; gcc/config/i386/t-linux64 &lt;&lt;"EOF"
+comma=,
+MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
+MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-linux-gnu)
+MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+EOF</userinput></screen>
+
     <para>Remove the symlink created earlier as the final gcc includes will be
     installed here:</para>
 
 <screen><userinput remap="pre">rm -f /usr/lib/gcc</userinput></screen>
 
+    <!-- Following patch might be obsolete with gcc >= 8.2.1 --> 
+    <para>Fix an issue with isl-&isl-version;:</para>
+
+<screen><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
+    -i gcc/graphite.h</userinput></screen>
+
     <para>The GCC documentation recommends building GCC in a dedicated build directory:</para>
 
 <screen><userinput remap="pre">mkdir -v build
@@ -63,7 +83,7 @@ cd       build</userinput></screen>
 
     <para>Prepare GCC for compilation:</para>
 
-<screen><userinput remap="configure">SED=sed                               \
+<screen arch="default"><userinput remap="configure">SED=sed                               \
 ../configure --prefix=/usr            \
              --enable-languages=c,c++ \
              --disable-multilib       \
@@ -71,6 +91,14 @@ cd       build</userinput></screen>
              --disable-libmpx         \
              --with-system-zlib</userinput></screen>
 
+<screen arch="multilib"><userinput remap="configure">SED=sed                               \
+../configure --prefix=/usr                     \
+             --enable-languages=c,c++          \
+             --enable-multilib                 \
+             --with-multilib-list=m32,m64,mx32 \
+             --disable-bootstrap               \
+             --with-system-zlib</userinput></screen>
+
     <para>Note that for other languages, there are some prerequisites that
     are not yet available. See the
     <ulink url="&blfs-book;general/gcc.html">BLFS Book</ulink>
@@ -265,10 +293,10 @@ SEARCH_DIR("/usr/local/lib")
 SEARCH_DIR("/lib")
 SEARCH_DIR("/usr/lib");</computeroutput></screen>
 
-   <para>A 32-bit system may see a few different directories. For example, here
-   is the output from an i686 machine:</para>
+   <para arch="default">A 32-bit system may see a few different directories.
+   For example, here is the output from an i686 machine:</para>
 
-<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
+<screen arch="default"><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
 SEARCH_DIR("/usr/local/lib32")
 SEARCH_DIR("/lib32")
 SEARCH_DIR("/usr/lib32")
@@ -324,7 +352,7 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
     <para>Finally, move a misplaced file:</para>
 
 <screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
-mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
+mv -v /usr/lib/libstdc++*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
 
   </sect2>
 

+ 158 - 0
chapter06/glibc-32.xml

@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 arch="multilib" id="ch-system-glibc-32" role="wrap">
+  <?dbhtml filename="glibc-32.html"?>
+
+  <sect1info condition="script">
+    <productname>glibc-32</productname>
+    <productnumber>&glibc-version;</productnumber>
+    <address>&glibc-url;</address>
+  </sect1info>
+
+  <title>Glibc-&glibc-version; - 32-bit</title>
+
+  <indexterm zone="ch-system-glibc-32">
+    <primary sortas="a-Glibc-32">Glibc-32</primary>
+  </indexterm>
+<!--
+  <sect2 role="package">
+    <title/>
+
+    <para>The Glibc package contains the main C library. This library provides
+    the basic routines for allocating memory, searching directories, opening and
+    closing files, reading and writing files, string handling, pattern matching,
+    arithmetic, and so on.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&glibc-ch6-sbu;</seg>
+        <seg>&glibc-ch6-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+-->
+  <sect2 role="installation">
+    <title>Installation of Glibc - 32-bit</title>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
+
+    <para>Remove a file that may be left over from a previous build attempt:</para>
+
+<screen><userinput remap="pre">mv /usr/include/limits.h{,.backup} </userinput></screen>
+
+    <para>The Glibc documentation recommends building Glibc 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+    <para>Prepare Glibc for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
+CXX="g++ -m32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
+../configure --prefix=/usr                          \
+             --disable-werror                       \
+             --enable-kernel=&min-kernel;                    \
+             --enable-stack-protector=strong        \
+             --enable-multi-arch                    \
+             --libdir=/usr/lib32                    \
+             --libexecdir=/usr/lib32                \
+             --with-headers=/usr/include            \
+             libc_cv_slibdir=/usr/lib32             \
+             i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
+make install_root=$PWD/DESTDIR install
+mv -v DESTDIR/usr/lib32/* /usr/lib32/
+install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
+               /usr/include/gnu/
+ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2
+ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-lsb.so.3
+ln -svf ../lib/locale /usr/lib32/locale</userinput></screen>
+
+    <para>Configure the linker cache configuration:</para>
+
+<screen><userinput>echo "/usr/lib32" > /etc/ld.so.conf.d/lib32.conf
+ldconfig</userinput></screen>
+
+    <para>Do cleanup:</para>
+
+<screen><userinput>cd ..
+rm -rf build</userinput></screen>
+
+  </sect2>
+
+  <sect2>
+    <title>Glibc - x32-bit</title>
+
+    <para>The Glibc documentation recommends building Glibc 
+    in a dedicated build directory:</para>
+
+<screen><userinput remap="pre">mkdir -v build
+cd       build</userinput></screen>
+
+      <para>Prepare Glibc for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
+CXX="g++ -mx32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
+../configure --prefix=/usr                          \
+             --disable-werror                       \
+             --enable-kernel=&min-kernel;                    \
+             --enable-stack-protector=strong        \
+             --enable-multi-arch                    \
+             --libdir=/usr/libx32                   \
+             --with-headers=/usr/include            \
+             libc_cv_slibdir=/usr/libx32            \
+             x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
+make install_root=$PWD/DESTDIR install
+mv -v DESTDIR/usr/libx32/* /usr/libx32/
+install -vm644 DESTDIR/usr/include/gnu/lib-names-x32.h /usr/include/gnu/
+[ -e DESTDIR/usr/include/gnu/stubs-x32.h ] \
+  &amp;&amp; install -vm644 DESTDIR/usr/include/gnu/stubs-x32.h /usr/include/gnu/ \
+  || ln -v /usr/include/gnu/stubs-64.h /usr/include/gnu/stubs-x32.h
+ln -svf ../usr/libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2
+ln -svf ../lib/locale /usr/libx32/locale</userinput></screen>
+<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
+just a "brute force" workaraound by copying the stubs-64.h file. -->
+
+    <para>Configure the linker cache configuration:</para>
+
+<screen><userinput>echo "/usr/libx32" > /etc/ld.so.conf.d/libx32.conf
+ldconfig</userinput></screen>
+
+    <para>Do cleanup:</para>
+
+<screen><userinput>cd ..
+rm -rf build</userinput></screen>
+
+    <para>Restore the file we moved temporarily away:</para>
+
+<screen><userinput remap="pre">mv /usr/include/limits.h{.backup,} </userinput></screen>
+
+  </sect2>
+
+</sect1>
+

+ 1 - 0
chapter06/glibc.xml

@@ -96,6 +96,7 @@ cd       build</userinput></screen>
              --disable-werror                       \
              --enable-kernel=&min-kernel;                    \
              --enable-stack-protector=strong        \
+             --with-headers=/usr/include            \
              libc_cv_slibdir=/lib</userinput></screen>
 
    <variablelist>

+ 104 - 0
chapter06/gmp.xml

@@ -120,6 +120,110 @@ make install-html</userinput></screen>
 
   </sect2>
 
+  <!-- ~~~~~ m32 ~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of GMP - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Generic libraries can be created by running
+    the following:</para>
+
+<screen><userinput>cp -v configfsf.guess config.guess
+cp -v configfsf.sub   config.sub</userinput></screen>
+
+    <para>Prepare GMP for compilation:</para>
+
+<screen><userinput remap="configure">ABI="32" \
+CC="gcc -m32"  \
+CXX="g++ -m32" \
+./configure             \
+    --prefix=/usr       \
+    --disable-static    \
+    --enable-cxx        \
+    --libdir=/usr/lib32 \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <important>
+      <para>The test suite for GMP in this section is considered critical.
+      Do not skip it under any circumstances.</para>
+    </important>
+
+    <para>Test the results:</para>
+
+<screen><userinput remap="test">make check 2>&amp;1 | tee gmp-check-log</userinput></screen>
+ 
+    <para>Ensure that all 190 tests in the test suite passed.
+    Check the results by issuing the following command:</para>
+
+<screen><userinput remap="test">awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+  
+  <!-- ~~~~~ m32 ~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of GMP - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Generic libraries can be created by running
+    the following:</para>
+
+<screen><userinput>cp -v configfsf.guess config.guess
+cp -v configfsf.sub   config.sub</userinput></screen>
+
+    <para>Prepare GMP for compilation:</para>
+
+<screen><userinput remap="configure">ABI="x32" \
+CC="gcc -mx32"  \
+CXX="g++ -mx32" \
+./configure              \
+    --prefix=/usr        \
+    --disable-static     \
+    --enable-cxx         \
+    --libdir=/usr/libx32 \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <important>
+      <para>The test suite for GMP in this section is considered critical.
+      Do not skip it under any circumstances.</para>
+    </important>
+
+    <para>Test the results:</para>
+
+<screen><userinput remap="test">make check 2>&amp;1 | tee gmp-check-log</userinput></screen>
+ 
+    <para>Ensure that all 190 tests in the test suite passed.
+    Check the results by issuing the following command:</para>
+
+<screen><userinput remap="test">awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+  
   <sect2 id="contents-gmp" role="content">
     <title>Contents of GMP</title>
 

+ 113 - 0
chapter06/isl.xml

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-isl" role="wrap">
+  <?dbhtml filename="isl.html"?>
+
+  <sect1info condition="script">
+    <productname>isl</productname>
+    <productnumber>&isl-version;</productnumber>
+    <address>&isl-url;</address>
+  </sect1info>
+
+  <title>ISL-&isl-version;</title>
+
+  <indexterm zone="ch-system-isl">
+    <primary sortas="a-ISL">ISL</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>ISL is a thread-safe C library for manipulating sets and relations
+    of integer points bounded by affine constraints.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&isl-ch6-sbu;</seg>
+        <seg>&isl-ch6-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of ISL</title>
+
+    <para>Prepare ISL for compilation:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr    \
+            --disable-static \
+            --docdir=/usr/share/doc/isl-&isl-version;</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--docdir=/usr/share/doc/isl-&isl-version;</parameter></term>
+        <listitem>
+          <para>This variable specifies the correct place for the
+          documentation.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package and its documentation:</para>
+
+<screen><userinput remap="install">make install
+install -vd /usr/share/doc/isl-&isl-version;
+install -m644 doc/{CodingStyle,manual.pdf,SubmittingPatches,user.pod} \
+        /usr/share/doc/isl-&isl-version;</userinput></screen>
+
+    <para>Finally, move a misplaced file:</para>
+
+<screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
+mv -v /usr/lib/libisl*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
+
+  </sect2>
+
+  <sect2 id="contents-isl" role="content">
+    <title>Contents of ISL</title>
+
+    <segmentedlist>
+      <segtitle>Installed Libraries</segtitle>
+      <segtitle>Installed directory</segtitle>
+
+      <seglistitem>
+        <seg>libisl.so</seg>
+        <seg>/usr/share/doc/isl-&isl-version;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="libisl">
+        <term><filename class="libraryfile">libisl</filename></term>
+        <listitem>
+          <para>Contains integer set manipulation functions</para>
+          <indexterm zone="ch-system-isl libisl">
+            <primary sortas="c-libisl">libisl</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
+  </sect2>
+
+</sect1>
+

+ 64 - 0
chapter06/kmod.xml

@@ -97,6 +97,70 @@ ln -sfv kmod /bin/lsmod</userinput></screen>
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Kmod - 32-bit</title>
+
+    <para>Clean previous build but keep man pages as they cannot be recreated
+    since xsltproc isn't installed yet:</para>
+
+<screen><userinput>sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile
+make clean</userinput></screen>
+
+    <para>Prepare Kmod for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure    \
+    --prefix=/usr            \
+    --bindir=/bin            \
+    --libdir=/usr/lib32      \
+    --sysconfdir=/etc        \
+    --with-xz --with-zlib    \
+    --host=i686-pc-linux-gnu \
+    --with-rootlibdir=/usr/lib32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+<sect2 arch="multilib" role="installation">
+    <title>Installation of Kmod - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput>sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile
+make clean</userinput></screen>
+
+    <para>Prepare Kmod for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" ./configure        \
+    --prefix=/usr                 \
+    --bindir=/bin                 \
+    --libdir=/usr/libx32          \
+    --sysconfdir=/etc             \
+    --with-xz                     \
+    --with-zlib                   \
+    --host=x86_64-pc-linux-gnux32 \
+    --with-rootlibdir=/usr/libx32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-kmod" role="content">
     <title>Contents of Kmod</title>
 

+ 38 - 0
chapter06/libcap.xml

@@ -92,6 +92,44 @@ ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so</userinput><
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libcap - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make CC="gcc -m32 -march=i686"</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make lib=lib32 prefix=$PWD/DESTDIR/usr -C libcap install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libcap - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make CC="gcc -mx32"</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make lib=libx32 prefix=$PWD/DESTDIR/usr -C libcap install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-libcap" role="content">
     <title>Contents of Libcap</title>
 

+ 54 - 0
chapter06/libelf.xml

@@ -63,6 +63,60 @@ install -vm644 config/libelf.pc /usr/lib/pkgconfig</userinput></screen>
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libelf - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Libelf for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure \
+    --prefix=/usr         \
+    --libdir=/usr/lib32   \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR -C libelf install
+install -vDm644 config/libelf.pc DESTDIR/usr/lib32/pkgconfig/libelf.pc
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libelf - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Libelf for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --libdir=/usr/libx32   \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR -C libelf install
+install -vDm644 config/libelf.pc DESTDIR/usr/libx32/pkgconfig/libelf.pc
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-elfutils" role="content">
     <title>Contents of Libelf</title>
 

+ 68 - 0
chapter06/libffi.xml

@@ -98,6 +98,74 @@ sed -e '/^includedir/ s/=.*$/=@includedir@/' \
 
   </sect2>
 
+  <!-- ~~~~~ m32 ~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libffi - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Libffi for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \
+./configure                  \
+    --prefix=/usr            \
+    --disable-static         \
+    --libdir=/usr/lib32      \
+    --with-gcc-arch=i686     \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <!-- ~~~~~ mx32 ~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libffi - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Libffi for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \
+./configure                    \
+    --prefix=/usr              \
+    --disable-static           \
+    --with-gcc-arch=x86_64     \
+    --libdir=/usr/libx32       \
+    --host=x86_64-unknown-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>To test the results, issue:</para>
+
+<screen><userinput remap="test">make check</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-libffi" role="content">
     <title>Contents of Libffi</title>
 

+ 54 - 0
chapter06/libtool.xml

@@ -71,6 +71,60 @@
   </sect2>
 
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libtool - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Libtool for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure \
+    --prefix=/usr         \
+    --libdir=/usr/lib32   \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Libtool - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Libtool for compilation:</para>
+
+<screen><userinput remap="configure">
+CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --libdir=/usr/libx32   \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+
   <sect2 id="contents-libtool" role="content">
     <title>Contents of Libtool</title>
 

+ 50 - 0
chapter06/linux-firmware.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-linux-firmware" role="wrap">
+  <?dbhtml filename="linux-firmware.html"?>
+
+  <sect1info condition="script">
+    <productname>linux-firmware</productname>
+    <productnumber>&linux-firmware-version;</productnumber>
+    <address>&linux-firmware-url;</address>
+  </sect1info>
+
+  <title>Linux-Firmware-&linux-firmware-version;</title>
+
+  <indexterm zone="ch-system-linux-firmware">
+    <primary sortas="a-Linux-Firmware">Linux-Firmware</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>The Linux-Firmware package contains propietary kernel "blobs"
+    required for some specific hardware.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&linux-firmware-ch6-sbu;</seg>
+        <seg>&linux-firmware-ch6-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Linux-Firmware</title>
+
+    <para>Install the Linux-Firmware package with the following commands:</para>
+
+<screen><userinput remap="install">cp -Rv * /lib/firmware</userinput></screen>
+
+  </sect2>
+
+</sect1>

+ 132 - 3
chapter06/ncurses.xml

@@ -47,13 +47,21 @@
 
     <para>Prepare Ncurses for compilation:</para>
 
-<screen><userinput remap="configure">./configure --prefix=/usr           \
+<screen arch="default"><userinput remap="configure">./configure --prefix=/usr           \
             --mandir=/usr/share/man \
             --with-shared           \
             --without-debug         \
             --without-normal        \
             --enable-pc-files       \
             --enable-widec</userinput></screen>
+<screen arch="multilib"><userinput remap="configure">./configure --prefix=/usr           \
+            --mandir=/usr/share/man \
+            --with-shared           \
+            --without-debug         \
+            --without-normal        \
+            --enable-pc-files       \
+            --enable-widec          \
+            --with-pkg-config-libdir=/usr/lib/pkgconfig</userinput></screen>
 
     <variablelist>
       <title>The meaning of the new configure options:</title>
@@ -88,6 +96,15 @@
         </listitem>
       </varlistentry>
 
+      <varlistentry arch="multilib">
+        <term><parameter>--with-pkg-config-libdir=/usr/lib/pkgconfig</parameter></term>
+        <listitem>
+          <para>This switch forces .pc to be installed in /usr/lib/pkgconfig. If
+           not set, .pc files gets installed in /usr/lib32 even for 64bit binaries.
+          </para>
+        </listitem>
+      </varlistentry>
+
     </variablelist>
 
     <para>Compile the package:</para>
@@ -139,7 +156,6 @@ ln -sfv libncurses.so      /usr/lib/libcurses.so</userinput></screen>
 cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen>
 
     <note>
-
       <para>The instructions above don't create non-wide-character Ncurses
       libraries since no package installed by compiling from sources would link
       against them at runtime. However, the only known binary-only
@@ -148,7 +164,7 @@ cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen>
       application or to be compliant with LSB, build the package again with the
       following commands:</para>
 
-<screen role="nodump"><userinput>make distclean
+<screen><userinput remap="install">make distclean
 ./configure --prefix=/usr    \
             --with-shared    \
             --without-normal \
@@ -157,10 +173,123 @@ cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen>
             --with-abi-version=5 
 make sources libs
 cp -av lib/lib*.so.5* /usr/lib</userinput></screen>
+
     </note>
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Ncurses - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+        <para>Prepare Ncurses for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32"  \
+    ./configure --prefix=/usr \
+    --libdir=/usr/lib32       \
+    --mandir=/usr/share/man   \
+    --with-shared             \
+    --without-debug           \
+    --without-normal          \
+    --enable-pc-files         \
+    --enable-widec            \
+    --host=i686-pc-linux-gnu  \
+    --with-pkg-config-libdir=/usr/lib32/pkgconfig</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make -j1</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+for lib in ncurses form panel menu ; do
+    rm -vf                    DESTDIR/usr/lib32/lib${lib}.so
+    echo "INPUT(-l${lib}w)" > DESTDIR/usr/lib32/lib${lib}.so
+    ln -svf ${lib}w.pc        DESTDIR/usr/lib32/pkgconfig/$lib.pc
+done
+rm -vf                     DESTDIR/usr/lib32/libcursesw.so
+echo "INPUT(-lncursesw)" > DESTDIR/usr/lib32/libcursesw.so
+ln -sfv libncurses.so      DESTDIR/usr/lib32/libcurses.so
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+    <para>If desired, make the version 5 libraries in 32bit as well:</para>
+
+<screen><userinput remap="install">make distclean
+CC="gcc -m32" CXX="g++ -m32"  \
+    ./configure --prefix=/usr \
+    --with-shared             \
+    --without-normal          \
+    --without-debug           \
+    --without-cxx-binding     \
+    --with-abi-version=5      \
+    --host=i686-pc-linux-gnu
+make -j1 sources libs
+cp -av lib/lib*.so.5* /usr/lib32</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Ncurses - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+        <para>Prepare Ncurses for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32"    \
+    ./configure --prefix=/usr     \
+    --libdir=/usr/libx32          \
+    --mandir=/usr/share/man       \
+    --with-shared                 \
+    --without-debug               \
+    --without-normal              \
+    --enable-pc-files             \
+    --enable-widec                \
+    --host=x86_64-pc-linux-gnux32 \
+    --with-pkg-config-libdir=/usr/libx32/pkgconfig</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make -j1</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+for lib in ncurses form panel menu ; do
+    rm -vf                    DESTDIR/usr/libx32/lib${lib}.so
+    echo "INPUT(-l${lib}w)" > DESTDIR/usr/libx32/lib${lib}.so
+    ln -svf ${lib}w.pc        DESTDIR/usr/libx32/pkgconfig/$lib.pc
+done
+rm -vf                     DESTDIR/usr/libx32/libcursesw.so
+echo "INPUT(-lncursesw)" > DESTDIR/usr/libx32/libcursesw.so
+ln -sfv libncurses.so      DESTDIR/usr/libx32/libcurses.so
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+<!-- Any package out there which still needs version 5?
+     Leave it out for x32bit for now.
+
+    <para>If desired, make the version 5 libraries in x32bit as well:</para>
+
+<screen><userinput remap="install">make distclean
+CC="gcc -mx32" CXX="g++ -mx32"  \
+    ./configure - -prefix=/usr \
+    - -with-shared             \
+    - -without-normal          \
+    - -without-debug           \
+    - -without-cxx-binding     \
+    - -with-abi-version=5
+make -j1 sources libs
+cp -av lib/lib*.so.5* /usr/libx32</userinput></screen>
+-->
+  </sect2>
+
   <sect2 id="contents-ncurses" role="content">
     <title>Contents of Ncurses</title>
 

+ 64 - 0
chapter06/openssl.xml

@@ -74,6 +74,70 @@ cp -vfr doc/* /usr/share/doc/openssl-&openssl-version;</userinput></screen>
 
   </sect2>
 
+  <!-- ~~~~~ 32-bit ~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of OpenSSL - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare OpenSSL for compilation:</para>
+
+<screen><userinput remap="configure">MACHINE="i686"             \
+CC="gcc -m32 -march=i686"  \
+CXX="g++ -m32 -march=i686" \
+    ./config               \
+    --prefix=/usr          \
+    --libdir=/usr/lib32    \
+         --openssldir=/etc/ssl \
+         --libdir=lib32        \
+         shared                \
+         zlib-dynamic</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <!-- ~~~~~ x32-bit ~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of OpenSSL - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare OpenSSL for compilation:</para>
+
+<screen><userinput remap="configure">MACHINE="x86_64"          \
+CC="gcc -mx32"            \
+CXX="g++ -mx32"           \
+    ./config              \
+    --prefix=/usr         \
+    --libdir=/usr/libx32  \
+         --openssldir=/etc/ssl \
+         --libdir=libx32       \
+         shared                \
+         zlib-dynamic</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-openssl" role="content">
     <title>Contents of OpenSSL</title>
 

+ 54 - 0
chapter06/readline.xml

@@ -92,6 +92,60 @@ ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so</us
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Readline - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Readline for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32 -march=i686" ./configure \
+    --prefix=/usr                     \
+    --libdir=/usr/lib32               \
+    --disable-static                  \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Readline - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Readline for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --libdir=/usr/libx32   \
+    --disable-static       \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-readline" role="content">
     <title>Contents of Readline</title>
 

+ 3 - 1
chapter06/revisedchroot.xml

@@ -62,7 +62,9 @@ rm -f /usr/lib/libz.a</userinput></screen>
   files and generally unneeded on a linux system. None of these are necessary
   at this point. To remove them, run:</para>
 
-<screen><userinput>find /usr/lib /usr/libexec -name \*.la -delete</userinput></screen>
+<screen arch="default"><userinput>find /usr/lib /usr/libexec -name \*.la -delete</userinput></screen>
+
+<screen arch="multilib"><userinput>find /usr/lib{,{,x}32} /usr/libexec -name \*.la -delete</userinput></screen>
 
    <para>For more information about libtool archive files, see the <ulink
    url="&blfs-book;/introduction/la-files.html">BLFS section "About Libtool

+ 35 - 2
chapter06/strippingagain.xml

@@ -33,7 +33,7 @@
 <!-- also of interest are libgfortan, libgo, libgomp, and libobjc from gcc -->
 
 <!--<screen><userinput>save_lib="ld-2.25.so libc-2.25.so libpthread-2.25.so libthread_db-1.0.so"-->
-<screen><userinput>save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so"
+<screen arch="default"><userinput>save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so"
 
 cd /lib
 
@@ -54,6 +54,30 @@ for LIB in $save_usrlib; do
     objcopy --add-gnu-debuglink=$LIB.dbg $LIB
 done
 
+unset LIB save_lib save_usrlib</userinput></screen>
+
+<screen arch="multilib"><userinput>save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so"
+
+cd /lib
+
+for LIB in $save_lib; do
+    objcopy --only-keep-debug $LIB $LIB.dbg 
+    strip --strip-unneeded $LIB
+    objcopy --add-gnu-debuglink=$LIB.dbg $LIB 
+done    
+
+save_usrlib="libquadmath.so.&libquadmath-version; libstdc++.so.&libstdcpp-version;
+             libitm.so.&libitm-version; libatomic.so.&libatomic-version;" <!-- libcilkrts.so.&libcilkrts-version;-->
+
+for libdir in /usr/lib{,{,x}32}; do
+    cd $libdir
+    for LIB in $save_usrlib; do
+        objcopy --only-keep-debug $LIB $LIB.dbg
+        strip --strip-unneeded $LIB
+        objcopy --add-gnu-debuglink=$LIB.dbg $LIB
+    done
+done
+
 unset LIB save_lib save_usrlib</userinput></screen>
 
   <para>Before performing the stripping, take special care to ensure that
@@ -80,12 +104,21 @@ unset LIB save_lib save_usrlib</userinput></screen>
 
   <para>Now the binaries and libraries can be safely stripped:</para>
 
-<screen><userinput>/tools/bin/find /usr/lib -type f -name \*.a \
+<screen arch="default"><userinput>/tools/bin/find /usr/lib -type f -name \*.a \
    -exec /tools/bin/strip --strip-debug {} ';'
 
 /tools/bin/find /lib /usr/lib -type f \( -name \*.so* -a ! -name \*dbg \) \
    -exec /tools/bin/strip --strip-unneeded {} ';'
 
+/tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \
+    -exec /tools/bin/strip --strip-all {} ';'</userinput></screen>
+
+<screen arch="multilib"><userinput>/tools/bin/find /usr/lib{,{,x}32} -type f -name \*.a \
+   -exec /tools/bin/strip --strip-debug {} ';'
+
+/tools/bin/find /lib /usr/lib{,{,x}32} -type f \( -name \*.so* -a ! -name \*dbg \) \
+   -exec /tools/bin/strip --strip-unneeded {} ';'
+
 /tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \
     -exec /tools/bin/strip --strip-all {} ';'</userinput></screen>
 

+ 143 - 0
chapter06/systemd.xml

@@ -210,6 +210,149 @@ chmod 755 /lib/systemd/systemd-user-sessions</userinput></screen>
 
   </sect2>
 
+<!-- ====== 32-bit ===== -->
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of systemd - 32-bit</title>
+
+    <para>If still in the build directory, step out:</para>
+<screen><userinput remap="pre">cd ..</userinput></screen>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">rm -rf build</userinput></screen>
+
+    <para>Create a symlink to work around missing xsltproc:</para>
+
+<screen><userinput remap="pre">ln -sf /tools/bin/true /usr/bin/xsltproc</userinput></screen>
+
+    <para>Because we have not yet installed the final version of Util-Linux,
+    create links to the libraries in the approprite location:</para>
+
+<screen><userinput remap="pre">for file in /tools/lib32/lib{blkid,mount,uuid}*; do
+    ln -sf $file /usr/lib32/
+done</userinput></screen>
+
+    <para>Set up the man pages:</para>
+
+<screen><userinput remap="pre">tar -xf ../systemd-man-pages-&systemd-version;.tar.xz</userinput></screen>
+
+    <para>Prepare systemd for compilation:</para>
+
+    <screen><userinput remap="configure">cd build
+PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/tools/lib32/pkgconfig" \
+CC="gcc -m32 -march=i686"              \
+CXX="g++ -m32 -march=i686"             \
+LANG=en_US.UTF-8                       \
+meson --prefix=/usr                    \
+      --sysconfdir=/etc                \
+      --localstatedir=/var             \
+      -Dblkid=true                     \
+      -Dbuildtype=release              \
+      -Ddefault-dnssec=no              \
+      -Dfirstboot=false                \
+      -Dinstall-tests=false            \
+      -Dkill-path=/bin/kill            \
+      -Dkmod-path=/bin/kmod            \
+      -Dldconfig=false                 \
+      -Dmount-path=/bin/mount          \
+      -Drootprefix=                    \
+      -Drootlibdir=/usr/lib32          \
+      -Dsplit-usr=true                 \
+      -Dsulogin-path=/sbin/sulogin     \
+      -Dsysusers=false                 \
+      -Dumount-path=/bin/umount        \
+      -Db_lto=false                    \
+      ..</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">LANG=en_US.UTF-8 ninja</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">LANG=en_US.UTF-8 DESTDIR=$PWD/DESTDIR ninja install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR
+rm -f /usr/bin/xsltproc</userinput></screen>
+
+  </sect2>
+
+<!-- ====== x32-bit ===== -->
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of systemd - x32-bit</title>
+
+    <para>If still in the build directory, step out:</para>
+<screen><userinput remap="pre">cd ..</userinput></screen>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">rm -rf build</userinput></screen>
+
+    <para>Create a symlink to work around missing xsltproc:</para>
+
+<screen><userinput remap="pre">ln -sf /tools/bin/true /usr/bin/xsltproc</userinput></screen>
+
+    <para>Because we have not yet installed the final version of Util-Linux,
+    create links to the libraries in the approprite location:</para>
+
+<screen><userinput remap="pre">for file in /tools/libx32/lib{blkid,mount,uuid}*; do
+    ln -sf $file /usr/libx32/
+done</userinput></screen>
+
+    <para>Set up the man pages:</para>
+
+<screen><userinput remap="pre">tar -xf ../systemd-man-pages-&systemd-version;.tar.xz</userinput></screen>
+
+    <para>Fix an issue on x32:</para>
+
+<screen><userinput remap="pre">sed '/log_debug/s@PRI_TIMEX@PRIi64@' -i src/timesync/timesyncd-manager.c
+sed '/long drift_freq;/s@long @int64_t @' -i src/timesync/timesyncd-manager.h</userinput></screen>
+
+    <para>Prepare systemd for compilation:</para>
+
+<screen><userinput remap="configure">cd build
+PKG_CONFIG_PATH="/tools/libx32/pkgconfig:/usr/libx32/pkgconfig" \
+CC="gcc -mx32"                          \
+CXX="g++ -mx32"                         \
+CFLAGS+="-Wno-error=shift-overflow"     \
+CXXFLAGS+="-Wno-error=shift-overflow"   \
+LANG=en_US.UTF-8                        \
+meson --prefix=/usr                     \
+      --sysconfdir=/etc                 \
+      --localstatedir=/var              \
+      -Dblkid=true                      \
+      -Dbuildtype=release               \
+      -Ddefault-dnssec=no               \
+      -Dfirstboot=false                 \
+      -Dinstall-tests=false             \
+      -Dkill-path=/bin/kill             \
+      -Dkmod-path=/bin/kmod             \
+      -Dldconfig=false                  \
+      -Dmount-path=/bin/mount           \
+      -Drootprefix=                     \
+      -Drootlibdir=/usr/libx32          \
+      -Dsplit-usr=true                  \
+      -Dsulogin-path=/sbin/sulogin      \
+      -Dsysusers=false                  \
+      -Dumount-path=/bin/umount         \
+      -Db_lto=false                     \
+      ..</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">LANG=en_US.UTF-8 ninja</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">LANG=en_US.UTF-8 DESTDIR=$PWD/DESTDIR ninja install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR
+rm -f /usr/bin/xsltproc</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-systemd" role="content">
     <title>Contents of systemd</title>
 

+ 113 - 0
chapter06/util-linux.xml

@@ -52,6 +52,7 @@
 
   </sect2>
 
+  <!-- ~~~~~~~~~~~~~~~~~~~~~ default ABI ~~~~~~~~~~~~~~~~~~~~~ -->
   <sect2 role="installation">
     <title>Installation of Util-linux</title>
 <!--
@@ -121,6 +122,118 @@ su nobody -s /bin/bash -c "PATH=$PATH make -k check"</userinput></screen>
 
   </sect2>
 
+  <!-- ~~~~~~~~~~~~~~~~~~~~~ ABI 32-bit ~~~~~~~~~~~~~~~~~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Util-linux - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Util-linux for compilation:</para>
+
+<screen revision="sysv"><userinput remap="configure">CC="gcc -m32" \
+./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
+            --docdir=/usr/share/doc/util-linux-&util-linux-version; \
+            --disable-chfn-chsh      \
+            --disable-login          \
+            --disable-nologin        \
+            --disable-su             \
+            --disable-setpriv        \
+            --disable-runuser        \
+            --disable-pylibmount     \
+            --disable-static         \
+            --without-python         \
+            --without-systemd        \
+            --libdir=/usr/lib32      \
+            --host=i686-pc-linux-gnu \
+            --without-systemdsystemunitdir \
+            --enable-libmount-force-mountinfo</userinput></screen>
+
+<screen revision="systemd"><userinput remap="configure">CC="gcc -m32" \
+./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
+            --docdir=/usr/share/doc/util-linux-&util-linux-version; \
+            --disable-chfn-chsh      \
+            --disable-login          \
+            --disable-nologin        \
+            --disable-su             \
+            --disable-setpriv        \
+            --disable-runuser        \
+            --disable-pylibmount     \
+            --disable-static         \
+            --without-python         \
+            --libdir=/usr/lib32      \
+            --host=i686-pc-linux-gnu \
+            --enable-libmount-force-mountinfo</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~ ABI x32-bit ~~~~~~~~~~~~~~~~~~~~~ -->
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Util-linux - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Util-linux for compilation:</para>
+
+<screen revision="sysv"><userinput remap="configure">CC="gcc -mx32" \
+./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
+            --docdir=/usr/share/doc/util-linux-&util-linux-version; \
+            --disable-chfn-chsh  \
+            --disable-login      \
+            --disable-nologin    \
+            --disable-su         \
+            --disable-setpriv    \
+            --disable-runuser    \
+            --disable-pylibmount \
+            --disable-static     \
+            --without-python     \
+            --without-systemd    \
+            --without-systemdsystemunitdir \
+            --libdir=/usr/libx32  \
+            --host=x86_64-pc-linux-gnux32 \
+            --enable-libmount-force-mountinfo</userinput></screen>
+
+<screen revision="systemd"><userinput remap="configure">CC="gcc -mx32" \
+./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
+            --docdir=/usr/share/doc/util-linux-&util-linux-version; \
+            --disable-chfn-chsh  \
+            --disable-login      \
+            --disable-nologin    \
+            --disable-su         \
+            --disable-setpriv    \
+            --disable-runuser    \
+            --disable-pylibmount \
+            --disable-static     \
+            --without-python     \
+            --libdir=/usr/libx32 \
+            --host=x86_64-pc-linux-gnux32 \
+            --enable-libmount-force-mountinfo</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-utillinux" role="content">
     <title>Contents of Util-linux</title>
 

+ 55 - 0
chapter06/xz.xml

@@ -68,6 +68,61 @@ ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so</userinput
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Xz - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Xz for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -m32" ./configure \
+    --prefix=/usr         \
+    --disable-static      \
+    --libdir=/usr/lib32   \
+    --host=i686-pc-linux-gnu</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Xz - x32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Xz for compilation:</para>
+
+<screen><userinput remap="configure">
+CC="gcc -mx32" ./configure \
+    --prefix=/usr          \
+    --disable-static       \
+    --libdir=/usr/libx32   \
+    --host=x86_64-pc-linux-gnux32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-xz" role="content">
     <title>Contents of Xz</title>
 

+ 49 - 0
chapter06/zlib.xml

@@ -67,6 +67,55 @@ ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so</userinput></scr
 
   </sect2>
 
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Zlib - 32-bit</title>
+
+    <para>Clean previous build:</para>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Zlib for compilation:</para>
+
+<!-- configure doesn't know option - -host=i686-pc-linux-gnu --> 
+<screen><userinput remap="configure">CC="gcc -m32 -march=i686" \
+./configure --prefix=/usr \
+    --libdir=/usr/lib32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/lib32/* /usr/lib32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
+  <sect2 arch="multilib" role="installation">
+    <title>Installation of Zlib - x32-bit</title>
+
+<screen><userinput remap="pre">make distclean</userinput></screen>
+
+    <para>Prepare Zlib for compilation:</para>
+
+<screen><userinput remap="configure">CC="gcc -mx32" \
+./configure --prefix=/usr    \
+    --libdir=/usr/libx32</userinput></screen>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -Rv DESTDIR/usr/libx32/* /usr/libx32
+rm -rf DESTDIR</userinput></screen>
+
+  </sect2>
+
   <sect2 id="contents-zlib" role="content">
     <title>Contents of Zlib</title>
 

+ 28 - 2
chapter08/grub.xml

@@ -139,7 +139,7 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
 
     <para>Generate <filename>/boot/grub/grub.cfg</filename>:</para>
 
-    <screen revision="sysv"><userinput>cat &gt; /boot/grub/grub.cfg &lt;&lt; "EOF"
+    <screen arch="default" revision="sysv"><userinput>cat &gt; /boot/grub/grub.cfg &lt;&lt; "EOF"
 <literal># Begin /boot/grub/grub.cfg
 set default=0
 set timeout=5
@@ -152,7 +152,7 @@ menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" {
 }</literal>
 EOF</userinput></screen>
 
-    <screen revision="systemd"><userinput>cat &gt; /boot/grub/grub.cfg &lt;&lt; "EOF"
+    <screen arch="default" revision="systemd"><userinput>cat &gt; /boot/grub/grub.cfg &lt;&lt; "EOF"
 <literal># Begin /boot/grub/grub.cfg
 set default=0
 set timeout=5
@@ -165,6 +165,32 @@ menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;" {
 }</literal>
 EOF</userinput></screen>
 
+    <screen arch="multilib" revision="sysv"><userinput>cat &gt; /boot/grub/grub.cfg &lt;&lt; "EOF"
+<literal># Begin /boot/grub/grub.cfg
+set default=0
+set timeout=5
+
+insmod ext2
+set root=(hd0,2)
+
+menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;-multilib" {
+        linux   /boot/vmlinuz-&linux-version;-lfs-&version;-multilib root=/dev/sda2 ro
+}</literal>
+EOF</userinput></screen>
+
+    <screen arch="multilib" revision="systemd"><userinput>cat &gt; /boot/grub/grub.cfg &lt;&lt; "EOF"
+<literal># Begin /boot/grub/grub.cfg
+set default=0
+set timeout=5
+
+insmod ext2
+set root=(hd0,2)
+
+menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;-multilib" {
+        linux   /boot/vmlinuz-&linux-version;-lfs-&versiond;-multilib root=/dev/sda2 ro
+}</literal>
+EOF</userinput></screen>
+
 
     <note><para>From <application>GRUB</application>'s perspective, the
     kernel files are relative to the partition used.  If you

+ 11 - 4
chapter08/kernel.xml

@@ -235,9 +235,14 @@ Kernel hacking  ---&gt;
     the automatic setup of the boot process described in the next section.  The
     following command assumes an x86 architecture:</para>
 
-<screen revision="sysv"><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version;</userinput></screen>
+<screen arch="default" revision="sysv"><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version;</userinput></screen>
+
+<screen arch="multilib" revision="sysv"><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version;-multilib</userinput></screen>
+
+<screen arch="default" revision="systemd"><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond;</userinput></screen>
+
+<screen arch="multilib" revision="systemd"><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond;-multilib</userinput></screen>
 
-<screen revision="systemd"><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond;</userinput></screen>
 
     <para><filename>System.map</filename> is a symbol file for the kernel.
     It maps the function entry points of every function in the kernel API,
@@ -346,8 +351,10 @@ EOF</userinput></screen>
 
       <seglistitem>
         <seg>config-&linux-version;,
-        <phrase revision="sysv">vmlinuz-&linux-version;-lfs-&version;,</phrase>
-        <phrase revision="systemd">vmlinuz-&linux-version;-lfs-&versiond;,</phrase>
+        <phrase arch="default" revision="sysv">vmlinuz-&linux-version;-lfs-&version;,</phrase>
+        <phrase arch="default" revision="systemd">vmlinuz-&linux-version;-lfs-&versiond;,</phrase>
+        <phrase arch="multilib" revision="sysv">vmlinuz-&linux-version;-lfs-&version;-multilib,</phrase>
+        <phrase arch="multilib" revision="systemd">vmlinuz-&linux-version;-lfs-&versiond;-multilib,</phrase>
         and System.map-&linux-version;</seg>
         <seg>/lib/modules, /usr/share/doc/linux-&linux-version;</seg>
       </seglistitem>

+ 27 - 4
chapter09/theend.xml

@@ -28,12 +28,20 @@
   <para revision="systemd">Create an <filename>/etc/os-release</filename> 
         file required by systemd:</para>
 
-<screen revision="systemd"><userinput>cat &gt; /etc/os-release &lt;&lt; "EOF"
+<screen arch="default" revision="systemd"><userinput>cat &gt; /etc/os-release &lt;&lt; "EOF"
 NAME="Linux From Scratch"
 VERSION="&versiond;"
 ID=lfs
 PRETTY_NAME="Linux From Scratch &versiond;"
 VERSION_CODENAME="&lt;your name here&gt;"
+EOF</userinput></screen>
+
+<screen arch="multilib" revision="systemd"><userinput>cat &gt; /etc/os-release &lt;&lt; "EOF"
+NAME="Linux From Scratch"
+VERSION="&versiond;"
+ID=lfs
+PRETTY_NAME="Linux From Scratch &versiond; Multlib"
+VERSION_CODENAME="&lt;your name here&gt;"
 EOF</userinput></screen>
 
   <para revision="sysv">It may be a good idea to create an
@@ -42,7 +50,8 @@ EOF</userinput></screen>
   out which LFS version is installed on the system. Create this file by
   running:</para>
 
-<screen revision="sysv"><userinput>echo &version; &gt; /etc/lfs-release</userinput></screen>
+<screen arch="default" revision="sysv"><userinput>echo &version; &gt; /etc/lfs-release</userinput></screen>
+<screen arch="multilib" revision="sysv"><userinput>echo &version;-multilib &gt; /etc/lfs-release</userinput></screen>
 
   <para revision="systemd">Creating the file
   <filename>/etc/lfs-release</filename> is recommended for compatibility with
@@ -56,18 +65,32 @@ EOF</userinput></screen>
   new system with respect to the Linux Standards Base (LSB).  To create
   this file, run:</para>
 
-<screen revision="sysv"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
+<screen arch="default" revision="sysv"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
 DISTRIB_ID="Linux From Scratch"
 DISTRIB_RELEASE="&version;"
 DISTRIB_CODENAME="&lt;your name here&gt;"
 DISTRIB_DESCRIPTION="Linux From Scratch"
 EOF</userinput></screen>
 
-<screen revision="systemd"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
+<screen arch="default" revision="systemd"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
 DISTRIB_ID="Linux From Scratch"
 DISTRIB_RELEASE="&versiond;"
 DISTRIB_CODENAME="&lt;your name here&gt;"
 DISTRIB_DESCRIPTION="Linux From Scratch"
+EOF</userinput></screen>
+
+<screen arch="multilib" revision="sysv"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
+DISTRIB_ID="Linux From Scratch"
+DISTRIB_RELEASE="&version;-multilib"
+DISTRIB_CODENAME="&lt;your name here&gt;"
+DISTRIB_DESCRIPTION="Linux From Scratch"
+EOF</userinput></screen>
+
+<screen arch="multilib" revision="systemd"><userinput>cat &gt; /etc/lsb-release &lt;&lt; "EOF"
+DISTRIB_ID="Linux From Scratch"
+DISTRIB_RELEASE="&versiond;-multilib"
+DISTRIB_CODENAME="&lt;your name here&gt;"
+DISTRIB_DESCRIPTION="Linux From Scratch"
 EOF</userinput></screen>
 
   <para>Be sure to put some sort of customization for the field

+ 16 - 0
packages.ent

@@ -357,6 +357,14 @@
 <!ENTITY iproute2-ch6-du "13 MB">
 <!ENTITY iproute2-ch6-sbu "0.2 SBU">
 
+<!ENTITY isl-version "0.20">
+<!ENTITY isl-size "1.5 MB">
+<!ENTITY isl-url "http://isl.gforge.inria.fr/isl-&isl-version;.tar.xz">
+<!ENTITY isl-md5 "2ee25141b7d1688afb63e5bf3ac12999">
+<!ENTITY isl-home "http://isl.gforge.inria.fr/">
+<!ENTITY isl-ch6-du "20 MB">
+<!ENTITY isl-ch6-sbu "0.1 SBU">
+
 <!ENTITY kbd-version "2.0.4">
 <!ENTITY kbd-size "1,008 KB">
 <!ENTITY kbd-url "https://www.kernel.org/pub/linux/utils/kbd/kbd-&kbd-version;.tar.xz">
@@ -441,6 +449,14 @@
 <!ENTITY linux-headers-ch6-du "941 MB">
 <!ENTITY linux-headers-ch6-sbu "less than 0.1 SBU">
 
+<!ENTITY linux-firmware-version "20180929">
+<!ENTITY linux-firmware-size "82,268 KB">
+<!ENTITY linux-firmware-url "http://www.linuxfromscratch.org/~dj/linux-firmware-&linux-firmware-version;.tar.xz">
+<!ENTITY linux-firmware-md5 "f803f618f0bd186b99da3a913e6c2dd2">
+<!ENTITY linux-firmware-home "http://www.kernel.org/">
+<!ENTITY linux-firmware-ch6-du "287 MB">
+<!ENTITY linux-firmware-ch6-sbu "0.2 SBU">
+
 <!ENTITY m4-version "1.4.18">
 <!ENTITY m4-size "1,180 KB">
 <!ENTITY m4-url "&gnu;m4/m4-&m4-version;.tar.xz">

+ 26 - 7
prologue/architecture.xml

@@ -40,13 +40,13 @@ builds on the same hardware.  Modern 64-bit systems are considerably
 faster than older 64-bit systems and the LFS authors recommend building
 on a 64-bit system when given a choice.</para></note>
 
-<para>The default 64-bit build that results from LFS is considered a "pure"
-64-bit system. That is, it supports 64-bit executables only. Building a
-"multi-lib" system requires compiling many applications twice, once for a
-32-bit system and once for a 64-bit system. This is not directly supported in
-LFS because it would interfere with the educational objective of providing the
-instructions needed for a straightforward base Linux system.  You can refer to
-the <ulink url="http://trac.clfs.org/">Cross Linux From Scratch</ulink>
+<para arch="default">The default 64-bit build that results from LFS is
+considered a "pure" 64-bit system. That is, it supports 64-bit executables only.
+Building a "multi-lib" system requires compiling many applications twice, once
+for a 32-bit system and once for a 64-bit system. This is not directly supported
+in LFS because it would interfere with the educational objective of providing
+the instructions needed for a straightforward base Linux system.  You can refer
+to the <ulink url="http://trac.clfs.org/">Cross Linux From Scratch</ulink>
 project for this advanced topic.</para>
 
 <!-- This does not appear to be valid for LFS/BLFS any more
@@ -61,5 +61,24 @@ problems can be worked around, but may require some specialized procedures or
 patches.</para>
 -->
 
+<para arch="multilib">You are reading the
+<emphasis>LFS-&version;-multilib</emphasis> book. Building a multilib system
+requires compiling many applications three times: once for the primary
+64-bit architecture; once for the minor 32-bit architecture; and once again for
+the 32-bit architecture with 64-bit memory extensions.</para>
+
+<para arch="multilib">Multilib goes a bit beyond the basic educational approach
+of LFS which is to teach you how to build a Linux system. If you haven't
+previously built by the standard LFS book, you are encouraged to do so before
+attempting this edition.</para>
+
+<para arch="multilib">Continue only if you meet the following requirements:
+<itemizedlist>
+  <listitem><para>you have a x86_64 compatible machine</para></listitem>
+  <listitem><para>you already have experience with LFS</para></listitem>
+  <listitem><para>you have a need for 32-bit support</para></listitem>
+</itemizedlist>
+</para>
+
 </sect1>
 

+ 9 - 2
prologue/bookinfo.xml

@@ -7,8 +7,10 @@
 
 <bookinfo>
   <title>Linux From Scratch</title>
-  <subtitle revision='sysv'   >Version &version; </subtitle>
-  <subtitle revision='systemd'>Version &versiond;</subtitle>
+  <subtitle arch="default" revision='sysv'>Version &version;</subtitle>
+  <subtitle arch="default" revision='systemd'>Version &versiond;</subtitle>
+  <subtitle arch="multilib" revision='sysv'>Version &version;-multilib</subtitle>
+  <subtitle arch="multilib" revision='systemd'>Version &versiond;-multilib</subtitle>
 
   <authorgroup>
     <author>
@@ -29,6 +31,11 @@
       <firstname>Editor: DJ</firstname>
       <surname>Lucas</surname>
     </author>
+
+    <author arch="multilib">
+      <firstname>Editor: Thomas</firstname>
+      <surname>Trepl</surname>
+    </author>
   </authorgroup>
 
   <copyright id="copyright">