Index: BLFS/TODO
===================================================================
--- BLFS/TODO	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ BLFS/TODO	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -20,5 +20,9 @@
 
 2. - To develop the XSL code needed to create the build scripts.
-     Work in progress.
+     Almost done. A lot of book-versus-scripts and testing is needed.
+     We need yet to figure out how to handle Perl modules installation and
+     other pages that have commands to install more that one package
+     (e.g., Gnat in GCC Java-bin in Java, sane-backends and sane-frontends
+     in Sane, etc)
 
 3. - To develop the code to create the Makefile.
@@ -27,4 +31,5 @@
      Must make the build scripts executables and set the SRC_ARCHIVE and
      FTP_SERVER envars.
+     Work in progress.
 
 4. - To find a way to track already installed packages by previous runs, to can
Index: CLFS/clfs.xsl
===================================================================
--- CLFS/clfs.xsl	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ CLFS/clfs.xsl	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -231,4 +231,8 @@
         <xsl:value-of select="$page"/>
       </xsl:when>
+      <xsl:when test="ancestor::sect1[@id='ch-boot-kernel'] or
+                      ancestor::sect1[@id='ch-bootable-kernel']">
+        <xsl:value-of select="$keymap"/>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:text>**EDITME</xsl:text>
Index: CLFS/config
===================================================================
--- CLFS/config	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ CLFS/config	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -23,6 +23,6 @@
 # >>>> 64-64 BUILD <<<<
 # ARCH=x86_64-64  ; TARGET="x86_64-unknown-linux-gnu"
-# ARCH=mips64-64  ; TARGET="mipsel-unknown-linux-gnu"
-# ARCH=mips64-64  ; TARGET="mips-unknown-linux-gnu"
+# ARCH=mips64-64  ; TARGET="mips64el-unknown-linux-gnu"
+# ARCH=mips64-64  ; TARGET="mips64-unknown-linux-gnu"
 # ARCH=sparc64-64 ; TARGET="sparc64-unknown-linux-gnu"
 # ARCH=alpha	  ; TARGET="alpha-unknown-linux-gnu"
@@ -30,7 +30,7 @@
 # >>>> MULTILIB 32/64 <<<<
 # ARCH=x86_64  ; TARGET="x86_64-unknown-linux-gnu"    ; TARGET32="i686-pc-linux-gnu"
-# ARCH=mips64  ; TARGET="mipsel-unknown-linux-gnu"    ; TARGET32="mipsel-unknown-linux-gnu"
-# ARCH=mips64  ; TARGET="mips-unknown-linux-gnu"      ; TARGET32="mips-unknown-linux-gnu"
-# ARCH=sparc64 ; TARGET="sparc64-unknown-linux-gnu"   ; TARGET32="sparcv9-unknown-linux-gnu"
+# ARCH=mips64  ; TARGET="mips64el-unknown-linux-gnu"  ; TARGET32="mipsel-unknown-linux-gnu"
+# ARCH=mips64  ; TARGET="mips64-unknown-linux-gnu"    ; TARGET32="mips-unknown-linux-gnu"
+# ARCH=sparc64 ; TARGET="sparc64-unknown-linux-gnu"   ; TARGET32="sparc-unknown-linux-gnu"
 # ARCH=ppc64   ; TARGET="powerpc64-unknown-linux-gnu" ; TARGET32="powerpc-unknown-linux-gnu"
 
@@ -69,4 +69,5 @@
 #--- Book version
 LFSVRS=development
+TREE=trunk/BOOK
 
 #--- Name of the makefile
