2 symlink /initlogo.rle.bak /initlogo.rle
11 # setup the global environment
12 export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
13 export LD_LIBRARY_PATH /system/lib
14 export ANDROID_BOOTLOGO 1
15 export ANDROID_CACHE /data/cache
16 export ANDROID_ROOT /system
17 export ANDROID_ASSETS /system/app
18 export ANDROID_DATA /data
19 export DOWNLOAD_CACHE /data/cache/download
20 export EXTERNAL_STORAGE /mnt/sdcard2
21 export ASEC_MOUNTPOINT /mnt/asec
22 export LOOP_MOUNTPOINT /mnt/obb
23 export SD_EXT_DIRECTORY /sd-ext
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
26 # Location of BT firmware files
27 export BT_FW_PATH /vendor/firmware
29 # Backward compatibility
30 symlink /system/etc /etc
31 symlink /sys/kernel/debug /d
34 mkdir /mnt 0775 root system
35 mkdir /mnt/sdcard 0000 system system
36 mkdir /mnt/sdcard2 0000 system system
38 # Create cgroup mount point for cpu accounting
40 mount cgroup none /acct cpuacct
43 # Backwards Compat - XXX: Going away in G*
44 symlink /mnt/sdcard2 /sdcard
47 mkdir /data 0771 system system
48 mkdir /data/cache 0771 system cache
49 symlink /data/cache /cache
50 mkdir /config 0500 root root
52 # Directory for putting things only root should see.
53 mkdir /mnt/secure 0700 root root
55 # Directory for staging bindmounts
56 mkdir /mnt/secure/staging 0700 root root
58 # Directory-target for where the secure container
59 # imagefile directory will be bind-mounted
60 mkdir /mnt/secure/asec 0700 root root
62 # Secure container public mount points.
63 mkdir /mnt/asec 0700 root system
64 mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
66 # Filesystem image public mount points.
67 mkdir /mnt/obb 0700 root system
68 mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000
70 mkdir /sd-ext 0771 system system
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
80 # Create cgroup mount points for process groups
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
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
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
97 write /dev/cpuctl/bg_non_interactive/cpu.shares 52
100 # once everything is setup, no need to modify /
101 mount rootfs rootfs / ro remount
103 # We chown/chmod /data again so because mount is run as root + defaults
104 chown system system /data
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.
111 mkdir /data/dontpanic
112 chown root log /data/dontpanic
113 chmod 0750 /data/dontpanic
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
120 copy /proc/apanic_threads /data/dontpanic/apanic_threads
121 chown root log /data/dontpanic/apanic_threads
122 chmod 0640 /data/dontpanic/apanic_threads
124 write /proc/apanic_console 1
126 # Same reason as /data above
127 chown system cache /data/cache
128 chmod 0771 /data/cache
130 # This may have been created by the recovery system with odd permissions
131 chown system cache /cache/recovery
132 chmod 0770 /cache/recovery
134 #change permissions on vmallocinfo so we can grab it from bugreports
135 chown root log /proc/vmallocinfo
136 chmod 0440 /proc/vmallocinfo
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
144 # change permissions for Overlay
145 chmod 0777 /dev/video1
146 chmod 0777 /dev/video2
147 chmod 0777 /dev/omap-resizer
148 chmod 777 /dev/video7
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
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
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
172 mkdir /data/local 0751 root root
173 mkdir /data/local/tmp 0771 shell shell
174 mkdir /data/local/download 0771 system cache
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
180 mkdir /data/cache/download 0771 system cache
182 mkdir /data/misc/dhcp 0777 dhcp dhcp
183 mkdir /data/misc/udhcpd 0777 system wifi
184 chown dhcp dhcp /data/misc/dhcp
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
191 mkdir /data/cache/dalvik-cache 0771 system system
192 chown system system /data/cache/dalvik-cache
193 chmod 0771 /data/cache/dalvik-cache
195 # create the lost+found directories, so as to enforce our permissions
196 mkdir /data/lost+found 0770
197 mkdir /cache/lost+found 0770
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
205 # allow net_raw to have access to /dev/socket directory
206 chown root net_raw /dev/socket
207 chmod 0775 /dev/socket
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
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
229 # domainname localdomain
231 # set RLIMIT_NICE to allow priorities from 19 to -20
234 # Power Management Patches
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
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
258 setprop ro.HIDDEN_APP_MEM 7168
259 setprop ro.EMPTY_APP_MEM 8192
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
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
270 # Set init its forked children's oom_adj.
271 write /proc/1/oom_adj -16
273 # Tweak background writeout
274 write /proc/sys/vm/dirty_expire_centisecs 200
275 write /proc/sys/vm/dirty_background_ratio 5
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
290 chmod 0660 /sys/power/state
291 chmod 0660 /sys/power/wake_lock
292 chmod 0660 /sys/power/wake_unlock
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
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
311 setprop wifi.interface wlan0
313 # Include extra init file
314 # import /system/etc/init.local.rc
317 exec /system/bin/sysinit
321 ## Daemon processes to be run by init.
323 #service logcat /system/bin/logcat -f /dev/kmsg
326 service ueventd /sbin/ueventd
329 #service console /system/bin/sh
335 #on property:ro.secure=0
338 service pvr /system/bin/rc.pvr start
340 # adbd is controlled by the persist.service.adb.enable system property
341 service adbd /sbin/adbd
344 # adbd on at boot in emulator
345 on property:ro.kernel.qemu=1
348 on property:persist.service.adb.enable=1
351 on property:persist.service.adb.enable=0
354 on property:service.adb.tcp.port=5555
357 on property:service.adb.tcp.port=-1
360 service servicemanager /system/bin/servicemanager
363 onrestart restart zygote
364 onrestart restart media
366 service vold /system/bin/vold
367 socket vold stream 0660 root mount
370 service netd /system/bin/netd
371 socket netd stream 0660 root system
372 socket dnsproxyd stream 0660 root inet
374 service debuggerd /system/bin/debuggerd
376 service ril-daemon /system/bin/rild
377 socket rild stream 660 root radio
378 socket rild-debug stream 660 radio system
380 group radio cache inet misc audio sdcard_rw net_admin net_raw qcom_oncrpc diag
382 service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
383 socket zygote stream 660 root system
384 onrestart write /sys/android_power/request_state wake
385 onrestart write /sys/power/state on
386 onrestart restart media
387 onrestart restart netd
389 service media /system/bin/mediaserver
391 group system audio camera graphics inet net_bt net_bt_admin net_raw sdcard_rw
394 service bootanim /system/bin/bootanimation
400 service dbus /system/bin/dbus-daemon --system --nofork
401 socket dbus stream 660 bluetooth bluetooth
403 group bluetooth net_bt_admin
405 service bluetoothd /system/bin/bluetoothd -n
406 socket bluetooth stream 660 bluetooth bluetooth
407 socket dbus_bluetooth stream 660 bluetooth bluetooth
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
410 group bluetooth net_bt_admin misc
413 service hfag /system/bin/sdptool add --channel=10 HFAG
415 group bluetooth net_bt_admin
419 service hsag /system/bin/sdptool add --channel=11 HSAG
421 group bluetooth net_bt_admin
425 service opush /system/bin/sdptool add --channel=12 OPUSH
427 group bluetooth net_bt_admin
431 service pbap /system/bin/sdptool add --channel=19 PBAP
433 group bluetooth net_bt_admin
437 service map /system/bin/sdptool add --channel=16 MAS
439 group bluetooth net_bt_admin
443 service installd /system/bin/installd
444 socket installd stream 600 system system
446 service racoon /system/bin/racoon
447 socket racoon stream 600 system system
448 # racoon will setuid to vpn after getting necessary resources.
453 service mtpd /system/bin/mtpd
454 socket mtpd stream 600 system system
456 group vpn net_admin net_raw
460 service keystore /system/bin/keystore /data/misc/keystore
463 socket keystore stream 666
465 service dumpstate /system/bin/dumpstate -s
466 socket dumpstate stream 0660 shell log
471 service wifi /system/bin/rc.wifi start
474 # rfkill is not supported, use this instead
475 #service btpwr /wl1271bt_enable /dev/ttyO1
479 #service hciattach /system/bin/hciattach -n /dev/ttyO1 texas 3000000
481 # changing user to root from bluetooth is a potential security issue
482 # group bluetooth net_bt_admin misc
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
493 service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL