blob: cfc3d3597495f969a35c24bd680bfcf6a3ec71fe [file] [log] [blame]
Nick Kralevichf3ef1272012-03-14 15:22:54 -07001# 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
Ying Wang5748ee92013-07-23 18:03:37 -07007import /init.environ.rc
Mike Lockwood4f5d5172012-04-04 11:26:59 -07008import /init.usb.rc
Mike Lockwood35ea5e42012-08-28 10:25:13 -07009import /init.${ro.hardware}.rc
Todd Poynorf1c50bf2012-09-20 20:10:53 -070010import /init.trace.rc
Dima Zavin7634bf82011-12-16 14:23:22 -080011
Colin Crossf83d0b92010-04-21 12:04:20 -070012on early-init
Dima Zavin4a253902011-11-04 12:45:52 -070013 # Set init and its forked children's oom_adj.
14 write /proc/1/oom_adj -16
15
Stephen Smalley1eee4192012-01-13 08:54:34 -050016 # Set the security context for the init process.
17 # This should occur before anything else (e.g. ueventd) is started.
18 setcon u:r:init:s0
19
Stephen Smalleydeb41e52013-10-01 09:21:47 -040020 # Set the security context of /adb_keys if present.
21 restorecon /adb_keys
22
Colin Crossf83d0b92010-04-21 12:04:20 -070023 start ueventd
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080024
Mike Lockwooda2dffa92010-06-15 20:57:59 -070025# create mountpoints
26 mkdir /mnt 0775 root system
27
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080028on init
29
30sysclktz 0
31
32loglevel 3
33
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080034# Backward compatibility
35 symlink /system/etc /etc
Brian Swetlandbb6f68c2009-09-18 15:31:23 -070036 symlink /sys/kernel/debug /d
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080037
Brian Swetland02863b92010-09-19 03:36:39 -070038# Right now vendor lives on the same filesystem as system,
39# but someday that may change.
40 symlink /system/vendor /vendor
San Mehat6ea3cc62010-02-19 18:25:22 -080041
Mike Chan89f235c2010-03-01 11:36:10 -080042# Create cgroup mount point for cpu accounting
43 mkdir /acct
44 mount cgroup none /acct cpuacct
45 mkdir /acct/uid
46
Rom Lemarchand435a52e2013-07-10 13:00:42 -070047# Create cgroup mount point for memory
Rom Lemarchand67b00d82013-09-10 17:39:30 -070048 mount tmpfs none /sys/fs/cgroup mode=0750,uid=0,gid=1000
49 mkdir /sys/fs/cgroup/memory 0750 root system
Rom Lemarchand435a52e2013-07-10 13:00:42 -070050 mount cgroup none /sys/fs/cgroup/memory memory
51 write /sys/fs/cgroup/memory/memory.move_charge_at_immigrate 1
52 chown root system /sys/fs/cgroup/memory/tasks
53 chmod 0660 /sys/fs/cgroup/memory/tasks
Rom Lemarchand67b00d82013-09-10 17:39:30 -070054 mkdir /sys/fs/cgroup/memory/sw 0750 root system
Rom Lemarchand435a52e2013-07-10 13:00:42 -070055 write /sys/fs/cgroup/memory/sw/memory.swappiness 100
56 write /sys/fs/cgroup/memory/sw/memory.move_charge_at_immigrate 1
57 chown root system /sys/fs/cgroup/memory/sw/tasks
58 chmod 0660 /sys/fs/cgroup/memory/sw/tasks
59
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080060 mkdir /system
61 mkdir /data 0771 system system
62 mkdir /cache 0770 system cache
Dmitry Shmidt720f08f2009-06-09 14:38:56 -070063 mkdir /config 0500 root root
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080064
Jeff Sharkeybfcd8102012-08-22 13:57:25 -070065 # See storage config details at http://source.android.com/tech/storage/
Jeff Sharkey5dd0f862012-08-17 16:01:16 -070066 mkdir /mnt/shell 0700 shell shell
Jeff Sharkeye93a0512013-10-08 10:14:24 -070067 mkdir /mnt/media_rw 0700 media_rw media_rw
Jeff Sharkey44d63422013-09-12 09:44:48 -070068 mkdir /storage 0751 root sdcard_r
Jeff Sharkey5dd0f862012-08-17 16:01:16 -070069
San Mehat6ea3cc62010-02-19 18:25:22 -080070 # Directory for putting things only root should see.
71 mkdir /mnt/secure 0700 root root
Jeff Sharkey58d39802012-09-06 14:15:46 -070072 # Create private mountpoint so we can MS_MOVE from staging
73 mount tmpfs tmpfs /mnt/secure mode=0700,uid=0,gid=0
San Mehat6ea3cc62010-02-19 18:25:22 -080074
75 # Directory for staging bindmounts
76 mkdir /mnt/secure/staging 0700 root root
77
78 # Directory-target for where the secure container
79 # imagefile directory will be bind-mounted
80 mkdir /mnt/secure/asec 0700 root root
81
82 # Secure container public mount points.
83 mkdir /mnt/asec 0700 root system
84 mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
San Mehat900570e2010-01-06 10:38:49 -080085
Kenny Rootc7858a32010-07-15 12:14:44 -070086 # Filesystem image public mount points.
87 mkdir /mnt/obb 0700 root system
88 mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000
89
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080090 write /proc/sys/kernel/panic_on_oops 1
91 write /proc/sys/kernel/hung_task_timeout_secs 0
92 write /proc/cpu/alignment 4
93 write /proc/sys/kernel/sched_latency_ns 10000000
94 write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
San Mehat4322f2d2009-06-29 08:47:43 -070095 write /proc/sys/kernel/sched_compat_yield 1
San Mehat7baff712009-09-16 13:32:23 -070096 write /proc/sys/kernel/sched_child_runs_first 0
Nick Kralevichd707fb32011-10-06 11:47:11 -070097 write /proc/sys/kernel/randomize_va_space 2
Nick Kralevich2e7c8332011-11-02 08:51:37 -070098 write /proc/sys/kernel/kptr_restrict 2
Nick Kralevichf9557fb2011-11-08 14:38:53 -080099 write /proc/sys/kernel/dmesg_restrict 1
Nick Kralevich27cca212011-12-05 14:48:08 -0800100 write /proc/sys/vm/mmap_min_addr 32768
Nick Kralevichbe341cc2013-02-21 18:36:43 -0800101 write /proc/sys/net/ipv4/ping_group_range "0 2147483647"
Glenn Kastenb91bd9f2012-04-19 16:18:37 -0700102 write /proc/sys/kernel/sched_rt_runtime_us 950000
103 write /proc/sys/kernel/sched_rt_period_us 1000000
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800104
San Mehat529520e2009-10-06 11:22:55 -0700105# Create cgroup mount points for process groups
106 mkdir /dev/cpuctl
San Mehatb91bf4b2010-02-27 08:20:11 -0800107 mount cgroup none /dev/cpuctl cpu
San Mehat92175e02010-01-17 12:21:42 -0800108 chown system system /dev/cpuctl
San Mehat529520e2009-10-06 11:22:55 -0700109 chown system system /dev/cpuctl/tasks
Glenn Kastenb91bd9f2012-04-19 16:18:37 -0700110 chmod 0660 /dev/cpuctl/tasks
San Mehat529520e2009-10-06 11:22:55 -0700111 write /dev/cpuctl/cpu.shares 1024
Glenn Kastenb91bd9f2012-04-19 16:18:37 -0700112 write /dev/cpuctl/cpu.rt_runtime_us 950000
113 write /dev/cpuctl/cpu.rt_period_us 1000000
San Mehat529520e2009-10-06 11:22:55 -0700114
Dima Zavindf44b882012-06-04 10:45:15 -0700115 mkdir /dev/cpuctl/apps
116 chown system system /dev/cpuctl/apps/tasks
117 chmod 0666 /dev/cpuctl/apps/tasks
118 write /dev/cpuctl/apps/cpu.shares 1024
Dima Zavin5f2d00b2012-06-04 13:15:01 -0700119 write /dev/cpuctl/apps/cpu.rt_runtime_us 800000
Dima Zavindf44b882012-06-04 10:45:15 -0700120 write /dev/cpuctl/apps/cpu.rt_period_us 1000000
San Mehat529520e2009-10-06 11:22:55 -0700121
Dima Zavindf44b882012-06-04 10:45:15 -0700122 mkdir /dev/cpuctl/apps/bg_non_interactive
123 chown system system /dev/cpuctl/apps/bg_non_interactive/tasks
124 chmod 0666 /dev/cpuctl/apps/bg_non_interactive/tasks
San Mehat529520e2009-10-06 11:22:55 -0700125 # 5.0 %
Dima Zavindf44b882012-06-04 10:45:15 -0700126 write /dev/cpuctl/apps/bg_non_interactive/cpu.shares 52
Dima Zavin5f2d00b2012-06-04 13:15:01 -0700127 write /dev/cpuctl/apps/bg_non_interactive/cpu.rt_runtime_us 700000
Dima Zavindf44b882012-06-04 10:45:15 -0700128 write /dev/cpuctl/apps/bg_non_interactive/cpu.rt_period_us 1000000
Glenn Kastenb91bd9f2012-04-19 16:18:37 -0700129
JP Abgrall3e54aab2013-01-04 14:34:58 -0800130# qtaguid will limit access to specific data based on group memberships.
131# net_bw_acct grants impersonation of socket owners.
132# net_bw_stats grants access to other apps' detailed tagged-socket stats.
133 chown root net_bw_acct /proc/net/xt_qtaguid/ctrl
134 chown root net_bw_stats /proc/net/xt_qtaguid/stats
135
JP Abgrall8e3ff702011-09-11 16:12:27 -0700136# Allow everybody to read the xt_qtaguid resource tracking misc dev.
137# This is needed by any process that uses socket tagging.
138 chmod 0644 /dev/xt_qtaguid
139
Ken Sumrall4eaf9052013-09-18 17:49:21 -0700140# Create location for fs_mgr to store abbreviated output from filesystem
141# checker programs.
142 mkdir /dev/fscklogs 0770 root system
143
Colin Cross31712be2010-04-09 12:26:06 -0700144on post-fs
Brian Swetland56de7a12010-09-08 15:06:45 -0700145 # once everything is setup, no need to modify /
146 mount rootfs rootfs / ro remount
Jeff Sharkey885342a2012-08-14 21:00:22 -0700147 # mount shared so changes propagate into child namespaces
148 mount rootfs rootfs / shared rec
Jeff Sharkey58d39802012-09-06 14:15:46 -0700149 mount tmpfs tmpfs /mnt/secure private rec
Brian Swetland56de7a12010-09-08 15:06:45 -0700150
Ken Sumrall752923c2010-12-03 16:33:31 -0800151 # We chown/chmod /cache again so because mount is run as root + defaults
152 chown system cache /cache
153 chmod 0770 /cache
Stephen Smalley1eee4192012-01-13 08:54:34 -0500154 # We restorecon /cache in case the cache partition has been reset.
155 restorecon /cache
Ken Sumrall752923c2010-12-03 16:33:31 -0800156
157 # This may have been created by the recovery system with odd permissions
158 chown system cache /cache/recovery
159 chmod 0770 /cache/recovery
Stephen Smalley1eee4192012-01-13 08:54:34 -0500160 # This may have been created by the recovery system with the wrong context.
161 restorecon /cache/recovery
Ken Sumrall752923c2010-12-03 16:33:31 -0800162
163 #change permissions on vmallocinfo so we can grab it from bugreports
164 chown root log /proc/vmallocinfo
165 chmod 0440 /proc/vmallocinfo
166
Dima Zavin94812662012-09-25 14:22:02 -0700167 chown root log /proc/slabinfo
168 chmod 0440 /proc/slabinfo
169
Ken Sumrall752923c2010-12-03 16:33:31 -0800170 #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
171 chown root system /proc/kmsg
172 chmod 0440 /proc/kmsg
173 chown root system /proc/sysrq-trigger
174 chmod 0220 /proc/sysrq-trigger
Colin Crossb35e36e2012-08-02 18:14:33 -0700175 chown system log /proc/last_kmsg
176 chmod 0440 /proc/last_kmsg
Ken Sumrall752923c2010-12-03 16:33:31 -0800177
178 # create the lost+found directories, so as to enforce our permissions
Chia-chi Yehea744142011-07-08 16:52:18 -0700179 mkdir /cache/lost+found 0770 root root
Ken Sumrall752923c2010-12-03 16:33:31 -0800180
181on post-fs-data
Colin Cross31712be2010-04-09 12:26:06 -0700182 # We chown/chmod /data again so because mount is run as root + defaults
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800183 chown system system /data
184 chmod 0771 /data
Stephen Smalley1eee4192012-01-13 08:54:34 -0500185 # We restorecon /data in case the userdata partition has been reset.
186 restorecon /data
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800187
Nick Kralevichb410eb12013-09-17 16:18:23 -0700188 # Avoid predictable entropy pool. Carry over entropy from previous boot.
189 copy /data/system/entropy.dat /dev/urandom
190
San Mehatf26d6ce2009-09-01 09:11:04 -0700191 # Create dump dir and collect dumps.
192 # Do this before we mount cache so eventually we can use cache for
193 # storing dumps on platforms which do not have a dedicated dump partition.
Chia-chi Yehea744142011-07-08 16:52:18 -0700194 mkdir /data/dontpanic 0750 root log
San Mehatf26d6ce2009-09-01 09:11:04 -0700195
196 # Collect apanic data, free resources and re-arm trigger
197 copy /proc/apanic_console /data/dontpanic/apanic_console
Mike Lockwood25f1a5a2009-09-11 17:13:28 -0400198 chown root log /data/dontpanic/apanic_console
Mike Lockwood93324822009-09-08 22:55:59 -0400199 chmod 0640 /data/dontpanic/apanic_console
San Mehat020f35f2009-09-01 15:38:18 -0700200
San Mehatf26d6ce2009-09-01 09:11:04 -0700201 copy /proc/apanic_threads /data/dontpanic/apanic_threads
Mike Lockwood25f1a5a2009-09-11 17:13:28 -0400202 chown root log /data/dontpanic/apanic_threads
Mike Lockwood93324822009-09-08 22:55:59 -0400203 chmod 0640 /data/dontpanic/apanic_threads
San Mehat020f35f2009-09-01 15:38:18 -0700204
San Mehatf26d6ce2009-09-01 09:11:04 -0700205 write /proc/apanic_console 1
206
Ken Sumrall752923c2010-12-03 16:33:31 -0800207 # create basic filesystem structure
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800208 mkdir /data/misc 01771 system misc
Benoit Goby0245e152012-05-09 17:27:53 -0700209 mkdir /data/misc/adb 02750 system shell
Matthew Xie971153a2012-10-04 12:35:27 -0700210 mkdir /data/misc/bluedroid 0770 bluetooth net_bt_stack
Jaikumar Ganesheafdd862010-01-07 20:24:55 -0800211 mkdir /data/misc/bluetooth 0770 system system
Chia-chi Yeh9b4f1ff2009-09-18 10:35:26 +0800212 mkdir /data/misc/keystore 0700 keystore keystore
Brian Carlstrom04918932011-06-30 22:50:29 -0700213 mkdir /data/misc/keychain 0771 system system
Robert Greenwalt2aa33a32013-07-16 09:46:17 -0700214 mkdir /data/misc/radio 0770 system radio
Robert Greenwaltd6d47802012-09-26 16:04:27 -0700215 mkdir /data/misc/sms 0770 system radio
Elliott Hughesf820e852012-10-19 18:10:05 -0700216 mkdir /data/misc/zoneinfo 0775 system system
Chia-chi Yeh9bb4d412011-07-08 20:03:03 -0700217 mkdir /data/misc/vpn 0770 system vpn
Oscar Montemayord0aa32c2010-01-06 13:18:12 -0800218 mkdir /data/misc/systemkeys 0700 system system
Mike Lockwood48d116e2009-07-08 18:42:08 -0400219 # give system access to wpa_supplicant.conf for backup and restore
220 mkdir /data/misc/wifi 0770 wifi wifi
Amith Yamasanieefef322009-07-02 12:08:13 -0700221 chmod 0660 /data/misc/wifi/wpa_supplicant.conf
Chia-chi Yeh5ebced32012-03-07 14:52:10 -0800222 mkdir /data/local 0751 root root
Glenn Kastenb0f908a2013-02-22 14:54:45 -0800223 mkdir /data/misc/media 0700 media media
Nick Kralevichf3ef1272012-03-14 15:22:54 -0700224
Stephen Smalleydeb41e52013-10-01 09:21:47 -0400225 # Set security context of any pre-existing /data/misc/adb/adb_keys file.
226 restorecon /data/misc/adb
227 restorecon /data/misc/adb/adb_keys
228
Nick Kralevichf3ef1272012-03-14 15:22:54 -0700229 # For security reasons, /data/local/tmp should always be empty.
230 # Do not place files or directories in /data/local/tmp
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800231 mkdir /data/local/tmp 0771 shell shell
232 mkdir /data/data 0771 system system
233 mkdir /data/app-private 0771 system system
Kenny Rootf8bbaba2012-04-12 15:01:52 -0700234 mkdir /data/app-asec 0700 root root
Kenny Root50544172012-09-08 22:39:25 -0700235 mkdir /data/app-lib 0771 system system
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800236 mkdir /data/app 0771 system system
237 mkdir /data/property 0700 root root
Mike Lockwood9dd2eef2011-12-11 20:25:16 -0800238 mkdir /data/ssh 0750 root shell
239 mkdir /data/ssh/empty 0700 root root
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800240
Chia-chi Yehea744142011-07-08 16:52:18 -0700241 # create dalvik-cache, so as to enforce our permissions
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800242 mkdir /data/dalvik-cache 0771 system system
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800243
MÃ¥rten Kongstadb45280d2011-05-30 10:24:54 +0200244 # create resource-cache and double-check the perms
245 mkdir /data/resource-cache 0771 system system
246 chown system system /data/resource-cache
247 chmod 0771 /data/resource-cache
248
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800249 # create the lost+found directories, so as to enforce our permissions
Chia-chi Yehea744142011-07-08 16:52:18 -0700250 mkdir /data/lost+found 0770 root root
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800251
James Dong09cdc0e2012-01-06 15:19:26 -0800252 # create directory for DRM plug-ins - give drm the read/write access to
253 # the following directory.
254 mkdir /data/drm 0770 drm drm
aimitakeshie572d592010-07-27 08:38:35 +0900255
Jeff Tinker08d64302013-04-23 19:54:17 -0700256 # create directory for MediaDrm plug-ins - give drm the read/write access to
257 # the following directory.
258 mkdir /data/mediadrm 0770 mediadrm mediadrm
259
Jeff Sharkeyfb4f7ac2013-03-14 14:27:38 -0700260 # symlink to bugreport storage location
261 symlink /data/data/com.android.shell/files/bugreports /data/bugreports
262
William Robertsbfd71b42013-01-23 14:05:04 -0800263 # Separate location for storing security policy files on data
William Robertsd43bab72013-04-15 13:56:22 -0700264 mkdir /data/security 0711 system system
William Robertsbfd71b42013-01-23 14:05:04 -0800265
Stephen Smalley6552f682013-08-26 10:45:05 -0400266 # Reload policy from /data/security if present.
267 setprop selinux.reload_policy 1
268
Ken Sumrall752923c2010-12-03 16:33:31 -0800269 # If there is no fs-post-data action in the init.<device>.rc file, you
270 # must uncomment this line, otherwise encrypted filesystems
271 # won't work.
272 # Set indication (checked by vold) that we have finished this action
273 #setprop vold.post_fs_data_done 1
274
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800275on boot
276# basic network init
277 ifup lo
278 hostname localhost
279 domainname localdomain
280
281# set RLIMIT_NICE to allow priorities from 19 to -20
282 setrlimit 13 40 40
283
Dianne Hackborn06787f42011-08-07 16:30:24 -0700284# Memory management. Basic kernel parameters, and allow the high
285# level system server to be able to adjust the kernel OOM driver
Glenn Kastenb91bd9f2012-04-19 16:18:37 -0700286# parameters to match how it is managing things.
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800287 write /proc/sys/vm/overcommit_memory 1
The Android Open Source Projecte037fd72009-03-13 13:04:37 -0700288 write /proc/sys/vm/min_free_order_shift 4
Dianne Hackborn06787f42011-08-07 16:30:24 -0700289 chown root system /sys/module/lowmemorykiller/parameters/adj
290 chmod 0664 /sys/module/lowmemorykiller/parameters/adj
291 chown root system /sys/module/lowmemorykiller/parameters/minfree
292 chmod 0664 /sys/module/lowmemorykiller/parameters/minfree
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800293
San Mehat831d8e12009-10-13 12:24:47 -0700294 # Tweak background writeout
295 write /proc/sys/vm/dirty_expire_centisecs 200
296 write /proc/sys/vm/dirty_background_ratio 5
297
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800298 # Permissions for System Server and daemons.
299 chown radio system /sys/android_power/state
300 chown radio system /sys/android_power/request_state
301 chown radio system /sys/android_power/acquire_full_wake_lock
302 chown radio system /sys/android_power/acquire_partial_wake_lock
303 chown radio system /sys/android_power/release_wake_lock
Arve Hjønnevåg70a163f2012-05-02 17:57:50 -0700304 chown system system /sys/power/autosleep
Arve Hjønnevåg1670f832012-03-20 20:33:09 -0700305 chown system system /sys/power/state
306 chown system system /sys/power/wakeup_count
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800307 chown radio system /sys/power/wake_lock
308 chown radio system /sys/power/wake_unlock
309 chmod 0660 /sys/power/state
310 chmod 0660 /sys/power/wake_lock
311 chmod 0660 /sys/power/wake_unlock
Todd Poynor0653b972012-04-11 14:48:51 -0700312
313 chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
314 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
Todd Poynor2b5b3bb2012-12-20 18:52:03 -0800315 chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack
316 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
Todd Poynor0653b972012-04-11 14:48:51 -0700317 chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
318 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
319 chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
320 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
Todd Poynor2b5b3bb2012-12-20 18:52:03 -0800321 chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
322 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
Todd Poynor0653b972012-04-11 14:48:51 -0700323 chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
324 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
Todd Poynorf35c2032012-04-19 13:17:24 -0700325 chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
326 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
Todd Poynor8d3ea1d2012-04-24 15:37:13 -0700327 chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
328 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
Todd Poynor4ff10e62012-05-03 15:20:48 -0700329 chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
Todd Poynor33045a62012-04-27 20:21:18 -0700330 chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost
331 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
Todd Poynor4f247d72012-12-19 17:43:06 -0800332 chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
333 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
Todd Poynor6b5de1c2013-03-25 13:17:13 -0700334 chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
335 chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
Todd Poynor0653b972012-04-11 14:48:51 -0700336
337 # Assume SMP uses shared cpufreq policy for all CPUs
338 chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
339 chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
340
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800341 chown system system /sys/class/timed_output/vibrator/enable
342 chown system system /sys/class/leds/keyboard-backlight/brightness
343 chown system system /sys/class/leds/lcd-backlight/brightness
344 chown system system /sys/class/leds/button-backlight/brightness
The Android Open Source Projectf614d642009-03-18 17:39:49 -0700345 chown system system /sys/class/leds/jogball-backlight/brightness
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800346 chown system system /sys/class/leds/red/brightness
347 chown system system /sys/class/leds/green/brightness
348 chown system system /sys/class/leds/blue/brightness
349 chown system system /sys/class/leds/red/device/grpfreq
350 chown system system /sys/class/leds/red/device/grppwm
351 chown system system /sys/class/leds/red/device/blink
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800352 chown system system /sys/class/timed_output/vibrator/enable
353 chown system system /sys/module/sco/parameters/disable_esco
354 chown system system /sys/kernel/ipv4/tcp_wmem_min
355 chown system system /sys/kernel/ipv4/tcp_wmem_def
356 chown system system /sys/kernel/ipv4/tcp_wmem_max
357 chown system system /sys/kernel/ipv4/tcp_rmem_min
358 chown system system /sys/kernel/ipv4/tcp_rmem_def
359 chown system system /sys/kernel/ipv4/tcp_rmem_max
360 chown root radio /proc/cmdline
361
Geremy Condrac2594f32013-03-30 17:27:43 -0700362# Set these so we can remotely update SELinux policy
Geremy Condrac2594f32013-03-30 17:27:43 -0700363 chown system system /sys/fs/selinux/enforce
364
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800365# Define TCP buffer sizes for various networks
366# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
Jianzheng Zhou52ea5102013-11-15 13:44:00 +0800367 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
368 setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576
369 setprop net.tcp.buffersize.ethernet 524288,1048576,3145728,524288,1048576,2097152
370 setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
371 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
372 setprop net.tcp.buffersize.hspa 4094,87380,262144,4096,16384,262144
373 setprop net.tcp.buffersize.hsupa 4094,87380,262144,4096,16384,262144
374 setprop net.tcp.buffersize.hsdpa 4094,87380,262144,4096,16384,262144
375 setprop net.tcp.buffersize.hspap 4094,87380,1220608,4096,16384,1220608
376 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
377 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
378 setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800379
Ken Sumrall752923c2010-12-03 16:33:31 -0800380 class_start core
381 class_start main
382
383on nonencrypted
384 class_start late_start
385
Dima Zavinca47cef2011-08-24 15:28:23 -0700386on charger
387 class_start charger
388
Ken Sumrall752923c2010-12-03 16:33:31 -0800389on property:vold.decrypt=trigger_reset_main
390 class_reset main
391
Ken Sumrallc5c51032011-03-08 17:01:29 -0800392on property:vold.decrypt=trigger_load_persist_props
393 load_persist_props
394
Ken Sumrall752923c2010-12-03 16:33:31 -0800395on property:vold.decrypt=trigger_post_fs_data
396 trigger post-fs-data
397
Ken Sumralle4349152011-01-17 14:26:34 -0800398on property:vold.decrypt=trigger_restart_min_framework
399 class_start main
400
Ken Sumrall752923c2010-12-03 16:33:31 -0800401on property:vold.decrypt=trigger_restart_framework
402 class_start main
403 class_start late_start
404
405on property:vold.decrypt=trigger_shutdown_framework
406 class_reset late_start
407 class_reset main
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800408
Nick Kralevichca8e66a2013-04-18 12:20:02 -0700409on property:sys.powerctl=*
410 powerctl ${sys.powerctl}
411
Colin Cross57fdb5c2013-07-25 10:34:30 -0700412# system server cannot write to /proc/sys files, so proxy it through init
413on property:sys.sysctl.extra_free_kbytes=*
414 write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}
415
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800416## Daemon processes to be run by init.
417##
Colin Crossf83d0b92010-04-21 12:04:20 -0700418service ueventd /sbin/ueventd
Ken Sumrall752923c2010-12-03 16:33:31 -0800419 class core
Colin Crossf83d0b92010-04-21 12:04:20 -0700420 critical
Stephen Smalley1eee4192012-01-13 08:54:34 -0500421 seclabel u:r:ueventd:s0
Colin Crossf83d0b92010-04-21 12:04:20 -0700422
Todd Poynor13f4c9f2013-06-19 15:09:35 -0700423service healthd /sbin/healthd
424 class core
425 critical
426 seclabel u:r:healthd:s0
427
428service healthd-charger /sbin/healthd -n
429 class charger
430 critical
431 seclabel u:r:healthd:s0
432
Brian Swetlandb4d65392010-10-27 15:40:23 -0700433service console /system/bin/sh
Ken Sumrall752923c2010-12-03 16:33:31 -0800434 class core
Brian Swetlandb4d65392010-10-27 15:40:23 -0700435 console
436 disabled
437 user shell
438 group log
439
Mike Lockwoodd49b4ef2010-11-19 09:12:27 -0500440on property:ro.debuggable=1
Brian Swetlandb4d65392010-10-27 15:40:23 -0700441 start console
442
Mike Lockwood352dfdf2011-06-08 17:40:00 -0700443# adbd is controlled via property triggers in init.<platform>.usb.rc
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800444service adbd /sbin/adbd
Ken Sumrall752923c2010-12-03 16:33:31 -0800445 class core
Benoit Goby0574d6b2012-04-24 15:07:12 -0700446 socket adbd stream 660 system system
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800447 disabled
Stephen Smalley1eee4192012-01-13 08:54:34 -0500448 seclabel u:r:adbd:s0
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800449
450# adbd on at boot in emulator
451on property:ro.kernel.qemu=1
452 start adbd
453
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800454service servicemanager /system/bin/servicemanager
Ken Sumrall752923c2010-12-03 16:33:31 -0800455 class core
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800456 user system
Nick Kralevich333f24b2010-12-10 14:10:16 -0800457 group system
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800458 critical
Todd Poynor13f4c9f2013-06-19 15:09:35 -0700459 onrestart restart healthd
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800460 onrestart restart zygote
461 onrestart restart media
Mathias Agopian04a87592011-10-31 14:27:36 -0700462 onrestart restart surfaceflinger
463 onrestart restart drm
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800464
The Android Open Source Projecte4749f32009-03-09 11:52:15 -0700465service vold /system/bin/vold
Ken Sumrall752923c2010-12-03 16:33:31 -0800466 class core
The Android Open Source Projecte4749f32009-03-09 11:52:15 -0700467 socket vold stream 0660 root mount
San Mehatf0cb74e2010-02-26 10:01:14 -0800468 ioprio be 2
The Android Open Source Projecte4749f32009-03-09 11:52:15 -0700469
San Mehat192277c2010-01-15 07:48:35 -0800470service netd /system/bin/netd
Ken Sumrall752923c2010-12-03 16:33:31 -0800471 class main
San Mehat192277c2010-01-15 07:48:35 -0800472 socket netd stream 0660 root system
Brad Fitzpatrick8c5669f2010-10-27 10:23:16 -0700473 socket dnsproxyd stream 0660 root inet
Robert Greenwalt1d91fcf2012-03-27 16:59:27 -0700474 socket mdns stream 0660 root system
San Mehat192277c2010-01-15 07:48:35 -0800475
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800476service debuggerd /system/bin/debuggerd
Ken Sumrall752923c2010-12-03 16:33:31 -0800477 class main
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800478
479service ril-daemon /system/bin/rild
vidya rao04cf6292011-06-24 12:15:20 -0700480 class main
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800481 socket rild stream 660 root radio
482 socket rild-debug stream 660 radio system
483 user root
Jeff Sharkey61f13592012-08-20 14:31:47 -0700484 group radio cache inet misc audio log
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800485
Mathias Agopiana40481b2011-03-03 18:48:30 -0800486service surfaceflinger /system/bin/surfaceflinger
487 class main
488 user system
Dima Zavinece565c2012-10-04 17:02:26 -0700489 group graphics drmrpc
Mathias Agopiana40481b2011-03-03 18:48:30 -0800490 onrestart restart zygote
491
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800492service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
Ken Sumrall752923c2010-12-03 16:33:31 -0800493 class main
Nick Kraleviche7fd9112012-01-27 13:06:53 -0800494 socket zygote stream 660 root system
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800495 onrestart write /sys/android_power/request_state wake
496 onrestart write /sys/power/state on
Dan Bornstein1dec5032009-10-09 14:24:51 -0700497 onrestart restart media
Brad Fitzpatrick64902572010-09-21 15:49:06 -0700498 onrestart restart netd
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800499
aimitakeshie572d592010-07-27 08:38:35 +0900500service drm /system/bin/drmserver
Ken Sumrall752923c2010-12-03 16:33:31 -0800501 class main
aimitakeshie572d592010-07-27 08:38:35 +0900502 user drm
Jeff Sharkey61f13592012-08-20 14:31:47 -0700503 group drm system inet drmrpc
aimitakeshie572d592010-07-27 08:38:35 +0900504
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800505service media /system/bin/mediaserver
Ken Sumrall752923c2010-12-03 16:33:31 -0800506 class main
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800507 user media
Jeff Tinker08d64302013-04-23 19:54:17 -0700508 group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm
San Mehatf0cb74e2010-02-26 10:01:14 -0800509 ioprio rt 4
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800510
Mathias Agopian8b2cf9f2009-05-20 18:09:51 -0700511service bootanim /system/bin/bootanimation
Ken Sumrall752923c2010-12-03 16:33:31 -0800512 class main
Mathias Agopian8b2cf9f2009-05-20 18:09:51 -0700513 user graphics
514 group graphics
515 disabled
516 oneshot
517
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800518service installd /system/bin/installd
Ken Sumrall752923c2010-12-03 16:33:31 -0800519 class main
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800520 socket installd stream 600 system system
521
Doug Zongkerd52f54c2009-07-23 15:18:34 -0700522service flash_recovery /system/etc/install-recovery.sh
Ken Sumrall752923c2010-12-03 16:33:31 -0800523 class main
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800524 oneshot
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800525
Chia-chi Yeh51afbf52009-07-01 07:06:47 +0800526service racoon /system/bin/racoon
Ken Sumrall752923c2010-12-03 16:33:31 -0800527 class main
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800528 socket racoon stream 600 system system
Chia-chi Yeh9bb4d412011-07-08 20:03:03 -0700529 # IKE uses UDP port 500. Racoon will setuid to vpn after binding the port.
Chia-chi Yeha2468712011-08-08 10:11:40 -0700530 group vpn net_admin inet
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800531 disabled
532 oneshot
533
534service mtpd /system/bin/mtpd
Ken Sumrall752923c2010-12-03 16:33:31 -0800535 class main
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800536 socket mtpd stream 600 system system
Chia-chi Yeh51afbf52009-07-01 07:06:47 +0800537 user vpn
Chia-chi Yeha2468712011-08-08 10:11:40 -0700538 group vpn net_admin inet net_raw
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800539 disabled
540 oneshot
541
Chia-chi Yeh9b4f1ff2009-09-18 10:35:26 +0800542service keystore /system/bin/keystore /data/misc/keystore
Ken Sumrall752923c2010-12-03 16:33:31 -0800543 class main
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800544 user keystore
Kenny Rootad5b9c72012-02-23 16:31:10 -0800545 group keystore drmrpc
Chung-yih Wang1f75d702009-06-01 19:04:05 +0800546
Mike Lockwoodabe3a9c2009-09-02 18:09:26 -0400547service dumpstate /system/bin/dumpstate -s
Ken Sumrall752923c2010-12-03 16:33:31 -0800548 class main
Mike Lockwoodabe3a9c2009-09-02 18:09:26 -0400549 socket dumpstate stream 0660 shell log
550 disabled
551 oneshot
Mike Lockwood9dd2eef2011-12-11 20:25:16 -0800552
553service sshd /system/bin/start-ssh
554 class main
Mike Lockwood19155b52012-03-21 11:58:05 -0700555 disabled
Robert Greenwalt1d91fcf2012-03-27 16:59:27 -0700556
557service mdnsd /system/bin/mdnsd
558 class main
559 user mdnsr
560 group inet net_raw
561 socket mdnsd stream 0660 mdnsr inet
562 disabled
563 oneshot