changeset 2:1a7e1616ab9d

Convert builds to use the new layout.
author Rob Landley <rob@landley.net>
date Tue, 05 Jul 2011 04:58:44 -0500
parents e6cf96654ab1
children 4c679e447ffc
files build.sh common/builder.sh common/include.sh common/utility_functions.sh images/busybox-test/build.sh images/gentoo-bootstrap/build.sh images/hello-world/build.sh images/lfs-bootstrap/build.sh images/static-tools/build.sh
diffstat 9 files changed, 83 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -0,0 +1,9 @@
+#/bin/bash
+
+if [ -z "$1" ] || [ ! -x "images/$1/build.sh" ]
+then
+  echo "Available images:"
+  ls images
+fi
+
+images/"$1"/build.sh
--- a/common/builder.sh	Tue Jul 05 04:57:29 2011 -0500
+++ b/common/builder.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -1,47 +1,24 @@
 #!/bin/bash
 
-# Control image generator infrastructure.
+# Control image generation infrastructure using common bootstrap files.
 
-source sources/include.sh || exit 1
-
-# Find path to our working directory.
-
-MYDIR="$(readlink -f "$(dirname "$(which "$0")")")"
-IMAGENAME="${MYDIR/*\//}"
-
-# Use our own directories for downloaded source tarballs and patches.
-# (We may have the same packages as the aboriginal build, but use different
-# versions, and we don't want our cleanup_oldfiles to overlap.)
-
-PATCHDIR="$MYDIR/patches"
-SRCDIR="$SRCDIR/control-images/$IMAGENAME" && mkdir -p "$SRCDIR" || dienow
-
-# Include package cache in the control image, so the target system image can
-# build from this source.
-
-WORK="$BUILD/control-images/$IMAGENAME" &&
-blank_tempdir "$WORK" &&
-SRCTREE="$WORK/packages" &&
-mkdir "$SRCTREE" &&
+source common/include.sh
 
 # Copy common infrastructure to target
 
