summaryrefslogtreecommitdiffstats
path: root/run
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2012-09-27 18:29:58 +0200
committerJan Luebbe <jlu@pengutronix.de>2012-09-27 18:29:58 +0200
commit33d389ac4c1494977315e47a34e0ebcd3ecef86a (patch)
treed1b5b4f105893b9a5569a97a40b91bbabe959a07 /run
downloadplatform-pengutronix-i686-qemu-33d389ac4c1494977315e47a34e0ebcd3ecef86a.tar.gz
platform-pengutronix-i686-qemu-33d389ac4c1494977315e47a34e0ebcd3ecef86a.tar.xz
i686-qemu: add platform
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Diffstat (limited to 'run')
-rwxr-xr-xrun89
1 files changed, 89 insertions, 0 deletions
diff --git a/run b/run
new file mode 100755
index 0000000..39ea0aa
--- /dev/null
+++ b/run
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# For some information about how to work with qemu for ARM, please
+# refer: http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu
+
+
+platformconfig=selected_platformconfig
+# fallback to platformconfig in the same dir as this script
+if [ ! -e "$platformconfig" ]; then
+ platformconfig=$(dirname $0)/platformconfig
+fi
+
+#
+# we need information about the platform
+#
+if [ ! -e "$platformconfig" ]; then
+ echo "error: selected_platformconfig does not exist"
+ echo " please use 'ptxdist platform ...' or 'ptxdist --platformconfig=...'"
+ exit 1
+fi
+
+source $platformconfig
+
+if [ -n "${PTXCONF_PLATFORM}" ]; then
+ PTXDIST_PLATFORMDIR="./platform-${PTXCONF_PLATFORM}"
+else
+ PTXDIST_PLATFORMDIR="."
+fi
+
+if [ ! -e "${PTXDIST_PLATFORMDIR}/images/linuximage" ]; then
+ echo "error: run 'ptxdist go' first"
+ exit 1
+fi
+
+if [ ! -e "${PTXDIST_PLATFORMDIR}/images/hd.img" ]; then
+ echo "error: run 'ptxdist images' first"
+ exit 1
+fi
+
+# the emulator to run
+QEMU_EXEC=qemu-system-${PTXCONF_ARCH_STRING}
+
+# disable this, if you want to have some graphics output
+QEMU_NOGRAPHIC=-nographic
+
+# Machine to emulate: The default kernel is prepared to run on "versatile pb"
+QEMU_MACHINE=pc
+
+#
+# 'user mode' network related settings
+#
+PLATFORM_IP="10.0.2.7"
+
+# the port a 'telned' would connect to (in the emulated sysem)
+TELNET_INTERNAL_PORT=23
+# port QEMU opens at the host side to give access to the ${TELNET_INTERNAL_PORT}
+TELNET_EXTERNAL_PORT=4444
+
+if [ -z "${VDE_SOCKET}" ]; then
+ for dir in $(ls -d /var/run/vde2/*.ctl 2>/dev/null); do
+ if [ -r "${dir}" ]; then
+ VDE_SOCKET="${dir}"
+ fi
+ done
+fi
+if [ -n "${VDE_SOCKET}" ]; then
+ if ${QEMU_EXEC} --help | grep -q -- '-net vde'; then
+ QEMU_NET="-net vde,vlan=1,sock=${VDE_SOCKET}"
+ fi
+fi
+if [ -z "${QEMU_NET}" ]; then
+ QEMU_NET="-net user,vlan=1"
+fi
+
+# use this to load a kernel directly without grub
+QEMU_KERNEL=" \
+ -kernel ${PTXDIST_PLATFORMDIR}/images/linuximage \
+ -append \"root=/dev/sda1 console=ttyS0,115200 ro\" \
+ "
+
+# do the job
+${QEMU_EXEC} ${QEMU_NOGRAPHIC} \
+ -M ${QEMU_MACHINE} \
+ -no-reboot \
+ -net nic,vlan=1 \
+ ${QEMU_NET} \
+ -redir tcp:${TELNET_EXTERNAL_PORT}:${PLATFORM_IP}:${TELNET_INTERNAL_PORT} \
+ -watchdog i6300esb -watchdog-action poweroff \
+ -hda ${PTXDIST_PLATFORMDIR}/images/hd.img