The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | |
| 2 | on init |
| 3 | |
| 4 | sysclktz 0 |
| 5 | |
| 6 | loglevel 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 /sqlite_stmt_journals 01777 root root |
| 27 | mount tmpfs tmpfs /sqlite_stmt_journals size=4m |
| 28 | |
| 29 | mount rootfs rootfs / ro remount |
| 30 | |
| 31 | write /proc/sys/kernel/panic_on_oops 1 |
| 32 | write /proc/sys/kernel/hung_task_timeout_secs 0 |
| 33 | write /proc/cpu/alignment 4 |
| 34 | write /proc/sys/kernel/sched_latency_ns 10000000 |
| 35 | write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000 |
| 36 | |
San Mehat | 4933098 | 2009-04-21 14:34:19 -0700 | [diff] [blame] | 37 | # Create cgroup mount points for process groups |
| 38 | mkdir /dev/cpuctl |
| 39 | mount cgroup none /dev/cpuctl cpu |
| 40 | chown sytem system /dev/cpuctl |
| 41 | chown system system /dev/cpuctl/tasks |
| 42 | chmod 0777 /dev/cpuctl/tasks |
| 43 | write /dev/cpuctl/cpu.shares 1024 |
| 44 | |
| 45 | mkdir /dev/cpuctl/fg_boost |
| 46 | chown system system /dev/cpuctl/fg_boost/tasks |
| 47 | chmod 0777 /dev/cpuctl/fg_boost/tasks |
| 48 | write /dev/cpuctl/fg_boost/cpu.shares 1024 |
| 49 | |
| 50 | mkdir /dev/cpuctl/bg_non_interactive |
| 51 | chown system system /dev/cpuctl/bg_non_interactive/tasks |
| 52 | chmod 0777 /dev/cpuctl/bg_non_interactive/tasks |
| 53 | write /dev/cpuctl/bg_non_interactive/cpu.shares 1024 |
| 54 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 55 | # mount mtd partitions |
| 56 | # Mount /system rw first to give the filesystem a chance to save a checkpoint |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 57 | mount yaffs2 mtd@system /system |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 58 | mount yaffs2 mtd@system /system ro remount |
| 59 | |
| 60 | # We chown/chmod /data again so because mount is run as root + defaults |
| 61 | mount yaffs2 mtd@userdata /data nosuid nodev |
| 62 | chown system system /data |
| 63 | chmod 0771 /data |
| 64 | |
| 65 | # Same reason as /data above |
| 66 | mount yaffs2 mtd@cache /cache nosuid nodev |
| 67 | chown system cache /cache |
| 68 | chmod 0770 /cache |
| 69 | |
| 70 | # This may have been created by the recovery system with odd permissions |
| 71 | chown system system /cache/recovery |
| 72 | chmod 0770 /cache/recovery |
| 73 | |
| 74 | # create basic filesystem structure |
| 75 | mkdir /data/misc 01771 system misc |
| 76 | mkdir /data/misc/hcid 0770 bluetooth bluetooth |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 77 | mkdir /data/misc/keystore 0770 keystore keystore |
| 78 | mkdir /data/misc/vpn 0770 system system |
| 79 | mkdir /data/misc/vpn/profiles 0770 system system |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 80 | mkdir /data/local 0771 shell shell |
| 81 | mkdir /data/local/tmp 0771 shell shell |
| 82 | mkdir /data/data 0771 system system |
| 83 | mkdir /data/app-private 0771 system system |
| 84 | mkdir /data/app 0771 system system |
| 85 | mkdir /data/property 0700 root root |
| 86 | |
| 87 | # create dalvik-cache and double-check the perms |
| 88 | mkdir /data/dalvik-cache 0771 system system |
| 89 | chown system system /data/dalvik-cache |
| 90 | chmod 0771 /data/dalvik-cache |
| 91 | |
| 92 | # create the lost+found directories, so as to enforce our permissions |
| 93 | mkdir /data/lost+found 0770 |
| 94 | mkdir /cache/lost+found 0770 |
| 95 | |
| 96 | # double check the perms, in case lost+found already exists, and set owner |
| 97 | chown root root /data/lost+found |
| 98 | chmod 0770 /data/lost+found |
| 99 | chown root root /cache/lost+found |
| 100 | chmod 0770 /cache/lost+found |
| 101 | |
| 102 | on boot |
| 103 | # basic network init |
| 104 | ifup lo |
| 105 | hostname localhost |
| 106 | domainname localdomain |
| 107 | |
| 108 | # set RLIMIT_NICE to allow priorities from 19 to -20 |
| 109 | setrlimit 13 40 40 |
| 110 | |
The Android Open Source Project | 2015549 | 2009-03-11 12:12:01 -0700 | [diff] [blame] | 111 | # Set timeout value for rmnet stats. |
| 112 | write /sys/devices/virtual/net/rmnet0/timeout_suspend 5000000 |
| 113 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 114 | # Define the oom_adj values for the classes of processes that can be |
| 115 | # killed by the kernel. These are used in ActivityManagerService. |
| 116 | setprop ro.FOREGROUND_APP_ADJ 0 |
| 117 | setprop ro.VISIBLE_APP_ADJ 1 |
| 118 | setprop ro.SECONDARY_SERVER_ADJ 2 |
Christopher Tate | 17df71e | 2009-06-05 18:20:08 -0700 | [diff] [blame] | 119 | setprop ro.BACKUP_APP_ADJ 2 |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 120 | setprop ro.HOME_APP_ADJ 4 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 121 | setprop ro.HIDDEN_APP_MIN_ADJ 7 |
| 122 | setprop ro.CONTENT_PROVIDER_ADJ 14 |
| 123 | setprop ro.EMPTY_APP_ADJ 15 |
| 124 | |
| 125 | # Define the memory thresholds at which the above process classes will |
| 126 | # be killed. These numbers are in pages (4k). |
| 127 | setprop ro.FOREGROUND_APP_MEM 1536 |
| 128 | setprop ro.VISIBLE_APP_MEM 2048 |
| 129 | setprop ro.SECONDARY_SERVER_MEM 4096 |
Christopher Tate | 17df71e | 2009-06-05 18:20:08 -0700 | [diff] [blame] | 130 | setprop ro.BACKUP_APP_MEM 4096 |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 131 | setprop ro.HOME_APP_MEM 4096 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 132 | setprop ro.HIDDEN_APP_MEM 5120 |
| 133 | setprop ro.CONTENT_PROVIDER_MEM 5632 |
| 134 | setprop ro.EMPTY_APP_MEM 6144 |
| 135 | |
| 136 | # Write value must be consistent with the above properties. |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 137 | # Note that the driver only supports 6 slots, so we have HOME_APP at the |
| 138 | # same memory level as services. |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 139 | write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15 |
| 140 | |
| 141 | write /proc/sys/vm/overcommit_memory 1 |
The Android Open Source Project | e037fd7 | 2009-03-13 13:04:37 -0700 | [diff] [blame] | 142 | write /proc/sys/vm/min_free_order_shift 4 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 143 | write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144 |
| 144 | |
| 145 | # Set init its forked children's oom_adj. |
| 146 | write /proc/1/oom_adj -16 |
| 147 | |
| 148 | # Permissions for System Server and daemons. |
| 149 | chown radio system /sys/android_power/state |
| 150 | chown radio system /sys/android_power/request_state |
| 151 | chown radio system /sys/android_power/acquire_full_wake_lock |
| 152 | chown radio system /sys/android_power/acquire_partial_wake_lock |
| 153 | chown radio system /sys/android_power/release_wake_lock |
| 154 | chown radio system /sys/power/state |
| 155 | chown radio system /sys/power/wake_lock |
| 156 | chown radio system /sys/power/wake_unlock |
| 157 | chmod 0660 /sys/power/state |
| 158 | chmod 0660 /sys/power/wake_lock |
| 159 | chmod 0660 /sys/power/wake_unlock |
| 160 | chown system system /sys/class/timed_output/vibrator/enable |
| 161 | chown system system /sys/class/leds/keyboard-backlight/brightness |
| 162 | chown system system /sys/class/leds/lcd-backlight/brightness |
| 163 | chown system system /sys/class/leds/button-backlight/brightness |
The Android Open Source Project | f614d64 | 2009-03-18 17:39:49 -0700 | [diff] [blame] | 164 | chown system system /sys/class/leds/jogball-backlight/brightness |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 165 | chown system system /sys/class/leds/red/brightness |
| 166 | chown system system /sys/class/leds/green/brightness |
| 167 | chown system system /sys/class/leds/blue/brightness |
| 168 | chown system system /sys/class/leds/red/device/grpfreq |
| 169 | chown system system /sys/class/leds/red/device/grppwm |
| 170 | chown system system /sys/class/leds/red/device/blink |
| 171 | chown system system /sys/class/leds/red/brightness |
| 172 | chown system system /sys/class/leds/green/brightness |
| 173 | chown system system /sys/class/leds/blue/brightness |
| 174 | chown system system /sys/class/leds/red/device/grpfreq |
| 175 | chown system system /sys/class/leds/red/device/grppwm |
| 176 | chown system system /sys/class/leds/red/device/blink |
| 177 | chown system system /sys/class/timed_output/vibrator/enable |
| 178 | chown system system /sys/module/sco/parameters/disable_esco |
| 179 | chown system system /sys/kernel/ipv4/tcp_wmem_min |
| 180 | chown system system /sys/kernel/ipv4/tcp_wmem_def |
| 181 | chown system system /sys/kernel/ipv4/tcp_wmem_max |
| 182 | chown system system /sys/kernel/ipv4/tcp_rmem_min |
| 183 | chown system system /sys/kernel/ipv4/tcp_rmem_def |
| 184 | chown system system /sys/kernel/ipv4/tcp_rmem_max |
| 185 | chown root radio /proc/cmdline |
| 186 | |
| 187 | # Define TCP buffer sizes for various networks |
| 188 | # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, |
| 189 | setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 |
| 190 | setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208 |
| 191 | setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 |
| 192 | setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 |
| 193 | setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 |
| 194 | |
| 195 | class_start default |
| 196 | |
| 197 | ## Daemon processes to be run by init. |
| 198 | ## |
| 199 | service console /system/bin/sh |
| 200 | console |
| 201 | |
| 202 | # adbd is controlled by the persist.service.adb.enable system property |
| 203 | service adbd /sbin/adbd |
| 204 | disabled |
| 205 | |
| 206 | # adbd on at boot in emulator |
| 207 | on property:ro.kernel.qemu=1 |
| 208 | start adbd |
| 209 | |
| 210 | on property:persist.service.adb.enable=1 |
| 211 | start adbd |
| 212 | |
| 213 | on property:persist.service.adb.enable=0 |
| 214 | stop adbd |
| 215 | |
| 216 | service servicemanager /system/bin/servicemanager |
| 217 | user system |
| 218 | critical |
| 219 | onrestart restart zygote |
| 220 | onrestart restart media |
| 221 | |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 222 | service vold /system/bin/vold |
| 223 | socket vold stream 0660 root mount |
| 224 | |
San Mehat | 269946c | 2009-05-06 11:18:43 -0700 | [diff] [blame] | 225 | service nexus /system/bin/nexus |
| 226 | socket nexus stream 0660 root system |
| 227 | disabled |
| 228 | |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 229 | #service mountd /system/bin/mountd |
| 230 | # socket mountd stream 0660 root mount |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 231 | |
| 232 | service debuggerd /system/bin/debuggerd |
| 233 | |
| 234 | service ril-daemon /system/bin/rild |
| 235 | socket rild stream 660 root radio |
| 236 | socket rild-debug stream 660 radio system |
| 237 | user root |
| 238 | group radio cache inet misc |
| 239 | |
| 240 | service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server |
| 241 | socket zygote stream 666 |
| 242 | onrestart write /sys/android_power/request_state wake |
| 243 | onrestart write /sys/power/state on |
| 244 | |
| 245 | service media /system/bin/mediaserver |
| 246 | user media |
| 247 | group system audio camera graphics inet net_bt net_bt_admin |
| 248 | |
| 249 | service bootsound /system/bin/playmp3 |
| 250 | user media |
| 251 | group audio |
| 252 | oneshot |
| 253 | |
Mathias Agopian | 8b2cf9f | 2009-05-20 18:09:51 -0700 | [diff] [blame] | 254 | service bootanim /system/bin/bootanimation |
| 255 | user graphics |
| 256 | group graphics |
| 257 | disabled |
| 258 | oneshot |
| 259 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 260 | service dbus /system/bin/dbus-daemon --system --nofork |
| 261 | socket dbus stream 660 bluetooth bluetooth |
| 262 | user bluetooth |
| 263 | group bluetooth net_bt_admin |
| 264 | |
Nick Pelly | 0116116 | 2009-03-25 18:00:56 -0700 | [diff] [blame] | 265 | service hcid /system/bin/hcid -s -n -f /etc/bluez/hcid.conf |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 266 | socket bluetooth stream 660 bluetooth bluetooth |
| 267 | socket dbus_bluetooth stream 660 bluetooth bluetooth |
| 268 | # init.rc does not yet support applying capabilities, so run as root and |
| 269 | # let hcid drop uid to bluetooth with the right linux capabilities |
| 270 | group bluetooth net_bt_admin misc |
| 271 | disabled |
| 272 | |
| 273 | service hfag /system/bin/sdptool add --channel=10 HFAG |
| 274 | user bluetooth |
| 275 | group bluetooth net_bt_admin |
| 276 | disabled |
| 277 | oneshot |
| 278 | |
| 279 | service hsag /system/bin/sdptool add --channel=11 HSAG |
| 280 | user bluetooth |
| 281 | group bluetooth net_bt_admin |
| 282 | disabled |
| 283 | oneshot |
| 284 | |
| 285 | service installd /system/bin/installd |
| 286 | socket installd stream 600 system system |
| 287 | |
| 288 | service flash_recovery /system/bin/flash_image recovery /system/recovery.img |
| 289 | oneshot |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 290 | |
| 291 | service racoon /system/bin/racoon -F -f /etc/racoon/racoon.conf |
| 292 | socket racoon stream 600 system system |
| 293 | disabled |
| 294 | oneshot |
| 295 | |
| 296 | service mtpd /system/bin/mtpd |
| 297 | socket mtpd stream 600 system system |
| 298 | disabled |
| 299 | oneshot |
| 300 | |
| 301 | service keystore /system/bin/keystore |
| 302 | user keystore |
| 303 | group keystore |
| 304 | socket keystore stream 666 |
| 305 | |