Index: CLFS/master.sh
===================================================================
--- CLFS/master.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ CLFS/master.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -11,10 +11,10 @@
 host_prep_Makefiles() {      # Initialization of the system
 #----------------------------#
-  local   LFS_HOST
+  local   CLFS_HOST
 
   echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
 
   # defined here, only for ease of reading
-  LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
+  CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
 (
 cat << EOF
@@ -42,14 +42,14 @@
 025-addinguser:  024-creatingcrossdir
 	@\$(call echo_message, Building)
-	@if [ ! -d /home/lfs ]; then \\
-		groupadd lfs; \\
-		useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
+	@if [ ! -d /home/clfs ]; then \\
+		groupadd clfs; \\
+		useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
 	else \\
-		touch user-lfs-exist; \\
+		touch user-clfs-exist; \\
 	fi;
-	@chown lfs \$(MOUNT_PT) && \\
-	chown lfs \$(MOUNT_PT)/tools && \\
-	chown lfs \$(MOUNT_PT)/cross-tools && \\
-	chown lfs \$(MOUNT_PT)/sources && \\
+	@chown clfs \$(MOUNT_PT) && \\
+	chown clfs \$(MOUNT_PT)/tools && \\
+	chown clfs \$(MOUNT_PT)/cross-tools && \\
+	chown clfs \$(MOUNT_PT)/sources && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -58,25 +58,25 @@
 026-settingenvironment:  025-addinguser
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
-		mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
+	@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
+		mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile  -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
+	@if [ -f /home/clfs/.bash_profile  -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
 	fi;
-	@echo "set +h" > /home/lfs/.bashrc && \\
-	echo "umask 022" >> /home/lfs/.bashrc && \\
-	echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
-	echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
-	echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
-	echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
-	echo "" >> /home/lfs/.bashrc && \\
-	echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
-	echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
-	echo "" >> /home/lfs/.bashrc && \\
-	echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
-	echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
-	echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
-	echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
-	@chown lfs:lfs /home/lfs/.bashrc && \\
+	@echo "set +h" > /home/clfs/.bashrc && \\
+	echo "umask 022" >> /home/clfs/.bashrc && \\
+	echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
+	echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
+	echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
+	echo "" >> /home/clfs/.bashrc && \\
+	echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
+	echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
+	echo "" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
+	@chown clfs:clfs /home/clfs/.bashrc && \\
 	touch envars && \\
 	touch \$@ && \\
@@ -118,15 +118,7 @@
                                   -e 's@-static@@' \
                                   -e 's@-final@@' \
-                                  -e 's@-headers@@' \
-                                  -e 's@-64@@' \
+				  -e 's@-64@@' \
                                   -e 's@-n32@@'`
-    # Adjust 'name' and patch a few scripts on the fly..
-    case $name in
-      linux-libc) name=linux-libc-headers ;;
-    esac
-    #
-    # Find the version of the command files, if it corresponds with the building of a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -138,11 +130,11 @@
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
-    #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
-    #
-    wrt_run_as_su "${this_script}" "${file}"
-    #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    # If $pkg_tarball isn't empty, we've got a package...
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
+    #
+    wrt_run_as_clfs_su "${this_script}" "${file}"
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -169,4 +161,13 @@
     this_script=`basename $file`
     #
+    #  Deal with any odd scripts..
+    case $this_script in
+      *choose) # The choose script will fail if you cannot enter the new environment
+               # If the 'boot' build method was chosen don't run the script
+         [[ $METHOD = "boot" ]] && continue; ;;
+      *) ;;
+    esac
+
+    #
     # First append each name of the script files to a list (this will become
     # the names of the targets in the Makefile
@@ -177,7 +178,5 @@
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
     #
-    # Find the version of the command files, if it corresponds with the building of a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -189,13 +188,13 @@
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and to set the PKGDIR variable.
     #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
-    [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
-    #
-    wrt_run_as_su "${this_script}" "${file}"
-    #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    #
+    wrt_run_as_clfs_su "${this_script}" "${file}"
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -250,6 +249,6 @@
       *)              name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
     esac
-
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+      # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -261,25 +260,25 @@
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
-    [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     # Select a script execution method
     case $this_script in
-      *changingowner*)  wrt_run_as_root "${this_script}" "${file}"    ;;
-      *devices*)        wrt_run_as_root "${this_script}" "${file}"    ;;
+      *changingowner*)  wrt_run_as_clfs_root "${this_script}" "${file}"    ;;
+      *devices*)        wrt_run_as_clfs_root "${this_script}" "${file}"    ;;
       *fstab*)   if [[ -n "$FSTAB" ]]; then
                    wrt_copy_fstab "${this_script}"
                  else
-                   wrt_run_as_su  "${this_script}" "${file}"
+                   wrt_run_as_clfs_su  "${this_script}" "${file}"
                  fi
          ;;
-      *)         wrt_run_as_su  "${this_script}" "${file}"       ;;
+      *)         wrt_run_as_clfs_su  "${this_script}" "${file}"       ;;
     esac
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -318,5 +317,6 @@
     # Grab the name of the target, strip id number, XXX-script
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -328,11 +328,11 @@
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       case $this_script in
-        *util-linux)    wrt_unpack  "$name-$vrs.tar.*"  ;;
-        *)              wrt_unpack2 "$name-$vrs.tar.*"  ;;
+        *util-linux)    wrt_unpack_clfs  "$pkg_tarball"  ;;
+        *)              wrt_unpack2 "$pkg_tarball"  ;;
       esac
       [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
@@ -341,11 +341,11 @@
     # Select a script execution method
     case $this_script in
-      *kernfs)        wrt_run_as_root    "${this_script}" "${file}"  ;;
-      *util-linux)    wrt_run_as_su     "${this_script}" "${file}"  ;;
-      *)              wrt_run_as_chroot1 "${this_script}" "${file}"  ;;
+      *kernfs)        wrt_run_as_clfs_root "${this_script}" "${file}"  ;;
+      *util-linux)    wrt_run_as_clfs_su   "${this_script}" "${file}"  ;;
+      *)              wrt_run_as_chroot1   "${this_script}" "${file}"  ;;
     esac
     #
     # Housekeeping...remove the build directory(ies), except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -383,5 +383,5 @@
                                   -e 's@n32@@'`
 
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -393,8 +393,5 @@
     wrt_target "${this_script}" "$PREV"
     #
-    case $name in
-      tcl)    wrt_unpack2 "$name$vrs-src.tar.*" ;;
-      *)      wrt_unpack2 "$name-$vrs.tar.*"    ;;
-    esac
+    wrt_unpack2 "$pkg_tarball"
     [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
@@ -438,5 +435,5 @@
                                   -e 's@n32@@'`
 
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -446,10 +443,7 @@
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}" "$PREV"
-    #
-    case $name in
-      tcl)    wrt_unpack3 "$name$vrs-src.tar.*" ;;
-      *)      wrt_unpack3 "$name-$vrs.tar.*"    ;;
-    esac
+    wrt_target_boot "${this_script}" "$PREV"
+    #
+    wrt_unpack3 "$pkg_tarball"
     [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
@@ -520,7 +514,7 @@
     # a specific package. We need this here to can skip scripts not needed for
     # iterations rebuilds
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
@@ -545,8 +539,7 @@
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      FILE="$name-$vrs.tar.*"
-      wrt_unpack2 "$FILE"
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_unpack2 "$pkg_tarball"
       # If the testsuites must be run, initialize the log file
       case $name in
@@ -564,5 +557,5 @@
     wrt_run_as_chroot1 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -631,7 +624,8 @@
     # a specific package. We need this here to can skip scripts not needed for
     # iterations rebuilds
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
@@ -654,9 +648,9 @@
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}${N}" "$PREV"
-
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      FILE="$name-$vrs.tar.*"
+    wrt_target_boot "${this_script}${N}" "$PREV"
+
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
+      FILE="$pkg_tarball"
       wrt_unpack3 "$FILE"
       # If the testsuites must be run, initialize the log file
@@ -675,5 +669,5 @@
     wrt_run_as_root2 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -721,5 +715,6 @@
       *udev-rules)   name=udev-cross-lfs ;;
     esac
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -731,11 +726,11 @@
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
-    #
-    [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
+    # If $pkg_tarball isn't empty, we've got a package...
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -782,5 +777,6 @@
        ;;
     esac
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -790,13 +786,13 @@
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}" "$PREV"
-    #
-    # If $vrs isn't empty, we've got a package...
-    #
-    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+    wrt_target_boot "${this_script}" "$PREV"
+    #
+    # If $pkg_tarball isn't empty, we've got a package...
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
     #
     wrt_run_as_root2 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -845,5 +841,6 @@
        ;;
     esac
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -855,8 +852,8 @@
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
     #
     # Select a script execution method
@@ -872,5 +869,5 @@
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -918,10 +915,9 @@
     # Grab the name of the target, strip id number and misc words.
     case $this_script in
-      *kernel) name=linux
-         ;;
+      *kernel) name=linux  ;;
       *)       name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
     esac
 
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
@@ -931,10 +927,10 @@
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}" "$PREV"
-    #
-    # If $vrs isn't empty, we've got a package...
+    wrt_target_boot "${this_script}" "$PREV"
+    #
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
     #
     # Select a script execution method
@@ -952,5 +948,5 @@
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
@@ -1032,5 +1028,5 @@
                                                                 -e 's|exit||g' \
                                                                 -e 's|$| -c|' \
-                                                                -e 's|"$$LFS"|$(MOUNT_PT)|'\
+                                                                -e 's|"$$CLFS"|$(MOUNT_PT)|'\
                                                                 -e 's|set -e||'`
     echo -e "CHROOT1= $chroot\n" >> $MKFILE
@@ -1064,8 +1060,11 @@
 clean:  clean-chapter4 clean-chapter3 clean-chapter2
 
+restart:
+	@echo "This feature does not exist for the CLFS makefile. (yet)"
+
 clean-chapter2:
-	-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+	-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
@@ -1073,10 +1072,10 @@
 	rm -rf \$(MOUNT_PT)/cross-tools
 	rm -f /cross-tools
-	rm -f envars user-lfs-exist
+	rm -f envars user-clfs-exist
 	rm -f 02* logs/02*.log
 
 clean-chapter3:
 	rm -rf \$(MOUNT_PT)/tools/*
-	rm -f $cross_tools restore-lfs-env sources-dir
+	rm -f $cross_tools restore-clfs-env sources-dir
 	cd logs && rm -f $cross_tools && cd ..
 
@@ -1092,13 +1091,13 @@
 
 
-restore-lfs-env:
+restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc.XXX ]; then \\
-		mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
+		mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
 	fi;
-	@chown lfs:lfs /home/lfs/.bash* && \\
+	@chown clfs:clfs /home/clfs/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -1111,7 +1110,7 @@
 	@-umount \$(MOUNT_PT)/sys
 	@-umount \$(MOUNT_PT)/proc
-	@-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+	@-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
 	fi;
 
@@ -1143,8 +1142,11 @@
 clean:  clean-makesys clean-makeboot clean-jhalfs
 
+restart:
+	@echo "This feature does not exist for the CLFS makefile. (yet)"
+
 clean-jhalfs:
-	-if [ ! -f user-lfs-exist ]; then \\
-		userdel lfs; \\
-		rm -rf /home/lfs; \\
+	-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
 	fi;
 	rm -rf \$(MOUNT_PT)/tools
@@ -1152,5 +1154,5 @@
 	rm -rf \$(MOUNT_PT)/cross-tools
 	rm -f /cross-tools
-	rm -f envars user-lfs-exist
+	rm -f envars user-clfs-exist
 	rm -f 02* logs/02*.log
 
@@ -1158,5 +1160,5 @@
 	rm -rf /tools/*
 	rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
-	rm -f restore-lfs-env sources-dir
+	rm -f restore-clfs-env sources-dir
 	cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
 
@@ -1174,13 +1176,13 @@
 
 
-restore-lfs-env:
+restore-clfs-env:
 	@\$(call echo_message, Building)
-	@if [ -f /home/lfs/.bashrc.XXX ]; then \\
-		mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
+		mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
 	fi;
-	@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
-		mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
 	fi;
-	@chown lfs:lfs /home/lfs/.bash* && \\
+	@chown clfs:clfs /home/clfs/.bash* && \\
 	touch \$@ && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
Index: CLFS2/clfs2.xsl
===================================================================
--- CLFS2/clfs2.xsl	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
+++ CLFS2/clfs2.xsl	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -0,0 +1,243 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
+  %general-entities;
+]>
+
+<!-- $Id$ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:exsl="http://exslt.org/common"
+    extension-element-prefixes="exsl"
+    version="1.0">
+
+<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
+
+  <!-- Build method used -->
+  <xsl:param name="method" select="chroot"/>
+
+  <!-- Compile the keymap into the kernel? -->
+  <xsl:param name="keymap" select="none"/>
+
+  <!-- Run test suites?
+       0 = none
+       1 = only Glibc, GCC and Binutils testsuites
+       2 = all testsuites
+       3 = alias to 2 -->
+  <xsl:param name="testsuite" select="0"/>
+
+  <!-- Install vim-lang package? -->
+  <xsl:param name="vim-lang" select="1"/>
+
+  <!-- Time zone -->
+  <xsl:param name="timezone" select="GMT"/>
+
+  <!-- Page size -->
+  <xsl:param name="page" select="letter"/>
+
+  <!-- Locale settings -->
+  <xsl:param name="lang" select="C"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//sect1"/>
+  </xsl:template>
+
+  <xsl:template match="sect1">
+    <xsl:choose>
+      <xsl:when test="../@id='chapter-partitioning' or
+                      ../@id='chapter-getting-materials' or
+                      ../@id='chapter-final-preps'"/>
+      <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
+      <xsl:otherwise>
+        <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
+                      count(descendant::screen/userinput) &gt;
+                      count(descendant::screen[@role='nodump'])">
+            <!-- The dirs names -->
+          <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
+          <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
+          <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
+          <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
+            <!-- The file names -->
+          <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
+          <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
+          <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
+            <!-- The build order -->
+          <xsl:variable name="position" select="position()"/>
+          <xsl:variable name="order">
+            <xsl:choose>
+              <xsl:when test="string-length($position) = 1">
+                <xsl:text>00</xsl:text>
+                <xsl:value-of select="$position"/>
+              </xsl:when>
+              <xsl:when test="string-length($position) = 2">
+                <xsl:text>0</xsl:text>
+                <xsl:value-of select="$position"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="$position"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+            <!-- Creating dirs and files -->
+          <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
+            <xsl:choose>
+              <xsl:when test="../@id='chapter-chroot'">
+                <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
+              </xsl:when>
+              <xsl:when test="@id='ch-system-stripping'">
+                <xsl:text>#!/bin/sh&#xA;</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+            <xsl:if test="sect2[@role='installation']">
+              <xsl:text>cd $PKGDIR&#xA;</xsl:text>
+              <xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
+                <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
+              </xsl:if>
+            </xsl:if>
+            <xsl:apply-templates select=".//para/userinput | .//screen"/>
+            <xsl:text>exit</xsl:text>
+          </exsl:document>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="screen">
+    <xsl:if test="child::* = userinput and not(@role = 'nodump')">
+      <xsl:apply-templates select="userinput" mode="screen"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="para/userinput">
+    <xsl:if test="(contains(string(),'test') or
+            contains(string(),'check')) and
+            ($testsuite = '2' or $testsuite = '3')">
+      <xsl:value-of select="substring-before(string(),'make')"/>
+      <xsl:text>make -k</xsl:text>
+      <xsl:value-of select="substring-after(string(),'make')"/>
+      <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="userinput" mode="screen">
+    <xsl:choose>
+      <!-- Estandarized package formats -->
+      <xsl:when test="contains(string(),'tar.gz')">
+        <xsl:value-of select="substring-before(string(),'tar.gz')"/>
+        <xsl:text>tar.*</xsl:text>
+        <xsl:value-of select="substring-after(string(),'tar.gz')"/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+      <!-- Avoiding a race condition in a patch -->
+      <xsl:when test="contains(string(),'debian_fixes')">
+        <xsl:value-of select="substring-before(string(),'patch')"/>
+        <xsl:text>patch -Z</xsl:text>
+        <xsl:value-of select="substring-after(string(),'patch')"/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+      <!-- Setting $LANG for /etc/profile -->
+      <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
+                contains(string(),'export LANG=')">
+        <xsl:value-of select="substring-before(string(),'export LANG=')"/>
+        <xsl:text>export LANG=</xsl:text>
+        <xsl:value-of select="$lang"/>
+        <xsl:value-of select="substring-after(string(),'charmap]')"/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:when>
+      <!-- Compile the keymap into the kernel? -->
+      <xsl:when test="contains(string(),'defkeymap') and
+                $keymap = 'none'"/>
+      <!-- Copying the kernel config file -->
+      <xsl:when test="string() = 'make mrproper'">
+        <xsl:text>make mrproper&#xA;</xsl:text>
+        <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
+          <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
+        </xsl:if>
+        <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
+          <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
+        </xsl:if>
+      </xsl:when>
+      <!-- No interactive commands are needed if the .config file is the proper one -->
+      <xsl:when test="contains(string(),'menuconfig')"/>
+      <!-- The Coreutils and Module-Init-Tools test suites are optional -->
+      <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
+                ancestor::sect1[@id='ch-system-module-init-tools']) and
+                (contains(string(),'check') or
+                contains(string(),'dummy'))">
+        <xsl:choose>
+          <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
+          <xsl:otherwise>
+            <xsl:apply-templates/>
+            <xsl:if test="contains(string(),'check')">
+              <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
+            </xsl:if>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <!-- Fixing toolchain test suites run -->
+      <xsl:when test="string() = 'make check' or
+                string() = 'make -k check'">
+        <xsl:choose>
+          <xsl:when test="$testsuite != '0'">
+            <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="contains(string(),'glibc-check-log')">
+        <xsl:choose>
+          <xsl:when test="$testsuite != '0'">
+            <xsl:value-of select="substring-before(string(),'&gt;g')"/>
+            <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="contains(string(),'test_summary') or
+                contains(string(),'expect -c')">
+        <xsl:choose>
+          <xsl:when test="$testsuite != '0'">
+            <xsl:apply-templates/>
+            <xsl:if test="contains(string(),'test_summary')">
+              <xsl:text> &gt;&gt; $TEST_LOG</xsl:text>
+            </xsl:if>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:when>
+      <!-- Don't stop on strip run -->
+      <xsl:when test="contains(string(),'strip ')">
+        <xsl:apply-templates/>
+        <xsl:text> || true&#xA;</xsl:text>
+      </xsl:when>
+      <!-- The rest of commands -->
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+        <xsl:text>&#xA;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="replaceable">
+    <xsl:choose>
+      <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
+        <xsl:value-of select="$timezone"/>
+      </xsl:when>
+      <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
+        <xsl:value-of select="$page"/>
+      </xsl:when>
+      <xsl:when test="ancestor::sect1[@id='ch-boot-kernel'] or
+                      ancestor::sect1[@id='ch-bootable-kernel']">
+        <xsl:value-of select="$keymap"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>**EDITME</xsl:text>
+        <xsl:apply-templates/>
+        <xsl:text>EDITME**</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: CLFS2/config
===================================================================
--- CLFS2/config	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
+++ CLFS2/config	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -0,0 +1,54 @@
+#####
+#
+# Configuration file for the CLFS module
+#
+# $Id$
+#
+#####
+
+#--- Which target architecture you want to build for,
+#    used to select proper book and set TARGETS
+#--------------------------------
+TARGET=
+TARGET32=
+# >>>> 32-32 BUILD <<<<
+  ARCH=x86 ;     TARGET="i486-pc-linux-gnu"
+# ARCH=x86 ;     TARGET="i586-pc-linux-gnu"
+# ARCH=x86 ;     TARGET="i686-pc-linux-gnu"
+# ARCH=arm ;     TARGET="arm-unknown-linux-gnu"
+#--------------------------------
+# >>>> 64-64 BUILD <<<<
+#--------------------------------
+# >>>> MULTILIB 32/64 <<<<
+
+#--- Location of fstab file (if empty, a template is created)
+FSTAB=
+
+#--- Fully qualified path to a kernel config file
+# If no config file is  specified the kernel is NOT compiled
+CONFIG=
+
+# Get the kernel package and patches even if no configutation file
+# has been supplied? 0(no)/1(yes)
+GETKERNEL=0
+
+#--- Book's sources directory
+# If you have previously checked out the book from the repository
+BOOK=
+
+#==== INTERNAL VARIABLES ====
+# Don't edit it unless you know what you are doing
+
+#--- Extra files that need be copied to $JHALFSDIR
+FILES=""
+
+#--- Default stylesheet
+XSL=clfs2.xsl
+
+#--- Book version
+LFSVRS=development
+TREE=branches/clfs-2.0/BOOK
+
+#--- Name of the makefile
+MKFILE=$JHALFSDIR/Makefile
+
Index: CLFS2/master.sh
===================================================================
--- CLFS2/master.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
+++ CLFS2/master.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -0,0 +1,557 @@
+#!/bin/sh
+# $Id$
+
+###################################
+###          FUNCTIONS          ###
+###################################
+
+#----------------------------------#
+wrt_ExecuteAsUser() {              # Execute the file ($3) under the users account ($1), log in $2
+#----------------------------------#
+  local this_user=$1
+  local this_script=$2
+  local file=$3
+(
+cat << EOF
+	@( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_Unpack_SetOwner() {            # Unpack and set owner. Assign 'ROOT' var
+#----------------------------------#
+  local USER_ACCT=$1
+  local FILE=$2
+  local optSAVE_PREVIOUS=$3
+
+  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
+    wrt_remove_existing_dirs "$FILE"
+  fi
+(
+cat << EOF
+	@\$(call unpack,$FILE)
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
+	echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
+	chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------#
+host_prep_Makefiles() {      # Initialization of the system
+#----------------------------#
+  local   CLFS_HOST
+
+  echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
+
+  # defined here, only for ease of reading
+  CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
+(
+cat << EOF
+023-creatingtoolsdir:
+	@\$(call echo_message, Building)
+	@mkdir \$(MOUNT_PT)/tools && \\
+	rm -f /tools && \\
+	ln -s \$(MOUNT_PT)/tools /
+	@if [ ! -d \$(MOUNT_PT)/sources ]; then \\
+		mkdir \$(MOUNT_PT)/sources; \\
+	fi;
+	@chmod a+wt \$(MOUNT_PT)/sources
+	@touch \$@ && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+
+025-addinguser:  023-creatingtoolsdir
+	@\$(call echo_message, Building)
+	@if [ ! -d /home/clfs ]; then \\
+		groupadd clfs; \\
+		useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
+	else \\
+		touch user-clfs-exist; \\
+	fi;
+	@chown clfs \$(MOUNT_PT) && \\
+	chown clfs \$(MOUNT_PT)/tools && \\
+	chown clfs \$(MOUNT_PT)/sources
+	@touch \$@ && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+
+026-settingenvironment:  025-addinguser
+	@\$(call echo_message, Building)
+	@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
+		mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
+	fi;
+	@if [ -f /home/clfs/.bash_profile  -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
+	fi;
+	@echo "set +h" > /home/clfs/.bashrc && \\
+	echo "umask 022" >> /home/clfs/.bashrc && \\
+	echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
+	echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
+	echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
+	echo "" >> /home/clfs/.bashrc && \\
+	echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
+	echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
+	echo "" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
+	echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
+	@chown clfs:clfs /home/clfs/.bashrc && \\
+	touch envars
+	@touch \$@ && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+
+027-create-directories: 026-settingenvironment
+	@\$(call echo_message, Building)
+
+	@mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
+	@mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
+	@mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
+	@mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
+	@install -d -m 0750 \$(MOUNT_PT)/root
+	@install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
+	@mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
+	@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
+	@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
+	@mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
+	@for dir in \$(MOUNT_PT)/usr{,/local}; do \\
+	  ln -s share/{man,doc,info} \$\$dir ; \\
+	done
+
+	@touch \$@ && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+
+028-creating-sysfile: 027-create-directories
+	@\$(call echo_message, Building)
+
+	@touch \$(MOUNT_PT)/etc/mtab
+	@echo "root::0:0:root:/root:/bin/bash" >> \$(MOUNT_PT)/etc/passwd
+	@echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
+	@echo "bin:x:1:"  >> \$(MOUNT_PT)/etc/group
+	@echo "sys:x:2:"  >> \$(MOUNT_PT)/etc/group
+	@echo "kmem:x:3"  >> \$(MOUNT_PT)/etc/group
+	@echo "tty:x:4:"  >> \$(MOUNT_PT)/etc/group
+	@echo "tape:x:5:"   >> \$(MOUNT_PT)/etc/group
+	@echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
+	@echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
+	@echo "disk:x:8:"   >> \$(MOUNT_PT)/etc/group
+	@echo "lp:x:9:"     >> \$(MOUNT_PT)/etc/group
+	@echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
+	@echo "audio:x:11:"   >> \$(MOUNT_PT)/etc/group
+	@echo "video:x:12:"   >> \$(MOUNT_PT)/etc/group
+	@echo "utmp:x:13:"    >> \$(MOUNT_PT)/etc/group
+	@echo "usb:x:14:"     >> \$(MOUNT_PT)/etc/group
+	@echo "cdrom:x:15:"   >> \$(MOUNT_PT)/etc/group
+
+	@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
+	@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
+	@chown -R clfs \$(MOUNT_PT)
+
+	@touch \$@ && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+
+EOF
+) >> $MKFILE.tmp
+}
+
+
+
+#-----------------------------#
+cross_tools_Makefiles() {     #
+#-----------------------------#
+  echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
+
+  for file in cross-tools/* ; do
+    # Keep the script file name
+    this_script=`basename $file`
+    #
+    # Skip this script...
+    case $this_script in
+      *cflags* | *variables* )  # work done in host_prep_Makefiles
+         continue; ;;
+      *) ;;
+    esac
+    #
+    # Set the dependency for the first target.
+    if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
+
+    # First append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    cross_tools="$cross_tools $this_script"
+
+    # Grab the name of the target (minus the -headers or -cross in the case of gcc
+    # and binutils in chapter 5)
+    name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
+                                  -e 's@-static@@' \
+                                  -e 's@-final@@' \
+				  -e 's@-64@@' \
+                                  -e 's@-n32@@'`
+    case $name in
+      glibc-headers) name="glibc" ;;
+    esac
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    #--------------------------------------------------------------------#
+    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
+    #--------------------------------------------------------------------#
+    #
+    # Drop in the name of the target on a new line, and the previous target
+    # as a dependency. Also call the echo_message function.
+    wrt_target "${this_script}" "$PREV"
+    #
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
+       wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+       # If using optimizations, write the instructions
+       [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    fi
+    #
+    wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
+    #
+    # Include a touch of the target name so make can check if it's already been made.
+    wrt_touch
+    #
+    #--------------------------------------------------------------------#
+    #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
+    #--------------------------------------------------------------------#
+    #
+    # Keep the script file name for Makefile dependencies.
+    PREV=$this_script
+
+  done # for file in ....
+}
+
+
+
+#-----------------------------#
+final_system_Makefiles() {    #
+#-----------------------------#
+  # Set envars and scripts for iteration targets
+  LOGS="" # Start with an empty global LOGS envar
+  if [[ -z "$1" ]] ; then
+    local N=""
+  else
+    local N=-build_$1
+    local basicsystem=""
+    mkdir final-system$N
+    cp final-system/* final-system$N
+    for script in final-system$N/* ; do
+      # Overwrite existing symlinks, files, and dirs
+      sed -e 's/ln -sv/&f/g' \
+          -e 's/mv -v/&f/g' \
+          -e 's/mkdir -v/&p/g' -i ${script}
+    done
+    # Remove Bzip2 binaries before make install
+    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
+    # Delete *old Readline libraries just after make install
+    sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
+  fi
+
+  echo "${tab_}${GREEN}Processing... ${L_arrow}final system$N${R_arrow}"
+
+  for file in final-system$N/* ; do
+    # Keep the script file name
+    this_script=`basename $file`
+
+    # Test if the stripping phase must be skipped.
+    # Skip alsp temp-perl for iterative runs
+    case $this_script in
+      *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
+    esac
+
+    # Grab the name of the target, strip id number, XXX-script
+    name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
+                                  -e 's@temp-@@' \
+                                  -e 's@-64bit@@' \
+                                  -e 's@-64@@' \
+                                  -e 's@64@@' \
+                                  -e 's@n32@@'`
+
+    # Find the version of the command files, if it corresponds with the building of
+    # a specific package. We need this here to can skip scripts not needed for
+    # iterations rebuilds
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
+      case "${this_script}" in
+        *stripping*) ;;
+        *)  continue ;;
+      esac
+    fi
+
+    # Append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    basicsystem="$basicsystem ${this_script}${N}"
+
+    # Append each name of the script files to a list (this will become
+    # the names of the logs to be moved for each iteration)
+    LOGS="$LOGS ${this_script}"
+
+    #--------------------------------------------------------------------#
+    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
+    #--------------------------------------------------------------------#
+    #
+    # Drop in the name of the target on a new line, and the previous target
+    # as a dependency. Also call the echo_message function.
+    wrt_target "${this_script}${N}" "$PREV"
+    #
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+      # If using optimizations, write the instructions
+      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    fi
+    #
+    wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
+    #
+    # Include a touch of the target name so make can check if it's already been made.
+    wrt_touch
+    #
+    #--------------------------------------------------------------------#
+    #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
+    #--------------------------------------------------------------------#
+    #
+    # Keep the script file name for Makefile dependencies.
+    PREV=${this_script}${N}
+    # Set system_build envar for iteration targets
+    system_build=$basicsystem
+  done  # for file in final-system/* ...
+}
+
+
+
+#-----------------------------#
+bootscripts_Makefiles() {     #
+#-----------------------------#
+    echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
+
+  for file in bootscripts/* ; do
+    # Keep the script file name
+    this_script=`basename $file`
+
+    case $this_script in
+      *udev)     continue ;; # This is not a script but a commentary, we want udev-rules
+      *console*) continue ;; # Use the files that came with the bootscripts
+      *)  ;;
+    esac
+
+    # First append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    bootscripttools="$bootscripttools $this_script"
+
+    # Grab the name of the target, strip id number, XXX-script
+    name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
+                                  -e 's@-64bit@@' \
+                                  -e 's@-64@@' \
+                                  -e 's@64@@' \
+                                  -e 's@n32@@'`
+    case $name in
+      *bootscripts*) name=bootscripts-cross-lfs ;;
+      *udev-rules)   name=udev-cross-lfs ;;
+    esac
+
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    #--------------------------------------------------------------------#
+    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
+    #--------------------------------------------------------------------#
+    #
+    # Drop in the name of the target on a new line, and the previous target
+    # as a dependency. Also call the echo_message function.
+    wrt_target "${this_script}" "$PREV"
+    #
+    # If $pkg_tarball isn't empty, we've got a package...
+    [[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+    #
+    wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
+    #
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
+    #
+    # Include a touch of the target name so make can check if it's already been made.
+    wrt_touch
+    #
+    #--------------------------------------------------------------------#
+    #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
+    #--------------------------------------------------------------------#
+    #
+    # Keep the script file name for Makefile dependencies.
+    PREV=$this_script
+
+  done  # for file in bootscripts/* ...
+
+}
+
+
+#-----------------------------#
+bootable_Makefiles() {        #
+#-----------------------------#
+  echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
+
+  for file in bootable/* ; do
+    # Keep the script file name
+    this_script=`basename $file`
+
+    # A little housekeeping on the scripts
+    case $this_script in
+      *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* )  continue ;;
+      *kernel) # if there is no kernel config file do not build the kernel
+               [[ -z $CONFIG ]] && continue
+                 # Copy the config file to /sources with a standardized name
+               cp $CONFIG $BUILDDIR/sources/kernel-config
+        ;;
+    esac
+    #
+    # First append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    bootable="$bootable $this_script"
+    #
+    # Grab the name of the target, strip id number and misc words.
+    name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
+    case $this_script in
+      *kernel*) name=linux
+       ;;
+    esac
+
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    #--------------------------------------------------------------------#
+    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
+    #--------------------------------------------------------------------#
+    #
+    # Drop in the name of the target on a new line, and the previous target
+    # as a dependency. Also call the echo_message function.
+    wrt_target "${this_script}" "$PREV"
+    #
+    # If $pkg_tarball isn't empty, we've got a package...
+    [[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
+    #
+    # Select a script execution method
+    case $this_script in
+      *fstab*)  if [[ -n "$FSTAB" ]]; then
+                  wrt_copy_fstab "${this_script}"
+                else
+                  wrt_ExecuteAsUser "clfs"  "${this_script}" "${file}"
+                fi
+          ;;
+      *)  wrt_ExecuteAsUser "clfs"  "${this_script}" "${file}" 
+	  ;;
+    esac
+    #
+    # Housekeeping...remove any build directory(ies) except if the package build fails.
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
+    #
+    # Include a touch of the target name so make can check if it's already been made.
+    wrt_touch
+    #
+    #--------------------------------------------------------------------#
+    #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
+    #--------------------------------------------------------------------#
+    #
+    # Keep the script file name for Makefile dependencies.
+    PREV=$this_script
+
+  done
+
+  # Add SBU-disk_usage report target if required
+  if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
+
+}
+
+
+#-----------------------------#
+build_Makefile() {            # Construct a Makefile from the book scripts
+#-----------------------------#
+  echo "Creating Makefile... ${BOLD}START${OFF}"
+
+  cd $JHALFSDIR/${PROGNAME}-commands
+  # Start with a clean Makefile.tmp file
+  >$MKFILE.tmp
+
+  host_prep_Makefiles
+  cross_tools_Makefiles            # $cross_tools
+  final_system_Makefiles           # $basicsystem
+  bootscripts_Makefiles            # $bootscripttools
+  bootable_Makefiles               # $bootable
+
+  # Add a header, some variables and include the function file
+  # to the top of the real Makefile.
+(
+    cat << EOF
+$HEADER
+
+SRC= /sources
+MOUNT_PT= $BUILDDIR
+PKG_LST= $PKG_LST
+
+include makefile-functions
+
+EOF
+) > $MKFILE
+
+  # Drop in the main target 'all:' and the chapter targets with each sub-target
+  # as a dependency.
+(
+	cat << EOF
+all:  chapter2 chapter3 chapter4 chapter5 chapter6 do-housekeeping
+	@\$(call echo_finished,$VERSION)
+
+chapter2:  023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
+
+chapter3:  chapter2 $cross_tools
+
+chapter4:  chapter3 $basicsystem
+
+chapter5:  chapter4 $bootscripttools
+
+chapter6:  chapter5 $bootable
+
+clean-all:  clean
+	rm -rf ./{clfs2-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+
+clean:  
+
+restart:
+	@echo "This feature does not exist for the CLFS makefile. (yet)"
+
+restore-clfs-env:
+	@\$(call echo_message, Building)
+	@if [ -f /home/clfs/.bashrc.XXX ]; then \\
+		mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
+	fi;
+	@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
+		mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
+	fi;
+	@chown clfs:clfs /home/clfs/.bash* && \\
+	touch \$@ && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+
+do-housekeeping:
+	@-if [ ! -f user-clfs-exist ]; then \\
+		userdel clfs; \\
+		rm -rf /home/clfs; \\
+	fi;
+
+EOF
+) >> $MKFILE
+
+  # Bring over the items from the Makefile.tmp
+  cat $MKFILE.tmp >> $MKFILE
+  rm $MKFILE.tmp
+  echo "Creating Makefile... ${BOLD}DONE${OFF}"
+
+}
+
Index: HLFS/config
===================================================================
--- HLFS/config	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ HLFS/config	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -39,4 +39,5 @@
 #--- Book version
 LFSVRS=development
+TREE=trunk/BOOK
 
 #--- Name of the makefile
Index: HLFS/master.sh
===================================================================
--- HLFS/master.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ HLFS/master.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -120,10 +120,11 @@
     # Adjust 'name'
     case $name in
-      linux-libc) name=linux-libc-headers ;;
+      linux-libc) name="linux-libc-headers" ;;
+      gcc)        name="gcc-core"  ;;
+      uclibc)     name="uClibc"  ;;
     esac
 
     # Set the dependency for the first target.
     if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
-
 
     #--------------------------------------------------------------------#
@@ -137,20 +138,11 @@
     # Find the version of the command files, if it corresponds with the building of
     # a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      # Deal with non-standard names
-      case $name in
-        tcl)    FILE="$name$vrs-src.tar.*"  ;;
-        uclibc) FILE="uClibc-$vrs.tar.*"    ;;
-        gcc)    FILE="gcc-core-$vrs.tar.*"  ;;
-        *)      FILE="$name-$vrs.tar.*"     ;;
-      esac
+    pkg_tarball=$(get_package_tarball_name $name)
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
       case $this_script in
-        *binutils* )
-          wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories
-        *)
-          wrt_unpack "$FILE" ;;
+        *binutils* )  wrt_unpack "$pkg_tarball" 1 ;; # Do not delete an existing package directories
+        *)            wrt_unpack "$pkg_tarball" ;;
       esac
       # If the testsuites must be run, initialize the log file
@@ -181,10 +173,9 @@
     # (so we can review config.cache, config.log, etc.)
     # For Binutils the sources must be retained for some time.
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       case "${this_script}" in
-        *binutils*) : # do NOTHING
-          ;;
-        *) wrt_remove_build_dirs "$name"
-          ;;
+        *binutils*) : ;;   # do NOTHING
+	*gcc*) wrt_remove_build_dirs "gcc"    ;;
+        *)     wrt_remove_build_dirs "$name"    ;;
       esac
     fi
@@ -272,9 +263,23 @@
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
 
+    #
+    # Sed replacement to fix some rm command that could fail.
+    # That should be fixed in the book sources.
+    #
+    case $name in
+      glibc)  sed 's/rm /rm -f /' -i chapter06$N/$this_script        ;;
+      gcc)    sed 's/rm /rm -f /' -i chapter06$N/$this_script        ;;
+    esac
+
+    case $name in
+      gcc)     name="gcc-core" ;;
+      uclibc)  name="uClibc"   ;;
+    esac
+
     # Find the version of the command files, if it corresponds with the building of
     # a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
@@ -291,16 +296,4 @@
     LOGS="$LOGS ${this_script}"
 
-    #
-    # Sed replacement to fix some rm command that could fail.
-    # That should be fixed in the book sources.
-    #
-    case $name in
-      glibc)
-          sed 's/rm /rm -f /' -i chapter06$N/$this_script
-        ;;
-      gcc)
-          sed 's/rm /rm -f /' -i chapter06$N/$this_script
-        ;;
-    esac
 
     #--------------------------------------------------------------------#
@@ -309,22 +302,15 @@
     #
     # Drop in the name of the target on a new line, and the previous target
-    # as a dependency. Also call the echo_message function.
+    # as a dependency. Also call the echo_message function.		
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
-    if [ "$vrs" != "" ] ; then
-      # Deal with non-standard names
-      case $name in
-        tcl)    FILE="$name$vrs-src.tar.*" ;;
-        uclibc) FILE="uClibc-$vrs.tar.*" ;;
-        gcc)    FILE="gcc-core-$vrs.tar.*" ;;
-        *)      FILE="$name-$vrs.tar.*" ;;
-      esac
-      wrt_unpack2 "$FILE"
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_unpack2 "$pkg_tarball"
       wrt_target_vars
       # If the testsuites must be run, initialize the log file
       case $name in
-        binutils | gcc | glibc )
+        binutils | gcc-core | glibc )
           [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
           ;;
@@ -354,5 +340,5 @@
     #
     # Remove the build directory(ies) except if the package build fails.
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       wrt_remove_build_dirs "$name"
     fi
@@ -428,9 +414,7 @@
     case "${this_script}" in
       *bootscripts*)
-        vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-        FILE="lfs-bootscripts-$vrs.tar.*"
-        wrt_unpack2 "$FILE"
-        vrs=`grep "^blfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-        echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/blfs-bootscripts-$vrs\" >> sources-dir" >> $MKFILE.tmp
+        wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts")
+        blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
+        echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
         ;;
     esac
@@ -547,4 +531,6 @@
 clean:  clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
 
+restart: restart_code all
+
 clean-chapter3:
 	-if [ ! -f user-lfs-exist ]; then \\
@@ -600,4 +586,45 @@
 	fi;
 
+restart_code:
+	@echo ">>> This feature is experimental, BUGS may exist"	
+	
+	@if [ ! -L /tools ]; then \\
+	  echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\
+	fi;
+	
+	@if [ ! -e /tools ]; then \\
+	  echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\
+	fi;
+	
+	@if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\
+	  echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\
+	fi;	
+
+	@if [ -f ???-kernfs ]; then \\
+	  mkdir -pv \$(MOUNT_PT)/{proc,sys};\\
+	  if !  mount -l | "\$(MOUNT_PT)/dev" >/dev/null ; then \\
+	    mount -vt ramfs ramfs \$(MOUNT_PT)/dev;\\
+	  fi;\\
+	  if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\
+	    mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\
+	  fi;\\
+	  if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\
+	    mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\
+	    mount -vt devpts -o gid=4,mode=620 devpts \$(MOUNT_PT)/dev/pts;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\
+	    mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
+	    mount -vt proc proc \$(MOUNT_PT)/proc;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
+	    mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
+	  fi;\\
+	fi;
+
+
 EOF
 ) >> $MKFILE
Index: LFS/config
===================================================================
--- LFS/config	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ LFS/config	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -11,8 +11,8 @@
 
 #--- Fully qualified path to a kernel config file
-# If no config file is  specified the kernel is NOT compiled
+# If no config file is specified the kernel is NOT compiled
 CONFIG=
 
-# Get the kernel package and patches even if no configutation file
+# Get the kernel package and patches even if no configuration file
 # has been supplied? 0(no)/1(yes)
 GETKERNEL=0
@@ -33,4 +33,5 @@
 #--- Book version
 LFSVRS=development
+TREE=trunk/BOOK
 
 #--- Name of the makefile
Index: LFS/master.sh
===================================================================
--- LFS/master.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ LFS/master.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -107,16 +107,10 @@
     # Find the version of the command files, if it corresponds with the building of
     # a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      if [ "$name" = "tcl" ] ; then
-        FILE="$name$vrs-src.tar.*"
-      else
-        FILE="$name-$vrs.tar.*"
-      fi
-
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
-      wrt_unpack "$FILE"
+      wrt_unpack "$pkg_tarball"
       # If the testsuites must be run, initialize the log file
       [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
@@ -135,5 +129,5 @@
     # Remove the build directory(ies) except if the package build fails
     # (so we can review config.cache, config.log, etc.)
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       wrt_remove_build_dirs "$name"
     fi
@@ -196,7 +190,7 @@
     # a specific package. We need this here to can skip scripts not needed for
     # iterations rebuilds
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
@@ -221,9 +215,8 @@
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
-    if [ "$vrs" != "" ] ; then
-      FILE="$name-$vrs.tar.*"
-      wrt_unpack2 "$FILE"
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_unpack2 "$pkg_tarball"
       # If the testsuites must be run, initialize the log file
       case $name in
@@ -247,5 +240,5 @@
 
     # Remove the build directory(ies) except if the package build fails.
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       wrt_remove_build_dirs "$name"
     fi
@@ -305,12 +298,12 @@
     case "${this_script}" in
       *bootscripts)
-          vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-          FILE="lfs-bootscripts-$vrs.tar.*"
-          wrt_unpack2 "$FILE"
+            name="lfs-bootscripts"
+            pkg_tarball=$(get_package_tarball_name $name)
+            wrt_unpack2 "$pkg_tarball"
         ;;
       *kernel)
-          vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-          FILE="linux-$vrs.tar.*"
-          wrt_unpack2 "$FILE"
+            name="linux"
+            pkg_tarball=$(get_package_tarball_name $name)
+            wrt_unpack2 "$pkg_tarball"
        ;;
     esac
@@ -503,5 +496,5 @@
 	    mount -vt proc proc \$(MOUNT_PT)/proc;\\
 	  fi;\\
-	  if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\
+	  if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
 	    mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
 	  fi;\\
Index: README
===================================================================
--- README	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ README	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -5,5 +5,5 @@
      This collection of scripts, known as jhalfs-X, strives to create
   accurate makefiles from the Linux From Scratch book series XML files.
-  This software is an evolution of the original "jhalfs" code.
+  This software is an evolution of the original "jhalfs-0.2" code.
 
      The usage of this script assumes you have read and are familiar with
@@ -34,5 +34,14 @@
   supplied symlinks. After editing the config file for the project you wish
   to build, run the script.
-  
+
+     IMPORTANT:
+       If you use the switch -M (automatically run the generated makefile) you
+       must be 'root' or you can run the scripts using 'sudo'
+        i.e.  sudo ./lfs -G -M
+
+       If you want to run make manually you can only do so if you are 'root' or
+       via 'sudo'
+        i.e  (from within the jhalfs directory) sudo make
+
      The term <symlink> refers to the 1 of 3 package symlinks, lfs,hlfs,clfs.
      Replace <symlink> with your choice of packages; i.e.: ./lfs
@@ -51,4 +60,40 @@
      will give you a context sensitive list of command line switches.
 
+   >>>> an expanded example
+
+   export SRC_ARCHIVE=/mnt/SourceFiles
+
+   ./lfs -D /mnt/partition4 \
+         -K ~/jhalfs_configs/linux-2.6.16.19-LFS.config \
+	 -F ~/jhalfs-configs/fstab-sda3 \
+	 -G -T 0 -M
+
+   explanation:::
+
+   export SRC_ARCHIVE=/mnt/SourceFiles
+      # This points to a local archive of existing packages. If the version in
+        the archive is incorrect jhalfs will access the net and download the
+	necessary version and store it here for later use. DO NOT set this to
+	$BUILDDIR/sources. If you do not set this variable to a valid directory
+	ALL package tarballs will be downloaded from the 'net.
+
+   -D /mnt/partition4
+      # where everything takes place.  ..NOTE it must already exist and be mounted
+
+   -K ~/jhalfs_configs/linux-2.6.16.19-LFS.config
+      # If you want to automatically build a the kernel you MUST supply a valid
+        kernel configuration file. The file you supply will be copied and renamed.
+
+   -F ~/jhalfs-configs/fstab-sda3
+      # If you have a fstab file you wish to use it will be copied and renamed
+
+   -G   # Retrieve the package files. You MUST enable this flag at least once if you
+          wish to do a build or whenever you update the book.
+
+   -T 0 # don't run any testsuites
+
+   -M   # automatically run make against Makefile once jhalfs finishes its work.
+
+
 5. LAYOUT::
 
@@ -56,4 +101,8 @@
              /master.sh
              /xxxx.xsl
+
+        /CLFS2/config
+              /master.sh
+              /xxxx.xsl
 
         /HLFS/config
@@ -84,4 +133,5 @@
 
 	 ./clfs  ---|
+	 ./clfs2 ---|
 	 ./hlfs  ---|+---> master.sh
 	 ./lfs   ---|
@@ -89,11 +139,22 @@
 
 6. FAQ::
+    Q. "This 'help' file is very sparse"
+    A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books
+       and wish to automate the build. 99% of any problems that arise can be
+       solved by reading the book(s).
+
     Q. "It doesn't work!"
     A. Yes it does, try ./lfs --help
 
+    Q. "It still doesn't work"
+    A. jhalfs was designed to work against the developement versions of the LFS
+       series of books. Consequently changes in a book(s) sometimes breaks older
+       versions of jhalfs. Before you start pulling out your hair download the
+       latest version of jhalfs to see if that solves your problem.
+
     Q. "How do I specify the build location?"
-    A. The original LFS document worked against the well know location /mnt/lfs.
+    A. The original LFS document worked against the well known location /mnt/lfs.
        This script automates the build of all of the LFS series of books and uses
-       a generic location $BUILDDIR with a default value a /mnt/build_dir.
+       a generic location $BUILDDIR with a default value of /mnt/build_dir.
        You may change this value to suit your needs.
 
@@ -110,8 +171,8 @@
     Q. "What is the function of the SRC_ARCHIVE variable?"
     A. When then symlinked master.sh runs it creates a local copy of the
-       necessary packages in BUILDDIR/sources by downloading the files. If 
-       the variable SRC_ARCHIVE is defined the software will first look in 
+       necessary packages in BUILDDIR/sources by downloading the files. If
+       the variable SRC_ARCHIVE is defined the software will first look in
        this location for the file and, if found, will copy it to BUILDDIR/sources.
-       If the files are not found in SRC_ARCHIVE _and_ you have write priv to 
+       If the files are not found in SRC_ARCHIVE _and_ you have write priv to
        the directory any downloaded files will be mirrored there.
 
@@ -120,10 +181,26 @@
        export SRC_ARCHIVE=/wherever/you/store/downloaded/packages
                        OR
-       you can change the setting in .common/config.
+       you can change the setting in common/config.
 
     Q. "Why have 2 copies of the files?"
-    A. The package files must be visible during the chroot phase and this is a 
+    A. The package files must be visible during the chroot phase and this is a
        simple and reliable method of doing so. This method also handles the CLFS
        build method where the final build may be done on a separate machine.
+
+    Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point"
+    A. There could be numerous reasons for the failure but the most likely reason
+       is you are doing a cross-build using the 'chroot' method and the target is
+       not compatible with the host.  If you choose to build using the chroot
+       method a test is performed at the end of the temptools phase. If the test
+       succeeds the build continues inside a chroot jail. However if the test fails
+       it means the host and target are not compatible an you should use the
+       'boot' method to create your target code.
+       As an extreme example: You can build a sparc target on a x86 platform but
+       only the temptools phase. You must run ./clfs using the 'boot' method and
+       not the 'chroot.' You must transfer the toolchain to a sparc platform, reboot
+       the sparc box and continue the build.
+       Of all the LFS series of books Cross-LFS requires the greatest
+       understanding of host/target hardware combination. Please read the book
+       carefully and don't skip the easy parts (there are none..)
 
 Authors:
Index: common/common-functions
===================================================================
--- common/common-functions	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ common/common-functions	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -53,6 +53,10 @@
 ${BOLD}  -B, --book VER${OFF}
         use VER version of the book as the system to build.
-        Supported versions are: dev*, trunk, SVN
-        These are aliases for the Development version of {C,H}LFS
+        Supported VER values are:
+          dev*, trunk, SVN = aliases for the Development version of {C,H}LFS
+          branch-NAME = a branch of name NAME
+          VERSION = the version of a stable released book
+        To know what branches and stable books work with this version of jhalfs
+        please see http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks
 
 ${BOLD}  -D  --directory DIR${OFF}
@@ -84,5 +88,5 @@
         use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book
 
-${BOLD}  -C, --comparasion TYPE${OFF}
+${BOLD}  -C, --comparison TYPE${OFF}
          do iterative comparison analysis. This extends the total build time
          considerably because the entire final system will rebuild itself
@@ -91,5 +95,5 @@
            ICA   = do ICA as designed by Greg Schafer
            farce = do the farce analysis designed by Ken Moffat
-           both  = perfom both ICA and farce analysis
+           both  = perform both ICA and farce analysis
 
 ${BOLD}  -F, --fstab FILE${OFF}
@@ -105,5 +109,5 @@
 
 ${BOLD}  -R --rebuild${OFF}
-        clean the build directory before perfoming any other task. The directory
+        clean the build directory before performing any other task. The directory
         is cleaned only if it was populated by a previous jhalfs-X run.
 -EOF-
@@ -128,4 +132,16 @@
 -EOF-
 
+[[ ${PROGNAME} = "clfs2" ]] &&
+cat <<- -EOF-
+
+${BOLD}  -A, --arch ARCH ${OFF}
+        Select the TARGET architecture, valid selections are:
+           32bit builds
+        arm
+           64bit builds
+
+	64bit multi-lib
+-EOF-
+
 [[ ${PROGNAME} = "hlfs" ]] &&
 cat <<- -EOF-
@@ -208,4 +224,39 @@
 }
 
+
+#----------------------------------#
+wrt_target_boot() {                # Create target and initialize log file
+#----------------------------------#
+  local i=$1
+  local PREV=$2
+  case $i in
+    iteration* ) local LOGFILE=$this_script.log ;;
+             * ) local LOGFILE=$this_script ;;
+  esac
+(
+cat << EOF
+
+$i:  $PREV
+	@\$(call echo_message, Building)
+	@./progress_bar.sh \$@ &
+	@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE
+EOF
+) >> $MKFILE.tmp
+}
+
+#----------------------------#
+get_package_tarball_name() { #
+#----------------------------#
+  local script_name=$1
+
+   # The use of 'head' is necessary to limit the return value to the FIRST match..
+   # hopefully this will not cause problems.
+   #
+   case $script_name in
+     tcl)   echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+     *)     echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+   esac
+
+}
 
 #----------------------------------#
@@ -266,4 +317,24 @@
 
 #----------------------------------#
+wrt_unpack_clfs() {                # Unpack and set 'ROOT' var
+#----------------------------------#
+  local FILE=$1
+  local optSAVE_PREVIOUS=$2
+
+  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
+    wrt_remove_existing_dirs "$FILE"
+  fi
+(
+cat << EOF
+	@\$(call unpack,$FILE)
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
+	echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
+	chown -R clfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
 wrt_unpack2() {                    #
 #----------------------------------#
@@ -361,4 +432,32 @@
 cat << EOF
 	@( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_run_as_clfs_su() {             # Execute script inside time { }, footer to log file
+#----------------------------------#
+  local this_script=$1
+  local file=$2
+(
+cat << EOF
+	@( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_run_as_clfs_root() {           # Some scripts must be run as root..
+#----------------------------------#
+  local this_script=$1
+  local file=$2
+(
+cat << EOF
+	@( time { export CLFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
 	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
 EOF
@@ -536,5 +635,5 @@
       rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
       echo -ne "Cleaning $JHALFSDIR...\n"
-      rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+      rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,*logs,Makefile,*.xsl,makefile-functions,pkg_tarball_list,*.config,*.sh}
       echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
       rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
@@ -559,4 +658,5 @@
       hlfs) svn_root="HLFS" ;;
       clfs) svn_root="cross-lfs" ;;
+      clfs2) svn_root="cross-lfs" ;;
       *) echo "BOOK not defined in function <get_book>"
           exit 1 ;;
@@ -567,36 +667,32 @@
     if [ -d ${PROGNAME}-$LFSVRS ] ; then
       cd ${PROGNAME}-$LFSVRS
-      if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/${PROGNAME}-commands && \
-      test -f $JHALFSDIR/packages ; then
+      if LC_ALL=C svn up | grep -q At && \
+         test -d $JHALFSDIR/${PROGNAME}-commands && \
+         test -f $JHALFSDIR/pkg_tarball_list ; then
+        # Set the canonical book version
         echo -ne "done\n"
-        # Set the canonical book version
         cd $JHALFSDIR
-        VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
+        case $PROGNAME in
+          clfs | clfs2)
+            VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
+          *)
+            VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//')  ;;
+        esac
         get_sources
       else
         echo -ne "done\n"
-        # Set the canonical book version
-        cd $JHALFSDIR
-        VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
         extract_commands
       fi
     else
-      case $LFSVRS in
-        development)
-           svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
-      esac
+      svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
       echo -ne "done\n"
-      # Set the canonical book version
-      cd $JHALFSDIR
-      VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
       extract_commands
     fi
+
   else
     echo -ne "Using $BOOK as book's sources ...\n"
-    # Set the canonical book version
-    cd $JHALFSDIR
-    VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
     extract_commands
   fi
+  echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
 }
 
@@ -610,5 +706,10 @@
 
   cd $JHALFSDIR
-  VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
+  case $PROGNAME in
+    clfs | clfs2 )
+      VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
+    *)
+      VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//')  ;;
+  esac
 
   # Start clean
@@ -634,4 +735,17 @@
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
       ;;
+
+    clfs2)
+        echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
+        xsltproc --nonet \
+                 --xinclude \
+                 --stringparam testsuite $TEST \
+                 --stringparam vim-lang $VIMLANG \
+                 --stringparam timezone $TIMEZONE \
+                 --stringparam page $PAGE \
+                 --stringparam lang $LANG \
+                 --stringparam keymap $KEYMAP \
+                 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
+      ;;
     hlfs)
         echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
@@ -668,13 +782,35 @@
 
   # Create the packages file. We need it for proper Makefile creation
-  rm -f packages
-  echo -n "Creating <${PROGNAME}> specific packages file"
-  grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
-                                             -e 's@">@"@' > packages
-  echo " ...OK"
+  create_package_list
 
   # Done. Moving on...
   get_sources
 }
+
+#----------------------------#
+create_package_list() {      #
+#----------------------------#
+
+  # Create the packages file. We need it for proper Makefile creation
+  rm -f pkg_tarball_list
+  echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
+  case ${PROGNAME} in
+    clfs | clfs2)
+        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
+                 $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
+      ;;
+    hlfs)
+        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
+                 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
+      ;;
+    lfs)
+        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
+                 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
+      ;;
+  esac
+  echo " ...OK"
+
+}
+
 
 #----------------------------#
@@ -794,11 +930,10 @@
 
   if [[ -s MISSING_FILES.DMP ]]; then
-    echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
-      # Do not allow the automatic exection of the Makefile.
+    echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
+      # Do not allow the automatic execution of the Makefile.
     echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
     RUNMAKE=0
   fi
 }
-
 
 #----------------------------#
@@ -816,4 +951,12 @@
         echo " ...OK"
       ;;
+    clfs2)
+        echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
+        xsltproc --nonet --xinclude \
+                 --stringparam server $SERVER \
+                 -o $BUILDDIR/sources/urls.lst urls.xsl \
+                 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
+        echo " ...OK"
+      ;;
     hlfs)
         echo -n "Creating HLFS <${MODEL}> specific URLs file"
Index: common/config
===================================================================
--- common/config	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ common/config	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -17,4 +17,6 @@
 
 #=== Getting packages ===
+#    Files will be retrieved from the local archive SRC_ARCHIVE 
+#    (if defined) or the 'net and will be stored in $BUILDDIR/sources
 #--- Download the source packages 0(no)/1(yes)
 GETPKG=0
@@ -31,5 +33,5 @@
 
 #=== Build options ===
-#--- Run the makefile at the end  0(no)/1(yes)
+#--- Automatically run the makefile once it has been created  0(no)/1(yes)
 RUNMAKE=0
 
Index: common/func_compare.sh
===================================================================
--- common/func_compare.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ common/func_compare.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -35,6 +35,4 @@
 
   echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
-  PREV=system_build_$RUN
-
 }
 
@@ -113,4 +111,5 @@
 	popd 1> /dev/null
 	@touch \$@ && \\
+        sleep .25 && \\
 	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
 	echo --------------------------------------------------------------------------------\$(WHITE)
Index: common/func_validate_configs.sh
===================================================================
--- common/func_validate_configs.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ common/func_validate_configs.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -37,6 +37,6 @@
    "x86_64-64")  [[ "${TARGET}" = "x86_64-unknown-linux-gnu" ]] && return
     ;;
-   "mips64-64")  [[ "${TARGET}" = "mipsel-unknown-linux-gnu" ]] && return
-                 [[ "${TARGET}" = "mips-unknown-linux-gnu"   ]] && return
+   "mips64-64")  [[ "${TARGET}" = "mips64el-unknown-linux-gnu" ]] && return
+                 [[ "${TARGET}" = "mips64-unknown-linux-gnu"   ]] && return
     ;;
    "sparc64-64") [[ "${TARGET}" = "sparc64-unknown-linux-gnu" ]] && return
@@ -47,15 +47,17 @@
                  [[ "${TARGET32}" = "i686-pc-linux-gnu" ]] && return
     ;;
-   "mips64")     [[ "${TARGET}"   = "mipsel-unknown-linux-gnu" ]] &&
+   "mips64")     [[ "${TARGET}"   = "mips64el-unknown-linux-gnu" ]] &&
                  [[ "${TARGET32}" = "mipsel-unknown-linux-gnu" ]] && return
 
-                 [[ "${TARGET}"   = "mips-unknown-linux-gnu" ]] &&
+                 [[ "${TARGET}"   = "mips64-unknown-linux-gnu" ]] &&
                  [[ "${TARGET32}" = "mips-unknown-linux-gnu" ]] && return
     ;;
    "sparc64")    [[ "${TARGET}"   = "sparc64-unknown-linux-gnu" ]] &&
-                 [[ "${TARGET32}" = "sparcv9-unknown-linux-gnu" ]] && return
+                 [[ "${TARGET32}" = "sparc-unknown-linux-gnu" ]] && return
     ;;
    "ppc64")      [[ "${TARGET}"   = "powerpc64-unknown-linux-gnu" ]] &&
                  [[ "${TARGET32}" = "powerpc-unknown-linux-gnu"   ]] && return
+    ;;
+   "arm")        [[ "${TARGET}"   = "arm-unknown-linux-gnu" ]] && return
     ;;
    *)  write_error_and_die
@@ -85,7 +87,8 @@
 
   # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
-  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP         PAGE TIMEZONE LANG LC_ALL"
-  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
-  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL        VIMLANG PAGE TIMEZONE LANG"
+  local -r  hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP         PAGE TIMEZONE LANG LC_ALL"
+  local -r  clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
+  local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE         ARCH  TARGET       OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
+  local -r   lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL        VIMLANG PAGE TIMEZONE LANG"
 
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
@@ -209,5 +212,5 @@
       PAGE)       validate_against_str "xletterx xA4x" ;;
       METHOD)     validate_against_str "xchrootx xbootx" ;;
-      ARCH)       validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax" ;;
+      ARCH)       validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;;
       TARGET)     validate_target ;;
       GRSECURITY_HOST)  validate_against_str "x0x x1x" ;;
@@ -217,5 +220,5 @@
                      validate_dir -z -d
                    else
-                     validate_against_str "x${PROGNAME}-developmentx"
+                     validate_against_str "x${PROGNAME}-${LFSVRS}x"
                    fi ;;
 
Index: common/makefile-functions
===================================================================
--- common/makefile-functions	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ common/makefile-functions	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -55,9 +55,9 @@
   @echo -e \\t- Enter to the chroot using the command found
   @echo -e \\tin the section -Entering the Chroot Environment-
-  @echo -e \\texcept if building CLFS with METHOO=boot.
+  @echo -e \\texcept if building CLFS with METHOD=boot.
   @echo
   @echo -e \\t- Set a password for the root user.
   @echo
-  @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
+  @echo -e \\t- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
   @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
   @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
@@ -66,9 +66,9 @@
   @echo -e \\t- Exit from the chroot.
   @echo
-  @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOO=boot.
+  @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOD=boot.
   @echo -e \\tYou can set-up the host bootloader or the new boot-loader
   @echo -e \\tinstalled on the new system.
   @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter
-  @echo -e \\tto the chroot and be sure that /dev is populated with the
+  @echo -e \\tthe chroot and be sure that /dev is populated with the
   @echo -e \\trequired devices before configure the boot-loader. When ready,
   @echo -e \\texit from the chroot and umount the filesystems
@@ -93,5 +93,5 @@
   @echo The build is not complete. Follow the next steps:$(WHITE)
   @echo
-  @echo -e \\t- Edit $(MOUNT_PT)/etc/fstab
+  @echo -e \\t- Edit or create $(MOUNT_PT)/etc/fstab
   @echo -e \\t and any other configuration file required to suit your needs.
   @echo $(BOLD)
Index: common/packages.xsl
===================================================================
--- common/packages.xsl	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
+++ common/packages.xsl	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!-- $Id$ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//para"/>
+  </xsl:template>
+
+  <xsl:template match="para">
+    <xsl:if test="contains(string(),'Download:')">
+      <xsl:call-template name="package_name">
+        <xsl:with-param name="url" select="ulink/@url"/>
+      </xsl:call-template>
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="package_name">
+    <xsl:param name="url" select="foo"/>
+    <xsl:param name="sub-url" select="substring-after($url,'/')"/>
+    <xsl:choose>
+      <xsl:when test="contains($sub-url,'/')">
+        <xsl:call-template name="package_name">
+          <xsl:with-param name="url" select="$sub-url"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="contains($sub-url,'.patch')"/>
+          <xsl:when test="contains($sub-url,'?')">
+            <xsl:value-of select="substring-before($sub-url,'?')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$sub-url"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: common/progress_bar.sh
===================================================================
--- common/progress_bar.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ common/progress_bar.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -22,12 +22,14 @@
 declare -i  PREV_SEC=0
 
+makePID=$(fuser -v . 2>&1 | grep make)
+makePID=$(echo $makePID | cut -d" " -f2)
 
 write_or_exit() {
     # make has been killed or failed or run to completion, leave
-  if ! fuser -v . 2>&1 | grep make >/dev/null ; then
-     echo -n "${CURSOR_ON}" && exit
-  fi
+  [[ ! -e /proc/$makePID ]] && echo -n "${CURSOR_ON}" && exit
+
     # Target build complete, leave.
   [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit
+
     # It is safe to write to the screen
   echo -n "$1"
Index: master.sh
===================================================================
--- master.sh	(revision 1504208b7b54f90c86e0a03e0057a143a66af921)
+++ master.sh	(revision 3b63c8c196c5e8988cd6306bc7bd8b09f0e80b36)
@@ -106,20 +106,21 @@
         dev* | SVN | trunk )
           LFSVRS=development
-          ;;
-        *) if [[ "$PROGNAME" = "lfs" ]]; then
-             case $1 in
-               6.1.1 )
-                 echo "For stable 6.1.1 book, please use jhalfs-0.2."
-                 exit 0
-                ;;
-               * )
-                 echo "$1 is an unsupported version at this time."
-                 exit 0
-                ;;
-             esac
-           else
-             echo "The requested version, ${L_arrow} ${BOLD}$1${OFF} ${R_arrow}, is undefined in the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} series."
-             exit 0
-           fi
+          TREE=trunk/BOOK
+          ;;
+        branch-* )
+          LFSVRS=$1
+          TREE=branches/${1#branch-}/BOOK
+          ;;
+        * )
+          case $PROGNAME in
+            lfs | hlfs )
+              LFSVRS=$1
+              TREE=tags/$1/BOOK
+              ;;
+            clfs )
+              LFSVRS=$1
+              TREE=tags/$1
+              ;;
+          esac
           ;;
       esac
@@ -193,5 +194,5 @@
             BOOK=$1
           else
-            echo -e "\nLooks like $1 isn't a LFS working copy."
+            echo -e "\nLooks like $1 isn't an LFS working copy."
             exit 1
           fi
@@ -211,5 +212,5 @@
             BOOK=$1
           else
-            echo -e "\nLooks like $1 isn't a HLFS working copy."
+            echo -e "\nLooks like $1 isn't an HLFS working copy."
             exit 1
           fi
@@ -218,5 +219,5 @@
       ;;
 
-    --comparasion | -C )
+    --comparison | -C )
       test $# = 1 && eval "$exit_missing_arg"
       shift
@@ -263,5 +264,5 @@
       ;;
 
-    --make | -M )          RUNMAKE=1 ;;
+    --run-make | -M )      RUNMAKE=1 ;;
 
     --rebuild | -R )       CLEAN=1   ;;
@@ -272,4 +273,8 @@
       shift
       case $1 in
+        arm )
+          ARCH=arm
+          TARGET="arm-unknown-linux-gnu"
+          ;;
         x86 )
           ARCH=x86
@@ -346,5 +351,5 @@
           ;;
         * )
-          echo -e "\n$1 is an unknown or unsopported arch."
+          echo -e "\n$1 is an unknown or unsupported arch."
           exit 1
           ;;
@@ -411,5 +416,5 @@
 
 
-# Check for minumum gcc and kernel versions
+# Check for minimum gcc and kernel versions
 #check_requirements  1 # 0/1  0-do not display values.
 echo
@@ -494,5 +499,5 @@
   #
   if [[ -n "$FILES" ]]; then
-    # pushd/popd necessary to deal with mulitiple files
+    # pushd/popd necessary to deal with multiple files
     pushd $PACKAGE_DIR 1> /dev/null
       cp $FILES $JHALFSDIR/
@@ -502,5 +507,5 @@
   if [[ "$REPORT" = "1" ]]; then
     cp $COMMON_DIR/create-sbu_du-report.sh  $JHALFSDIR/
-    # After be sure that all look sane, dump the settings to a file
+    # After being sure that all looks sane, dump the settings to a file
     # This file will be used to create the REPORT header
     validate_config > $JHALFSDIR/jhalfs.config
@@ -509,4 +514,6 @@
   [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl  $JHALFSDIR/
   #
+  cp $COMMON_DIR/packages.xsl  $JHALFSDIR/
+  #
   sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
   export XSL=$JHALFSDIR/${XSL}
