init.rc revision 35237d135807af84bf9b0e5b8d7f8633e58db6f5
1 2on init 3 4sysclktz 0 5 6loglevel 3 7 8# setup the global environment 9 export PATH /sbin:/system/sbin:/system/bin:/system/xbin 10 export LD_LIBRARY_PATH /system/lib 11 export ANDROID_BOOTLOGO 1 12 export ANDROID_ROOT /system 13 export ANDROID_ASSETS /system/app 14 export ANDROID_DATA /data 15 export EXTERNAL_STORAGE /sdcard 16 export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar 17 18# Backward compatibility 19 symlink /system/etc /etc 20 21# create mountpoints and mount tmpfs on sqlite_stmt_journals 22 mkdir /sdcard 0000 system system 23 mkdir /system 24 mkdir /data 0771 system system 25 mkdir /cache 0770 system cache 26 mkdir /sqlite_stmt_journals 01777 root root 27 mount tmpfs tmpfs /sqlite_stmt_journals size=4m 28 29 mount rootfs rootfs / ro remount 30 31 write /proc/sys/kernel/panic_on_oops 1 32 write /proc/sys/kernel/hung_task_timeout_secs 0 33 write /proc/cpu/alignment 4 34 write /proc/sys/kernel/sched_latency_ns 10000000 35 write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000 36 37# mount mtd partitions 38 # Mount /system rw first to give the filesystem a chance to save a checkpoint 39 mount yaffs2 mtd@system /system 40 mount yaffs2 mtd@system /system ro remount 41 42 # We chown/chmod /data again so because mount is run as root + defaults 43 mount yaffs2 mtd@userdata /data nosuid nodev 44 chown system system /data 45 chmod 0771 /data 46 47 # Same reason as /data above 48 mount yaffs2 mtd@cache /cache nosuid nodev 49 chown system cache /cache 50 chmod 0770 /cache 51 52 # This may have been created by the recovery system with odd permissions 53 chown system system /cache/recovery 54 chmod 0770 /cache/recovery 55 56# create basic filesystem structure 57 mkdir /data/misc 01771 system misc 58 mkdir /data/misc/hcid 0770 bluetooth bluetooth 59 mkdir /data/local 0771 shell shell 60 mkdir /data/local/tmp 0771 shell shell 61 mkdir /data/data 0771 system system 62 mkdir /data/app-private 0771 system system 63 mkdir /data/app 0771 system system 64 mkdir /data/property 0700 root root 65 66 # create dalvik-cache and double-check the perms 67 mkdir /data/dalvik-cache 0771 system system 68 chown system system /data/dalvik-cache 69 chmod 0771 /data/dalvik-cache 70 71 # create the lost+found directories, so as to enforce our permissions 72 mkdir /data/lost+found 0770 73 mkdir /cache/lost+found 0770 74 75 # double check the perms, in case lost+found already exists, and set owner 76 chown root root /data/lost+found 77 chmod 0770 /data/lost+found 78 chown root root /cache/lost+found 79 chmod 0770 /cache/lost+found 80 81on boot 82# basic network init 83 ifup lo 84 hostname localhost 85 domainname localdomain 86 87# set RLIMIT_NICE to allow priorities from 19 to -20 88 setrlimit 13 40 40 89 90# Define the oom_adj values for the classes of processes that can be 91# killed by the kernel. These are used in ActivityManagerService. 92 setprop ro.FOREGROUND_APP_ADJ 0 93 setprop ro.VISIBLE_APP_ADJ 1 94 setprop ro.SECONDARY_SERVER_ADJ 2 95 setprop ro.HIDDEN_APP_MIN_ADJ 7 96 setprop ro.CONTENT_PROVIDER_ADJ 14 97 setprop ro.EMPTY_APP_ADJ 15 98 99# Define the memory thresholds at which the above process classes will 100# be killed. These numbers are in pages (4k). 101 setprop ro.FOREGROUND_APP_MEM 1536 102 setprop ro.VISIBLE_APP_MEM 2048 103 setprop ro.SECONDARY_SERVER_MEM 4096 104 setprop ro.HIDDEN_APP_MEM 5120 105 setprop ro.CONTENT_PROVIDER_MEM 5632 106 setprop ro.EMPTY_APP_MEM 6144 107 108# Write value must be consistent with the above properties. 109 write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15 110 111 write /proc/sys/vm/overcommit_memory 1 112 write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144 113 114 # Set init its forked children's oom_adj. 115 write /proc/1/oom_adj -16 116 117 # Permissions for System Server and daemons. 118 chown radio system /sys/android_power/state 119 chown radio system /sys/android_power/request_state 120 chown radio system /sys/android_power/acquire_full_wake_lock 121 chown radio system /sys/android_power/acquire_partial_wake_lock 122 chown radio system /sys/android_power/release_wake_lock 123 chown radio system /sys/power/state 124 chown radio system /sys/power/wake_lock 125 chown radio system /sys/power/wake_unlock 126 chmod 0660 /sys/power/state 127 chmod 0660 /sys/power/wake_lock 128 chmod 0660 /sys/power/wake_unlock 129 chown system system /sys/class/timed_output/vibrator/enable 130 chown system system /sys/class/leds/keyboard-backlight/brightness 131 chown system system /sys/class/leds/lcd-backlight/brightness 132 chown system system /sys/class/leds/button-backlight/brightness 133 chown system system /sys/class/leds/red/brightness 134 chown system system /sys/class/leds/green/brightness 135 chown system system /sys/class/leds/blue/brightness 136 chown system system /sys/class/leds/red/device/grpfreq 137 chown system system /sys/class/leds/red/device/grppwm 138 chown system system /sys/class/leds/red/device/blink 139 chown system system /sys/class/leds/red/brightness 140 chown system system /sys/class/leds/green/brightness 141 chown system system /sys/class/leds/blue/brightness 142 chown system system /sys/class/leds/red/device/grpfreq 143 chown system system /sys/class/leds/red/device/grppwm 144 chown system system /sys/class/leds/red/device/blink 145 chown system system /sys/class/timed_output/vibrator/enable 146 chown system system /sys/module/sco/parameters/disable_esco 147 chown system system /sys/kernel/ipv4/tcp_wmem_min 148 chown system system /sys/kernel/ipv4/tcp_wmem_def 149 chown system system /sys/kernel/ipv4/tcp_wmem_max 150 chown system system /sys/kernel/ipv4/tcp_rmem_min 151 chown system system /sys/kernel/ipv4/tcp_rmem_def 152 chown system system /sys/kernel/ipv4/tcp_rmem_max 153 chown root radio /proc/cmdline 154 155# Define TCP buffer sizes for various networks 156# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, 157 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 158 setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208 159 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 160 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 161 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 162 163 class_start default 164 165## Daemon processes to be run by init. 166## 167service console /system/bin/sh 168 console 169 170# adbd is controlled by the persist.service.adb.enable system property 171service adbd /sbin/adbd 172 disabled 173 174# adbd on at boot in emulator 175on property:ro.kernel.qemu=1 176 start adbd 177 178on property:persist.service.adb.enable=1 179 start adbd 180 181on property:persist.service.adb.enable=0 182 stop adbd 183 184service servicemanager /system/bin/servicemanager 185 user system 186 critical 187 onrestart restart zygote 188 onrestart restart media 189 190service mountd /system/bin/mountd 191 socket mountd stream 0660 root mount 192 193service debuggerd /system/bin/debuggerd 194 195service ril-daemon /system/bin/rild 196 socket rild stream 660 root radio 197 socket rild-debug stream 660 radio system 198 user root 199 group radio cache inet misc 200 201service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server 202 socket zygote stream 666 203 onrestart write /sys/android_power/request_state wake 204 onrestart write /sys/power/state on 205 206service media /system/bin/mediaserver 207 user media 208 group system audio camera graphics inet net_bt net_bt_admin 209 210service bootsound /system/bin/playmp3 211 user media 212 group audio 213 oneshot 214 215service dbus /system/bin/dbus-daemon --system --nofork 216 socket dbus stream 660 bluetooth bluetooth 217 user bluetooth 218 group bluetooth net_bt_admin 219 220#STOPSHIP: disable the verbose logging 221service hcid /system/bin/logwrapper /system/bin/hcid -d -s -n -f /etc/bluez/hcid.conf 222 socket bluetooth stream 660 bluetooth bluetooth 223 socket dbus_bluetooth stream 660 bluetooth bluetooth 224 # init.rc does not yet support applying capabilities, so run as root and 225 # let hcid drop uid to bluetooth with the right linux capabilities 226 group bluetooth net_bt_admin misc 227 disabled 228 229service hfag /system/bin/sdptool add --channel=10 HFAG 230 user bluetooth 231 group bluetooth net_bt_admin 232 disabled 233 oneshot 234 235service hsag /system/bin/sdptool add --channel=11 HSAG 236 user bluetooth 237 group bluetooth net_bt_admin 238 disabled 239 oneshot 240 241service installd /system/bin/installd 242 socket installd stream 600 system system 243 244service flash_recovery /system/bin/flash_image recovery /system/recovery.img 245 oneshot 246