1#!/system/bin/sh
2
3# Setup networking when boot starts
4ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
5route add default gw 10.0.2.2 dev eth0
6
7wifi=`getprop ro.kernel.qemu.wifi`
8case "$wifi" in
9    1) /system/bin/init.wifi.sh
10       ;;
11esac
12
13# ro.kernel.android.qemud is normally set when we
14# want the RIL (radio interface layer) to talk to
15# the emulated modem through qemud.
16#
17# However, this will be undefined in two cases:
18#
19# - When we want the RIL to talk directly to a guest
20#   serial device that is connected to a host serial
21#   device by the emulator.
22#
23# - We don't want to use the RIL but the VM-based
24#   modem emulation that runs inside the guest system
25#   instead.
26#
27# The following detects the latter case and sets up the
28# system for it.
29#
30qemud=`getprop ro.kernel.android.qemud`
31case "$qemud" in
32    "")
33    radio_ril=`getprop ro.kernel.android.ril`
34    case "$radio_ril" in
35        "")
36        # no need for the radio interface daemon
37        # telephony is entirely emulated in Java
38        setprop ro.radio.noril yes
39        stop ril-daemon
40        ;;
41    esac
42    ;;
43esac
44
45# Setup additionnal DNS servers if needed
46num_dns=`getprop ro.kernel.ndns`
47case "$num_dns" in
48    2) setprop net.eth0.dns2 10.0.2.4
49       ;;
50    3) setprop net.eth0.dns2 10.0.2.4
51       setprop net.eth0.dns3 10.0.2.5
52       ;;
53    4) setprop net.eth0.dns2 10.0.2.4
54       setprop net.eth0.dns3 10.0.2.5
55       setprop net.eth0.dns4 10.0.2.6
56       ;;
57esac
58
59# disable boot animation for a faster boot sequence when needed
60boot_anim=`getprop ro.kernel.android.bootanim`
61case "$boot_anim" in
62    0)  setprop debug.sf.nobootanimation 1
63    ;;
64esac
65
66# set up the second interface (for inter-emulator connections)
67# if required
68my_ip=`getprop net.shared_net_ip`
69case "$my_ip" in
70    "")
71    ;;
72    *) ifconfig eth1 "$my_ip" netmask 255.255.255.0 up
73    ;;
74esac
75
76# take the wake lock
77echo "emulator_wake_lock" > /sys/power/wake_lock
78