Index: LFS/master.sh
===================================================================
--- LFS/master.sh	(revision b33c6ee52df999ed450f3bf1b52de09076f3d8d6)
+++ LFS/master.sh	(revision 3da8c49659d0092a67e90b9d4c541717677ca15d)
@@ -18,15 +18,40 @@
   printf -v dir chapter%02d $1
 
-  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter $1${R_arrow}"
-
-  for file in $dir/* ; do
+# $2 contains the build number if rebuilding for ICA
+  if [[ -z "$2" ]] ; then
+    local N=""
+  else
+    local N=-build_$2
+    local CHROOT_TGT=""
+    mkdir ${dir}$N
+    cp ${dir}/* ${dir}$N
+    for script in ${dir}$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}
+      # Rename the scripts
+      mv ${script} ${script}$N
+    done
+    # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
+    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i ${dir}$N/*-bzip2$N
+    # Remove openssl-<version> from /usr/share/doc (LFS-9.x), because
+    # otherwise the mv command creates an openssl directory.
+    sed -e 's@mv -v@rm -rfv /usr/share/doc/openssl-*\n&@' \
+        -i ${dir}$N/*-openssl$N
+  fi
+
+  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter $1$N${R_arrow}"
+
+  for file in ${dir}$N/* ; do
     # Keep the script file name
     this_script=`basename $file`
 
     # Some scripts need peculiar actions:
-    # - glibc chap 5: ix locales creation when running chapter05 testsuites
+    # - glibc chap 5: fix locales creation when running chapter05 testsuites
     # - Stripping at the end of system build: lfs.xsl does not generate
     #   correct commands if the user does not want to strip, so skip it
     #   in this case
+    # - do not reinstall linux-headers when rebuilding
     # - grub config: must be done manually; skip it
     # - handle fstab and .config. Skip kernel if .config not supplied
@@ -35,4 +60,5 @@
                        sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
       *strippingagain) [[ "${STRIP}" = "n" ]] && continue ;;
+      *linux-headers*) [[ -n "$N" ]] && continue ;;
       8*grub)          (( nb_chaps == 5 )) && continue ;;
       10*grub)         continue ;;
@@ -44,4 +70,22 @@
                        cp ${CONFIG} $BUILDDIR/sources/kernel-config  ;;
     esac
+    # Grab the name of the target
+    name=`echo ${this_script} | sed -e 's@[0-9]\{3,4\}-@@' \
+                                    -e 's@-pass[0-9]\{1\}@@' \
+                                    -e 's@-libstdc++@@' \
+                                    -e 's,'$N',,'`
+
+    # Find the name of the tarball and the version of the package
+    # If it doesn't exist, we skip it in iterations rebuilds (except stripping
+    # and revisedchroot, where .a and .la files are removed).
+    pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
+    pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
+      case "${this_script}" in
+        *stripping*|*revised*) ;;
+        *)  continue ;;
+      esac
+    fi
 
     # Append the name of the script to a list. The name of the
@@ -58,16 +102,7 @@
     eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
 
-    # Grab the name of the target
-    name=`echo ${this_script} | sed -e 's@[0-9]\{3,4\}-@@' \
-                                    -e 's@-pass[0-9]\{1\}@@' \
-                                    -e 's@-libstdc++@@'`
-
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
-    #
-    # Find the name of the tarball and the version of the package
-    pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
-    pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
 
     # Drop in the name of the target on a new line, and the previous target
@@ -81,6 +116,8 @@
     if [ "$pkg_tarball" != "" ] ; then
       # Touch timestamp file if installed files logs shall be created.
-      # But only for the final install chapter
-      if [ "${INSTALL_LOG}" = "y" ] && (( 1+nb_chaps <= $1 )) ; then
+      # But only for the final install chapter and not when rebuilding it
+      if [ "${INSTALL_LOG}" = "y" ] &&
+         (( 1+nb_chaps <= $1 )) &&
+         [ "x$N" = x ] ; then
         CHROOT_wrt_TouchTimestamp
       fi
@@ -153,5 +190,7 @@
     # except if the package build fails.
     if [ "$pkg_tarball" != "" ] ; then
-      if [ "${INSTALL_LOG}" = "y" ] && (( 1+nb_chaps <= $1 )) ; then
+      if [ "${INSTALL_LOG}" = "y" ] &&
+         (( 1+nb_chaps <= $1 )) &&
+         [ "x${N}" = "x" ] ; then
         CHROOT_wrt_LogNewFiles "$name"
       fi
@@ -168,5 +207,15 @@
     # Keep the script file name for Makefile dependencies.
     PREV=${this_script}
+    # Set "system_build" var for iteration targets
+    if [ -z "$N" ] && (( 1+nb_chaps == $1 )); then
+      system_build="$system_build $this_script"
+    fi
+
   done  # end for file in $dir/*
+  # Set "system_build" when rebuilding: note the CHROOT_TGT is local
+  # in that case.
+  if [ -n "$N" ]; then
+    system_build="$CHROOT_TGT"
+  fi
 }
 
@@ -535,6 +584,8 @@
       [[ "$SAVE_CH5" = "y" ]] && wrt_save_target $Makefile_target
     fi
-    # TODO Add the iterations targets, if needed
-    #  [[ "$COMPARE" = "y" ]] && wrt_compare_targets
+    if (( i ==  1+nb_chaps )); then : # we have finished final system
+      # Add the iterations targets, if needed
+      [[ "$COMPARE" = "y" ]] && wrt_compare_targets $i
+    fi
   done
   # Add the CUSTOM_TOOLS targets, if needed
Index: common/libs/func_compare.sh
===================================================================
--- common/libs/func_compare.sh	(revision b33c6ee52df999ed450f3bf1b52de09076f3d8d6)
+++ common/libs/func_compare.sh	(revision 3da8c49659d0092a67e90b9d4c541717677ca15d)
@@ -9,6 +9,7 @@
     ITERATION=iteration-$N
     if [ "$N" != "1" ] ; then
-      wrt_system_build "$N" "$PREV_IT"
+      wrt_system_build "$1" "$N" "$PREV_IT"
     fi
+    # add needed Makefile target
     this_script=$ITERATION
     CHROOT_wrt_target "$ITERATION" "$PREV"
@@ -19,4 +20,14 @@
     PREV=$ITERATION
   done
+  # We need to prevent "userdel" in all iterations but the last
+  # We need to access the scriptlets in "dir"
+  local dir
+  printf -v dir chapter%02d "$1"
+
+  sed -i '/userdel/d' $dir/*revised*
+  for (( N = 2; N < ITERATIONS; N++ )); do
+     sed -i '/userdel/d' $dir-build_$N/*revised*
+  done
+
 }
 
@@ -24,11 +35,12 @@
 wrt_system_build() {               #
 #----------------------------------#
-  local     RUN=$1
-  local PREV_IT=$2
+  local    CHAP=$1
+  local     RUN=$2
+  local PREV_IT=$3
 
   if [[ "$PROGNAME" = "clfs" ]] ; then
     final_system_Makefiles $RUN
   else
-    chapter6_Makefiles $RUN
+    chapter_targets $CHAP $RUN
   fi
 
@@ -36,5 +48,5 @@
     basicsystem="$basicsystem $PREV_IT $system_build"
   else
-    chapter6="$chapter6 $PREV_IT $system_build"
+    CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
   fi
 
@@ -43,5 +55,5 @@
       basicsystem="$basicsystem iteration-$RUN"
     else
-      chapter6="$chapter6 iteration-$RUN"
+      CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
     fi
   fi
@@ -74,5 +86,4 @@
     fi
   fi
-
 }
 
