Nick Kralevich | f3ef127 | 2012-03-14 15:22:54 -0700 | [diff] [blame] | 1 | # Copyright (C) 2012 The Android Open Source Project |
| 2 | # |
| 3 | # IMPORTANT: Do not create world writable files or directories. |
| 4 | # This is a common source of Android security bugs. |
| 5 | # |
| 6 | |
Dima Zavin | 7634bf8 | 2011-12-16 14:23:22 -0800 | [diff] [blame] | 7 | import /init.${ro.hardware}.rc |
Mike Lockwood | 4f5d517 | 2012-04-04 11:26:59 -0700 | [diff] [blame] | 8 | import /init.usb.rc |
Dima Zavin | 7634bf8 | 2011-12-16 14:23:22 -0800 | [diff] [blame] | 9 | |
Colin Cross | f83d0b9 | 2010-04-21 12:04:20 -0700 | [diff] [blame] | 10 | on early-init |
Dima Zavin | 4a25390 | 2011-11-04 12:45:52 -0700 | [diff] [blame] | 11 | # Set init and its forked children's oom_adj. |
| 12 | write /proc/1/oom_adj -16 |
| 13 | |
Colin Cross | f83d0b9 | 2010-04-21 12:04:20 -0700 | [diff] [blame] | 14 | start ueventd |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 15 | |
Mike Lockwood | a2dffa9 | 2010-06-15 20:57:59 -0700 | [diff] [blame] | 16 | # create mountpoints |
| 17 | mkdir /mnt 0775 root system |
| 18 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 19 | on init |
| 20 | |
| 21 | sysclktz 0 |
| 22 | |
| 23 | loglevel 3 |
| 24 | |
| 25 | # setup the global environment |
Brian Swetland | 02863b9 | 2010-09-19 03:36:39 -0700 | [diff] [blame] | 26 | export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin |
| 27 | export LD_LIBRARY_PATH /vendor/lib:/system/lib |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 28 | export ANDROID_BOOTLOGO 1 |
| 29 | export ANDROID_ROOT /system |
| 30 | export ANDROID_ASSETS /system/app |
| 31 | export ANDROID_DATA /data |
San Mehat | a9db22f | 2010-02-24 10:17:32 -0800 | [diff] [blame] | 32 | export ASEC_MOUNTPOINT /mnt/asec |
Kenny Root | c7858a3 | 2010-07-15 12:14:44 -0700 | [diff] [blame] | 33 | export LOOP_MOUNTPOINT /mnt/obb |
Marius Renn | 7151356 | 2012-03-27 10:56:06 -0700 | [diff] [blame] | 34 | export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 35 | |
| 36 | # Backward compatibility |
| 37 | symlink /system/etc /etc |
Brian Swetland | bb6f68c | 2009-09-18 15:31:23 -0700 | [diff] [blame] | 38 | symlink /sys/kernel/debug /d |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 39 | |
Brian Swetland | 02863b9 | 2010-09-19 03:36:39 -0700 | [diff] [blame] | 40 | # Right now vendor lives on the same filesystem as system, |
| 41 | # but someday that may change. |
| 42 | symlink /system/vendor /vendor |
San Mehat | 6ea3cc6 | 2010-02-19 18:25:22 -0800 | [diff] [blame] | 43 | |
Mike Chan | 89f235c | 2010-03-01 11:36:10 -0800 | [diff] [blame] | 44 | # Create cgroup mount point for cpu accounting |
| 45 | mkdir /acct |
| 46 | mount cgroup none /acct cpuacct |
| 47 | mkdir /acct/uid |
| 48 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 49 | mkdir /system |
| 50 | mkdir /data 0771 system system |
| 51 | mkdir /cache 0770 system cache |
Dmitry Shmidt | 720f08f | 2009-06-09 14:38:56 -0700 | [diff] [blame] | 52 | mkdir /config 0500 root root |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 53 | |
San Mehat | 6ea3cc6 | 2010-02-19 18:25:22 -0800 | [diff] [blame] | 54 | # Directory for putting things only root should see. |
| 55 | mkdir /mnt/secure 0700 root root |
| 56 | |
| 57 | # Directory for staging bindmounts |
| 58 | mkdir /mnt/secure/staging 0700 root root |
| 59 | |
| 60 | # Directory-target for where the secure container |
| 61 | # imagefile directory will be bind-mounted |
| 62 | mkdir /mnt/secure/asec 0700 root root |
| 63 | |
| 64 | # Secure container public mount points. |
| 65 | mkdir /mnt/asec 0700 root system |
| 66 | mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000 |
San Mehat | 900570e | 2010-01-06 10:38:49 -0800 | [diff] [blame] | 67 | |
Kenny Root | c7858a3 | 2010-07-15 12:14:44 -0700 | [diff] [blame] | 68 | # Filesystem image public mount points. |
| 69 | mkdir /mnt/obb 0700 root system |
| 70 | mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000 |
| 71 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 72 | write /proc/sys/kernel/panic_on_oops 1 |
| 73 | write /proc/sys/kernel/hung_task_timeout_secs 0 |
| 74 | write /proc/cpu/alignment 4 |
| 75 | write /proc/sys/kernel/sched_latency_ns 10000000 |
| 76 | write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000 |
San Mehat | 4322f2d | 2009-06-29 08:47:43 -0700 | [diff] [blame] | 77 | write /proc/sys/kernel/sched_compat_yield 1 |
San Mehat | 7baff71 | 2009-09-16 13:32:23 -0700 | [diff] [blame] | 78 | write /proc/sys/kernel/sched_child_runs_first 0 |
Nick Kralevich | d707fb3 | 2011-10-06 11:47:11 -0700 | [diff] [blame] | 79 | write /proc/sys/kernel/randomize_va_space 2 |
Nick Kralevich | 2e7c833 | 2011-11-02 08:51:37 -0700 | [diff] [blame] | 80 | write /proc/sys/kernel/kptr_restrict 2 |
Nick Kralevich | f9557fb | 2011-11-08 14:38:53 -0800 | [diff] [blame] | 81 | write /proc/sys/kernel/dmesg_restrict 1 |
Nick Kralevich | 27cca21 | 2011-12-05 14:48:08 -0800 | [diff] [blame] | 82 | write /proc/sys/vm/mmap_min_addr 32768 |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 83 | write /proc/sys/kernel/sched_rt_runtime_us 950000 |
| 84 | write /proc/sys/kernel/sched_rt_period_us 1000000 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 85 | |
San Mehat | 529520e | 2009-10-06 11:22:55 -0700 | [diff] [blame] | 86 | # Create cgroup mount points for process groups |
| 87 | mkdir /dev/cpuctl |
San Mehat | b91bf4b | 2010-02-27 08:20:11 -0800 | [diff] [blame] | 88 | mount cgroup none /dev/cpuctl cpu |
San Mehat | 92175e0 | 2010-01-17 12:21:42 -0800 | [diff] [blame] | 89 | chown system system /dev/cpuctl |
San Mehat | 529520e | 2009-10-06 11:22:55 -0700 | [diff] [blame] | 90 | chown system system /dev/cpuctl/tasks |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 91 | chmod 0660 /dev/cpuctl/tasks |
San Mehat | 529520e | 2009-10-06 11:22:55 -0700 | [diff] [blame] | 92 | write /dev/cpuctl/cpu.shares 1024 |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 93 | write /dev/cpuctl/cpu.rt_runtime_us 950000 |
| 94 | write /dev/cpuctl/cpu.rt_period_us 1000000 |
San Mehat | 529520e | 2009-10-06 11:22:55 -0700 | [diff] [blame] | 95 | |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 96 | mkdir /dev/cpuctl/foreground |
| 97 | chown system system /dev/cpuctl/foreground/tasks |
| 98 | chmod 0666 /dev/cpuctl/foreground/tasks |
| 99 | write /dev/cpuctl/foreground/cpu.shares 1024 |
| 100 | write /dev/cpuctl/foreground/cpu.rt_runtime_us 0 |
| 101 | write /dev/cpuctl/foreground/cpu.rt_period_us 1000000 |
San Mehat | 529520e | 2009-10-06 11:22:55 -0700 | [diff] [blame] | 102 | |
| 103 | mkdir /dev/cpuctl/bg_non_interactive |
| 104 | chown system system /dev/cpuctl/bg_non_interactive/tasks |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 105 | chmod 0666 /dev/cpuctl/bg_non_interactive/tasks |
San Mehat | 529520e | 2009-10-06 11:22:55 -0700 | [diff] [blame] | 106 | # 5.0 % |
| 107 | write /dev/cpuctl/bg_non_interactive/cpu.shares 52 |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 108 | write /dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us 0 |
| 109 | write /dev/cpuctl/bg_non_interactive/cpu.rt_period_us 1000000 |
| 110 | |
| 111 | mkdir /dev/cpuctl/audio_app |
| 112 | chown system system /dev/cpuctl/audio_app/tasks |
| 113 | chmod 0660 /dev/cpuctl/audio_app/tasks |
| 114 | write /dev/cpuctl/audio_app/cpu.shares 10 |
| 115 | write /dev/cpuctl/audio_app/cpu.rt_runtime_us 50000 |
| 116 | write /dev/cpuctl/audio_app/cpu.rt_period_us 1000000 |
| 117 | |
| 118 | mkdir /dev/cpuctl/audio_sys |
| 119 | chown system system /dev/cpuctl/audio_sys/tasks |
| 120 | chmod 0660 /dev/cpuctl/audio_sys/tasks |
| 121 | write /dev/cpuctl/audio_sys/cpu.shares 10 |
| 122 | write /dev/cpuctl/audio_sys/cpu.rt_runtime_us 50000 |
| 123 | write /dev/cpuctl/audio_sys/cpu.rt_period_us 1000000 |
San Mehat | 4933098 | 2009-04-21 14:34:19 -0700 | [diff] [blame] | 124 | |
JP Abgrall | 8e3ff70 | 2011-09-11 16:12:27 -0700 | [diff] [blame] | 125 | # Allow everybody to read the xt_qtaguid resource tracking misc dev. |
| 126 | # This is needed by any process that uses socket tagging. |
| 127 | chmod 0644 /dev/xt_qtaguid |
| 128 | |
Colin Cross | 31712be | 2010-04-09 12:26:06 -0700 | [diff] [blame] | 129 | on fs |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 130 | # mount mtd partitions |
| 131 | # 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] | 132 | mount yaffs2 mtd@system /system |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 133 | mount yaffs2 mtd@system /system ro remount |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 134 | mount yaffs2 mtd@userdata /data nosuid nodev |
Colin Cross | 31712be | 2010-04-09 12:26:06 -0700 | [diff] [blame] | 135 | mount yaffs2 mtd@cache /cache nosuid nodev |
| 136 | |
| 137 | on post-fs |
Brian Swetland | 56de7a1 | 2010-09-08 15:06:45 -0700 | [diff] [blame] | 138 | # once everything is setup, no need to modify / |
| 139 | mount rootfs rootfs / ro remount |
| 140 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 141 | # We chown/chmod /cache again so because mount is run as root + defaults |
| 142 | chown system cache /cache |
| 143 | chmod 0770 /cache |
| 144 | |
| 145 | # This may have been created by the recovery system with odd permissions |
| 146 | chown system cache /cache/recovery |
| 147 | chmod 0770 /cache/recovery |
| 148 | |
| 149 | #change permissions on vmallocinfo so we can grab it from bugreports |
| 150 | chown root log /proc/vmallocinfo |
| 151 | chmod 0440 /proc/vmallocinfo |
| 152 | |
| 153 | #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks |
| 154 | chown root system /proc/kmsg |
| 155 | chmod 0440 /proc/kmsg |
| 156 | chown root system /proc/sysrq-trigger |
| 157 | chmod 0220 /proc/sysrq-trigger |
| 158 | |
| 159 | # create the lost+found directories, so as to enforce our permissions |
Chia-chi Yeh | ea74414 | 2011-07-08 16:52:18 -0700 | [diff] [blame] | 160 | mkdir /cache/lost+found 0770 root root |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 161 | |
| 162 | on post-fs-data |
Colin Cross | 31712be | 2010-04-09 12:26:06 -0700 | [diff] [blame] | 163 | # We chown/chmod /data again so because mount is run as root + defaults |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 164 | chown system system /data |
| 165 | chmod 0771 /data |
| 166 | |
San Mehat | f26d6ce | 2009-09-01 09:11:04 -0700 | [diff] [blame] | 167 | # Create dump dir and collect dumps. |
| 168 | # Do this before we mount cache so eventually we can use cache for |
| 169 | # storing dumps on platforms which do not have a dedicated dump partition. |
Chia-chi Yeh | ea74414 | 2011-07-08 16:52:18 -0700 | [diff] [blame] | 170 | mkdir /data/dontpanic 0750 root log |
San Mehat | f26d6ce | 2009-09-01 09:11:04 -0700 | [diff] [blame] | 171 | |
| 172 | # Collect apanic data, free resources and re-arm trigger |
| 173 | copy /proc/apanic_console /data/dontpanic/apanic_console |
Mike Lockwood | 25f1a5a | 2009-09-11 17:13:28 -0400 | [diff] [blame] | 174 | chown root log /data/dontpanic/apanic_console |
Mike Lockwood | 9332482 | 2009-09-08 22:55:59 -0400 | [diff] [blame] | 175 | chmod 0640 /data/dontpanic/apanic_console |
San Mehat | 020f35f | 2009-09-01 15:38:18 -0700 | [diff] [blame] | 176 | |
San Mehat | f26d6ce | 2009-09-01 09:11:04 -0700 | [diff] [blame] | 177 | copy /proc/apanic_threads /data/dontpanic/apanic_threads |
Mike Lockwood | 25f1a5a | 2009-09-11 17:13:28 -0400 | [diff] [blame] | 178 | chown root log /data/dontpanic/apanic_threads |
Mike Lockwood | 9332482 | 2009-09-08 22:55:59 -0400 | [diff] [blame] | 179 | chmod 0640 /data/dontpanic/apanic_threads |
San Mehat | 020f35f | 2009-09-01 15:38:18 -0700 | [diff] [blame] | 180 | |
San Mehat | f26d6ce | 2009-09-01 09:11:04 -0700 | [diff] [blame] | 181 | write /proc/apanic_console 1 |
| 182 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 183 | # create basic filesystem structure |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 184 | mkdir /data/misc 01771 system misc |
Jaikumar Ganesh | 1d36696 | 2009-05-05 22:28:54 -0700 | [diff] [blame] | 185 | mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth |
Jaikumar Ganesh | eafdd86 | 2010-01-07 20:24:55 -0800 | [diff] [blame] | 186 | mkdir /data/misc/bluetooth 0770 system system |
Chia-chi Yeh | 9b4f1ff | 2009-09-18 10:35:26 +0800 | [diff] [blame] | 187 | mkdir /data/misc/keystore 0700 keystore keystore |
Brian Carlstrom | 0491893 | 2011-06-30 22:50:29 -0700 | [diff] [blame] | 188 | mkdir /data/misc/keychain 0771 system system |
Chia-chi Yeh | 9bb4d41 | 2011-07-08 20:03:03 -0700 | [diff] [blame] | 189 | mkdir /data/misc/vpn 0770 system vpn |
Oscar Montemayor | d0aa32c | 2010-01-06 13:18:12 -0800 | [diff] [blame] | 190 | mkdir /data/misc/systemkeys 0700 system system |
Mike Lockwood | 48d116e | 2009-07-08 18:42:08 -0400 | [diff] [blame] | 191 | # give system access to wpa_supplicant.conf for backup and restore |
| 192 | mkdir /data/misc/wifi 0770 wifi wifi |
Amith Yamasani | eefef32 | 2009-07-02 12:08:13 -0700 | [diff] [blame] | 193 | chmod 0660 /data/misc/wifi/wpa_supplicant.conf |
Chia-chi Yeh | 5ebced3 | 2012-03-07 14:52:10 -0800 | [diff] [blame] | 194 | mkdir /data/local 0751 root root |
Nick Kralevich | f3ef127 | 2012-03-14 15:22:54 -0700 | [diff] [blame] | 195 | |
| 196 | # For security reasons, /data/local/tmp should always be empty. |
| 197 | # Do not place files or directories in /data/local/tmp |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 198 | mkdir /data/local/tmp 0771 shell shell |
| 199 | mkdir /data/data 0771 system system |
| 200 | mkdir /data/app-private 0771 system system |
Kenny Root | f8bbaba | 2012-04-12 15:01:52 -0700 | [diff] [blame] | 201 | mkdir /data/app-asec 0700 root root |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 202 | mkdir /data/app 0771 system system |
| 203 | mkdir /data/property 0700 root root |
Mike Lockwood | 9dd2eef | 2011-12-11 20:25:16 -0800 | [diff] [blame] | 204 | mkdir /data/ssh 0750 root shell |
| 205 | mkdir /data/ssh/empty 0700 root root |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 206 | |
Chia-chi Yeh | ea74414 | 2011-07-08 16:52:18 -0700 | [diff] [blame] | 207 | # create dalvik-cache, so as to enforce our permissions |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 208 | mkdir /data/dalvik-cache 0771 system system |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 209 | |
MÃ¥rten Kongstad | b45280d | 2011-05-30 10:24:54 +0200 | [diff] [blame] | 210 | # create resource-cache and double-check the perms |
| 211 | mkdir /data/resource-cache 0771 system system |
| 212 | chown system system /data/resource-cache |
| 213 | chmod 0771 /data/resource-cache |
| 214 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 215 | # create the lost+found directories, so as to enforce our permissions |
Chia-chi Yeh | ea74414 | 2011-07-08 16:52:18 -0700 | [diff] [blame] | 216 | mkdir /data/lost+found 0770 root root |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 217 | |
James Dong | 09cdc0e | 2012-01-06 15:19:26 -0800 | [diff] [blame] | 218 | # create directory for DRM plug-ins - give drm the read/write access to |
| 219 | # the following directory. |
| 220 | mkdir /data/drm 0770 drm drm |
aimitakeshi | e572d59 | 2010-07-27 08:38:35 +0900 | [diff] [blame] | 221 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 222 | # If there is no fs-post-data action in the init.<device>.rc file, you |
| 223 | # must uncomment this line, otherwise encrypted filesystems |
| 224 | # won't work. |
| 225 | # Set indication (checked by vold) that we have finished this action |
| 226 | #setprop vold.post_fs_data_done 1 |
| 227 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 228 | on boot |
| 229 | # basic network init |
| 230 | ifup lo |
| 231 | hostname localhost |
| 232 | domainname localdomain |
| 233 | |
| 234 | # set RLIMIT_NICE to allow priorities from 19 to -20 |
| 235 | setrlimit 13 40 40 |
| 236 | |
Dianne Hackborn | 06787f4 | 2011-08-07 16:30:24 -0700 | [diff] [blame] | 237 | # Memory management. Basic kernel parameters, and allow the high |
| 238 | # level system server to be able to adjust the kernel OOM driver |
Glenn Kasten | b91bd9f | 2012-04-19 16:18:37 -0700 | [diff] [blame] | 239 | # parameters to match how it is managing things. |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 240 | write /proc/sys/vm/overcommit_memory 1 |
The Android Open Source Project | e037fd7 | 2009-03-13 13:04:37 -0700 | [diff] [blame] | 241 | write /proc/sys/vm/min_free_order_shift 4 |
Dianne Hackborn | 06787f4 | 2011-08-07 16:30:24 -0700 | [diff] [blame] | 242 | chown root system /sys/module/lowmemorykiller/parameters/adj |
| 243 | chmod 0664 /sys/module/lowmemorykiller/parameters/adj |
| 244 | chown root system /sys/module/lowmemorykiller/parameters/minfree |
| 245 | chmod 0664 /sys/module/lowmemorykiller/parameters/minfree |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 246 | |
San Mehat | 831d8e1 | 2009-10-13 12:24:47 -0700 | [diff] [blame] | 247 | # Tweak background writeout |
| 248 | write /proc/sys/vm/dirty_expire_centisecs 200 |
| 249 | write /proc/sys/vm/dirty_background_ratio 5 |
| 250 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 251 | # Permissions for System Server and daemons. |
| 252 | chown radio system /sys/android_power/state |
| 253 | chown radio system /sys/android_power/request_state |
| 254 | chown radio system /sys/android_power/acquire_full_wake_lock |
| 255 | chown radio system /sys/android_power/acquire_partial_wake_lock |
| 256 | chown radio system /sys/android_power/release_wake_lock |
Arve Hjønnevåg | 1670f83 | 2012-03-20 20:33:09 -0700 | [diff] [blame] | 257 | chown system system /sys/power/state |
| 258 | chown system system /sys/power/wakeup_count |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 259 | chown radio system /sys/power/wake_lock |
| 260 | chown radio system /sys/power/wake_unlock |
| 261 | chmod 0660 /sys/power/state |
| 262 | chmod 0660 /sys/power/wake_lock |
| 263 | chmod 0660 /sys/power/wake_unlock |
Todd Poynor | 0653b97 | 2012-04-11 14:48:51 -0700 | [diff] [blame] | 264 | |
| 265 | chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate |
| 266 | chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate |
| 267 | chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time |
| 268 | chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time |
| 269 | chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq |
| 270 | chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq |
| 271 | chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load |
| 272 | chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load |
Todd Poynor | f35c203 | 2012-04-19 13:17:24 -0700 | [diff] [blame] | 273 | chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay |
| 274 | chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay |
Todd Poynor | 8d3ea1d | 2012-04-24 15:37:13 -0700 | [diff] [blame] | 275 | chown system system /sys/devices/system/cpu/cpufreq/interactive/boost |
| 276 | chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost |
Todd Poynor | 0653b97 | 2012-04-11 14:48:51 -0700 | [diff] [blame] | 277 | |
| 278 | # Assume SMP uses shared cpufreq policy for all CPUs |
| 279 | chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq |
| 280 | chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq |
| 281 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 282 | chown system system /sys/class/timed_output/vibrator/enable |
| 283 | chown system system /sys/class/leds/keyboard-backlight/brightness |
| 284 | chown system system /sys/class/leds/lcd-backlight/brightness |
| 285 | chown system system /sys/class/leds/button-backlight/brightness |
The Android Open Source Project | f614d64 | 2009-03-18 17:39:49 -0700 | [diff] [blame] | 286 | chown system system /sys/class/leds/jogball-backlight/brightness |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 287 | chown system system /sys/class/leds/red/brightness |
| 288 | chown system system /sys/class/leds/green/brightness |
| 289 | chown system system /sys/class/leds/blue/brightness |
| 290 | chown system system /sys/class/leds/red/device/grpfreq |
| 291 | chown system system /sys/class/leds/red/device/grppwm |
| 292 | chown system system /sys/class/leds/red/device/blink |
| 293 | chown system system /sys/class/leds/red/brightness |
| 294 | chown system system /sys/class/leds/green/brightness |
| 295 | chown system system /sys/class/leds/blue/brightness |
| 296 | chown system system /sys/class/leds/red/device/grpfreq |
| 297 | chown system system /sys/class/leds/red/device/grppwm |
| 298 | chown system system /sys/class/leds/red/device/blink |
| 299 | chown system system /sys/class/timed_output/vibrator/enable |
| 300 | chown system system /sys/module/sco/parameters/disable_esco |
| 301 | chown system system /sys/kernel/ipv4/tcp_wmem_min |
| 302 | chown system system /sys/kernel/ipv4/tcp_wmem_def |
| 303 | chown system system /sys/kernel/ipv4/tcp_wmem_max |
| 304 | chown system system /sys/kernel/ipv4/tcp_rmem_min |
| 305 | chown system system /sys/kernel/ipv4/tcp_rmem_def |
| 306 | chown system system /sys/kernel/ipv4/tcp_rmem_max |
| 307 | chown root radio /proc/cmdline |
| 308 | |
| 309 | # Define TCP buffer sizes for various networks |
| 310 | # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, |
| 311 | setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 |
Robert Greenwalt | 1ac40f4 | 2011-09-07 15:40:26 -0700 | [diff] [blame] | 312 | setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576 |
| 313 | setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 314 | setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 |
sinikang | aa75df7 | 2011-10-16 12:32:13 -0700 | [diff] [blame] | 315 | setprop net.tcp.buffersize.hspa 4094,87380,262144,4096,16384,262144 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 316 | setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 |
| 317 | setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 |
| 318 | |
Mathias Agopian | a40481b | 2011-03-03 18:48:30 -0800 | [diff] [blame] | 319 | # Set this property so surfaceflinger is not started by system_init |
| 320 | setprop system_init.startsurfaceflinger 0 |
| 321 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 322 | class_start core |
| 323 | class_start main |
| 324 | |
| 325 | on nonencrypted |
| 326 | class_start late_start |
| 327 | |
Dima Zavin | ca47cef | 2011-08-24 15:28:23 -0700 | [diff] [blame] | 328 | on charger |
| 329 | class_start charger |
| 330 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 331 | on property:vold.decrypt=trigger_reset_main |
| 332 | class_reset main |
| 333 | |
Ken Sumrall | c5c5103 | 2011-03-08 17:01:29 -0800 | [diff] [blame] | 334 | on property:vold.decrypt=trigger_load_persist_props |
| 335 | load_persist_props |
| 336 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 337 | on property:vold.decrypt=trigger_post_fs_data |
| 338 | trigger post-fs-data |
| 339 | |
Ken Sumrall | e434915 | 2011-01-17 14:26:34 -0800 | [diff] [blame] | 340 | on property:vold.decrypt=trigger_restart_min_framework |
| 341 | class_start main |
| 342 | |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 343 | on property:vold.decrypt=trigger_restart_framework |
| 344 | class_start main |
| 345 | class_start late_start |
| 346 | |
| 347 | on property:vold.decrypt=trigger_shutdown_framework |
| 348 | class_reset late_start |
| 349 | class_reset main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 350 | |
| 351 | ## Daemon processes to be run by init. |
| 352 | ## |
Colin Cross | f83d0b9 | 2010-04-21 12:04:20 -0700 | [diff] [blame] | 353 | service ueventd /sbin/ueventd |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 354 | class core |
Colin Cross | f83d0b9 | 2010-04-21 12:04:20 -0700 | [diff] [blame] | 355 | critical |
| 356 | |
Brian Swetland | b4d6539 | 2010-10-27 15:40:23 -0700 | [diff] [blame] | 357 | service console /system/bin/sh |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 358 | class core |
Brian Swetland | b4d6539 | 2010-10-27 15:40:23 -0700 | [diff] [blame] | 359 | console |
| 360 | disabled |
| 361 | user shell |
| 362 | group log |
| 363 | |
Mike Lockwood | d49b4ef | 2010-11-19 09:12:27 -0500 | [diff] [blame] | 364 | on property:ro.debuggable=1 |
Brian Swetland | b4d6539 | 2010-10-27 15:40:23 -0700 | [diff] [blame] | 365 | start console |
| 366 | |
Jamie Gennis | db49739 | 2012-04-09 16:01:30 -0700 | [diff] [blame] | 367 | # Allow writing to the kernel trace log. Enabling tracing still requires root. |
| 368 | on property:ro.debuggable=1 |
| 369 | chmod 0222 /sys/kernel/debug/tracing/trace_marker |
| 370 | |
Mike Lockwood | 352dfdf | 2011-06-08 17:40:00 -0700 | [diff] [blame] | 371 | # adbd is controlled via property triggers in init.<platform>.usb.rc |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 372 | service adbd /sbin/adbd |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 373 | class core |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 374 | disabled |
| 375 | |
| 376 | # adbd on at boot in emulator |
| 377 | on property:ro.kernel.qemu=1 |
| 378 | start adbd |
| 379 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 380 | service servicemanager /system/bin/servicemanager |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 381 | class core |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 382 | user system |
Nick Kralevich | 333f24b | 2010-12-10 14:10:16 -0800 | [diff] [blame] | 383 | group system |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 384 | critical |
| 385 | onrestart restart zygote |
| 386 | onrestart restart media |
Mathias Agopian | 04a8759 | 2011-10-31 14:27:36 -0700 | [diff] [blame] | 387 | onrestart restart surfaceflinger |
| 388 | onrestart restart drm |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 389 | |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 390 | service vold /system/bin/vold |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 391 | class core |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 392 | socket vold stream 0660 root mount |
San Mehat | f0cb74e | 2010-02-26 10:01:14 -0800 | [diff] [blame] | 393 | ioprio be 2 |
The Android Open Source Project | e4749f3 | 2009-03-09 11:52:15 -0700 | [diff] [blame] | 394 | |
San Mehat | 192277c | 2010-01-15 07:48:35 -0800 | [diff] [blame] | 395 | service netd /system/bin/netd |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 396 | class main |
San Mehat | 192277c | 2010-01-15 07:48:35 -0800 | [diff] [blame] | 397 | socket netd stream 0660 root system |
Brad Fitzpatrick | 8c5669f | 2010-10-27 10:23:16 -0700 | [diff] [blame] | 398 | socket dnsproxyd stream 0660 root inet |
Robert Greenwalt | 1d91fcf | 2012-03-27 16:59:27 -0700 | [diff] [blame] | 399 | socket mdns stream 0660 root system |
San Mehat | 192277c | 2010-01-15 07:48:35 -0800 | [diff] [blame] | 400 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 401 | service debuggerd /system/bin/debuggerd |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 402 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 403 | |
| 404 | service ril-daemon /system/bin/rild |
vidya rao | 04cf629 | 2011-06-24 12:15:20 -0700 | [diff] [blame] | 405 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 406 | socket rild stream 660 root radio |
| 407 | socket rild-debug stream 660 radio system |
| 408 | user root |
Kazuhiro Ondo | e65e946 | 2011-09-29 10:50:43 -0500 | [diff] [blame] | 409 | group radio cache inet misc audio sdcard_rw log |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 410 | |
Mathias Agopian | a40481b | 2011-03-03 18:48:30 -0800 | [diff] [blame] | 411 | service surfaceflinger /system/bin/surfaceflinger |
| 412 | class main |
| 413 | user system |
| 414 | group graphics |
| 415 | onrestart restart zygote |
| 416 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 417 | service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 418 | class main |
Nick Kralevich | e7fd911 | 2012-01-27 13:06:53 -0800 | [diff] [blame] | 419 | socket zygote stream 660 root system |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 420 | onrestart write /sys/android_power/request_state wake |
| 421 | onrestart write /sys/power/state on |
Dan Bornstein | 1dec503 | 2009-10-09 14:24:51 -0700 | [diff] [blame] | 422 | onrestart restart media |
Brad Fitzpatrick | 6490257 | 2010-09-21 15:49:06 -0700 | [diff] [blame] | 423 | onrestart restart netd |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 424 | |
aimitakeshi | e572d59 | 2010-07-27 08:38:35 +0900 | [diff] [blame] | 425 | service drm /system/bin/drmserver |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 426 | class main |
aimitakeshi | e572d59 | 2010-07-27 08:38:35 +0900 | [diff] [blame] | 427 | user drm |
Nick Kralevich | 3c9eed8 | 2012-03-26 11:13:17 -0700 | [diff] [blame] | 428 | group drm system inet drmrpc |
aimitakeshi | e572d59 | 2010-07-27 08:38:35 +0900 | [diff] [blame] | 429 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 430 | service media /system/bin/mediaserver |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 431 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 432 | user media |
Jeffrey Tinker | 65c4df5 | 2011-10-06 18:19:46 -0700 | [diff] [blame] | 433 | group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc |
San Mehat | f0cb74e | 2010-02-26 10:01:14 -0800 | [diff] [blame] | 434 | ioprio rt 4 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 435 | |
Mathias Agopian | 8b2cf9f | 2009-05-20 18:09:51 -0700 | [diff] [blame] | 436 | service bootanim /system/bin/bootanimation |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 437 | class main |
Mathias Agopian | 8b2cf9f | 2009-05-20 18:09:51 -0700 | [diff] [blame] | 438 | user graphics |
| 439 | group graphics |
| 440 | disabled |
| 441 | oneshot |
| 442 | |
Jaikumar Ganesh | 1320687 | 2009-09-18 15:45:43 -0700 | [diff] [blame] | 443 | service dbus /system/bin/dbus-daemon --system --nofork |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 444 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 445 | socket dbus stream 660 bluetooth bluetooth |
| 446 | user bluetooth |
| 447 | group bluetooth net_bt_admin |
| 448 | |
Jaikumar Ganesh | 1320687 | 2009-09-18 15:45:43 -0700 | [diff] [blame] | 449 | service bluetoothd /system/bin/bluetoothd -n |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 450 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 451 | socket bluetooth stream 660 bluetooth bluetooth |
| 452 | socket dbus_bluetooth stream 660 bluetooth bluetooth |
| 453 | # init.rc does not yet support applying capabilities, so run as root and |
Jaikumar Ganesh | 1d36696 | 2009-05-05 22:28:54 -0700 | [diff] [blame] | 454 | # let bluetoothd drop uid to bluetooth with the right linux capabilities |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 455 | group bluetooth net_bt_admin misc |
| 456 | disabled |
| 457 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 458 | service installd /system/bin/installd |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 459 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 460 | socket installd stream 600 system system |
| 461 | |
Doug Zongker | d52f54c | 2009-07-23 15:18:34 -0700 | [diff] [blame] | 462 | service flash_recovery /system/etc/install-recovery.sh |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 463 | class main |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 464 | oneshot |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 465 | |
Chia-chi Yeh | 51afbf5 | 2009-07-01 07:06:47 +0800 | [diff] [blame] | 466 | service racoon /system/bin/racoon |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 467 | class main |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 468 | socket racoon stream 600 system system |
Chia-chi Yeh | 9bb4d41 | 2011-07-08 20:03:03 -0700 | [diff] [blame] | 469 | # IKE uses UDP port 500. Racoon will setuid to vpn after binding the port. |
Chia-chi Yeh | a246871 | 2011-08-08 10:11:40 -0700 | [diff] [blame] | 470 | group vpn net_admin inet |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 471 | disabled |
| 472 | oneshot |
| 473 | |
| 474 | service mtpd /system/bin/mtpd |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 475 | class main |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 476 | socket mtpd stream 600 system system |
Chia-chi Yeh | 51afbf5 | 2009-07-01 07:06:47 +0800 | [diff] [blame] | 477 | user vpn |
Chia-chi Yeh | a246871 | 2011-08-08 10:11:40 -0700 | [diff] [blame] | 478 | group vpn net_admin inet net_raw |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 479 | disabled |
| 480 | oneshot |
| 481 | |
Chia-chi Yeh | 9b4f1ff | 2009-09-18 10:35:26 +0800 | [diff] [blame] | 482 | service keystore /system/bin/keystore /data/misc/keystore |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 483 | class main |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 484 | user keystore |
Kenny Root | ad5b9c7 | 2012-02-23 16:31:10 -0800 | [diff] [blame] | 485 | group keystore drmrpc |
Chung-yih Wang | 1f75d70 | 2009-06-01 19:04:05 +0800 | [diff] [blame] | 486 | socket keystore stream 666 |
| 487 | |
Mike Lockwood | abe3a9c | 2009-09-02 18:09:26 -0400 | [diff] [blame] | 488 | service dumpstate /system/bin/dumpstate -s |
Ken Sumrall | 752923c | 2010-12-03 16:33:31 -0800 | [diff] [blame] | 489 | class main |
Mike Lockwood | abe3a9c | 2009-09-02 18:09:26 -0400 | [diff] [blame] | 490 | socket dumpstate stream 0660 shell log |
| 491 | disabled |
| 492 | oneshot |
Mike Lockwood | 9dd2eef | 2011-12-11 20:25:16 -0800 | [diff] [blame] | 493 | |
| 494 | service sshd /system/bin/start-ssh |
| 495 | class main |
Mike Lockwood | 19155b5 | 2012-03-21 11:58:05 -0700 | [diff] [blame] | 496 | disabled |
Robert Greenwalt | 1d91fcf | 2012-03-27 16:59:27 -0700 | [diff] [blame] | 497 | |
| 498 | service mdnsd /system/bin/mdnsd |
| 499 | class main |
| 500 | user mdnsr |
| 501 | group inet net_raw |
| 502 | socket mdnsd stream 0660 mdnsr inet |
| 503 | disabled |
| 504 | oneshot |
| 505 | |