changeset 1743:10b64f52ad20

Make tweak.sh actually work, and do less unnecessary rebuilding.
author Rob Landley <rob@landley.net>
date Sun, 22 Feb 2015 17:00:33 -0600
parents 50c3a1575288
children 4c3164f0d2c2
files build.sh more/tweak.sh system-image.sh
diffstat 3 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Sun Feb 22 16:56:10 2015 -0600
+++ b/build.sh	Sun Feb 22 17:00:33 2015 -0600
@@ -61,6 +61,7 @@
 
 not_already()
 {
+  [ "$AGAIN" == "$1" ] && return 0
   [ "$REBUILD" == "$1" ] && zap "$1"
 
   if [ -f "$BUILD/$1-$ARCH.tar.gz" ]
--- a/more/tweak.sh	Sun Feb 22 16:56:10 2015 -0600
+++ b/more/tweak.sh	Sun Feb 22 17:00:33 2015 -0600
@@ -10,9 +10,12 @@
 
 [ ! -e "$2".sh ] && echo "No stage $2" >&2 && exit 1
 ARCH="$1"
-export STAGE_NAME="$2"
+STAGE="$2"
+[ "$STAGE" == "native-compiler" ] &&
+   STUFF='STAGE_DIR=$STAGE_DIR/usr HOST_ARCH=$ARCH'
 shift
 shift
 
-NO_CLEANUP=1 more/test.sh "$ARCH" "$@" ";create_stage_tarball"
-AFTER="$STAGE_NAME" ./build.sh "$ARCH" "$STAGE_NAME"
+NO_CLEANUP=temp STAGE_NAME="$STAGE" more/test.sh "$ARCH" \
+  $STUFF "$@" ";create_stage_tarball"
+NO_CLEANUP=temp AFTER="$STAGE" ./build.sh "$ARCH" "$STAGE"
--- a/system-image.sh	Sun Feb 22 16:56:10 2015 -0600
+++ b/system-image.sh	Sun Feb 22 17:00:33 2015 -0600
@@ -72,17 +72,19 @@
 
 # Build linux kernel for the target
 
-setupfor linux
-getconfig linux > mini.conf
-[ "$SYSIMAGE_TYPE" == rootfs ] &&
-  echo -e "CONFIG_INITRAMFS_SOURCE=\"$BUILD/root-filesystem-$ARCH/rootfs.cpio.gz\"\n" \
-    >> mini.conf
-make ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS KCONFIG_ALLCONFIG=mini.conf \
-  allnoconfig >/dev/null &&
-make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY &&
-cp "$KERNEL_PATH" "$STAGE_DIR/linux"
-cleanup
-
+if [ -z "$NO_CLEANUP" ] || [ ! -e "$STAGE_DIR/linux" ]
+then
+  setupfor linux
+  getconfig linux > mini.conf
+  [ "$SYSIMAGE_TYPE" == rootfs ] &&
+    echo -e "CONFIG_INITRAMFS_SOURCE=\"$BUILD/root-filesystem-$ARCH/rootfs.cpio.gz\"\n" \
+      >> mini.conf
+  make ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS KCONFIG_ALLCONFIG=mini.conf \
+    allnoconfig >/dev/null &&
+  make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY &&
+  cp "$KERNEL_PATH" "$STAGE_DIR/linux"
+  cleanup
+fi
 # Tar it up.
 
 ARCH="$ARCH_NAME" create_stage_tarball