init.rc revision 92175e04a56db804d4dae75fc49fdd5edc6a2968
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 symlink /sys/kernel/debug /d 21 22# create mountpoints and mount tmpfs on sqlite_stmt_journals 23 mkdir /sdcard 0000 system system 24 mkdir /system 25 mkdir /data 0771 system system 26 mkdir /cache 0770 system cache 27 mkdir /config 0500 root root 28 mkdir /sqlite_stmt_journals 01777 root root 29 mount tmpfs tmpfs /sqlite_stmt_journals size=4m 30 31# create Android Secure External Cache mount tree 32 mkdir /asec 0700 system system 33 mount tmpfs tmpfs /asec mode=0755 34 35 mount rootfs rootfs / ro remount 36 37 write /proc/sys/kernel/panic_on_oops 1 38 write /proc/sys/kernel/hung_task_timeout_secs 0 39 write /proc/cpu/alignment 4 40 write /proc/sys/kernel/sched_latency_ns 10000000 41 write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000 42 write /proc/sys/kernel/sched_compat_yield 1 43 write /proc/sys/kernel/sched_child_runs_first 0 44 45# Create cgroup mount points for process groups 46 mkdir /dev/cpuctl 47 mount cgroup none /dev/cpuctl cpu 48 chown system system /dev/cpuctl 49 chown system system /dev/cpuctl/tasks 50 chmod 0777 /dev/cpuctl/tasks 51 write /dev/cpuctl/cpu.shares 1024 52 53 mkdir /dev/cpuctl/fg_boost 54 chown system system /dev/cpuctl/fg_boost/tasks 55 chmod 0777 /dev/cpuctl/fg_boost/tasks 56 write /dev/cpuctl/fg_boost/cpu.shares 1024 57 58 mkdir /dev/cpuctl/bg_non_interactive 59 chown system system /dev/cpuctl/bg_non_interactive/tasks 60 chmod 0777 /dev/cpuctl/bg_non_interactive/tasks 61 # 5.0 % 62 write /dev/cpuctl/bg_non_interactive/cpu.shares 52 63 64# mount mtd partitions 65 # Mount /system rw first to give the filesystem a chance to save a checkpoint 66 mount yaffs2 mtd@system /system 67 mount yaffs2 mtd@system /system ro remount 68 69 # We chown/chmod /data again so because mount is run as root + defaults 70 mount yaffs2 mtd@userdata /data nosuid nodev 71 chown system system /data 72 chmod 0771 /data 73 74 # Create dump dir and collect dumps. 75 # Do this before we mount cache so eventually we can use cache for 76 # storing dumps on platforms which do not have a dedicated dump partition. 77 78 mkdir /data/dontpanic 79 chown root log /data/dontpanic 80 chmod 0750 /data/dontpanic 81 82 # Collect apanic data, free resources and re-arm trigger 83 copy /proc/apanic_console /data/dontpanic/apanic_console 84 chown root log /data/dontpanic/apanic_console 85 chmod 0640 /data/dontpanic/apanic_console 86 87 copy /proc/apanic_threads /data/dontpanic/apanic_threads 88 chown root log /data/dontpanic/apanic_threads 89 chmod 0640 /data/dontpanic/apanic_threads 90 91 write /proc/apanic_console 1 92 93 # Same reason as /data above 94 mount yaffs2 mtd@cache /cache nosuid nodev 95 chown system cache /cache 96 chmod 0770 /cache 97 98 # This may have been created by the recovery system with odd permissions 99 chown system cache /cache/recovery 100 chmod 0770 /cache/recovery 101 102 #change permissions on vmallocinfo so we can grab it from bugreports 103 chown root log /proc/vmallocinfo 104 chmod 0440 /proc/vmallocinfo 105 106# create basic filesystem structure 107 mkdir /data/misc 01771 system misc 108 mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth 109 mkdir /data/misc/keystore 0700 keystore keystore 110 mkdir /data/misc/vpn 0770 system system 111 mkdir /data/misc/systemkeys 0700 system system 112 mkdir /data/misc/vpn/profiles 0770 system system 113 # give system access to wpa_supplicant.conf for backup and restore 114 mkdir /data/misc/wifi 0770 wifi wifi 115 chmod 0770 /data/misc/wifi 116 chmod 0660 /data/misc/wifi/wpa_supplicant.conf 117 mkdir /data/local 0771 shell shell 118 mkdir /data/local/tmp 0771 shell shell 119 mkdir /data/data 0771 system system 120 mkdir /data/app-private 0771 system system 121 mkdir /data/app 0771 system system 122 mkdir /data/property 0700 root root 123 124 # STOPSHIP: Temporary Encrypted File Systems workaround 125 mkdir /data/secure 0771 system system 126 mkdir /data/secure/data 0771 system system 127 mkdir /data/secure/misc 01771 system misc 128 mkdir /data/securemisc/vpn 0770 system system 129 mkdir /data/secure/misc/vpn/profiles 0770 system system 130 131 # create dalvik-cache and double-check the perms 132 mkdir /data/dalvik-cache 0771 system system 133 chown system system /data/dalvik-cache 134 chmod 0771 /data/dalvik-cache 135 136 # create the lost+found directories, so as to enforce our permissions 137 mkdir /data/lost+found 0770 138 mkdir /cache/lost+found 0770 139 140 # double check the perms, in case lost+found already exists, and set owner 141 chown root root /data/lost+found 142 chmod 0770 /data/lost+found 143 chown root root /cache/lost+found 144 chmod 0770 /cache/lost+found 145 146on boot 147# basic network init 148 ifup lo 149 hostname localhost 150 domainname localdomain 151 152# set RLIMIT_NICE to allow priorities from 19 to -20 153 setrlimit 13 40 40 154 155# Define the oom_adj values for the classes of processes that can be 156# killed by the kernel. These are used in ActivityManagerService. 157 setprop ro.FOREGROUND_APP_ADJ 0 158 setprop ro.VISIBLE_APP_ADJ 1 159 setprop ro.SECONDARY_SERVER_ADJ 2 160 setprop ro.BACKUP_APP_ADJ 2 161 setprop ro.HOME_APP_ADJ 4 162 setprop ro.HIDDEN_APP_MIN_ADJ 7 163 setprop ro.CONTENT_PROVIDER_ADJ 14 164 setprop ro.EMPTY_APP_ADJ 15 165 166# Define the memory thresholds at which the above process classes will 167# be killed. These numbers are in pages (4k). 168 setprop ro.FOREGROUND_APP_MEM 1536 169 setprop ro.VISIBLE_APP_MEM 2048 170 setprop ro.SECONDARY_SERVER_MEM 4096 171 setprop ro.BACKUP_APP_MEM 4096 172 setprop ro.HOME_APP_MEM 4096 173 setprop ro.HIDDEN_APP_MEM 5120 174 setprop ro.CONTENT_PROVIDER_MEM 5632 175 setprop ro.EMPTY_APP_MEM 6144 176 177# Write value must be consistent with the above properties. 178# Note that the driver only supports 6 slots, so we have HOME_APP at the 179# same memory level as services. 180 write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15 181 182 write /proc/sys/vm/overcommit_memory 1 183 write /proc/sys/vm/min_free_order_shift 4 184 write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144 185 186 # Set init its forked children's oom_adj. 187 write /proc/1/oom_adj -16 188 189 # Tweak background writeout 190 write /proc/sys/vm/dirty_expire_centisecs 200 191 write /proc/sys/vm/dirty_background_ratio 5 192 193 # Permissions for System Server and daemons. 194 chown radio system /sys/android_power/state 195 chown radio system /sys/android_power/request_state 196 chown radio system /sys/android_power/acquire_full_wake_lock 197 chown radio system /sys/android_power/acquire_partial_wake_lock 198 chown radio system /sys/android_power/release_wake_lock 199 chown radio system /sys/power/state 200 chown radio system /sys/power/wake_lock 201 chown radio system /sys/power/wake_unlock 202 chmod 0660 /sys/power/state 203 chmod 0660 /sys/power/wake_lock 204 chmod 0660 /sys/power/wake_unlock 205 chown system system /sys/class/timed_output/vibrator/enable 206 chown system system /sys/class/leds/keyboard-backlight/brightness 207 chown system system /sys/class/leds/lcd-backlight/brightness 208 chown system system /sys/class/leds/button-backlight/brightness 209 chown system system /sys/class/leds/jogball-backlight/brightness 210 chown system system /sys/class/leds/red/brightness 211 chown system system /sys/class/leds/green/brightness 212 chown system system /sys/class/leds/blue/brightness 213 chown system system /sys/class/leds/red/device/grpfreq 214 chown system system /sys/class/leds/red/device/grppwm 215 chown system system /sys/class/leds/red/device/blink 216 chown system system /sys/class/leds/red/brightness 217 chown system system /sys/class/leds/green/brightness 218 chown system system /sys/class/leds/blue/brightness 219 chown system system /sys/class/leds/red/device/grpfreq 220 chown system system /sys/class/leds/red/device/grppwm 221 chown system system /sys/class/leds/red/device/blink 222 chown system system /sys/class/timed_output/vibrator/enable 223 chown system system /sys/module/sco/parameters/disable_esco 224 chown system system /sys/kernel/ipv4/tcp_wmem_min 225 chown system system /sys/kernel/ipv4/tcp_wmem_def 226 chown system system /sys/kernel/ipv4/tcp_wmem_max 227 chown system system /sys/kernel/ipv4/tcp_rmem_min 228 chown system system /sys/kernel/ipv4/tcp_rmem_def 229 chown system system /sys/kernel/ipv4/tcp_rmem_max 230 chown root radio /proc/cmdline 231 232# Define TCP buffer sizes for various networks 233# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, 234 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 235 setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208 236 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 237 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 238 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 239 240 class_start default 241 242## Daemon processes to be run by init. 243## 244service console /system/bin/sh 245 console 246 247# adbd is controlled by the persist.service.adb.enable system property 248service adbd /sbin/adbd 249 disabled 250 251# adbd on at boot in emulator 252on property:ro.kernel.qemu=1 253 start adbd 254 255on property:persist.service.adb.enable=1 256 start adbd 257 258on property:persist.service.adb.enable=0 259 stop adbd 260 261service servicemanager /system/bin/servicemanager 262 user system 263 critical 264 onrestart restart zygote 265 onrestart restart media 266 267service vold /system/bin/vold 268 socket vold stream 0660 root mount 269 270service netd /system/bin/netd 271 socket netd stream 0660 root system 272 273service nexus /system/bin/nexus 274 socket nexus stream 0660 root system 275 disabled 276 277#service mountd /system/bin/mountd 278# socket mountd stream 0660 root mount 279 280service debuggerd /system/bin/debuggerd 281 282service ril-daemon /system/bin/rild 283 socket rild stream 660 root radio 284 socket rild-debug stream 660 radio system 285 user root 286 group radio cache inet misc audio 287 288service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server 289 socket zygote stream 666 290 onrestart write /sys/android_power/request_state wake 291 onrestart write /sys/power/state on 292 onrestart restart media 293 294service media /system/bin/mediaserver 295 user media 296 group system audio camera graphics inet net_bt net_bt_admin 297 298service bootsound /system/bin/playmp3 299 user media 300 group audio 301 oneshot 302 303service bootanim /system/bin/bootanimation 304 user graphics 305 group graphics 306 disabled 307 oneshot 308 309service dbus /system/bin/dbus-daemon --system --nofork 310 socket dbus stream 660 bluetooth bluetooth 311 user bluetooth 312 group bluetooth net_bt_admin 313 314service bluetoothd /system/bin/bluetoothd -n 315 socket bluetooth stream 660 bluetooth bluetooth 316 socket dbus_bluetooth stream 660 bluetooth bluetooth 317 # init.rc does not yet support applying capabilities, so run as root and 318 # let bluetoothd drop uid to bluetooth with the right linux capabilities 319 group bluetooth net_bt_admin misc 320 disabled 321 322service hfag /system/bin/sdptool add --channel=10 HFAG 323 user bluetooth 324 group bluetooth net_bt_admin 325 disabled 326 oneshot 327 328service hsag /system/bin/sdptool add --channel=11 HSAG 329 user bluetooth 330 group bluetooth net_bt_admin 331 disabled 332 oneshot 333 334service opush /system/bin/sdptool add --channel=12 OPUSH 335 user bluetooth 336 group bluetooth net_bt_admin 337 disabled 338 oneshot 339 340service pbap /system/bin/sdptool add --channel=19 PBAP 341 user bluetooth 342 group bluetooth net_bt_admin 343 disabled 344 oneshot 345 346service installd /system/bin/installd 347 socket installd stream 600 system system 348 349service flash_recovery /system/etc/install-recovery.sh 350 oneshot 351 352service racoon /system/bin/racoon 353 socket racoon stream 600 system system 354 # racoon will setuid to vpn after getting necessary resources. 355 group net_admin 356 disabled 357 oneshot 358 359service mtpd /system/bin/mtpd 360 socket mtpd stream 600 system system 361 user vpn 362 group vpn net_admin net_raw 363 disabled 364 oneshot 365 366service keystore /system/bin/keystore /data/misc/keystore 367 user keystore 368 group keystore 369 socket keystore stream 666 370 371service dumpstate /system/bin/dumpstate -s 372 socket dumpstate stream 0660 shell log 373 disabled 374 oneshot 375