view system-image.sh @ 1477:431d5b4ee537

Switch from busybox defconfig to baseconfig-busybox selecting just what we need, with a config variable to use defconfig instead if you really want that. Busybox defconfig doesn't build on Ubuntu 11.10 because of an app that didn't exist until recently breaking. Busybox keeps ininitely adding more and more stuff (with the Katamari Damacy theme playing), and it becomes more of a portability issue keeping it all working. Plus, most if it should not be in busybox anyway. I've revived my toybox project, and would eventually like to be able to use that here anyway, and a specific set of functionality is easier to replace than a moving target. This is an experimentally determined defconfig good enough to build aboriginal and linux from scratch, plus things like vi and shell history that I obviously missed. I'll probably add more stuff later. If I still want to do static defconfig busybox binaries for each target, I can do them as native builds via hdc.
author Rob Landley <rob@landley.net>
date Tue, 27 Dec 2011 08:58:16 -0600
parents 5a0ca606858b
children 29109240fd6d
line wrap: on
line source

#!/bin/bash

# Combine a filesystem image and kernel with emulator launch scripts.

source sources/include.sh || exit 1

# Parse sources/targets/$1

load_target "$1"

cd "$BUILD/linux-kernel-$ARCH_NAME" &&
KERNEL="$(ls)" &&
ln "$KERNEL" "$STAGE_DIR" &&
cd "$BUILD/root-image-$ARCH" &&
IMAGE="$(ls)" &&
ln "$IMAGE" "$STAGE_DIR" || dienow

# Provide qemu's common command line options between architectures.

kernel_cmdline()
{
  [ "$SYSIMAGE_TYPE" != "initramfs" ] &&
    echo -n "root=/dev/$ROOT rw init=/sbin/init.sh "

  echo -n "panic=1 PATH=\$DISTCC_PATH_PREFIX/bin:/sbin console=$CONSOLE"
  echo -n " HOST=$ARCH ${KERNEL_EXTRA}\$KERNEL_EXTRA"
}

qemu_defaults()
{
  echo -n "-nographic -no-reboot -kernel $KERNEL"
  [ "$SYSIMAGE_TYPE" != "initramfs" ] && echo -n " -hda $IMAGE"
  echo -n " -append \"$(kernel_cmdline)\" \$QEMU_EXTRA"
}

# Write out a script to call the appropriate emulator.  We split out the
# filesystem, kernel, and base kernel command line arguments in case you want
# to use an emulator other than qemu, but put the default case in qemu_defaults

cat > "$STAGE_DIR/run-emulator.sh" << EOF &&
ARCH=$ARCH
run_emulator()
{
  [ ! -z "\$DEBUG" ] && set -x
  $(emulator_command)
}

if [ "\$1" != "--norun" ]
then
  run_emulator
fi
EOF
chmod +x "$STAGE_DIR/run-emulator.sh" &&

# Write out development wrapper scripts, substituting INCLUDE lines.

[ -z "$NO_NATIVE_COMPILER" ] && for FILE in dev-environment.sh native-build.sh
do
  (export IFS="$(echo -e "\n")"
   cat "$SOURCES/toys/$FILE" | while read -r i
   do
     if [ "${i:0:8}" == "INCLUDE " ]
     then
       cat "$SOURCES/toys/${i:8}" || dienow
     else
       # because echo doesn't support --, that's why.
       echo "$i" || dienow
     fi
   done
  ) > "$STAGE_DIR/$FILE"

  chmod +x "$STAGE_DIR/$FILE" || dienow
done

# Tar it up.

ARCH="$ARCH_NAME" create_stage_tarball

announce "Packaging complete"