changeset 711:20ba34b54140

Rename mini-native.sh to root-filesystem.sh, since that's what it builds.
author Rob Landley <rob@landley.net>
date Thu, 09 Apr 2009 23:53:05 -0500
parents 946b01b2cc7f
children 9d766670154a
files README build-static-toolchains.sh build.sh config host-tools.sh mini-native.sh root-filesystem.sh sources/include.sh system-image.sh
diffstat 9 files changed, 349 insertions(+), 355 deletions(-) [+]
line wrap: on
line diff
--- a/README	Wed Apr 08 04:28:59 2009 -0500
+++ b/README	Thu Apr 09 23:53:05 2009 -0500
@@ -63,11 +63,11 @@
 Although Firmware Linux creates reusable cross compilers, the purpose of FWL
 is actually to eliminate the need for cross compiling.
 
-The FWL build does all the cross compiling necessary to create a minimal
-native development environment (mini-native) for a target, then packages
-it into a system image.  Once that target system is up and running (usually
-under qemu), you can build your software natively in there, and no longer
-need to cross compile anything from the host.
+The FWL build does all the cross compiling necessary to create a root
+filesystem for a target containing a minimal native development environment,
+then packages it into a system image.  Once that target system is up and
+running (usually under qemu), you can build your software natively in there,
+and no longer need to cross compile anything from the host.
 
 FWL is also designed to be readable.  The build is a series of bash scripts,
 with comments where necessary.  They document how to make a cross compiler,
@@ -79,9 +79,9 @@
 
 The build.sh script is a wrapper around other scripts.  The main three are:
 
-  cross-compiler.sh - creates a cross compiler for the target.
+  cross-compiler.sh - create a cross compiler for the target.
 
-  mini-native.sh - use the cross compiler to build a root filesystem.
+  root-filesystem.sh - use the cross compiler to build a root filesystem.
 
   system-image.sh - build a kernel and ext2 image to run under emulator.
 
--- a/build-static-toolchains.sh	Wed Apr 08 04:28:59 2009 -0500
+++ b/build-static-toolchains.sh	Thu Apr 09 23:53:05 2009 -0500
@@ -55,7 +55,7 @@
 mkdir -p build/logs || exit 1
 for i in $STATIC_TARGETS
 do
-  ./cross-compiler.sh \$i && ./mini-native.sh \$i
+  ./cross-compiler.sh \$i && ./root-filesystem.sh \$i
 done
 (cd build; tar c cross-compiler-*.tar.bz2) | netcat 10.0.2.2 \
   $(mkdir -p build/static; cd build/static; ../host/netcat -s 127.0.0.1 -l tar xv)
--- a/build.sh	Wed Apr 08 04:28:59 2009 -0500
+++ b/build.sh	Thu Apr 09 23:53:05 2009 -0500
@@ -27,16 +27,16 @@
   then
     echo "=== Skipping cross-compiler-$i (already there)"
   else
-    rm -rf "build/mini-native-$i.tar.bz2"
+    rm -rf "build/root-filesystem-$i.tar.bz2"
     time ./cross-compiler.sh $i || exit 1
   fi
   echo "=== native ($i)"
-  if [ -f "build/mini-native-$i.tar.bz2" ]
+  if [ -f "build/root-filesystem-$i.tar.bz2" ]
   then
-    echo "=== Skipping mini-native-$i (already there)"
+    echo "=== Skipping root-filesystem-$i (already there)"
   else
     rm -rf "build/system-image-$i.tar.bz2"
-    time ./mini-native.sh $i || exit 1
+    time ./root-filesystem.sh $i || exit 1
   fi
 
   if [ -f "build/system-image-$i.tar.bz2" ]
--- a/config	Wed Apr 08 04:28:59 2009 -0500
+++ b/config	Thu Apr 09 23:53:05 2009 -0500
@@ -5,7 +5,7 @@
 # are left blank by the build.  Feel free to replace this file with your
 # own version, or to set these as environment variables on the command line.
 
-# By default mini-native.sh will build a native toolchain (binutils, gcc,
+# By default root-filesystem.sh will build a native toolchain (binutils, gcc,
 # make, bash, distcc).  Set this variable to "none" to skip all that, and
 # build a root filesystem containing only uClibc and busybox.  You can also
 # set it to "headers" to retain the linux/uClibc kernel headers (in case you'd
