changeset 325:51bcd6de223d

Redo plumbing that constructs run-emulator.sh. Group common qemu command line options (while still allowing the whole thing to be overridden for a target using a different emulator). This clears the way to hook up run-with-home.sh and run-with-dist.sh
author Rob Landley <rob@landley.net>
date Sat, 03 May 2008 15:29:58 -0500
parents 966e397abd60
children 391ea980fffd
files package-mini-native.sh sources/configs/armv4l sources/configs/armv5l sources/configs/i586 sources/configs/i686 sources/configs/m68k sources/configs/mips sources/configs/mipsel sources/configs/powerpc sources/configs/sh4 sources/configs/sparc sources/configs/x86_64
diffstat 12 files changed, 30 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/package-mini-native.sh	Sat May 03 15:22:55 2008 -0500
+++ b/package-mini-native.sh	Sat May 03 15:29:58 2008 -0500
@@ -30,7 +30,6 @@
 
 # Write out a script to control user mode linux
 TARDEST="mini-native-$ARCH"
-tar c
 cat > "${WORK}/uml-package.sh" << EOF &&
 #!/bin/sh
 mount -n -t ramfs /dev /dev
@@ -50,9 +49,16 @@
 sync
 EOF
 chmod +x ${WORK}/uml-package.sh &&
-linux rootfstype=hostfs rw quiet ARCH=${ARCH} PATH=/bin:/usr/bin:/sbin:/usr/sbin init="${HOSTTOOLS}/oneit -p ${WORK}/uml-package.sh"
+linux rootfstype=hostfs rw quiet ARCH=${ARCH} PATH=/bin:/usr/bin:/sbin:/usr/sbin init="${HOSTTOOLS}/oneit -p ${WORK}/uml-package.sh" || dienow
 
-# Call the appropriate emulator
+function qemu_defaults()
+{
+  echo "-nographic -no-reboot -hda \"$1\" -kernel \"$2\" -append \"$3"
+}
+
+# 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_BASE.
 
 emulator_command image-$ARCH.ext2 zImage-$ARCH \
   'rw init=/tools/bin/qemu-setup.sh panic=1 PATH=$DISTCC_PATH_PREFIX/tools/bin $DISTCC_VARS' \
