changeset 713:9282f84b31a1

Add NATIVE_TOOLCHAIN=only, to build _just_ the native toolchain (sae set of packages as the cross compiler, only --enable-shared and with uClibc++).
author Rob Landley <rob@landley.net>
date Fri, 10 Apr 2009 03:32:41 -0500
parents 9d766670154a
children db04bd3c11e0
files config root-filesystem.sh
diffstat 2 files changed, 66 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/config	Fri Apr 10 03:29:29 2009 -0500
+++ b/config	Fri Apr 10 03:32:41 2009 -0500
@@ -10,9 +10,12 @@
 # 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
 # like to build your own native toolchain based on a different compiler).
+# If you set it to "only", it'll build a native toolchain (binutils, gcc,
+# uClibc, and the kernel headers) and nothing else.
 
 # export NATIVE_TOOLCHAIN=none
 # export NATIVE_TOOLCHAIN=headers
+# export NATIVE_TOOLCHAIN=only
 
 # If this is set, root-filesystem will build a Linux From Scratch style /tools
 # directory instead of a more conventional filesystem layout in /usr.
--- a/root-filesystem.sh	Fri Apr 10 03:29:29 2009 -0500
+++ b/root-filesystem.sh	Fri Apr 10 03:32:41 2009 -0500
@@ -33,16 +33,6 @@
   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
@@ -59,7 +49,7 @@
 
 setupfor uClibc
 make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig &&
-cp .config "${TOOLS}"/src/config-uClibc || dienow
+cp .config "${WORK}"/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.
@@ -74,44 +64,6 @@
 
 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,
@@ -231,6 +183,61 @@
 
 cleanup uClibc++
 
+fi # End of NATIVE_TOOLCHAIN build
+
+if [ "$NATIVE_TOOLCHAIN" != "only" ]
+then
+
+# Copy qemu setup script and so on.
+
+cp -r "${SOURCES}/native/." "${TOOLS}/" &&
+cp "$SRCDIR"/MANIFEST "${TOOLS}/src" &&
+cp "${WORK}/config-uClibc" "${TOOLS}/src/config-uClibc" || dienow
+
+if [ -z "${NATIVE_TOOLSDIR}" ]
+then
+  sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow
+fi
+
+# 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}-" &&
+  cd ..
+fi
+
+cleanup toybox
+
+# Build and install busybox
+
+setupfor busybox
+make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
+cp .config "${TOOLS}"/src/config-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
+  # Allowed to fail.
+  ln -s busybox "${TOOLS}/bin/$i" 2>/dev/null
+done
+cd ..
+
+cleanup busybox
+
 # Build and install make
 
 setupfor make
@@ -242,14 +249,11 @@
 
 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.
+# Build and install bash.  (Yes, this is an old version.  It's intentional.)
 
 setupfor bash
+# Remove existing /bin/sh link (busybox) so the bash install doesn't get upset.
+#rm "$TOOLS"/bin/sh
 # wire around some tests ./configure can't run when cross-compiling.
 cat > config.cache << EOF &&
 ac_cv_func_setvbuf_reversed=no
@@ -264,7 +268,7 @@
 make &&
 make install &&
 # Make bash the default shell.
-ln -s bash "${TOOLS}/bin/sh" &&
+ln -sf bash "${TOOLS}/bin/sh" &&
 cd ..
 
 cleanup bash
@@ -287,19 +291,17 @@
 # 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 -o "${TOOLS}/bin/hello-dynamic" &&
 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static"
 
 [ $? -ne 0 ] && dienow
 
+fi   # End of NATIVE_TOOLCHAIN != only
+
 # 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/*/*/*}
@@ -307,16 +309,5 @@
 
 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"