summaryrefslogtreecommitdiffstats
path: root/configs
diff options
context:
space:
mode:
authorRobert Schwebel <r.schwebel@pengutronix.de>2016-06-07 21:07:09 +0200
committerRobert Schwebel <r.schwebel@pengutronix.de>2016-06-07 21:07:09 +0200
commit061b89e07dbc3398277f696a55abbe60d70f4107 (patch)
tree246dbbe33273a0db8a21e5410a7cbaf4493f4150 /configs
parent560777db6cc97495b00802427b6806ae88ce8f20 (diff)
downloadDistroKit-061b89e07dbc3398277f696a55abbe60d70f4107.tar.gz
DistroKit-061b89e07dbc3398277f696a55abbe60d70f4107.tar.xz
platform beaglebone: add qemu run script
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'configs')
-rwxr-xr-xconfigs/platform-beaglebone/qemu-common92
-rwxr-xr-xconfigs/platform-beaglebone/run21
2 files changed, 113 insertions, 0 deletions
diff --git a/configs/platform-beaglebone/qemu-common b/configs/platform-beaglebone/qemu-common
new file mode 100755
index 0000000..86e2584
--- /dev/null
+++ b/configs/platform-beaglebone/qemu-common
@@ -0,0 +1,92 @@
+#!/bin/bash
+#
+# This is sourced by the run scripts.
+
+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
+
+#if [ ! -e "${PTXDIST_PLATFORMDIR}/images/nor0.img" ]; then
+# echo "error: run 'ptxdist images' first"
+# exit 1
+#fi
+
+# the emulator to run
+QEMU_EXEC="${PTXDIST_PLATFORMDIR}/sysroot-host/bin/qemu-system-arm"
+
+if [ ! -e "${QEMU_EXEC}" ]; then
+ echo "error: enable and install 'host-qemu' first"
+ exit 1
+fi
+
+# 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=vexpress-a9
+
+#
+# 'user mode' network related settings
+#
+PLATFORM_IP="10.0.2.7"
+
+#
+# *_INTERNAL_PORT: the port a service would connect (in the emulated system)
+# *_EXTERNAL_PORT: port QEMU opens at the host side to give access to the ${*_INTERNAL_PORT}
+#
+TELNET_INTERNAL_PORT=23
+TELNET_EXTERNAL_PORT=20023
+
+HTTP_INTERNAL_PORT=80
+HTTP_EXTERNAL_PORT=20080
+
+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"
+ PLATFORM_IP=""
+fi
+
+QEMU_REDIR=" \
+ -redir tcp:${TELNET_EXTERNAL_PORT}:${PLATFORM_IP}:${TELNET_INTERNAL_PORT} \
+ -redir tcp:${HTTP_EXTERNAL_PORT}:${PLATFORM_IP}:${HTTP_INTERNAL_PORT} \
+"
diff --git a/configs/platform-beaglebone/run b/configs/platform-beaglebone/run
new file mode 100755
index 0000000..eba8197
--- /dev/null
+++ b/configs/platform-beaglebone/run
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# For some information about how to work with qemu for ARM, please
+# refer: http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu
+
+. $(dirname $0)/qemu-common
+
+# do the job
+${QEMU_EXEC} ${QEMU_NOGRAPHIC} \
+ -M ${QEMU_MACHINE} \
+ -m 1024 \
+ -no-reboot \
+ -net nic,vlan=1 \
+ ${QEMU_NET} \
+ ${QEMU_REDIR} \
+ -kernel ${PTXDIST_PLATFORMDIR}/images/linuximage \
+ -dtb ${PTXDIST_PLATFORMDIR}/images/vexpress-v2p-ca9.dtb \
+ -drive if=sd,file=${PTXDIST_PLATFORMDIR}/images/hd.img,format=raw \
+ -smp 1 \
+ -append "console=ttyAMA0 root=/dev/mmcblk0p2 rootfs=ext2 rw mem=1024M rootwait loglevel=5 rootfstype=ext4 systemd.log_level=warning systemd.show_status=auto"
+