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