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