@@ -14,7 +14,7 @@
 # export NATIVE_TOOLCHAIN=none
 # export NATIVE_TOOLCHAIN=headers
 
-# If this is set, mini-native will build a Linux From Scratch style /tools
+# If this is set, root-filesystem will build a Linux From Scratch style /tools
 # directory instead of a more conventional filesystem layout in /usr.
 
 # export NATIVE_TOOLSDIR=1
@@ -99,13 +99,6 @@
   export PACKAGE_COLOR="$BACKGROUND_COLOR\e[36m"
 fi
 
-# Install the uClibc++ files into the cross-compiler directory and create a
-# new tarball.  This is insanely ugly and a layering violation, but building
-# uClibc++ in the cross compiler stage is actually worse.  Compromise by
-# making it a config option.
-
-# export NATIVE_RETROFIT_CXX=1
-
 # Tell the linux kernel, uClibc, and busybox to show the actual build commands
 # instead of pretty-print output.
 
--- a/host-tools.sh	Wed Apr 08 04:28:59 2009 -0500
+++ b/host-tools.sh	Thu Apr 09 23:53:05 2009 -0500
@@ -49,19 +49,20 @@
 
 # If we're not recording the host command lines, then populate a directory
 # with host versions of all the command line utilities we're going to install
-# into mini-native.  When we're done, PATH can be set to include just this
+# into root-filesystem.  When we're done, PATH can be set to include just this
 # directory and nothing else.
 
 # This serves three purposes:
 #
 # 1) Enumerate exactly what we need to build the system, so we can make sure
-#    mini-native has everything it needs to rebuild us.  If anything is missing
-#    from this list, the resulting mini-native probably won't have it either,
-#    so it's nice to know as early as possible that we actually needed it.
+#    root-filesystem has everything it needs to rebuild us.  If anything is
+#    missing from this list, the resulting root-filesystem probably won't have
+#    it either, so it's nice to know as early as possible that we actually
+#    needed it.
 #
 # 2) Quick smoke test that the versions of the tools we're using can compile
-#    everything from source correctly, and thus mini-native should be able to
-#    rebuild from source using those same tools.
+#    everything from source correctly, and thus root-filesystem should be able
+#    to rebuild from source using those same tools.
 #
 # 3) Reduce variation from distro to distro.  The build always uses the
 #    same command line utilities no matter where we're running, because we
@@ -125,8 +126,8 @@
   PATH="${HOSTTOOLS}"
 fi
 
-# This is optionally used by mini-native to accelerate native builds when
-# running under qemu.  It's not used to build mini-native, or to build
+# This is optionally used by root-filesystem to accelerate native builds when
+# running under qemu.  It's not used to build root-filesystem, or to build
 # the cross compiler, but it needs to be on the host system in order to
 # use the distcc acceleration trick.
 
