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