init.rc revision 89f235c5e028466bb273dbaacb3346f1f0ba9f1e
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 # STOPSHIP: Temporary Encrypted File Systems workaround 145 mkdir /data/secure 0771 system system 146 mkdir /data/secure/data 0771 system system 147 mkdir /data/secure/misc 01771 system misc 148 mkdir /data/securemisc/vpn 0770 system system 149 mkdir /data/secure/misc/vpn/profiles 0770 system system 150 151 # create dalvik-cache and double-check the perms 152 mkdir /data/dalvik-cache 0771 system system 153 chown system system /data/dalvik-cache 154 chmod 0771 /data/dalvik-cache 155 156 # create the lost+found directories, so as to enforce our permissions 157 mkdir /data/lost+found 0770 158 mkdir /cache/lost+found 0770 159 160 # double check the perms, in case lost+found already exists, and set owner 161 chown root root /data/lost+found 162 chmod 0770 /data/lost+found 163 chown root root /cache/lost+found 164 chmod 0770 /cache/lost+found 165 166on boot 167# basic network init 168 ifup lo 169 hostname localhost 170 domainname localdomain 171 172# set RLIMIT_NICE to allow priorities from 19 to -20 173 setrlimit 13 40 40 174 175# Define the oom_adj values for the classes of processes that can be 176# killed by the kernel. These are used in ActivityManagerService. 177 setprop ro.FOREGROUND_APP_ADJ 0 178 setprop ro.VISIBLE_APP_ADJ 1 179 setprop ro.SECONDARY_SERVER_ADJ 2 180 setprop ro.BACKUP_APP_ADJ 2 181 setprop ro.HOME_APP_ADJ 4 182 setprop ro.HIDDEN_APP_MIN_ADJ 7 183 setprop ro.CONTENT_PROVIDER_ADJ 14 184 setprop ro.EMPTY_APP_ADJ 15 185 186# Define the memory thresholds at which the above process classes will 187# be killed. These numbers are in pages (4k). 188 setprop ro.FOREGROUND_APP_MEM 1536 189 setprop ro.VISIBLE_APP_MEM 2048 190 setprop ro.SECONDARY_SERVER_MEM 4096 191 setprop ro.BACKUP_APP_MEM 4096 192 setprop ro.HOME_APP_MEM 4096 193 setprop ro.HIDDEN_APP_MEM 5120 194 setprop ro.CONTENT_PROVIDER_MEM 5632 195 setprop ro.EMPTY_APP_MEM 6144 196 197# Write value must be consistent with the above properties. 198# Note that the driver only supports 6 slots, so we have HOME_APP at the 199# same memory level as services. 200 write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15 201 202 write /proc/sys/vm/overcommit_memory 1 203 write /proc/sys/vm/min_free_order_shift 4 204 write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144 205 206 # Set init its forked children's oom_adj. 207 write /proc/1/oom_adj -16 208 209 # Tweak background writeout 210 write /proc/sys/vm/dirty_expire_centisecs 200 211 write /proc/sys/vm/dirty_background_ratio 5 212 213 # Permissions for System Server and daemons. 214 chown radio system /sys/android_power/state 215 chown radio system /sys/android_power/request_state 216 chown radio system /sys/android_power/acquire_full_wake_lock 217 chown radio system /sys/android_power/acquire_partial_wake_lock 218 chown radio system /sys/android_power/release_wake_lock 219 chown radio system /sys/power/state 220 chown radio system /sys/power/wake_lock 221 chown radio system /sys/power/wake_unlock 222 chmod 0660 /sys/power/state 223 chmod 0660 /sys/power/wake_lock 224 chmod 0660 /sys/power/wake_unlock 225 chown system system /sys/class/timed_output/vibrator/enable 226 chown system system /sys/class/leds/keyboard-backlight/brightness 227 chown system system /sys/class/leds/lcd-backlight/brightness 228 chown system system /sys/class/leds/button-backlight/brightness 229 chown system system /sys/class/leds/jogball-backlight/brightness 230 chown system system /sys/class/leds/red/brightness 231 chown system system /sys/class/leds/green/brightness 232 chown system system /sys/class/leds/blue/brightness 233 chown system system /sys/class/leds/red/device/grpfreq 234 chown system system /sys/class/leds/red/device/grppwm 235 chown system system /sys/class/leds/red/device/blink 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/timed_output/vibrator/enable 243 chown system system /sys/module/sco/parameters/disable_esco 244 chown system system /sys/kernel/ipv4/tcp_wmem_min 245 chown system system /sys/kernel/ipv4/tcp_wmem_def 246 chown system system /sys/kernel/ipv4/tcp_wmem_max 247 chown system system /sys/kernel/ipv4/tcp_rmem_min 248 chown system system /sys/kernel/ipv4/tcp_rmem_def 249 chown system system /sys/kernel/ipv4/tcp_rmem_max 250 chown root radio /proc/cmdline 251 252# Define TCP buffer sizes for various networks 253# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, 254 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 255 setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208 256 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 257 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 258 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 259 260 class_start default 261 262## Daemon processes to be run by init. 263## 264service console /system/bin/sh 265 console 266 267# adbd is controlled by the persist.service.adb.enable system property 268service adbd /sbin/adbd 269 disabled 270 271# adbd on at boot in emulator 272on property:ro.kernel.qemu=1 273 start adbd 274 275on property:persist.service.adb.enable=1 276 start adbd 277 278on property:persist.service.adb.enable=0 279 stop adbd 280 281service servicemanager /system/bin/servicemanager 282 user system 283 critical 284 onrestart restart zygote 285 onrestart restart media 286 287service vold /system/bin/vold 288 socket vold stream 0660 root mount 289 ioprio be 2 290 291service netd /system/bin/netd 292 socket netd stream 0660 root system 293 294service debuggerd /system/bin/debuggerd 295 296service ril-daemon /system/bin/rild 297 socket rild stream 660 root radio 298 socket rild-debug stream 660 radio system 299 user root 300 group radio cache inet misc audio 301 302service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server 303 socket zygote stream 666 304 onrestart write /sys/android_power/request_state wake 305 onrestart write /sys/power/state on 306 onrestart restart media 307 308service media /system/bin/mediaserver 309 user media 310 group system audio camera graphics inet net_bt net_bt_admin 311 ioprio rt 4 312 313service bootanim /system/bin/bootanimation 314 user graphics 315 group graphics 316 disabled 317 oneshot 318 319service dbus /system/bin/dbus-daemon --system --nofork 320 socket dbus stream 660 bluetooth bluetooth 321 user bluetooth 322 group bluetooth net_bt_admin 323 324service bluetoothd /system/bin/bluetoothd -n 325 socket bluetooth stream 660 bluetooth bluetooth 326 socket dbus_bluetooth stream 660 bluetooth bluetooth 327 # init.rc does not yet support applying capabilities, so run as root and 328 # let bluetoothd drop uid to bluetooth with the right linux capabilities 329 group bluetooth net_bt_admin misc 330 disabled 331 332service hfag /system/bin/sdptool add --channel=10 HFAG 333 user bluetooth 334 group bluetooth net_bt_admin 335 disabled 336 oneshot 337 338service hsag /system/bin/sdptool add --channel=11 HSAG 339 user bluetooth 340 group bluetooth net_bt_admin 341 disabled 342 oneshot 343 344service opush /system/bin/sdptool add --channel=12 OPUSH 345 user bluetooth 346 group bluetooth net_bt_admin 347 disabled 348 oneshot 349 350service pbap /system/bin/sdptool add --channel=19 PBAP 351 user bluetooth 352 group bluetooth net_bt_admin 353 disabled 354 oneshot 355 356service installd /system/bin/installd 357 socket installd stream 600 system system 358 359service flash_recovery /system/etc/install-recovery.sh 360 oneshot 361 362service racoon /system/bin/racoon 363 socket racoon stream 600 system system 364 # racoon will setuid to vpn after getting necessary resources. 365 group net_admin 366 disabled 367 oneshot 368 369service mtpd /system/bin/mtpd 370 socket mtpd stream 600 system system 371 user vpn 372 group vpn net_admin net_raw 373 disabled 374 oneshot 375 376service keystore /system/bin/keystore /data/misc/keystore 377 user keystore 378 group keystore 379 socket keystore stream 666 380 381service dumpstate /system/bin/dumpstate -s 382 socket dumpstate stream 0660 shell log 383 disabled 384 oneshot 385