34a1da07 |
1 | on early-init |
2 | symlink /initlogo.rle.bak /initlogo.rle |
3 | start ueventd |
4 | |
5 | on init |
6 | |
7 | sysclktz 0 |
8 | |
9 | loglevel 3 |
10 | |
11 | # setup the global environment |
220674ac |
12 | export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin |
34a1da07 |
13 | export LD_LIBRARY_PATH /system/lib |
14 | export ANDROID_BOOTLOGO 1 |
220674ac |
15 | export ANDROID_CACHE /data/cache |
34a1da07 |
16 | export ANDROID_ROOT /system |
17 | export ANDROID_ASSETS /system/app |
18 | export ANDROID_DATA /data |
220674ac |
19 | export DOWNLOAD_CACHE /data/cache/download |
34a1da07 |
20 | export EXTERNAL_STORAGE /mnt/sdcard2 |
21 | export ASEC_MOUNTPOINT /mnt/asec |
220674ac |
22 | export LOOP_MOUNTPOINT /mnt/obb |
23 | export SD_EXT_DIRECTORY /sd-ext |
34a1da07 |
24 | export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar |
25 | |
26 | # Location of BT firmware files |
27 | export BT_FW_PATH /vendor/firmware |
28 | |
29 | # Backward compatibility |
30 | symlink /system/etc /etc |
31 | symlink /sys/kernel/debug /d |
32 | |
33 | # create mountpoints |
34 | mkdir /mnt 0775 root system |
35 | mkdir /mnt/sdcard 0000 system system |
36 | mkdir /mnt/sdcard2 0000 system system |
37 | |
38 | # Create cgroup mount point for cpu accounting |
39 | mkdir /acct |
40 | mount cgroup none /acct cpuacct |
41 | mkdir /acct/uid |
42 | |
43 | # Backwards Compat - XXX: Going away in G* |
44 | symlink /mnt/sdcard2 /sdcard |
45 | |
46 | mkdir /system |
47 | mkdir /data 0771 system system |
220674ac |
48 | mkdir /data/cache 0771 system cache |
49 | symlink /data/cache /cache |
34a1da07 |
50 | mkdir /config 0500 root root |
51 | |
52 | # Directory for putting things only root should see. |
53 | mkdir /mnt/secure 0700 root root |
54 | |
55 | # Directory for staging bindmounts |
56 | mkdir /mnt/secure/staging 0700 root root |
57 | |
58 | # Directory-target for where the secure container |
59 | # imagefile directory will be bind-mounted |
60 | mkdir /mnt/secure/asec 0700 root root |
61 | |
62 | # Secure container public mount points. |
63 | mkdir /mnt/asec 0700 root system |
64 | mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000 |
65 | |
220674ac |
66 | # Filesystem image public mount points. |
67 | mkdir /mnt/obb 0700 root system |
68 | mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000 |
69 | |
70 | mkdir /sd-ext 0771 system system |
71 | |
34a1da07 |
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 |
77 | write /proc/sys/kernel/sched_compat_yield 1 |
78 | write /proc/sys/kernel/sched_child_runs_first 0 |
79 | |
80 | # Create cgroup mount points for process groups |
81 | mkdir /dev/cpuctl |
82 | mount cgroup none /dev/cpuctl cpu |
83 | chown system system /dev/cpuctl |
84 | chown system system /dev/cpuctl/tasks |
85 | chmod 0777 /dev/cpuctl/tasks |
86 | write /dev/cpuctl/cpu.shares 1024 |
87 | |
88 | mkdir /dev/cpuctl/fg_boost |
89 | chown system system /dev/cpuctl/fg_boost/tasks |
90 | chmod 0777 /dev/cpuctl/fg_boost/tasks |
91 | write /dev/cpuctl/fg_boost/cpu.shares 1024 |
92 | |
93 | mkdir /dev/cpuctl/bg_non_interactive |
94 | chown system system /dev/cpuctl/bg_non_interactive/tasks |
95 | chmod 0777 /dev/cpuctl/bg_non_interactive/tasks |
96 | # 5.0 % |
97 | write /dev/cpuctl/bg_non_interactive/cpu.shares 52 |
98 | |
220674ac |
99 | on post-fs |
100 | # once everything is setup, no need to modify / |
101 | mount rootfs rootfs / ro remount |
34a1da07 |
102 | |
220674ac |
103 | # We chown/chmod /data again so because mount is run as root + defaults |
34a1da07 |
104 | chown system system /data |
105 | chmod 0771 /data |
106 | |
107 | # Create dump dir and collect dumps. |
108 | # Do this before we mount cache so eventually we can use cache for |
109 | # storing dumps on platforms which do not have a dedicated dump partition. |
110 | |
111 | mkdir /data/dontpanic |
112 | chown root log /data/dontpanic |
113 | chmod 0750 /data/dontpanic |
114 | |
115 | # Collect apanic data, free resources and re-arm trigger |
116 | copy /proc/apanic_console /data/dontpanic/apanic_console |
117 | chown root log /data/dontpanic/apanic_console |
118 | chmod 0640 /data/dontpanic/apanic_console |
119 | |
120 | copy /proc/apanic_threads /data/dontpanic/apanic_threads |
121 | chown root log /data/dontpanic/apanic_threads |
122 | chmod 0640 /data/dontpanic/apanic_threads |
123 | |
124 | write /proc/apanic_console 1 |
125 | |
126 | # Same reason as /data above |
220674ac |
127 | chown system cache /data/cache |
128 | chmod 0771 /data/cache |
34a1da07 |
129 | |
130 | # This may have been created by the recovery system with odd permissions |
131 | chown system cache /cache/recovery |
132 | chmod 0770 /cache/recovery |
133 | |
134 | #change permissions on vmallocinfo so we can grab it from bugreports |
135 | chown root log /proc/vmallocinfo |
136 | chmod 0440 /proc/vmallocinfo |
137 | |
138 | #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks |
139 | chown root system /proc/kmsg |
140 | chmod 0440 /proc/kmsg |
141 | chown root system /proc/sysrq-trigger |
142 | chmod 0220 /proc/sysrq-trigger |
143 | |
144 | # change permissions for Overlay |
145 | chmod 0777 /dev/video1 |
146 | chmod 0777 /dev/video2 |
147 | chmod 0777 /dev/omap-resizer |
220674ac |
148 | chmod 777 /dev/video7 |
34a1da07 |
149 | |
150 | |
151 | # create basic filesystem structure |
152 | mkdir /data/misc 01771 system misc |
153 | mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth |
154 | mkdir /data/misc/bluetooth 0770 system system |
155 | mkdir /data/misc/keystore 0700 keystore keystore |
156 | mkdir /data/misc/vpn 0770 system system |
157 | mkdir /data/misc/systemkeys 0700 system system |
158 | mkdir /data/misc/vpn/profiles 0770 system system |
34a1da07 |
159 | # give system access to wpa_supplicant.conf for backup and restore |
160 | mkdir /system/etc/wifi 0770 system wifi |
161 | chmod 0770 /system/etc/wifi |
162 | chmod 0660 /system/etc/wifi/wpa_supplicant.conf |
220674ac |
163 | |
34a1da07 |
164 | chown system wifi /system/etc/wifi/wpa_supplicant.conf |
165 | mkdir /data/misc/wifi 0770 system wifi |
166 | mkdir /data/misc/wifi/sockets 0777 system wifi |
167 | chmod 0770 /data/misc/wifi |
168 | chmod 0660 /data/misc/wifi/wpa_supplicant.conf |
169 | chown wifi wifi /data/misc/wifi |
170 | chown wifi wifi /data/misc/wifi/wpa_supplicant.conf |
171 | |
220674ac |
172 | mkdir /data/local 0751 root root |
34a1da07 |
173 | mkdir /data/local/tmp 0771 shell shell |
220674ac |
174 | mkdir /data/local/download 0771 system cache |
34a1da07 |
175 | mkdir /data/data 0771 system system |
176 | mkdir /data/app-private 0771 system system |
177 | mkdir /data/app 0771 system system |
178 | mkdir /data/property 0700 root root |
220674ac |
179 | |
180 | mkdir /data/cache/download 0771 system cache |
181 | |
34a1da07 |
182 | mkdir /data/misc/dhcp 0777 dhcp dhcp |
183 | mkdir /data/misc/udhcpd 0777 system wifi |
184 | chown dhcp dhcp /data/misc/dhcp |
185 | |
186 | # create dalvik-cache and double-check the perms |
187 | mkdir /data/dalvik-cache 0771 system system |
188 | chown system system /data/dalvik-cache |
189 | chmod 0771 /data/dalvik-cache |
190 | |
220674ac |
191 | mkdir /data/cache/dalvik-cache 0771 system system |
192 | chown system system /data/cache/dalvik-cache |
193 | chmod 0771 /data/cache/dalvik-cache |
194 | |
34a1da07 |
195 | # create the lost+found directories, so as to enforce our permissions |
196 | mkdir /data/lost+found 0770 |
197 | mkdir /cache/lost+found 0770 |
198 | |
199 | # double check the perms, in case lost+found already exists, and set owner |
200 | chown root root /data/lost+found |
201 | chmod 0770 /data/lost+found |
202 | chown root root /cache/lost+found |
203 | chmod 0770 /cache/lost+found |
204 | |
220674ac |
205 | # allow net_raw to have access to /dev/socket directory |
206 | chown root net_raw /dev/socket |
207 | chmod 0775 /dev/socket |
208 | |
209 | # allow system to modify cpufreq control files |
210 | chown root system /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor |
211 | chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor |
212 | chown root system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq |
213 | chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq |
214 | chown root system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq |
215 | chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq |
216 | |
34a1da07 |
217 | # console changed to ttyO* from ttyS* since 2.6.37 kernel. |
218 | chmod 0660 /dev/ttyO1 |
219 | chown bluetooth bluetooth /dev/ttyO1 |
220 | # chmod 0660 sys/class/rfkill/rfkill0/state |
221 | # chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state |
222 | # write /sys/class/rfkill/rfkill0/state 0 |
223 | |
224 | |
225 | on boot |
226 | # basic network init |
227 | ifup lo |
228 | # hostname localhost |
229 | # domainname localdomain |
230 | |
231 | # set RLIMIT_NICE to allow priorities from 19 to -20 |
232 | setrlimit 13 40 40 |
233 | |
34a1da07 |
234 | # Power Management Patches |
235 | setprop hw.nopm true |
236 | |
34a1da07 |
237 | # Define the oom_adj values for the classes of processes that can be |
238 | # killed by the kernel. These are used in ActivityManagerService. |
239 | setprop ro.FOREGROUND_APP_ADJ 0 |
240 | setprop ro.VISIBLE_APP_ADJ 1 |
241 | setprop ro.PERCEPTIBLE_APP_ADJ 2 |
242 | setprop ro.HEAVY_WEIGHT_APP_ADJ 3 |
243 | setprop ro.SECONDARY_SERVER_ADJ 4 |
244 | setprop ro.BACKUP_APP_ADJ 5 |
245 | setprop ro.HOME_APP_ADJ 6 |
246 | setprop ro.HIDDEN_APP_MIN_ADJ 7 |
247 | setprop ro.EMPTY_APP_ADJ 15 |
248 | |
249 | # Define the memory thresholds at which the above process classes will |
250 | # be killed. These numbers are in pages (4k). |
251 | setprop ro.FOREGROUND_APP_MEM 2048 |
252 | setprop ro.VISIBLE_APP_MEM 3072 |
253 | setprop ro.PERCEPTIBLE_APP_MEM 4096 |
254 | setprop ro.HEAVY_WEIGHT_APP_MEM 4096 |
255 | setprop ro.SECONDARY_SERVER_MEM 6144 |
256 | setprop ro.BACKUP_APP_MEM 6144 |
257 | setprop ro.HOME_APP_MEM 6144 |
220674ac |
258 | setprop ro.HIDDEN_APP_MEM 7168 |
259 | setprop ro.EMPTY_APP_MEM 8192 |
34a1da07 |
260 | |
261 | # Write value must be consistent with the above properties. |
262 | # Note that the driver only supports 6 slots, so we have HOME_APP at the |
263 | # same memory level as services. |
264 | write /sys/module/lowmemorykiller/parameters/adj 0,1,2,4,7,15 |
265 | |
266 | write /proc/sys/vm/overcommit_memory 1 |
267 | write /proc/sys/vm/min_free_order_shift 4 |
268 | write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192 |
269 | |
220674ac |
270 | # Set init its forked children's oom_adj. |
271 | write /proc/1/oom_adj -16 |
34a1da07 |
272 | |
273 | # Tweak background writeout |
274 | write /proc/sys/vm/dirty_expire_centisecs 200 |
275 | write /proc/sys/vm/dirty_background_ratio 5 |
276 | |
277 | # Permissions for System Server and daemons. |
278 | chown radio system /sys/android_power/state |
279 | chown radio system /sys/android_power/request_state |
280 | chown radio system /sys/android_power/acquire_full_wake_lock |
281 | chown radio system /sys/android_power/acquire_partial_wake_lock |
282 | chown radio system /sys/android_power/release_wake_lock |
283 | chown radio system /sys/power/state |
284 | chown radio system /sys/power/wake_lock |
285 | chown radio system /sys/power/wake_unlock |
286 | #Power Management patches |
287 | chown radio system /sys/power/wait_for_fb_sleep |
288 | chown radio system /sys/power/wait_for_fb_wake |
289 | |
290 | chmod 0660 /sys/power/state |
291 | chmod 0660 /sys/power/wake_lock |
292 | chmod 0660 /sys/power/wake_unlock |
34a1da07 |
293 | chown system system /sys/module/sco/parameters/disable_esco |
294 | chown system system /sys/kernel/ipv4/tcp_wmem_min |
295 | chown system system /sys/kernel/ipv4/tcp_wmem_def |
296 | chown system system /sys/kernel/ipv4/tcp_wmem_max |
297 | chown system system /sys/kernel/ipv4/tcp_rmem_min |
298 | chown system system /sys/kernel/ipv4/tcp_rmem_def |
299 | chown system system /sys/kernel/ipv4/tcp_rmem_max |
300 | chown root radio /proc/cmdline |
301 | chown system system /system/etc/wifi |
34a1da07 |
302 | |
303 | # Define TCP buffer sizes for various networks |
304 | # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, |
305 | setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 |
306 | setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208 |
307 | setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 |
308 | setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040 |
309 | setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 |
310 | |
311 | setprop wifi.interface wlan0 |
312 | |
220674ac |
313 | # Include extra init file |
314 | # import /system/etc/init.local.rc |
315 | |
316 | # Run sysinit |
317 | exec /system/bin/sysinit |
318 | |
34a1da07 |
319 | class_start default |
320 | |
321 | ## Daemon processes to be run by init. |
322 | ## |
323 | #service logcat /system/bin/logcat -f /dev/kmsg |
324 | # oneshot |
325 | |
326 | service ueventd /sbin/ueventd |
327 | critical |
328 | |
329 | #service console /system/bin/sh |
330 | # console |
220674ac |
331 | # disabled |
332 | # user shell |
333 | # group log |
334 | |
335 | #on property:ro.secure=0 |
336 | # start console |
34a1da07 |
337 | |
338 | service pvr /system/bin/rc.pvr start |
339 | |
340 | # adbd is controlled by the persist.service.adb.enable system property |
341 | service adbd /sbin/adbd |
342 | disabled |
343 | |
344 | # adbd on at boot in emulator |
345 | on property:ro.kernel.qemu=1 |
346 | start adbd |
347 | |
348 | on property:persist.service.adb.enable=1 |
349 | start adbd |
350 | |
351 | on property:persist.service.adb.enable=0 |
352 | stop adbd |
353 | |
220674ac |
354 | on property:service.adb.tcp.port=5555 |
355 | restart adbd |
356 | |
357 | on property:service.adb.tcp.port=-1 |
358 | restart adbd |
359 | |
34a1da07 |
360 | service servicemanager /system/bin/servicemanager |
361 | user system |
362 | critical |
363 | onrestart restart zygote |
364 | onrestart restart media |
365 | |
366 | service vold /system/bin/vold |
367 | socket vold stream 0660 root mount |
368 | ioprio be 2 |
369 | |
370 | service netd /system/bin/netd |
371 | socket netd stream 0660 root system |
220674ac |
372 | socket dnsproxyd stream 0660 root inet |
34a1da07 |
373 | |
374 | service debuggerd /system/bin/debuggerd |
375 | |
376 | service ril-daemon /system/bin/rild |
377 | socket rild stream 660 root radio |
378 | socket rild-debug stream 660 radio system |
379 | user root |
220674ac |
380 | group radio cache inet misc audio sdcard_rw net_admin net_raw qcom_oncrpc diag |
34a1da07 |
381 | |
382 | service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server |
220674ac |
383 | socket zygote stream 660 root system |
34a1da07 |
384 | onrestart write /sys/android_power/request_state wake |
385 | onrestart write /sys/power/state on |
386 | onrestart restart media |
220674ac |
387 | onrestart restart netd |
34a1da07 |
388 | |
389 | service media /system/bin/mediaserver |
390 | user media |
391 | group system audio camera graphics inet net_bt net_bt_admin net_raw sdcard_rw |
392 | ioprio rt 4 |
393 | |
394 | service bootanim /system/bin/bootanimation |
395 | user graphics |
396 | group graphics |
397 | disabled |
398 | oneshot |
399 | |
400 | service dbus /system/bin/dbus-daemon --system --nofork |
401 | socket dbus stream 660 bluetooth bluetooth |
402 | user bluetooth |
403 | group bluetooth net_bt_admin |
404 | |
405 | service bluetoothd /system/bin/bluetoothd -n |
406 | socket bluetooth stream 660 bluetooth bluetooth |
407 | socket dbus_bluetooth stream 660 bluetooth bluetooth |
220674ac |
408 | # init.rc does not yet support applying capabilities, so run as root and |
409 | # let bluetoothd drop uid to bluetooth with the right linux capabilities |
34a1da07 |
410 | group bluetooth net_bt_admin misc |
411 | disabled |
412 | |
413 | service hfag /system/bin/sdptool add --channel=10 HFAG |
414 | user bluetooth |
415 | group bluetooth net_bt_admin |
416 | disabled |
417 | oneshot |
418 | |
419 | service hsag /system/bin/sdptool add --channel=11 HSAG |
420 | user bluetooth |
421 | group bluetooth net_bt_admin |
422 | disabled |
423 | oneshot |
424 | |
425 | service opush /system/bin/sdptool add --channel=12 OPUSH |
426 | user bluetooth |
427 | group bluetooth net_bt_admin |
428 | disabled |
429 | oneshot |
430 | |
431 | service pbap /system/bin/sdptool add --channel=19 PBAP |
432 | user bluetooth |
433 | group bluetooth net_bt_admin |
434 | disabled |
435 | oneshot |
436 | |
220674ac |
437 | service map /system/bin/sdptool add --channel=16 MAS |
438 | user bluetooth |
439 | group bluetooth net_bt_admin |
440 | disabled |
441 | oneshot |
442 | |
34a1da07 |
443 | service installd /system/bin/installd |
444 | socket installd stream 600 system system |
445 | |
34a1da07 |
446 | service racoon /system/bin/racoon |
447 | socket racoon stream 600 system system |
448 | # racoon will setuid to vpn after getting necessary resources. |
449 | group net_admin |
450 | disabled |
451 | oneshot |
452 | |
453 | service mtpd /system/bin/mtpd |
454 | socket mtpd stream 600 system system |
455 | user vpn |
456 | group vpn net_admin net_raw |
457 | disabled |
458 | oneshot |
459 | |
460 | service keystore /system/bin/keystore /data/misc/keystore |
461 | user keystore |
462 | group keystore |
463 | socket keystore stream 666 |
464 | |
465 | service dumpstate /system/bin/dumpstate -s |
466 | socket dumpstate stream 0660 shell log |
467 | disabled |
468 | oneshot |
469 | |
470 | # Start WiFi |
471 | service wifi /system/bin/rc.wifi start |
472 | oneshot |
473 | |
474 | # rfkill is not supported, use this instead |
475 | #service btpwr /wl1271bt_enable /dev/ttyO1 |
476 | # disabled |
477 | # oneshot |
478 | |
479 | #service hciattach /system/bin/hciattach -n /dev/ttyO1 texas 3000000 |
480 | # user root |
481 | # changing user to root from bluetooth is a potential security issue |
482 | # group bluetooth net_bt_admin misc |
483 | # disabled |
484 | # oneshot |
485 | |
486 | # wpa_supplicant and dhcp daemon |
487 | service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd -qq |
488 | socket wpa_wlan0 dgram 660 system wifi |
489 | group system wifi inet |
490 | disabled |
491 | oneshot |
492 | |
220674ac |
493 | service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL |
34a1da07 |
494 | disabled |
495 | oneshot |