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