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