diff options
Diffstat (limited to 'rootdir')
-rw-r--r-- | rootdir/etc/init.goldfish.rc | 16 | ||||
-rwxr-xr-x | rootdir/etc/init.goldfish.sh | 37 | ||||
-rw-r--r-- | rootdir/etc/ueventd.goldfish.rc | 3 | ||||
-rw-r--r-- | rootdir/init.rc | 195 | ||||
-rw-r--r-- | rootdir/ueventd.rc | 2 |
5 files changed, 165 insertions, 88 deletions
diff --git a/rootdir/etc/init.goldfish.rc b/rootdir/etc/init.goldfish.rc index 569555c..1ac09ca 100644 --- a/rootdir/etc/init.goldfish.rc +++ b/rootdir/etc/init.goldfish.rc @@ -1,5 +1,12 @@ +on early-init + export EXTERNAL_STORAGE /mnt/sdcard + mkdir /mnt/sdcard 0000 system system + # for backwards compatibility + symlink /mnt/sdcard /sdcard + on boot setprop ARGH ARGH + setprop net.eth0.gw 10.0.2.2 setprop net.eth0.dns1 10.0.2.3 setprop net.gprs.local-ip 10.0.2.15 setprop ro.radio.use-ppp no @@ -16,6 +23,11 @@ on boot stop dund stop akmd +# start essential services + start qemud + start goldfish-logcat + start goldfish-setup + setprop ro.setupwizard.mode EMULATOR # enable Google-specific location features, @@ -36,6 +48,8 @@ on boot # something else. service goldfish-setup /system/etc/init.goldfish.sh + user root + group root oneshot service qemud /system/bin/qemud @@ -46,7 +60,7 @@ service qemud /system/bin/qemud # 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 +# if not, is simply exits immediately service goldfish-logcat /system/bin/logcat -Q oneshot diff --git a/rootdir/etc/init.goldfish.sh b/rootdir/etc/init.goldfish.sh index cfa2c82..1156dd7 100755 --- a/rootdir/etc/init.goldfish.sh +++ b/rootdir/etc/init.goldfish.sh @@ -1,8 +1,26 @@ #!/system/bin/sh +# Setup networking when boot starts ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up route add default gw 10.0.2.2 dev eth0 +# ro.kernel.android.qemud is normally set when we +# want the RIL (radio interface layer) to talk to +# the emulated modem through qemud. +# +# However, this will be undefined in two cases: +# +# - When we want the RIL to talk directly to a guest +# serial device that is connected to a host serial +# device by the emulator. +# +# - We don't want to use the RIL but the VM-based +# modem emulation that runs inside the guest system +# instead. +# +# The following detects the latter case and sets up the +# system for it. +# qemud=`getprop ro.kernel.android.qemud` case "$qemud" in "") @@ -18,17 +36,18 @@ case "$qemud" in ;; esac -num_dns=`getprop ro.kernel.android.ndns` +# Setup additionnal DNS servers if needed +num_dns=`getprop ro.kernel.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 - ;; + 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 - ;; + 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 @@ -42,10 +61,6 @@ esac # /system/bin/qemu-props -# 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 - # set up the second interface (for inter-emulator connections) # if required my_ip=`getprop net.shared_net_ip` diff --git a/rootdir/etc/ueventd.goldfish.rc b/rootdir/etc/ueventd.goldfish.rc index f4262fb..8de7049 100644 --- a/rootdir/etc/ueventd.goldfish.rc +++ b/rootdir/etc/ueventd.goldfish.rc @@ -1,2 +1,5 @@ +# These settings are specific to running under the Android emulator /dev/qemu_trace 0666 system system /dev/qemu_pipe 0666 system system +/dev/ttyS* 0666 system system +/proc 0666 system system diff --git a/rootdir/init.rc b/rootdir/init.rc index 90c017b..657797e 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -1,6 +1,9 @@ on early-init start ueventd +# create mountpoints + mkdir /mnt 0775 root system + on init sysclktz 0 @@ -14,10 +17,9 @@ loglevel 3 export ANDROID_ROOT /system export ANDROID_ASSETS /system/app export ANDROID_DATA /data - export EXTERNAL_STORAGE /mnt/sdcard export ASEC_MOUNTPOINT /mnt/asec export LOOP_MOUNTPOINT /mnt/obb - export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar + export BOOTCLASSPATH /system/framework/core.jar:/system/framework/apache-xml.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar # Backward compatibility symlink /system/etc /etc @@ -27,18 +29,11 @@ loglevel 3 # but someday that may change. symlink /system/vendor /vendor -# create mountpoints - mkdir /mnt 0775 root system - mkdir /mnt/sdcard 0000 system system - # Create cgroup mount point for cpu accounting mkdir /acct mount cgroup none /acct cpuacct mkdir /acct/uid -# Backwards Compat - XXX: Going away in G* - symlink /mnt/sdcard /sdcard - mkdir /system mkdir /data 0771 system system mkdir /cache 0770 system cache @@ -101,6 +96,32 @@ on post-fs # once everything is setup, no need to modify / mount rootfs rootfs / ro remount + # We chown/chmod /cache again so because mount is run as root + defaults + chown system cache /cache + chmod 0770 /cache + + # This may have been created by the recovery system with odd permissions + chown system cache /cache/recovery + chmod 0770 /cache/recovery + + #change permissions on vmallocinfo so we can grab it from bugreports + chown root log /proc/vmallocinfo + chmod 0440 /proc/vmallocinfo + + #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks + chown root system /proc/kmsg + chmod 0440 /proc/kmsg + chown root system /proc/sysrq-trigger + chmod 0220 /proc/sysrq-trigger + + # create the lost+found directories, so as to enforce our permissions + mkdir /cache/lost+found 0770 + + # double check the perms, in case lost+found already exists, and set owner + chown root root /cache/lost+found + chmod 0770 /cache/lost+found + +on post-fs-data # We chown/chmod /data again so because mount is run as root + defaults chown system system /data chmod 0771 /data @@ -124,25 +145,7 @@ on post-fs write /proc/apanic_console 1 - # Same reason as /data above - chown system cache /cache - chmod 0770 /cache - - # This may have been created by the recovery system with odd permissions - chown system cache /cache/recovery - chmod 0770 /cache/recovery - - #change permissions on vmallocinfo so we can grab it from bugreports - chown root log /proc/vmallocinfo - chmod 0440 /proc/vmallocinfo - - #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks - chown root system /proc/kmsg - chmod 0440 /proc/kmsg - chown root system /proc/sysrq-trigger - chmod 0220 /proc/sysrq-trigger - -# create basic filesystem structure + # create basic filesystem structure mkdir /data/misc 01771 system misc mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth mkdir /data/misc/bluetooth 0770 system system @@ -168,18 +171,19 @@ on post-fs # create the lost+found directories, so as to enforce our permissions mkdir /data/lost+found 0770 - mkdir /cache/lost+found 0770 # double check the perms, in case lost+found already exists, and set owner chown root root /data/lost+found chmod 0770 /data/lost+found - chown root root /cache/lost+found - chmod 0770 /cache/lost+found - # create data/drm directory + # create directory for DRM plug-ins mkdir /data/drm 0774 drm drm - chown drm drm /data/drm - chmod 0774 /data/drm + + # If there is no fs-post-data action in the init.<device>.rc file, you + # must uncomment this line, otherwise encrypted filesystems + # won't work. + # Set indication (checked by vold) that we have finished this action + #setprop vold.post_fs_data_done 1 on boot # basic network init @@ -204,15 +208,28 @@ on boot # Define the memory thresholds at which the above process classes will # be killed. These numbers are in pages (4k). - setprop ro.FOREGROUND_APP_MEM 2048 - setprop ro.VISIBLE_APP_MEM 3072 - setprop ro.PERCEPTIBLE_APP_MEM 4096 - setprop ro.HEAVY_WEIGHT_APP_MEM 4096 - setprop ro.SECONDARY_SERVER_MEM 6144 - setprop ro.BACKUP_APP_MEM 6144 - setprop ro.HOME_APP_MEM 6144 - setprop ro.HIDDEN_APP_MEM 7168 - setprop ro.EMPTY_APP_MEM 8192 + # These are currently tuned for tablets with approx 1GB RAM. + setprop ro.FOREGROUND_APP_MEM 8192 + setprop ro.VISIBLE_APP_MEM 10240 + setprop ro.PERCEPTIBLE_APP_MEM 12288 + setprop ro.HEAVY_WEIGHT_APP_MEM 12288 + setprop ro.SECONDARY_SERVER_MEM 14336 + setprop ro.BACKUP_APP_MEM 14336 + setprop ro.HOME_APP_MEM 14336 + setprop ro.HIDDEN_APP_MEM 16384 + setprop ro.EMPTY_APP_MEM 20480 + + # Old values for phones. Should probably be adjusted up for the next + # phone version. + #setprop ro.FOREGROUND_APP_MEM 2048 + #setprop ro.VISIBLE_APP_MEM 3072 + #setprop ro.PERCEPTIBLE_APP_MEM 4096 + #setprop ro.HEAVY_WEIGHT_APP_MEM 4096 + #setprop ro.SECONDARY_SERVER_MEM 6144 + #setprop ro.BACKUP_APP_MEM 6144 + #setprop ro.HOME_APP_MEM 6144 + #setprop ro.HIDDEN_APP_MEM 7168 + #setprop ro.EMPTY_APP_MEM 8192 # Write value must be consistent with the above properties. # Note that the driver only supports 6 slots, so we have combined some of @@ -222,7 +239,7 @@ on boot write /proc/sys/vm/overcommit_memory 1 write /proc/sys/vm/min_free_order_shift 4 - write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192 + write /sys/module/lowmemorykiller/parameters/minfree 8192,10240,12288,14336,16384,20480 # Set init its forked children's oom_adj. write /proc/1/oom_adj -16 @@ -278,24 +295,54 @@ on boot setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 - class_start default +# Set this property so surfaceflinger is not started by system_init + setprop system_init.startsurfaceflinger 0 + + class_start core + class_start main + +on nonencrypted + class_start late_start + +on property:vold.decrypt=trigger_reset_main + class_reset main + +on property:vold.decrypt=trigger_load_persist_props + load_persist_props + +on property:vold.decrypt=trigger_post_fs_data + trigger post-fs-data + +on property:vold.decrypt=trigger_restart_min_framework + class_start main + +on property:vold.decrypt=trigger_restart_framework + class_start main + class_start late_start + +on property:vold.decrypt=trigger_shutdown_framework + class_reset late_start + class_reset main ## Daemon processes to be run by init. ## service ueventd /sbin/ueventd + class core critical service console /system/bin/sh + class core console disabled user shell group log -on property:ro.secure=0 +on property:ro.debuggable=1 start console # adbd is controlled by the persist.service.adb.enable system property service adbd /sbin/adbd + class core disabled # adbd on at boot in emulator @@ -309,58 +356,74 @@ on property:persist.service.adb.enable=0 stop adbd service servicemanager /system/bin/servicemanager + class core user system + group system critical onrestart restart zygote onrestart restart media service vold /system/bin/vold + class core socket vold stream 0660 root mount ioprio be 2 service netd /system/bin/netd + class main socket netd stream 0660 root system socket dnsproxyd stream 0660 root inet service debuggerd /system/bin/debuggerd + class main service ril-daemon /system/bin/rild + class late_start socket rild stream 660 root radio socket rild-debug stream 660 radio system user root group radio cache inet misc audio sdcard_rw +service surfaceflinger /system/bin/surfaceflinger + class main + user system + group graphics + onrestart restart zygote + service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server + class main socket zygote stream 666 onrestart write /sys/android_power/request_state wake onrestart write /sys/power/state on + onrestart restart surfaceflinger onrestart restart media onrestart restart netd service drm /system/bin/drmserver + class main user drm - group system root inet - -service drmio /system/bin/drmioserver - user drmio + group system inet service media /system/bin/mediaserver + class main user media - group system audio camera graphics inet net_bt net_bt_admin net_raw + group audio camera inet net_bt net_bt_admin ioprio rt 4 service bootanim /system/bin/bootanimation + class main user graphics group graphics disabled oneshot service dbus /system/bin/dbus-daemon --system --nofork + class main socket dbus stream 660 bluetooth bluetooth user bluetooth group bluetooth net_bt_admin service bluetoothd /system/bin/bluetoothd -n + class main socket bluetooth stream 660 bluetooth bluetooth socket dbus_bluetooth stream 660 bluetooth bluetooth # init.rc does not yet support applying capabilities, so run as root and @@ -368,37 +431,16 @@ service bluetoothd /system/bin/bluetoothd -n group bluetooth net_bt_admin misc disabled -service hfag /system/bin/sdptool add --channel=10 HFAG - user bluetooth - group bluetooth net_bt_admin - disabled - oneshot - -service hsag /system/bin/sdptool add --channel=11 HSAG - user bluetooth - group bluetooth net_bt_admin - disabled - oneshot - -service opush /system/bin/sdptool add --channel=12 OPUSH - user bluetooth - group bluetooth net_bt_admin - disabled - oneshot - -service pbap /system/bin/sdptool add --channel=19 PBAP - user bluetooth - group bluetooth net_bt_admin - disabled - oneshot - service installd /system/bin/installd + class main socket installd stream 600 system system service flash_recovery /system/etc/install-recovery.sh + class main oneshot service racoon /system/bin/racoon + class main socket racoon stream 600 system system # racoon will setuid to vpn after getting necessary resources. group net_admin @@ -406,6 +448,7 @@ service racoon /system/bin/racoon oneshot service mtpd /system/bin/mtpd + class main socket mtpd stream 600 system system user vpn group vpn net_admin net_raw @@ -413,11 +456,13 @@ service mtpd /system/bin/mtpd oneshot service keystore /system/bin/keystore /data/misc/keystore + class main user keystore group keystore socket keystore stream 666 service dumpstate /system/bin/dumpstate -s + class main socket dumpstate stream 0660 shell log disabled oneshot diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc index d475c44..51a4337 100644 --- a/rootdir/ueventd.rc +++ b/rootdir/ueventd.rc @@ -23,7 +23,6 @@ /dev/android_adb 0660 adb adb /dev/android_adb_enable 0660 adb adb /dev/ttyMSM0 0600 bluetooth bluetooth -/dev/ttyHS0 0600 bluetooth bluetooth /dev/uinput 0660 system bluetooth /dev/alarm 0664 system radio /dev/tty0 0660 root system @@ -69,6 +68,7 @@ /dev/qmi1 0640 radio radio /dev/qmi2 0640 radio radio /dev/bus/usb/* 0660 root usb +/dev/mtp_usb 0660 root mtp /dev/usb_accessory 0660 root usb # CDMA radio interface MUX |