--- a/mini-native.sh	Wed Apr 08 04:28:59 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-#!/bin/bash
-
-# Get lots of predefined environment variables and shell functions.
-
-source sources/include.sh || exit 1
-
-# Purple.  And why not?
-echo -e "$NATIVE_COLOR"
-
-check_for_base_arch mini-native || exit 0
-
-echo "=== Building minimal native development environment"
-
-rm -rf "${NATIVE_ROOT}"
-
-# Determine which directory layout we're using
-
-if [ ! -z "${NATIVE_TOOLSDIR}" ]
-then
-  mkdir -p "${TOOLS}/bin" || dienow
-
-  # Tell the wrapper script where to find the dynamic linker.
-  export UCLIBC_DYNAMIC_LINKER=/tools/lib/ld-uClibc.so.0
-  UCLIBC_TOPDIR="${NATIVE_ROOT}"
-  UCLIBC_DLPREFIX="/tools"
-else
-  mkdir -p "${NATIVE_ROOT}"/{tmp,proc,sys,dev,etc,home} || dienow
-  UCLIBC_TOPDIR="${TOOLS}"
-  for i in bin sbin lib
-  do
-    mkdir -p "$TOOLS/$i" || dienow
-    ln -s "usr/$i" "${NATIVE_ROOT}/$i" || dienow
-  done
-fi
-
-# Copy qemu setup script and so on.
-
-cp -r "${SOURCES}/native/." "${TOOLS}/" &&
-cp "$SRCDIR"/MANIFEST "${TOOLS}/src" || dienow
-
-if [ -z "${NATIVE_TOOLSDIR}" ]
-then
-  sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow
-fi
-
-# Install Linux kernel headers.
-
-setupfor linux
-# Install Linux kernel headers (for use by uClibc).
-make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" &&
-# This makes some very old package builds happy.
-ln -s ../sys/user.h "${TOOLS}/include/asm/page.h" &&
-cd ..
-
-cleanup linux
-
-# Build and install uClibc.  (We could just copy the one from the compiler
-# toolchain, but this is cleaner.)
-
-setupfor uClibc
-make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig &&
-cp .config "${TOOLS}"/src/config-uClibc || dienow
-
-# Alas, if we feed install and install_utils to make at the same time with
-# -j > 1, it dies.  Not SMP safe.
-for i in install install_utils
-do
-  make CROSS="${ARCH}-" KERNEL_HEADERS="${TOOLS}/include" \
-       PREFIX="${UCLIBC_TOPDIR}/" $VERBOSITY \
-       RUNTIME_PREFIX="$UCLIBC_DLPREFIX/" DEVEL_PREFIX="$UCLIBC_DLPREFIX/" \
-       UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow
-done
-cd ..
-
-cleanup uClibc
-
-# Build and install toybox
-
-setupfor toybox
-make defconfig &&
-if [ -z "$USE_TOYBOX" ]
-then
-  make CROSS="${ARCH}-" &&
-  cp toybox "$TOOLS/bin" &&
-  ln -s toybox "$TOOLS/bin/patch" &&
-  ln -s toybox "$TOOLS/bin/oneit" &&
-  ln -s toybox "$TOOLS/bin/netcat" &&
-  cd ..
-else
-  make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" &&
-  rm "${TOOLS}"/bin/sh &&  # Bash won't install if this exists.
-  cd ..
-fi
-
-cleanup toybox
-
-# Build and install busybox
-
-setupfor busybox
-make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
-make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY &&
-make busybox.links &&
-cp busybox "${TOOLS}/bin"
-
-[ $? -ne 0 ] && dienow
-
-for i in $(sed 's@.*/@@' busybox.links)
-do
-  ln -s busybox "${TOOLS}/bin/$i" # || dienow
-done
-cd ..
-
-cleanup busybox
-
-if [ "$NATIVE_TOOLCHAIN" == "none" ]
-then
-    # If we're not installing a compiler, delete the headers, static libs,
-	# and example source code.
-
-    rm -rf "${TOOLS}"/include &&
-    rm -rf "${TOOLS}"/lib/*.a &&
-    rm -rf "${TOOLS}/src" || dienow
-
-elif [ "$NATIVE_TOOLCHAIN" == "headers" ]
-then
-
-# If you want to use a compiler other than gcc, you need to keep the headers,
-# so do nothing here.
-  echo
-
-else
-
-# Build and install native binutils
-
-setupfor binutils build-binutils
-CC="${ARCH}-gcc" AR="${ARCH}-ar" "${CURSRC}/configure" --prefix="${TOOLS}" \
-  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
-  --disable-nls --disable-shared --disable-multilib --program-prefix= \
-  --disable-werror $BINUTILS_FLAGS &&
-make -j $CPUS configure-host &&
-make -j $CPUS &&
-make -j $CPUS install &&
-cd .. &&
-mkdir -p "${TOOLS}/include" &&
-cp binutils/include/libiberty.h "${TOOLS}/include"
-
-cleanup binutils build-binutils
-
-# Build and install native gcc, with c++ support this time.
-
-setupfor gcc-core build-gcc
-setupfor gcc-g++ build-gcc gcc-core
-# GCC tries to "help out in the kitchen" by screwing up the linux include
-# files.  Cut out those bits with sed and throw them away.
-sed -i 's@^STMP_FIX.*@@' "${CURSRC}/gcc/Makefile.in" &&
-# GCC has some deep assumptions about the name of the cross-compiler it should
-# be using.  These assumptions are wrong, and lots of redundant corrections
-# are required to make it stop.
-CC="${ARCH}-gcc" GCC_FOR_TARGET="${ARCH}-gcc" CC_FOR_TARGET="${ARCH}-gcc" \
-  AR="${ARCH}-ar" AR_FOR_TARGET="${ARCH}-ar" AS="${ARCH}-as" LD="${ARCH}-ld" \
-  ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \
-  ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \
-  ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \
-  NM="${ARCH}-nm" NM_FOR_TARGET="${ARCH}-nm" CXX_FOR_TARGET="${ARCH}-g++" \
-  "${CURSRC}/configure" --prefix="${TOOLS}" --disable-multilib \
-  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
-  --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \
-  --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
-  --disable-libstdcxx-pch --program-prefix="" \
-  $GCC_FLAGS &&
-mkdir gcc &&
-ln -s `which "${ARCH}-gcc"` gcc/xgcc &&
-make -j $CPUS configure-host &&
-make -j $CPUS all-gcc &&
-# Work around gcc bug; we disabled multilib but it doesn't always notice.
-ln -s lib "$TOOLS/lib64" &&
-make -j $CPUS install-gcc &&
-rm "$TOOLS/lib64" &&
-ln -s gcc "${TOOLS}/bin/cc" &&
-# Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build).
-# But don't want to build the whole of libstdc++-v3 because
-# A) we're using uClibc++ instead,  B) the build breaks.
-make -j $CPUS configure-target-libstdc++-v3 &&
-cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ &&
-make -j $CPUS &&
-mv .libs/libsupc++.a "$TOOLS"/lib &&
-cd ../../../..
-
-cleanup gcc-core build-gcc
-
-# Move the gcc internal libraries and headers somewhere sane, and
-# build and install gcc wrapper script.
-
-mkdir -p "${TOOLS}"/gcc &&
-mv "${TOOLS}"/lib/gcc/*/*/include "${TOOLS}"/gcc/include &&
-mv "${TOOLS}"/lib/gcc/*/* "${TOOLS}"/gcc/lib &&
-mv "${TOOLS}/bin/gcc" "${TOOLS}/bin/rawgcc" &&
-"${ARCH}-gcc" "${SOURCES}"/toys/ccwrap.c -Os -s -o "${TOOLS}/bin/gcc" \
-  -DGCC_UNWRAPPED_NAME='"rawgcc"' -DGIMME_AN_S &&
-
-# Wrap C++
-mv "${TOOLS}/bin/g++" "${TOOLS}/bin/rawg++" &&
-ln "${TOOLS}/bin/gcc" "${TOOLS}/bin/g++" &&
-rm "${TOOLS}/bin/c++" &&
-ln -s g++ "${TOOLS}/bin/c++"
-
-cleanup "${TOOLS}"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*}
-
-# Tell future packages to link against the libraries in mini-native,
-# rather than the ones in the cross compiler directory.
-
-export WRAPPER_TOPDIR="${TOOLS}"
-
-# Build and install uClibc++
-
-setupfor uClibc++
-CROSS= make defconfig &&
-sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config &&
-sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config &&
-CROSS= make oldconfig &&
-CROSS="$ARCH"- make &&
-CROSS= make install PREFIX="${TOOLS}/c++" &&
-
-# Move libraries somewhere useful.
-
-mv "${TOOLS}"/c++/lib/* "${TOOLS}"/lib &&
-rm -rf "${TOOLS}"/c++/{lib,bin} &&
-ln -s libuClibc++.so "${TOOLS}"/lib/libstdc++.so &&
-ln -s libuClibc++.a "${TOOLS}"/lib/libstdc++.a &&
-cd ..
-
-cleanup uClibc++
-
-# Build and install make
-
-setupfor make
-CC="${ARCH}-gcc" ./configure --prefix="${TOOLS}" --build="${CROSS_HOST}" \
-  --host="${CROSS_TARGET}" &&
-make -j $CPUS &&
-make -j $CPUS install &&
-cd ..
-
-cleanup make
-
-# Remove the busybox /bin/sh link so the bash install doesn't get upset.
-
-rm "$TOOLS"/bin/sh
-
-# Build and install bash.  (Yes, this is an old version.  I prefer it.)
-# I plan to replace it with toysh anyway.
-
-setupfor bash
-# wire around some tests ./configure can't run when cross-compiling.
-cat > config.cache << EOF &&
-ac_cv_func_setvbuf_reversed=no
-bash_cv_sys_named_pipes=yes
-bash_cv_have_mbstate_t=yes
-bash_cv_getenv_redef=no
-EOF
-CC="${ARCH}-gcc" RANLIB="${ARCH}-ranlib" ./configure --prefix="${TOOLS}" \
-  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \
-  --without-bash-malloc --disable-readline &&
-# note: doesn't work with -j
-make &&
-make install &&
-# Make bash the default shell.
-ln -s bash "${TOOLS}/bin/sh" &&
-cd ..
-
-cleanup bash
-
-setupfor distcc
-CC="${ARCH}-cc" ./configure --host="${CROSS_TARGET}" --prefix="${TOOLS}" \
-  --with-included-popt --disable-Werror &&
-make -j $CPUS &&
-make -j $CPUS install &&
-mkdir -p "${TOOLS}/distcc" || dienow
-
-for i in gcc cc g++ c++
-do
-  ln -s ../bin/distcc "${TOOLS}/distcc/$i" || dienow
-done
-cd ..
-
-cleanup distcc
-
-# Put statically and dynamically linked hello world programs on there for
-# test purposes.
-
-"${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -o "${TOOLS}/bin/hello-dynamic"  &&
-"${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static"
-
-[ $? -ne 0 ] && dienow
-
-# Delete some unneeded files
-
-rm -rf "${TOOLS}"/{info,man,libexec/gcc/*/*/install-tools}
-
-# End of NATIVE_TOOLCHAIN
-
-fi
-
-# Clean up and package the result
-
-"${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*}
-"${ARCH}-strip" --strip-unneeded "${TOOLS}"/lib/*.so
-
-create_stage_tarball mini-native
-
-if [ ! -z "$NATIVE_RETROFIT_CXX" ]
-then
-  [ -z "$NATIVE_TOOLSDIR" ] && SUBDIR=usr || SUBDIR=tools
-
-  (cd "${BUILD}/mini-native-$ARCH"/$SUBDIR &&
-   tar c c++ lib/*c++* lib/libgcc_s.so* || dienow) |
-    (tar xC "${BUILD}/cross-compiler-$ARCH" || dienow)
-
-  create_stage_tarball cross-compiler
-fi
-
-# Color back to normal
-echo -e "\e[0mBuild complete"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/root-filesystem.sh	Thu Apr 09 23:53:05 2009 -0500
@@ -0,0 +1,322 @@
+#!/bin/bash
+
+# Get lots of predefined environment variables and shell functions.
+
+source sources/include.sh || exit 1
+
+# Purple.  And why not?
+echo -e "$NATIVE_COLOR"
+
+check_for_base_arch root-filesystem || exit 0
+
+echo "=== Building minimal native development environment"
+
+rm -rf "${NATIVE_ROOT}"
+
+# Determine which directory layout we're using
+
+if [ ! -z "${NATIVE_TOOLSDIR}" ]
+then
+  mkdir -p "${TOOLS}/bin" || dienow
+
+  # Tell the wrapper script where to find the dynamic linker.
+  export UCLIBC_DYNAMIC_LINKER=/tools/lib/ld-uClibc.so.0
+  UCLIBC_TOPDIR="${NATIVE_ROOT}"
+  UCLIBC_DLPREFIX="/tools"
+else
+  mkdir -p "${NATIVE_ROOT}"/{tmp,proc,sys,dev,etc,home} || dienow
+  UCLIBC_TOPDIR="${TOOLS}"
+  for i in bin sbin lib
+  do
+    mkdir -p "$TOOLS/$i" || dienow
+    ln -s "usr/$i" "${NATIVE_ROOT}/$i" || dienow
+  done
+fi
+
+# Copy qemu setup script and so on.
+
+cp -r "${SOURCES}/native/." "${TOOLS}/" &&
+cp "$SRCDIR"/MANIFEST "${TOOLS}/src" || dienow
+
+if [ -z "${NATIVE_TOOLSDIR}" ]
+then
+  sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow
+fi
+
+# Install Linux kernel headers.
+
+setupfor linux
+# Install Linux kernel headers (for use by uClibc).
+make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" &&
+# This makes some very old package builds happy.
+ln -s ../sys/user.h "${TOOLS}/include/asm/page.h" &&
+cd ..
+
+cleanup linux
+
+# Build and install uClibc.  (We could just copy the one from the compiler
+# toolchain, but this is cleaner.)
+
+setupfor uClibc
+make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig &&
+cp .config "${TOOLS}"/src/config-uClibc || dienow
+
+# Alas, if we feed install and install_utils to make at the same time with
+# -j > 1, it dies.  Not SMP safe.
+for i in install install_utils
+do
+  make CROSS="${ARCH}-" KERNEL_HEADERS="${TOOLS}/include" \
+       PREFIX="${UCLIBC_TOPDIR}/" $VERBOSITY \
+       RUNTIME_PREFIX="$UCLIBC_DLPREFIX/" DEVEL_PREFIX="$UCLIBC_DLPREFIX/" \
+       UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow
+done
+cd ..
+
+cleanup uClibc
+
+# Build and install toybox
+
+setupfor toybox
+make defconfig &&
+if [ -z "$USE_TOYBOX" ]
+then
+  make CROSS="${ARCH}-" &&
+  cp toybox "$TOOLS/bin" &&
+  ln -s toybox "$TOOLS/bin/patch" &&
+  ln -s toybox "$TOOLS/bin/oneit" &&
+  ln -s toybox "$TOOLS/bin/netcat" &&
+  cd ..
+else
+  make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" &&
+  rm "${TOOLS}"/bin/sh &&  # Bash won't install if this exists.
+  cd ..
+fi
+
+cleanup toybox
+
+# Build and install busybox
+
+setupfor busybox
+make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
+make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY &&
+make busybox.links &&
+cp busybox "${TOOLS}/bin"
+
+[ $? -ne 0 ] && dienow
+
+for i in $(sed 's@.*/@@' busybox.links)
+do
+  ln -s busybox "${TOOLS}/bin/$i" # || dienow
+done
+cd ..
+
+cleanup busybox
+
+if [ "$NATIVE_TOOLCHAIN" == "none" ]
+then
+    # If we're not installing a compiler, delete the headers, static libs,
+	# and example source code.
+
+    rm -rf "${TOOLS}"/include &&
+    rm -rf "${TOOLS}"/lib/*.a &&
+    rm -rf "${TOOLS}/src" || dienow
+
+elif [ "$NATIVE_TOOLCHAIN" == "headers" ]
+then
+
+# If you want to use a compiler other than gcc, you need to keep the headers,
+# so do nothing here.
+  echo
+
+else
+
+# Build and install native binutils
+
+setupfor binutils build-binutils
+CC="${ARCH}-gcc" AR="${ARCH}-ar" "${CURSRC}/configure" --prefix="${TOOLS}" \
+  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
+  --disable-nls --disable-shared --disable-multilib --program-prefix= \
+  --disable-werror $BINUTILS_FLAGS &&
+make -j $CPUS configure-host &&
+make -j $CPUS &&
+make -j $CPUS install &&
+cd .. &&
+mkdir -p "${TOOLS}/include" &&
+cp binutils/include/libiberty.h "${TOOLS}/include"
+
+cleanup binutils build-binutils
+
+# Build and install native gcc, with c++ support this time.
+
+setupfor gcc-core build-gcc
+setupfor gcc-g++ build-gcc gcc-core
+# GCC tries to "help out in the kitchen" by screwing up the linux include
+# files.  Cut out those bits with sed and throw them away.
+sed -i 's@^STMP_FIX.*@@' "${CURSRC}/gcc/Makefile.in" &&
+# GCC has some deep assumptions about the name of the cross-compiler it should
+# be using.  These assumptions are wrong, and lots of redundant corrections
+# are required to make it stop.
+CC="${ARCH}-gcc" GCC_FOR_TARGET="${ARCH}-gcc" CC_FOR_TARGET="${ARCH}-gcc" \
+  AR="${ARCH}-ar" AR_FOR_TARGET="${ARCH}-ar" AS="${ARCH}-as" LD="${ARCH}-ld" \
+  ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \
+  ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \
+  ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \
+  NM="${ARCH}-nm" NM_FOR_TARGET="${ARCH}-nm" CXX_FOR_TARGET="${ARCH}-g++" \
+  "${CURSRC}/configure" --prefix="${TOOLS}" --disable-multilib \
+  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
+  --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \
+  --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
+  --disable-libstdcxx-pch --program-prefix="" \
+  $GCC_FLAGS &&
+mkdir gcc &&
+ln -s `which "${ARCH}-gcc"` gcc/xgcc &&
+make -j $CPUS configure-host &&
+make -j $CPUS all-gcc &&
+# Work around gcc bug; we disabled multilib but it doesn't always notice.
+ln -s lib "$TOOLS/lib64" &&
+make -j $CPUS install-gcc &&
+rm "$TOOLS/lib64" &&
+ln -s gcc "${TOOLS}/bin/cc" &&
+# Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build).
+# But don't want to build the whole of libstdc++-v3 because
+# A) we're using uClibc++ instead,  B) the build breaks.
+make -j $CPUS configure-target-libstdc++-v3 &&
+cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ &&
+make -j $CPUS &&
+mv .libs/libsupc++.a "$TOOLS"/lib &&
+cd ../../../..
+
+cleanup gcc-core build-gcc
+
+# Move the gcc internal libraries and headers somewhere sane, and
+# build and install gcc wrapper script.
+
+mkdir -p "${TOOLS}"/gcc &&
+mv "${TOOLS}"/lib/gcc/*/*/include "${TOOLS}"/gcc/include &&
+mv "${TOOLS}"/lib/gcc/*/* "${TOOLS}"/gcc/lib &&
+mv "${TOOLS}/bin/gcc" "${TOOLS}/bin/rawgcc" &&
+"${ARCH}-gcc" "${SOURCES}"/toys/ccwrap.c -Os -s -o "${TOOLS}/bin/gcc" \
+  -DGCC_UNWRAPPED_NAME='"rawgcc"' -DGIMME_AN_S &&
+
+# Wrap C++
+mv "${TOOLS}/bin/g++" "${TOOLS}/bin/rawg++" &&
+ln "${TOOLS}/bin/gcc" "${TOOLS}/bin/g++" &&
+rm "${TOOLS}/bin/c++" &&
+ln -s g++ "${TOOLS}/bin/c++"
+
+cleanup "${TOOLS}"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*}
+
+# Tell future packages to link against the libraries in root-filesystem,
+# rather than the ones in the cross compiler directory.
+
+export WRAPPER_TOPDIR="${TOOLS}"
+
+# Build and install uClibc++
+
+setupfor uClibc++
+CROSS= make defconfig &&
+sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config &&
+sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config &&
+CROSS= make oldconfig &&
+CROSS="$ARCH"- make &&
+CROSS= make install PREFIX="${TOOLS}/c++" &&
+
+# Move libraries somewhere useful.
+
+mv "${TOOLS}"/c++/lib/* "${TOOLS}"/lib &&
+rm -rf "${TOOLS}"/c++/{lib,bin} &&
+ln -s libuClibc++.so "${TOOLS}"/lib/libstdc++.so &&
+ln -s libuClibc++.a "${TOOLS}"/lib/libstdc++.a &&
+cd ..
+
+cleanup uClibc++
+
+# Build and install make
+
+setupfor make
+CC="${ARCH}-gcc" ./configure --prefix="${TOOLS}" --build="${CROSS_HOST}" \
+  --host="${CROSS_TARGET}" &&
+make -j $CPUS &&
+make -j $CPUS install &&
+cd ..
+
+cleanup make
+
+# Remove the busybox /bin/sh link so the bash install doesn't get upset.
+
+rm "$TOOLS"/bin/sh
+
+# Build and install bash.  (Yes, this is an old version.  I prefer it.)
+# I plan to replace it with toysh anyway.
+
+setupfor bash
+# wire around some tests ./configure can't run when cross-compiling.
+cat > config.cache << EOF &&
+ac_cv_func_setvbuf_reversed=no
+bash_cv_sys_named_pipes=yes
+bash_cv_have_mbstate_t=yes
+bash_cv_getenv_redef=no
+EOF
+CC="${ARCH}-gcc" RANLIB="${ARCH}-ranlib" ./configure --prefix="${TOOLS}" \
+  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \
+  --without-bash-malloc --disable-readline &&
+# note: doesn't work with -j
+make &&
+make install &&
+# Make bash the default shell.
+ln -s bash "${TOOLS}/bin/sh" &&
+cd ..
+
+cleanup bash
+
+setupfor distcc
+CC="${ARCH}-cc" ./configure --host="${CROSS_TARGET}" --prefix="${TOOLS}" \
+  --with-included-popt --disable-Werror &&
+make -j $CPUS &&
+make -j $CPUS install &&
+mkdir -p "${TOOLS}/distcc" || dienow
+
+for i in gcc cc g++ c++
+do
+  ln -s ../bin/distcc "${TOOLS}/distcc/$i" || dienow
+done
+cd ..
+
+cleanup distcc
+
+# Put statically and dynamically linked hello world programs on there for
+# test purposes.
+
+"${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -o "${TOOLS}/bin/hello-dynamic"  &&
+"${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static"
+
+[ $? -ne 0 ] && dienow
+
+# Delete some unneeded files
+
+rm -rf "${TOOLS}"/{info,man,libexec/gcc/*/*/install-tools}
+
+# End of NATIVE_TOOLCHAIN
+
+fi
+
+# Clean up and package the result
+
+"${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*}
+"${ARCH}-strip" --strip-unneeded "${TOOLS}"/lib/*.so
+
+create_stage_tarball root-filesystem
+
+if [ ! -z "$NATIVE_RETROFIT_CXX" ]
+then
+  [ -z "$NATIVE_TOOLSDIR" ] && SUBDIR=usr || SUBDIR=tools
+
+  (cd "${BUILD}/root-filesystem-$ARCH"/$SUBDIR &&
+   tar c c++ lib/*c++* lib/libgcc_s.so* || dienow) |
+    (tar xC "${BUILD}/cross-compiler-$ARCH" || dienow)
+
+  create_stage_tarball cross-compiler
+fi
+
+# Color back to normal
+echo -e "\e[0mBuild complete"
--- a/sources/include.sh	Wed Apr 08 04:28:59 2009 -0500
+++ b/sources/include.sh	Thu Apr 09 23:53:05 2009 -0500
@@ -92,14 +92,14 @@
   # Say "unknown" in two different ways so it doesn't assume we're NOT
   # cross compiling when the host and target are the same processor.  (If host
   # and target match, the binutils/gcc/make builds won't use the cross compiler
-  # during mini-native.sh, and the host compiler links binaries against the
+  # during root-filesystem.sh, and the host compiler links binaries against the
   # wrong libc.)
   [ -z "$CROSS_HOST" ] && export CROSS_HOST=`uname -m`-walrus-linux
   [ -z "$CROSS_TARGET" ] && export CROSS_TARGET=${ARCH}-unknown-linux
 
   # Setup directories and add the cross compiler to the start of the path.
 
-  [ -z "$NATIVE_ROOT" ] && export NATIVE_ROOT="${BUILD}/mini-native-$ARCH"
+  [ -z "$NATIVE_ROOT" ] && export NATIVE_ROOT="${BUILD}/root-filesystem-$ARCH"
   export PATH="${BUILD}/cross-compiler-$ARCH/bin:$PATH"
 
   if [ ! -z "${NATIVE_TOOLSDIR}" ]
--- a/system-image.sh	Wed Apr 08 04:28:59 2009 -0500
+++ b/system-image.sh	Thu Apr 09 23:53:05 2009 -0500
@@ -1,11 +1,11 @@
 #!/bin/bash
 
-# Create a bootable system image from mini-native
+# Create a bootable system image from root-filesystem
 
 source sources/include.sh || exit 1
 
 echo -e "$PACKAGE_COLOR"
-echo "=== Packaging system image from mini-native"
+echo "=== Packaging system image from root-filesystem"
 
 [ -z "$SYSIMAGE_TYPE" ] && SYSIMAGE_TYPE=ext2