auto import from //depot/cupcake/@135843
diff --git a/rootdir/etc/dbus.conf b/rootdir/etc/dbus.conf
new file mode 100644
index 0000000..75586b9
--- /dev/null
+++ b/rootdir/etc/dbus.conf
@@ -0,0 +1,27 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- Our well-known bus type, do not change this -->
+  <type>system</type>
+
+  <!-- Only allow socket-credentials-based authentication -->
+  <auth>EXTERNAL</auth>
+
+  <!-- Only listen on a local socket. (abstract=/path/to/socket 
+       means use abstract namespace, don't really create filesystem 
+       file; only Linux supports this. Use path=/whatever on other 
+       systems.) -->
+  <listen>unix:path=/dev/socket/dbus</listen>
+
+  <!-- Allow everything, D-Bus socket is protected by unix filesystem
+       permissions -->
+  <policy context="default">
+    <allow send_interface="*"/>
+    <allow receive_interface="*"/>
+    <allow own="*"/>
+    <allow user="*"/>
+    <allow send_requested_reply="true"/>
+    <allow receive_requested_reply="true"/>
+  </policy>
+</busconfig>
diff --git a/rootdir/etc/hosts b/rootdir/etc/hosts
new file mode 100644
index 0000000..99848f6
--- /dev/null
+++ b/rootdir/etc/hosts
@@ -0,0 +1 @@
+127.0.0.1		    localhost
diff --git a/rootdir/etc/init.goldfish.rc b/rootdir/etc/init.goldfish.rc
new file mode 100644
index 0000000..96480f3
--- /dev/null
+++ b/rootdir/etc/init.goldfish.rc
@@ -0,0 +1,54 @@
+on boot
+    setprop ARGH ARGH
+    setprop net.eth0.dns1 10.0.2.3
+    setprop net.gprs.local-ip 10.0.2.15
+    setprop ro.radio.use-ppp no
+    setprop ro.build.product generic
+    setprop ro.product.device generic
+
+# fake some battery state
+    setprop status.battery.state Slow
+    setprop status.battery.level 5
+    setprop status.battery.level_raw  50
+    setprop status.battery.level_scale 9
+
+# disable some daemons the emulator doesn't want
+    stop dund
+    stop akmd
+
+    setprop ro.setupwizard.mode EMULATOR
+
+# enable Google-specific location features,
+# like NetworkLocationProvider and LocationCollector
+    setprop ro.com.google.locationfeatures 1
+
+# For the emulator, which bypasses Setup Wizard, you can specify
+# account info for the device via these two properties.  Google
+# Login Service will insert these accounts into the database when
+# it is created (ie, after a data wipe).
+#
+#   setprop ro.config.hosted_account username@hosteddomain.org:password
+#   setprop ro.config.google_account username@gmail.com:password
+#
+# You MUST have a Google account on the device, and you MAY
+# additionally have a hosted account.  No other configuration is
+# supported, and arbitrary breakage may result if you specify
+# something else.
+
+service goldfish-setup /system/etc/init.goldfish.sh
+    oneshot
+
+service qemud /system/bin/qemud
+    socket qemud_gsm     stream 666
+    socket qemud_gps     stream 666
+    socket qemud_control stream 666
+    oneshot
+
+# -Q is a special logcat option that forces the
+# program to check wether it runs on the emulator
+# if it does, it redirects its output to the device
+# named by the androidboot.console kernel option
+# if not, is simply exit immediately
+
+service goldfish-logcat /system/bin/logcat -Q
+    oneshot
diff --git a/rootdir/etc/init.goldfish.sh b/rootdir/etc/init.goldfish.sh
new file mode 100755
index 0000000..0eb0154
--- /dev/null
+++ b/rootdir/etc/init.goldfish.sh
@@ -0,0 +1,39 @@
+#!/system/bin/sh
+
+ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
+route add default gw 10.0.2.2 dev eth0
+
+qemud=`getprop.ro.kernel.android.qemud`
+if test -z "$qemud"; then
+    radio_ril=`getprop ro.kernel.android.ril`
+    if test -z "$radio_ril"; then
+        # no need for the radio interface daemon
+        # telephony is entirely emulated in Java
+        setprop ro.radio.noril yes
+        stop ril-daemon
+    fi
+fi
+
+num_dns=`getprop ro.kernel.android.ndns`
+case "$num_dns" in
+    2) setprop net.eth0.dns2 10.0.2.4
+    ;;
+    3) setprop net.eth0.dns2 10.0.2.4
+    setprop net.eth0.dns3 10.0.2.5
+    ;;
+    4) setprop net.eth0.dns2 10.0.2.4
+    setprop net.eth0.dns3 10.0.2.5
+    setprop net.eth0.dns4 10.0.2.6
+    ;;
+esac
+
+# disable boot animation for a faster boot sequence when needed
+boot_anim=`getprop ro.kernel.android.bootanim`
+case "$boot_anim" in
+    0)  setprop debug.sf.nobootanimation 1
+    ;;
+esac
+
+# this line doesn't really do anything useful. however without it the
+# previous setprop doesn't seem to apply for some really odd reason
+setprop ro.qemu.init.completed 1
diff --git a/rootdir/etc/init.gprs-pppd b/rootdir/etc/init.gprs-pppd
new file mode 100755
index 0000000..521eec9
--- /dev/null
+++ b/rootdir/etc/init.gprs-pppd
@@ -0,0 +1,23 @@
+#!/system/bin/sh
+# An unforunate wrapper script 
+# so that the exit code of pppd may be retrieved
+
+
+# this is a workaround for issue #651747
+#trap "/system/bin/sleep 1;exit 0" TERM
+
+
+PPPD_PID=
+
+/system/bin/setprop "net.gprs.ppp-exit" ""
+
+/system/bin/log -t pppd "Starting pppd"
+
+/system/bin/pppd $*
+
+PPPD_EXIT=$?
+PPPD_PID=$!
+
+/system/bin/log -t pppd "pppd exited with $PPPD_EXIT"
+
+/system/bin/setprop "net.gprs.ppp-exit" "$PPPD_EXIT"
diff --git a/rootdir/etc/init.testmenu b/rootdir/etc/init.testmenu
new file mode 100755
index 0000000..7ae16d5
--- /dev/null
+++ b/rootdir/etc/init.testmenu
@@ -0,0 +1,322 @@
+#!/system/bin/sh
+
+atdev=/dev/omap_csmi_tty0
+pppdev=/dev/omap_csmi_tty1
+
+n1=`cat /data/phoneentry1 2>/dev/null`
+n2=`cat /data/phoneentry2 2>/dev/null`
+n3=`cat /data/phoneentry3 2>/dev/null`
+n1=${n1:-"*#06#"}
+n2=${n2:-"*#06#"}
+n3=${n3:-"*#06#"}
+phoneoutputpid=
+eventoutputpid=
+notifypid=
+notifytoggle=false
+pppdpid=
+powerdidletime=120
+
+# map phone specific keys
+setkey -k 0xe4 -v 0x23 # map #
+setkey -k 0xe3 -v 0x2a # map *
+setkey -k 231 -v 513 # map send to newline
+#setkey -k 0x67 -v 0x20b # map up to scroll back
+#setkey -k 0x6c -v 0x20a # map down to scroll forward
+setkey -k 0x73 -v 0x20b # map volume up to scroll back
+setkey -k 0x72 -v 0x20a # map volume down to scroll forward
+setkey -k 0x60 -v 0x211 # map PoC to next console
+
+# tuttle keys
+setkey -k 0x38 -v 0x703 # map leftalt to alt
+setkey -k 0x9b -v 0x703 # map mail to alt
+setkey -t 8 -k 0x9b -v 0x703 # map alt-mail to alt
+setkey -t 8 -k 0x10 -v 0x21 # map alt-q to !
+setkey -t 8 -k 0x11 -v 0x31 # map alt-w to 1
+setkey -t 8 -k 0x12 -v 0x32 # map alt-e to 2
+setkey -t 8 -k 0x13 -v 0x33 # map alt-r to 3
+setkey -t 8 -k 0x14 -v 0x2b # map alt-t to +
+setkey -t 8 -k 0x15 -v 0x28 # map alt-y to (
+setkey -t 8 -k 0x16 -v 0x29 # map alt-u to )
+setkey -t 8 -k 0x17 -v 0x2d # map alt-i to -
+setkey -t 8 -k 0x18 -v 0x5f # map alt-o to _
+setkey -t 8 -k 0x19 -v 0x22 # map alt-p to "
+setkey -t 8 -k 0x1e -v 0x23 # map alt-a to #
+setkey -t 8 -k 0x1f -v 0x34 # map alt-s to 4
+setkey -t 8 -k 0x20 -v 0x35 # map alt-d to 5
+setkey -t 8 -k 0x21 -v 0x36 # map alt-f to 6
+setkey -t 8 -k 0x22 -v 0x2f # map alt-g to /
+setkey -t 8 -k 0x23 -v 0x3f # map alt-h to ?
+setkey -t 8 -k 0x24 -v 0xa3 # map alt-j to pound
+setkey -t 8 -k 0x25 -v 0x24 # map alt-k to $
+setkey -t 8 -k 0x2c -v 0x2a # map alt-z to *
+setkey -t 8 -k 0x2d -v 0x37 # map alt-x to 7
+setkey -t 8 -k 0x2e -v 0x38 # map alt-c to 8
+setkey -t 8 -k 0x2f -v 0x39 # map alt-v to 9
+setkey -t 8 -k 0x30 -v 0x7c # map alt-b to |
+setkey -t 8 -k 0x31 -v 0x40 # map alt-n to @
+setkey -t 8 -k 0x32 -v 0x3d # map alt-m to =
+setkey -t 8 -k 0x33 -v 0x3b # map alt-, to ;
+setkey -t 8 -k 0x34 -v 0x3a # map alt-. to :
+setkey -t 8 -k 0x0f -v 0x30 # map alt-tab to 0
+setkey -t 8 -k 0x67 -v 0x20b # map alt-up to scroll back
+setkey -t 8 -k 0x6c -v 0x20a # map alt-down to scroll forward
+
+while true
+do
+	echo
+	echo "------------------------------"
+	echo " 1: init commands"
+	echo " 2: call commands"
+	echo " 3: misc phone"
+	echo " 4: phone debug output"
+	echo " 5: test data connection"
+	echo " 6: start runtime"
+	echo " 7: start runtime w/output"
+	echo " 8: stop runtime"
+	echo " 9: misc"
+	echo -n ": "
+	while true
+	do
+		c=`readtty -t 50 -f -a 1234567890#`
+		case "$c" in
+			"" ) ;;
+			* ) break;
+		esac
+	done
+	echo Got key -$c-
+	case $c in
+		"1" )
+			while true; do
+				echo
+				echo "------------------------------"
+				echo " 1: Print phone output"
+				echo " 2: ATQ0V1E1+CMEE=2;+CREG=0"
+				echo " 3: AT+CFUN=1"
+				echo " 4: AT+COPS=0"
+				echo " 5: AT+CREG?"
+				echo " 6: Stop phone output"
+				echo " 0: back"
+				echo -n ": "
+				c=`readtty -f -a 1234560#`
+				echo Got key -$c-
+				case "$c" in
+					"1" ) kill $phoneoutputpid; cat $atdev & phoneoutputpid=$! ;;
+					"2" ) echo -e "ATQ0V1E1+CMEE=2;+CREG=0\r" >$atdev;;
+					"3" ) echo -e "AT+CFUN=1\r" >$atdev;;
+					"4" ) echo -e "AT+COPS=0\r" >$atdev;;
+					"5" ) echo -e "AT+CREG?\r" >$atdev;;
+					"6" ) kill $phoneoutputpid; phoneoutputpid= ;;
+					"0" ) break;;
+				esac
+			done
+		;;
+		"2" )
+			while true; do
+				echo
+				echo "------------------------------"
+				echo " 1: Dial: ATD $n1;"
+				echo " 2: Dial: ATD $n2;"
+				echo " 3: Dial: ATD $n3;"
+				echo " 4: Set number for 1"
+				echo " 5: Set number for 2"
+				echo " 6: Set number for 3"
+				echo " 7: Dial: ATD ...;"
+				echo " 8: Hang up: ATH"
+				echo " 9: Answer: ATA"
+				echo " 0: back"
+				echo -n ": "
+				c=`readtty -f -a 1234567890#`
+				echo Got key -$c-
+				case "$c" in
+					"1" ) echo "Dialing $n1"; echo -e "ATD $n1;\r" >$atdev;;
+					"2" ) echo "Dialing $n2"; echo -e "ATD $n2;\r" >$atdev;;
+					"3" ) echo "Dialing $n3"; echo -e "ATD $n3;\r" >$atdev;;
+					"4" ) echo -n "Number: "; read n1; echo $n1 >/data/phoneentry1;;
+					"5" ) echo -n "Number: "; read n2; echo $n2 >/data/phoneentry2;;
+					"6" ) echo -n "Number: "; read n3; echo $n3 >/data/phoneentry3;;
+					"7" ) echo -n "Number: "; read n; echo "Dialing $n"; echo -e "ATD $n;\r" >$atdev;;
+					"8" ) echo -e "ATH\r" >$atdev;;
+					"9" ) echo -e "ATA\r" >$atdev;;
+					"0" ) break;;
+				esac
+			done
+		;;
+		"3" )
+			while true; do
+				echo
+				echo "------------------------------"
+				echo " 1: Save FFS data"
+				echo " 2: Load user FFS data"
+				echo " 3: Load system FFS data"
+				echo " 4: Reset FFS data"
+				echo " 5: Set uplink gain"
+				echo " 6: Set echo"
+				echo " 7: cat /dev/omap_csmi_battery_t"
+				echo " 8: cat /dev/omap_csmi_htc"
+				echo " 0: back"
+				echo -n ": "
+				c=`readtty -f -a 123456780#`
+				echo Got key -$c-
+				case "$c" in
+					"1" ) cat /dev/omap_csmi_ffs >/data/ffsdata;;
+					"2" ) cat /data/ffsdata >/dev/omap_csmi_ffs;;
+					"3" ) cat /system/ffsdata >/dev/omap_csmi_ffs;;
+					"4" ) echo - >/dev/omap_csmi_ffs;;
+					"5" )
+						echo -n "Gain: "; read g;
+						echo gu$g >/tmp/gain;
+						cat /tmp/gain 2>/dev/null >/dev/omap_csmi_audio_tes
+					;;
+					"6" )
+						echo -n "Echo param (hex): "; read e;
+						echo "e0x$e" >/tmp/echo;
+						cat /tmp/echo 2>/dev/null >/dev/omap_csmi_audio_tes
+					;;
+					"7" ) cat /dev/omap_csmi_battery_t;;
+					"8" ) cat /dev/omap_csmi_htc;;
+					"0" ) break;;
+				esac
+			done
+		;;
+		"4" )
+			while true; do
+				echo
+				echo "------------------------------"
+				echo " 1: Toggle debug I/O"
+				echo " 2: Toggle debug Flow"
+				echo " 3: Toggle debug Interrupt"
+				echo " 4: Toggle debug Info"
+				echo " 5: Toggle GSM run state"
+				echo " 6: Clear GSM data area"
+				echo " 0: back"
+				echo -n ": "
+				c=`readtty -f -a 1234560#`
+				echo Got key -$c-
+				case "$c" in
+					"1" ) echo -n "i" >/sys/devices/system/omap_csmi/debug;;
+					"2" ) echo -n "f" >/sys/devices/system/omap_csmi/debug;;
+					"3" ) echo -n "I" >/sys/devices/system/omap_csmi/debug;;
+					"4" ) echo -n "F" >/sys/devices/system/omap_csmi/debug;;
+					"5" ) echo -n "s" >/sys/devices/system/omap_csmi/debug;;
+					"6" ) echo -n "c" >/sys/devices/system/omap_csmi/debug;;
+					"0" ) break;;
+				esac
+			done
+		;;
+		"5" )
+			while true; do
+				echo
+				echo "------------------------------"
+				echo " 1: Start pppd - userspace"
+				echo " 2: Start pppd - kernel"
+				echo " 3: Start pppd - kernel <at1"
+				echo " 4: Configure ppp data to at2"
+				echo " 5: Test with HTTP GET"
+				echo " 6: Kill pppd"
+				echo " 0: back"
+				echo -n ": "
+				c=`readtty -f -a 1234560#`
+				echo Got key -$c-
+				case "$c" in
+					"1" ) kill $pppdpid; pppd notty < $pppdev > $pppdev & pppdpid=$!;;
+					"2" ) kill $pppdpid; pppd nodetach $pppdev & pppdpid=$!;;
+					"3" ) kill &pppdpid; pppd nodetach $pppdev connect "sh -c \"chat -v -f /etc/ppp/connect-data <$atdev >$atdev\"" & pppdpid=$!;;
+					"4" ) echo -e 'AT%DATA=2,"UART",1,,"SER","UART",0\r' >$atdev;;
+					"5" ) test-data-connection;;
+					"6" ) kill $pppdpid; pppdpid=;;
+					"0" ) break;;
+				esac
+			done
+		;;
+		"6" )
+			echo
+			echo ------------------------
+			echo Starting android runtime
+			echo ------------------------
+			start
+		;;
+		"7" )
+			echo
+			echo ------------------------
+			echo Starting android runtime
+			echo ------------------------
+			if exists /data/singleproc
+			then
+				single_process="-s"
+			else
+				single_process=""
+			fi
+			start runtime $single_process
+		;;
+		"8" )
+			stop
+		;;
+		"9" )
+			while true; do
+				echo
+				echo "------------------------------"
+				echo " 1: Print events"
+				echo " 2: Stop event output"
+				if $notifytoggle
+				then
+					echo " 3: stop notify"
+				else
+					echo " 3: notify /sys/android_power"
+				fi
+				echo " 4: start powerd"
+				echo " 5: start powerd verbose"
+				echo " 6: stop powerd"
+				echo " 7: set powerd idletime ($powerdidletime)"
+				echo " 8: start multitap shell"
+				if exists /data/singleproc
+				then
+					echo " 9: enable multiprocess"
+				else
+					echo " 9: disable multiprocess"
+				fi
+				echo " c: start shell"
+				echo " 0: back"
+				echo -n ": "
+				c=`readtty -f -a 1234567890c#`
+				echo Got key -$c-
+				case "$c" in
+					"1" ) kill $eventoutputpid; getevent & eventoutputpid=$! ;;
+					"2" ) kill $eventoutputpid; eventoutputpid= ;;
+					"3" )
+						if $notifytoggle
+						then
+							kill $notifypid
+							notifypid=
+							notifytoggle=false
+						else
+							kill $notifypid
+							notify -m 0x00000002 -c 0 -p -v 0 -w 30 /sys/android_power &
+							notifypid=$!
+							notifytoggle=true
+						fi
+					;;
+					"4" ) start powerd -i $powerdidletime ;;
+					"5" ) start powerd -i $powerdidletime -v ;;
+					"6" ) stop powerd ;;
+					"7" ) echo -n "Idle time (seconds): "; read powerdidletime ;;
+					"8" )
+						readtty -f -p -t 10 -e "[ ~" | sh -i
+					;;
+					"9" )
+						if exists /data/singleproc
+						then
+							echo "Enabling multiprocess environment."
+							rm /data/singleproc
+						else
+							echo "Disabling multiprocess environment."
+							echo >/data/singleproc "true"
+						fi
+					;;
+					"c" ) sh -i <>/dev/tty0 1>&0 2>&1 ;;
+					"0" ) break;;
+				esac
+			done
+		;;
+	esac
+done
+
diff --git a/rootdir/etc/mountd.conf b/rootdir/etc/mountd.conf
new file mode 100644
index 0000000..094a2c7
--- /dev/null
+++ b/rootdir/etc/mountd.conf
@@ -0,0 +1,19 @@
+## mountd configuration file
+
+## add a mount entry for each mount point to be managed by mountd
+mount {
+    ## root block device with partition map or raw FAT file system
+    block_device    /dev/block/mmcblk0
+        
+    ## mount point for block device
+    mount_point     /sdcard
+    
+    ## true if this mount point can be shared via USB mass storage
+    enable_ums      true
+    
+    ## path to the UMS driver file for specifying the block device path  
+    ## use this for the mass_storage function driver
+    driver_store_path   /sys/devices/platform/usb_mass_storage/lun0/file
+    ## use this for android_usb composite gadget driver
+    ##driver_store_path   /sys/devices/platform/msm_hsusb/gadget/lun0/file
+}
diff --git a/rootdir/etc/ppp/chap-secrets b/rootdir/etc/ppp/chap-secrets
new file mode 100644
index 0000000..6546b0f
--- /dev/null
+++ b/rootdir/etc/ppp/chap-secrets
@@ -0,0 +1,2 @@
+* * bogus
+
diff --git a/rootdir/etc/ppp/ip-down b/rootdir/etc/ppp/ip-down
new file mode 100755
index 0000000..672fa1e
--- /dev/null
+++ b/rootdir/etc/ppp/ip-down
@@ -0,0 +1,14 @@
+#!/system/bin/sh
+case $1 in
+    ppp1)
+	echo 0 > /proc/sys/net/ipv4/ip_forward;
+	;;
+esac
+
+# Use interface name if linkname is not available
+NAME=${LINKNAME:-"$1"}
+
+/system/bin/setprop "net.$NAME.dns1" "$DNS1"
+/system/bin/setprop "net.$NAME.dns2" "$DNS2" 
+/system/bin/setprop "net.$NAME.local-ip" "$IPLOCAL" 
+/system/bin/setprop "net.$NAME.remote-ip" "$IPREMOTE" 
diff --git a/rootdir/etc/ppp/ip-up b/rootdir/etc/ppp/ip-up
new file mode 100755
index 0000000..cb2d577
--- /dev/null
+++ b/rootdir/etc/ppp/ip-up
@@ -0,0 +1,24 @@
+#!/system/bin/sh
+case $1 in
+    ppp1)
+	/android/bin/iptables --flush;
+	/android/bin/iptables --table nat --flush;
+	/android/bin/iptables --delete-chain;
+	/android/bin/iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE;
+	/android/bin/iptables --append FORWARD --in-interface ppp1 -j ACCEPT;
+	echo 0 > /proc/sys/net/ipv4/ip_forward;
+	echo 1 > /proc/sys/net/ipv4/ip_forward;
+	;;
+    ppp0)
+        /system/bin/setprop "net.interfaces.defaultroute" "gprs"
+        ;;
+esac
+
+# Use interface name if linkname is not available
+NAME=${LINKNAME:-"$1"}
+
+/system/bin/setprop "net.$NAME.dns1" "$DNS1"
+/system/bin/setprop "net.$NAME.dns2" "$DNS2" 
+/system/bin/setprop "net.$NAME.local-ip" "$IPLOCAL" 
+/system/bin/setprop "net.$NAME.remote-ip" "$IPREMOTE" 
+