-cp "$MYDIR"/../bootstrap-skeleton/mnt/* "$WORK" || exit 1
+cp "$TOP/common/"{utility_functions.sh,bootstrap/*} "$WORK" || exit 1
 if [ -e "$MYDIR/mnt" ]
 then
   cp -a "$MYDIR/mnt/." "$WORK" || exit 1
 fi
 
-# Populate packages directory
+# Put package cache in the control image, so the target system image can
+# build from this source.
 
-echo "=== $IMAGENAME: Download/extract source code"
-
-EXTRACT_ALL=1
-
-source "$MYDIR"/download.sh || exit 1
+SRCTREE="$WORK/packages" &&
+mkdir "$SRCTREE" &&
+announce "Download/extract source code" &&
+EXTRACT_ALL=1 source "$MYDIR"/download.sh || exit 1
 
 cleanup_oldfiles
-
-# Create sqaushfs image
-
-mksquashfs "$WORK" "$WORK.hdc" -noappend -all-root || dienow
+squash_image
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/include.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# Grab common shell functions
+
+source common/utility_functions.sh || exit 1
+source common/download_functions.sh || exit 1
+
+# Figure out where everything is:
+
+[ -z "$TOP" ] && TOP="$(pwd)"
+[ -z "$BUILD" ] && BUILD="$TOP/build"
+
+# what directory is this script in, and what's that directory called?
+[ -z "$MYDIR" ] && MYDIR="$(readlink -f "$(dirname "$(which "$0")")")"
+[ -z "$IMAGENAME" ] && IMAGENAME="${MYDIR/*\//}"
+
+# Directories for downloaded source tarballs and patches.
+
+[ -z "$PATCHDIR" ] && PATCHDIR="$MYDIR/patches"
+[ -z "$SRCDIR" ] && SRCDIR="$TOP/packages/$IMAGENAME"
+mkdir -p "$SRCDIR" || dienow
+
+# Put package cache in the control image, so the target system image can
+# build from this source.
+
+WORK="$TOP/build/$IMAGENAME" &&
+SRCTREE="$WORK" &&
+blank_tempdir "$WORK" &&
+
+squash_image()
+{
+  # Create squashfs image
+
+  if [ ! -z "$(which mksquashfs)" ]
+  then
+    mksquashfs "$WORK" "$WORK.hdc" -noappend -all-root || dienow
+  else
+    echo "No mksquashfs in path"
+  fi
+}
--- a/common/utility_functions.sh	Tue Jul 05 04:57:29 2011 -0500
+++ b/common/utility_functions.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -154,9 +154,7 @@
 
 path_search()
 {
-  # For each each $PATH element, loop through each file in that directory,
-  # and create a symlink to the wrapper with that name.  In the case of
-  # duplicates, keep the first one.
+  # For each each $PATH element, for each file in that directory, run command.
 
   echo "$1" | sed 's/:/\n/g' | while read DIR
   do
--- a/images/busybox-test/build.sh	Tue Jul 05 04:57:29 2011 -0500
+++ b/images/busybox-test/build.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -2,14 +2,15 @@
 
 # Run the busybox test suite.
 
-source sources/include.sh || exit 1
-
-WORK="$BUILD/control-images/busybox-test" && blank_tempdir "$WORK"
+source common/include.sh || exit 1
 
 # Don't download busybox, it's got to already be there in standard sources.
 
-setupfor busybox
-cd "$TOP"
+EXTRACT_ALL=1
+
+URL=http://www.busybox.net/downloads/busybox-1.18.4.tar.bz2 \
+SHA1=d285855e5770b0fb7caf477dd41ce0863657b975 \
+maybe_fork "download || dienow"
 
 cat > "$WORK"/init << 'EOF' || dienow
 #!/bin/bash
@@ -27,7 +28,6 @@
 sync
 
 EOF
-
 chmod +x "$WORK"/init || dienow
 
-mksquashfs "$WORK" "$WORK.hdc" -noappend -all-root
+squash_image
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/images/gentoo-bootstrap/build.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -0,0 +1,1 @@
+../../common/builder.sh
\ No newline at end of file
--- a/images/hello-world/build.sh	Tue Jul 05 04:57:29 2011 -0500
+++ b/images/hello-world/build.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -1,16 +1,18 @@
 #!/bin/bash
 
+# Simple self-contained build control image creation script.  Doesn't use
+# the bootstrap skeleton, instead compiles and runs the threaded "hello world"
+# program from the Aboriginal Linux /usr/src directory as a build environment
+# smoketest.  Grep the output for "Hello world!" to test for success.
+
 # Download all the source tarballs we haven't got up-to-date copies of.
 
 # The tarballs are downloaded into the "packages" directory, which is
 # created as needed.
 
-source sources/include.sh || exit 1
+source common/include.sh || exit 1
 
-# Set up working directories
-
-WORK="$BUILD/control-images/hello-world"
-blank_tempdir "$WORK"
+# Write init script via a "here" document.
 
 cat > "$WORK"/init << 'EOF' || dienow
 #!/bin/bash
@@ -32,6 +34,4 @@
 
 chmod +x "$WORK"/init || dienow
 
-cd "$TOP"
-
-mksquashfs "$WORK" "$WORK.hdc" -noappend -all-root
+squash_image
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/images/lfs-bootstrap/build.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -0,0 +1,1 @@
+../../common/builder.sh
\ No newline at end of file
--- a/images/static-tools/build.sh	Tue Jul 05 04:57:29 2011 -0500
+++ b/images/static-tools/build.sh	Tue Jul 05 04:58:44 2011 -0500
@@ -5,12 +5,7 @@
 # The tarballs are downloaded into the "packages" directory, which is
 # created as needed.
 
-source sources/include.sh || exit 1
-
-PATCHDIR="$SOURCES/control-images/static-tools-patches"
-SRCDIR="$SRCDIR/static-tools" && mkdir -p "$SRCDIR" || dienow
-WORK="$BUILD/control-images/static-tools" && blank_tempdir "$WORK"
-SRCTREE="$WORK"
+source common/include.sh || exit 1
 
 EXTRACT_ALL=1
 
@@ -27,12 +22,12 @@
 maybe_fork "download || dienow"
 
 URL=http://matt.ucc.asn.au/dropbear/releases/dropbear-0.53.1.tar.bz2 \
-SHA1= \
+SHA1=01d9c6673b2b20659b8557cfe6de8386a94f4801 \
 maybe_fork download || dienow
 
-URL=http://kernel.org/pub/software/utils/pciutils/pciutils-3.1.7.tar.bz2 \
-SHA1= \
-maybe_fork download || dienow
+#URL=http://kernel.org/pub/software/utils/pciutils/pciutils-3.1.7.tar.bz2 \
+#SHA1= \
+#maybe_fork download || dienow
 
 echo === Got all source.
 
@@ -91,4 +86,4 @@
 
 cd "$TOP"
 
-mksquashfs "$WORK" "$WORK.hdc" -noappend -all-root
+squash_image