changeset 649:950ef7de1cf9

Add qemu to host-tools.sh. If HOST_BUILD_EXTRA set, compile from source, otherwise symlink it from host. (Note that ppc --nographic and sh4 --append are currently broken in host version of qemu.)
author Rob Landley <rob@landley.net>
date Tue, 24 Mar 2009 21:23:15 -0500
parents a72f7f70c003
children 7a4ea7f6dc3d
files config download.sh host-tools.sh run-from-build.sh
diffstat 4 files changed, 57 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/config	Tue Mar 24 19:36:07 2009 -0500
+++ b/config	Tue Mar 24 21:23:15 2009 -0500
@@ -44,9 +44,21 @@
 
 # export SNAPSHOT_SYMLINK=1
 
+# Set this to build packages the host system doesn't need in order to build
+# a cross compiler, root filesystem, or system image, but which is needed
+# to boot a system image with run-emulator.sh.  Specifically, this means
+# building qemu and e2fsprogs.  (Note that the qemu build takes a very long
+# time and consumes a lot of memory.)
+
+# If you don't enable this, host-tools.sh will attempt to symlink these
+# commands out of the host $PATH, although it won't fail if it can't find
+# them (unlink symlinking the host toolchain).
+
+# export HOST_BUILD_EXTRA=1
+
 # If this is set, try downloading packages from this location first.
 
-# export PREFERRED_MIRROR=http://landley.net/code/firmware/mirror
+# export PREFERRED_MIRROR=http://impactlinux.com/fml/mirror
 
 # If this is set, the toybox utilities will take precedence over busybox ones.
 
--- a/download.sh	Tue Mar 24 19:36:07 2009 -0500
+++ b/download.sh	Tue Mar 24 21:23:15 2009 -0500
@@ -98,7 +98,7 @@
 # but the following packages are not cross compiled for the target, and thus
 # do not wind up in the system image.)
 
-if [ ! -z "$BUILD_HOST_EXTRA" ]
+if [ ! -z "$HOST_BUILD_EXTRA" ]
 then
   URL=http://download.savannah.nongnu.org/releases/qemu/qemu-0.10.1.tar.gz \
   SHA1=d1cafd4751e4feee606feb844dec4762713b2b69 \
--- a/host-tools.sh	Tue Mar 24 19:36:07 2009 -0500
+++ b/host-tools.sh	Tue Mar 24 21:23:15 2009 -0500
@@ -200,6 +200,49 @@
   cleanup squashfs
 fi
 
+# Here's some stuff that isn't used to build a cross compiler or system
+# image, but is used by run-from-build.sh.  By default we assume it's
+# installed on the host you're running system images on (which may not be
+# the one you're building them on).
+
+# Either build qemu from source, or symlink it.
+
+if [ ! -z "$HOST_BUILD_EXTRA" ]
+then
+
+  # Build qemu.  Note that this is _very_slow_.  (It takes about as long as
+  # building a system image from scratch, including the cross compiler.)
+
+  # It's also ugly: its wants to populate a bunch of subdirectories under
+  # --prefix, and we can't just install it in host-temp and copy out what
+  # we want because the pc-bios directory needs to exist at a hardwired
+  # absolute path.
+
+  if [ -z "$(which qemu)" ]
+  then
+    setupfor qemu &&
+    ./configure --disable-gfx-check --prefix="$HOSTTOOLS/qemu-stuff" &&
+    make -j "$CPUS" &&
+    make install &&
+    mv "$HOSTTOOLS/qemu-stuff/bin/*" "$HOSTTOOLS" &&
+    cd ..
+
+    cleanup qemu
+  fi
+else
+
+  # Symlink qemu out of the host, if found.  Since run-from-build.sh uses
+  # $PATH=.../build/host if it exists, add the various qemu instances to that.
+
+  echo "$PATH" | sed 's/:/\n/g' | while read i
+  do
+    for j in $(cd "$i"; ls qemu-system-* 2>/dev/null)
+    do
+      ln -s "$i/$j" "$HOSTTOOLS/$j"
+    done
+  done
+fi
+
 if [ ! -z "$RECORD_COMMANDS" ]
 then 
   # Make sure the host tools we just built are also in wrapdir
--- a/run-from-build.sh	Tue Mar 24 19:36:07 2009 -0500
+++ b/run-from-build.sh	Tue Mar 24 21:23:15 2009 -0500
@@ -1,12 +1,7 @@
 #!/bin/bash
 
-SAVEPATH="$PATH"
 source sources/include.sh
 
-# Some distros don't put /sbin:/usr/sbin in the $PATH for non-root users.
-export PATH="$SAVEPATH"
-[ -z "$(which mke2fs)" ] && PATH=/sbin:/usr/sbin:$PATH
-
 cd "${BUILD}/system-image-$ARCH_NAME" || exit 1
 
 # A little paranoia.