blob: 1363ed7a2969ba281ec0c5c9def234d2b19841be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/bin/bash
SCRIPTDIR=$(cd $(dirname $0); pwd)
#
# we need information about the platform
#
if [ ! -e "selected_platformconfig" ]; then
echo "error: selected_platformconfig does not exist"
echo " please use 'ptxdist platform ...' or 'ptxdist --platformconfig=...'"
exit 1
fi
source selected_platformconfig
if [ -n "${PTXCONF_PLATFORM}" ]; then
PTXDIST_PLATFORMDIR="./platform-${PTXCONF_PLATFORM}"
else
PTXDIST_PLATFORMDIR="."
fi
# sorce it again, to really get valuable variables
source selected_platformconfig
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
if test "${PTXCONF_ARCH_STRING}" = "i386"; then
ARCH_STRING="x86_64"
# Machine to emulate
QEMU_MACHINE=pc
else
ARCH_STRING="${PTXCONF_ARCH_STRING}"
# Machine to emulate
QEMU_MACHINE=${PTXCONF_PLATFORM}
fi
# we should prefer the QEMU which comes with this BSP
QEMU_EXEC_PATH="${PTXCONF_SYSROOT_HOST}/bin"
# the QEMU to be used
QEMU_EXEC=qemu-system-${ARCH_STRING}
if [ -x "${QEMU_EXEC_PATH}/${QEMU_EXEC}" ]; then
QEMU_EXEC="${QEMU_EXEC_PATH}/${QEMU_EXEC}"
fi
# disable this, if you want to have some graphics output
QEMU_NOGRAPHIC=--nographic
#
# 'user mode' network related settings
#
PLATFORM_IP="10.0.2.7"
# the port a 'telned' would connect to (in the emulated system)
TELNET_INTERNAL_PORT=23
# port QEMU opens at the host side to give access to the ${TELNET_INTERNAL_PORT}
TELNET_EXTERNAL_PORT=4444
# do the job
${QEMU_EXEC} ${QEMU_NOGRAPHIC} \
-M ${QEMU_MACHINE} \
-no-reboot \
-net nic,vlan=1 \
-net user,vlan=1 \
-redir tcp:${TELNET_EXTERNAL_PORT}:${PLATFORM_IP}:${TELNET_INTERNAL_PORT} \
-kernel ${PTXDIST_PLATFORMDIR}/images/linuximage \
-hda ${PTXDIST_PLATFORMDIR}/images/hd.img \
-append "root=/dev/sda1 rw console=ttyAMA0,115200"
|