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