@@ -64,11 +70,12 @@
 
 function shipit()
 {
-  cd "$WORK" &&
+  cd "$WORK" || dienow
+  rm -rf qemu-image-$ARCH
   mkdir qemu-image-$ARCH &&
   ln {image-$ARCH.ext2,zImage-$ARCH,run-*.sh} \
 	"$SOURCES"/toys/run-with-{distcc,home}.sh \
-	qemu-image-$ARCH &&
+	qemu-image-$ARCH
 
   [ $? -ne 0 ] && dienow
 
--- a/sources/configs/armv4l	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/armv4l	Sat May 03 15:29:58 2008 -0500
@@ -17,9 +17,8 @@
 QEMU_TEST=$KARCH
 emulator_command()
 {
-  echo qemu-system-arm -M versatilepb -nographic -no-reboot -hda "$1" \
-	-kernel "$2" -append "\"$3 root=/dev/sda console=ttyAMA0\"" \
-	-net nic,model=rtl8139 -net user
+  echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \
+	"root=/dev/sda console=ttyAMA0\"" -net nic,model=rtl8139 -net user
 }
 
 # Write out uClibc .config file.
--- a/sources/configs/armv5l	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/armv5l	Sat May 03 15:29:58 2008 -0500
@@ -9,9 +9,8 @@
 QEMU_TEST=$KARCH
 emulator_command()
 {
-  echo qemu-system-arm -M versatilepb -nographic -no-reboot -hda "$1" \
-	-kernel "$2" -append "\"$3 root=/dev/sda console=ttyAMA0\"" \
-	-net nic,model=rtl8139 -net user
+  echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \
+	"root=/dev/sda console=ttyAMA0\"" -net nic,model=rtl8139 -net user
 }
 
 # Write out uClibc .config file.
--- a/sources/configs/i586	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/i586	Sat May 03 15:29:58 2008 -0500
@@ -9,8 +9,7 @@
 
 emulator_command()
 {
-  echo qemu -cpu pentium -nographic -hda "$1" -kernel "$2" \
-	-append "\"$3 root=/dev/hda console=ttyS0\""
+  echo qemu -cpu pentium $(qemu_defaults "$@") "root=/dev/hda console=ttyS0\""
 }
 
 # Write out uClibc .config file.
--- a/sources/configs/i686	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/i686	Sat May 03 15:29:58 2008 -0500
@@ -8,8 +8,7 @@
 
 emulator_command()
 {
-  echo qemu -cpu pentium2 -nographic -hda "$1" -kernel "$2" \
-	-append "\"$3 root=/dev/hda console=ttyS0\""
+  echo qemu -cpu pentium2 $(qemu_defaults "$@") "root=/dev/hda console=ttyS0\""
 }
 
 # Write out uClibc .config file.
--- a/sources/configs/m68k	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/m68k	Sat May 03 15:29:58 2008 -0500
@@ -8,9 +8,8 @@
 QEMU_TEST= #$KARCH
 emulator_command()
 {
-#  echo qemu-system-arm -M versatilepb -nographic -no-reboot -hda "$1" \
-#	-kernel "$2" -append "\"$3 root=/dev/sda console=ttyAMA0\"" \
-#	-net nic,model=rtl8139 -net user
+#  echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \
+#  "root=/dev/sda console=ttyAMA0\"" -net nic,model=rtl8139 -net user
   echo
 }
 
--- a/sources/configs/mips	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/mips	Sat May 03 15:29:58 2008 -0500
@@ -8,8 +8,8 @@
 
 emulator_command()
 {
-  echo qemu-system-mips -M mips -no-reboot -nographic -hda "$1" -kernel "$2" \
-	-append "\"$3 console=ttyS0 root=/dev/hda\""
+  echo qemu-system-mips -M mips $(qemu_defaults "$@") \
+	"console=ttyS0 root=/dev/hda\""
 }
 
 # Write out uClibc .config file.
--- a/sources/configs/mipsel	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/mipsel	Sat May 03 15:29:58 2008 -0500
@@ -8,8 +8,8 @@
 
 emulator_command()
 {
-  echo qemu-system-mipsel -M mips -no-reboot -nographic -hda "$1" -kernel "$2" \
-	-append "\"$3 console=ttyS0 root=/dev/hda\""
+  echo qemu-system-mipsel -M mips $(qemu_defaults "$@") \
+	"console=ttyS0 root=/dev/hda\""
 }
 
 # Write out uClibc .config file.
--- a/sources/configs/powerpc	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/powerpc	Sat May 03 15:29:58 2008 -0500
@@ -1,10 +1,5 @@
 # Power PC system
 
-# XXX Status: Builds but doesn't run under qemu system emulation, due to Open Firmware being
-# evil and workarounds not quite making it into the linux kernel tree yet.  This is as much a qemu
-# problem as a Linux problem, supply the appropriate kernel .config and it should run on real
-# hardware just fine.
-
 KARCH=powerpc
 KERNEL_PATH=arch/${KARCH}/boot/zImage
 GCC_FLAGS=
@@ -12,8 +7,8 @@
 QEMU_TEST= #ppc
 emulator_command()
 {
-  echo qemu-system-ppc -M prep -nographic -hda "$1" \
-	-kernel "$2" -append "\"$3 root=/dev/hda console=ttyS0\"" -L .
+  echo qemu-system-ppc -M prep $(qemu_defaults "$@") \
+	"root=/dev/hda console=ttyS0\"" -L .
 }
 
 # Write out Linux kernel .config file
--- a/sources/configs/sh4	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/sh4	Sat May 03 15:29:58 2008 -0500
@@ -6,9 +6,8 @@
 QEMU_TEST=$KARCH
 emulator_command()
 {
-#  echo qemu-system-arm -M versatilepb -nographic -no-reboot -hda "$1" \
-#	-kernel "$2" -append "\"$3 root=/dev/sda console=ttyAMA0\"" \
-#	-net nic,model=rtl8139 -net user
+#  echo qemu-system-arm -M versatilepb $(qemu_defaults "$@") \
+#	"root=/dev/sda console=ttyAMA0\"" -net nic,model=rtl8139 -net user
   echo
 }
 
--- a/sources/configs/sparc	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/sparc	Sat May 03 15:29:58 2008 -0500
@@ -9,8 +9,7 @@
 QEMU_TEST=$KARCH
 emulator_command()
 {
-  echo qemu-system-sparc -nographic -no-reboot -hda "$1" \
-        -kernel "$2" -append "\"$3 root=/dev/sda console=ttyS0\""
+  echo qemu-system-sparc $(qemu_defaults "$@") "root=/dev/sda console=ttyS0\""
 }
 
 
--- a/sources/configs/x86_64	Sat May 03 15:22:55 2008 -0500
+++ b/sources/configs/x86_64	Sat May 03 15:29:58 2008 -0500
@@ -6,8 +6,7 @@
 
 emulator_command()
 {
-  echo qemu-system-x86_64 -nographic -hda "$1" -kernel "$2" \
-	-append "\"$3 root=/dev/hda console=ttyS0\""
+  echo qemu-system-x86_64 $(qemu_defaults "$@") "root=/dev/hda console=ttyS0\""
 }
 
 # Write out uClibc .config file.