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