diff include.sh @ 306:358ef8a27085

Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic. Now that it's making a qemu-image tarball, the kernel and ext2 image files are temporary files, so put them in temp-$ARCH. Don't delete temp-$ARCH at the start of build stages, don't delete old source at start of setupfor (g++ adds to gcc-core). Run scripts are now three layers: run-with-distcc.sh, run-with-home.sh, and run-emulator.sh. Each calls the next after adding some behavior, you can call later scripts directly if you don't want that behavior. The first enables distcc, the second provides a second virtual drive (/dev/hdb) with extra space to build in, and the third fires up qemu.
author Rob Landley <rob@landley.net>
date Wed, 27 Feb 2008 22:32:25 -0600
parents 309b574a5059
children 7a6033813fe5
line wrap: on
line diff
--- a/include.sh	Tue Feb 26 19:11:28 2008 -0600
+++ b/include.sh	Wed Feb 27 22:32:25 2008 -0600
@@ -200,7 +200,11 @@
 
   echo "=== Building $1 ($ARCH_NAME)"
   echo "Snapshot '$1'..."
-  cd "${WORK}" &&
+  cd "${WORK}" || dienow
+  if [ $# -lt 3 ]
+  then
+    rm -rf "${CURSRC}" || dienow
+  fi
   mkdir -p "${CURSRC}" &&
   cp -lfR "${SRCTREE}/$1/"* "${CURSRC}"
 
@@ -265,7 +269,6 @@
   # Which platform are we building for?
 
   export WORK="${BUILD}/temp-$ARCH"
-  rm -rf "${WORK}"
   mkdir -p "${WORK}"
   # 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
@@ -284,42 +287,6 @@
   export CROSS="${BUILD}/cross-compiler-$ARCH"
   export NATIVE="${BUILD}/mini-native-$ARCH"
   export PATH="${CROSS}/bin:$PATH"
-  export IMAGE="${BUILD}/image-${ARCH}.ext2"
-
-  # output run-$ARCH.sh script
-
-  # Start with distcc setup
-
-  cat > "$BUILD/run-$ARCH.sh" << 'EOF'
-#!/bin/bash
-
-if [ "$1" == "--crosspath" ]
-then
-  DCC="$(which distccd)"
-  [ -z "$DCC" ] && DCC="$2"/host/distcc
-  PATH="$(readlink -f "$2/distcc")" "$DCC" --listen 127.0.0.1 --log-stderr \
-  --log-level error --daemon -a 127.0.0.1 --no-detach & # 2>/dev/null
-  DCC1=/tools/distcc:
-  CPUS=$[$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)+1]
-  DCC2="DISTCC_HOSTS=10.0.2.2 CPUS=$CPUS"
-else
-  DCC1=
-  DCC2=
-  CPUS="CPUS=1"
-fi
-EOF
-
-  # Call the appropriate emulator
-
-  emulator_command image-$ARCH.ext2 zImage-$ARCH \
-    'rw init=/tools/bin/qemu-setup.sh panic=1 PATH=$DCC1/tools/bin $DCC2' \
-    >> "$BUILD/run-$ARCH.sh" &&
-
-  # distcc cleanup
-
-  echo -e '\nkill `jobs -p`' >> "$BUILD/run-$ARCH.sh" &&
-  chmod +x "$BUILD/run-$ARCH.sh"
-
 else
   export WORK="${BUILD}/host-temp"
   mkdir -p "${WORK}"