blob: 49199ea6f56d3cb5e05e63cf1cc0e970fb8cb3ac (
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/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/sd.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=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
# do the job
${QEMU_EXEC} ${QEMU_NOGRAPHIC} \
-M ${QEMU_MACHINE} \
-m 1024 \
-no-reboot \
-net nic,vlan=1 \
${QEMU_NET} \
-redir tcp:${TELNET_EXTERNAL_PORT}:${PLATFORM_IP}:${TELNET_INTERNAL_PORT} \
-redir tcp:${HTTP_EXTERNAL_PORT}:${PLATFORM_IP}:${HTTP_INTERNAL_PORT} \
-kernel ${PTXDIST_PLATFORMDIR}/images/linuximage \
-sd ${PTXDIST_PLATFORMDIR}/images/sd.img \
-smp 2 \
-append "root=/dev/mmcblk0p1 rootfs=ext2 rw mem=1024M console=ttyAMA0,38400n8 rootwait"
|