forked from mozilla-b2g/B2G
-
Notifications
You must be signed in to change notification settings - Fork 17
/
run-emulator.sh
executable file
·74 lines (62 loc) · 1.89 KB
/
run-emulator.sh
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
#!/bin/bash
# Get full path from where the script was executed, full path is needed to run emulator succesfully
B2G_HOME=$(cd $(dirname $BASH_SOURCE); pwd)
. $B2G_HOME/load-config.sh
DEVICE=${DEVICE:-generic}
TOOLS_PATH=$B2G_HOME/out/host/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/bin
DBG_CMD=""
if [ x"$DBG" != x"" ]; then
DBG_CMD="gdb -args"
fi
TAIL_ARGS=""
if [ x"$GDBSERVER" != x"" ]; then
TAIL_ARGS="$TAIL_ARGS -s -S"
fi
dns_servers=""
if [ x"$B2G_DNS_SERVER" != x"" ]; then
dns_servers=$B2G_DNS_SERVER
fi
# DNS servers from command line arg override ones from environment variable.
while [ $# -gt 0 ]; do
case "$1" in
--dns-server)
shift; dns_servers=$1 ;;
*)
break ;;
esac
shift
done
emu_extra_args=""
if [ -n "$dns_servers" ]; then
emu_extra_args="$emu_extra_args -dns-server $dns_servers"
fi
if [ "$DEVICE" = "generic_x86" ]; then
EMULATOR=$TOOLS_PATH/emulator-x86
KERNEL=$B2G_HOME/prebuilts/qemu-kernel/x86/kernel-qemu
else
EMULATOR=$TOOLS_PATH/emulator
KERNEL=$B2G_HOME/prebuilts/qemu-kernel/arm/kernel-qemu-armv7
TAIL_ARGS="$TAIL_ARGS -cpu cortex-a8"
fi
SDCARD_SIZE=${SDCARD_SIZE:-512M}
SDCARD_IMG=${SDCARD_IMG:-${B2G_HOME}/out/target/product/${DEVICE}/sdcard.img}
if [ ! -f "${SDCARD_IMG}" ]; then
echo "Creating sdcard image file with size: ${SDCARD_SIZE} ..."
${TOOLS_PATH}/mksdcard -l sdcard ${SDCARD_SIZE} ${SDCARD_IMG}
fi
export DYLD_LIBRARY_PATH="$B2G_HOME/out/host/darwin-x86/lib"
export PATH=$PATH:$TOOLS_PATH
${DBG_CMD} $EMULATOR \
-kernel $KERNEL \
-sysdir $B2G_HOME/out/target/product/$DEVICE/ \
-data $B2G_HOME/out/target/product/$DEVICE/userdata.img \
-sdcard ${SDCARD_IMG} \
-memory 512 \
-partition-size 512 \
-skindir $B2G_HOME/development/tools/emulator/skins \
-skin HVGA \
-verbose \
-gpu on \
-camera-back webcam0 \
$emu_extra_args \
-qemu $TAIL_ARGS