view more/ @ 1213:65d1e11679af

Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
author Rob Landley <>
date Wed, 18 Aug 2010 17:07:13 -0500
line wrap: on
line source


# Combine a control image and a root-filesystem image into an $ARCH-specific
# chroot containing native build control files in /mnt.

if [ $# -ne 2 ]
  echo 'usage: ./ $ARCH $CONTROL_IMAGE' >&2
  exit 1

# Zap old stuff (if any)

rm -rf build/root-filesystem-"$1" build/chroot-"$1" &&

# Make sure the root filesystem is there for this $ARCH

./ "$1" &&

# Build control image.

mkdir -p build/host-temp &&
rm -rf build/host-temp/"$2".hdc &&
sources/native-builds/"$2".sh build/host-temp/"$2".hdc &&

# Combine the control image's files with the root filesystem and rename result.

rm -rf build/control-in-chroot-"$1" build/root-filesystem-"$1"/mnt &&
mv build/host-temp/"$2" build/root-filesystem-"$1"/mnt &&
mv build/root-filesystem-"$1" build/control-in-chroot-"$1" &&

# Tar it up

tar -cvj -f build/control-in-chroot-"$1".tar.bz2 -C build control-in-chroot-"$1" &&

# Output some usage hints

echo "export CPUS=1 HOST=$1 && cd /home && /mnt/init" &&
echo "sudo chroot build/control-in-chroot-"$1" /sbin/"