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