1dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#!/system/bin/sh
2dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
3eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# Setup networking when boot starts
4dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
5dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectroute add default gw 10.0.2.2 dev eth0
6dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
7eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# ro.kernel.android.qemud is normally set when we
8eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# want the RIL (radio interface layer) to talk to
9eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# the emulated modem through qemud.
10eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#
11eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# However, this will be undefined in two cases:
12eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#
13eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# - When we want the RIL to talk directly to a guest
14eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#   serial device that is connected to a host serial
15eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#   device by the emulator.
16eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#
17eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# - We don't want to use the RIL but the VM-based
18eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#   modem emulation that runs inside the guest system
19eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#   instead.
20eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#
21eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# The following detects the latter case and sets up the
22eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# system for it.
23eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner#
2415681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidtqemud=`getprop ro.kernel.android.qemud`
2515681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidtcase "$qemud" in
2615681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidt    "")
27dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    radio_ril=`getprop ro.kernel.android.ril`
2815681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidt    case "$radio_ril" in
2915681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidt        "")
30dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project        # no need for the radio interface daemon
31dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project        # telephony is entirely emulated in Java
32dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project        setprop ro.radio.noril yes
33dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project        stop ril-daemon
3415681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidt        ;;
3515681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidt    esac
3615681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidt    ;;
3715681df3563dbea684b7cd27c85af5bde7cd153eSimon Braunschmidtesac
38dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
39eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner# Setup additionnal DNS servers if needed
4095df887ac0cd2fab3f5d3148feb7839b5f65223fDavid 'Digit' Turnernum_dns=`getprop ro.kernel.ndns`
41dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectcase "$num_dns" in
42dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    2) setprop net.eth0.dns2 10.0.2.4
43eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner       ;;
44dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    3) setprop net.eth0.dns2 10.0.2.4
45eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner       setprop net.eth0.dns3 10.0.2.5
46eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner       ;;
47dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    4) setprop net.eth0.dns2 10.0.2.4
48eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner       setprop net.eth0.dns3 10.0.2.5
49eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner       setprop net.eth0.dns4 10.0.2.6
50eeeca4dd45899c20d4fc187c59bda58af43352f2David 'Digit' Turner       ;;
51dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectesac
52dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
53dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project# disable boot animation for a faster boot sequence when needed
54dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectboot_anim=`getprop ro.kernel.android.bootanim`
55dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectcase "$boot_anim" in
56dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    0)  setprop debug.sf.nobootanimation 1
57dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    ;;
58dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectesac
59dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
602a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnie# set up the second interface (for inter-emulator connections)
612a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnie# if required
622a743730c7d1a8adba8a922f7af46cef0b35363aDries Harniemy_ip=`getprop net.shared_net_ip`
632a743730c7d1a8adba8a922f7af46cef0b35363aDries Harniecase "$my_ip" in
642a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnie    "")
652a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnie    ;;
662a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnie    *) ifconfig eth1 "$my_ip" netmask 255.255.255.0 up
672a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnie    ;;
682a743730c7d1a8adba8a922f7af46cef0b35363aDries Harnieesac
69