10 # setup the global environment
11 export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
12 export LD_LIBRARY_PATH /vendor/lib:/system/lib
13 export ANDROID_BOOTLOGO 1
14 export ANDROID_ROOT /system
15 export ANDROID_ASSETS /system/app
16 export ANDROID_DATA /data
17 export EXTERNAL_STORAGE /mnt/sdcard
18 export ASEC_MOUNTPOINT /mnt/asec
19 export LOOP_MOUNTPOINT /mnt/obb
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
23 # Backward compatibility
24 ## symlink /system/etc /etc
25 symlink /sys/kernel/debug /d
28 mkdir /mnt 0775 root system
29 mkdir /mnt/sdcard 0000 system system
31 # Create cgroup mount point for cpu accounting
33 mount cgroup none /acct cpuacct
36 # Backwards Compat - XXX: Going away in G*
37 symlink /mnt/sdcard /sdcard
40 ## mkdir /data 0771 system system
41 mkdir /cache 0770 system cache
42 mkdir /config 0500 root root
44 # Directory for putting things only root should see.
45 mkdir /mnt/secure 0700 root root
47 # Directory for staging bindmounts
48 mkdir /mnt/secure/staging 0700 root root
50 # Directory-target for where the secure container
51 # imagefile directory will be bind-mounted
52 mkdir /mnt/secure/asec 0700 root root
54 # Secure container public mount points.
55 mkdir /mnt/asec 0700 root system
56 mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
58 # Filesystem image public mount points.
59 mkdir /mnt/obb 0700 root system
60 mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000
62 write /proc/sys/kernel/panic_on_oops 1
63 write /proc/sys/kernel/hung_task_timeout_secs 0
64 write /proc/cpu/alignment 4
65 write /proc/sys/kernel/sched_latency_ns 10000000
66 write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
67 write /proc/sys/kernel/sched_compat_yield 1
68 write /proc/sys/kernel/sched_child_runs_first 0
70 # Create cgroup mount points for process groups
72 mount cgroup none /dev/cpuctl cpu
73 chown system system /dev/cpuctl
74 chown system system /dev/cpuctl/tasks
75 chmod 0777 /dev/cpuctl/tasks
76 write /dev/cpuctl/cpu.shares 1024
78 mkdir /dev/cpuctl/fg_boost
79 chown system system /dev/cpuctl/fg_boost/tasks
80 chmod 0777 /dev/cpuctl/fg_boost/tasks
81 write /dev/cpuctl/fg_boost/cpu.shares 1024
83 mkdir /dev/cpuctl/bg_non_interactive
84 chown system system /dev/cpuctl/bg_non_interactive/tasks
85 chmod 0777 /dev/cpuctl/bg_non_interactive/tasks
87 write /dev/cpuctl/bg_non_interactive/cpu.shares 52
90 # mount mtd partitions
91 # Mount /system rw first to give the filesystem a chance to save a checkpoint
92 ## mount yaffs2 mtd@system /system
93 ## mount yaffs2 mtd@system /system ro remount
94 ## mount yaffs2 mtd@userdata /data0 nosuid nodev
95 mount yaffs2 mtd@cache /cache nosuid nodev
98 # once everything is setup, no need to modify /
99 ## mount rootfs rootfs / ro remount
101 mount ext3 /dev/block/mmcblk0p1 /data0 nodev
102 symlink /data0/data_ginger/data /data
103 chown system system /data
104 chown system system /data0/data_ginger/data
105 chmod 0771 system system /data0/data_ginger/data
106 symlink /data0/system_ginger/system /system
107 symlink /system/etc /etc
109 # Right now vendor lives on the same filesystem as system,
110 # but someday that may change.
111 symlink /system/vendor /vendor
113 # We chown/chmod /data again so because mount is run as root + defaults
114 chown system system /data
117 # Create dump dir and collect dumps.
118 # Do this before we mount cache so eventually we can use cache for
119 # storing dumps on platforms which do not have a dedicated dump partition.
121 mkdir /data/dontpanic
122 chown root log /data/dontpanic
123 chmod 0750 /data/dontpanic
125 # Collect apanic data, free resources and re-arm trigger
126 copy /proc/apanic_console /data/dontpanic/apanic_console
127 chown root log /data/dontpanic/apanic_console
128 chmod 0640 /data/dontpanic/apanic_console
130 copy /proc/apanic_threads /data/dontpanic/apanic_threads
131 chown root log /data/dontpanic/apanic_threads
132 chmod 0640 /data/dontpanic/apanic_threads
134 write /proc/apanic_console 1
136 # Same reason as /data above
137 chown system cache /cache
140 # This may have been created by the recovery system with odd permissions
141 chown system cache /cache/recovery
142 chmod 0770 /cache/recovery
144 #change permissions on vmallocinfo so we can grab it from bugreports
145 chown root log /proc/vmallocinfo
146 chmod 0440 /proc/vmallocinfo
148 #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
149 chown root system /proc/kmsg
150 chmod 0440 /proc/kmsg
151 chown root system /proc/sysrq-trigger
152 chmod 0220 /proc/sysrq-trigger
154 # create basic filesystem structure
155 mkdir /data/misc 01771 system misc
156 mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
157 mkdir /data/misc/bluetooth 0770 system system
158 mkdir /data/misc/keystore 0700 keystore keystore
159 mkdir /data/misc/vpn 0770 system system
160 mkdir /data/misc/systemkeys 0700 system system
161 mkdir /data/misc/vpn/profiles 0770 system system
162 # give system access to wpa_supplicant.conf for backup and restore
163 mkdir /data/misc/wifi 0770 wifi wifi
164 mkdir /data/misc/wifi/sockets 0770 wifi wifi
165 mkdir /data/misc/dhcp 0770 dhcp dhcp
166 chown dhcp dhcp /data/misc/dhcp
167 chown wifi wifi /data/misc/wifi
168 chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
169 chown wifi wifi /data/misc/wifi/sockets
170 chmod 0666 /system/etc/wifi/wpa_supplicant.conf
171 chmod 0770 /data/misc/wifi
172 chmod 0660 /data/misc/wifi/wpa_supplicant.conf
174 chmod 0660 /data/misc/dhcp/dhcpcd-wlan0.pid
175 chown dhcp shell /system/etc/dhcpcd/dhcpcd-run-hooks
177 mkdir /data/local 0771 shell shell
178 mkdir /data/local/tmp 0771 shell shell
179 mkdir /data/data 0771 system system
180 mkdir /data/app-private 0771 system system
181 mkdir /data/app 0771 system system
182 mkdir /data/property 0700 root root
183 chown system system /data/app
184 chown system system /data/app-private
186 chmod 777 /data/app-private
188 # create dalvik-cache and double-check the perms
189 mkdir /data/dalvik-cache 0771 system system
190 chown system system /data/dalvik-cache
191 chmod 0771 /data/dalvik-cache
193 # create the lost+found directories, so as to enforce our permissions
194 mkdir /data/lost+found 0770
195 mkdir /cache/lost+found 0770
197 # double check the perms, in case lost+found already exists, and set owner
198 chown root root /data/lost+found
199 chmod 0770 /data/lost+found
200 chown root root /cache/lost+found
201 chmod 0770 /cache/lost+found
203 # create data/drm directory
204 mkdir /data/drm 0774 drm drm
205 chown drm drm /data/drm
212 # domainname localdomain
214 # set RLIMIT_NICE to allow priorities from 19 to -20
217 # Define the oom_adj values for the classes of processes that can be
218 # killed by the kernel. These are used in ActivityManagerService.
219 setprop ro.FOREGROUND_APP_ADJ 0
220 setprop ro.VISIBLE_APP_ADJ 1
221 setprop ro.PERCEPTIBLE_APP_ADJ 2
222 setprop ro.HEAVY_WEIGHT_APP_ADJ 3
223 setprop ro.SECONDARY_SERVER_ADJ 4
224 setprop ro.BACKUP_APP_ADJ 5
225 setprop ro.HOME_APP_ADJ 6
226 setprop ro.HIDDEN_APP_MIN_ADJ 7
227 setprop ro.EMPTY_APP_ADJ 15
229 # Define the memory thresholds at which the above process classes will
230 # be killed. These numbers are in pages (4k).
231 setprop ro.FOREGROUND_APP_MEM 2048
232 setprop ro.VISIBLE_APP_MEM 3072
233 setprop ro.PERCEPTIBLE_APP_MEM 4096
234 setprop ro.HEAVY_WEIGHT_APP_MEM 4096
235 setprop ro.SECONDARY_SERVER_MEM 6144
236 setprop ro.BACKUP_APP_MEM 6144
237 setprop ro.HOME_APP_MEM 6144
238 setprop ro.HIDDEN_APP_MEM 7168
239 setprop ro.EMPTY_APP_MEM 8192
241 # Write value must be consistent with the above properties.
242 # Note that the driver only supports 6 slots, so we have combined some of
243 # the classes into the same memory level; the associated processes of higher
244 # classes will still be killed first.
245 write /sys/module/lowmemorykiller/parameters/adj 0,1,2,4,7,15
247 write /proc/sys/vm/overcommit_memory 1
248 write /proc/sys/vm/min_free_order_shift 4
249 write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192
251 # Set init its forked children's oom_adj.
252 write /proc/1/oom_adj -16
254 # Tweak background writeout
255 write /proc/sys/vm/dirty_expire_centisecs 200
256 write /proc/sys/vm/dirty_background_ratio 5
258 # Permissions for System Server and daemons.
259 chown radio system /sys/android_power/state
260 chown radio system /sys/android_power/request_state
261 chown radio system /sys/android_power/acquire_full_wake_lock
262 chown radio system /sys/android_power/acquire_partial_wake_lock
263 chown radio system /sys/android_power/release_wake_lock
264 chown radio system /sys/power/state
265 chown radio system /sys/power/wake_lock
266 chown radio system /sys/power/wake_unlock
267 chmod 0660 /sys/power/state
268 chmod 0660 /sys/power/wake_lock
269 chmod 0660 /sys/power/wake_unlock
270 chown system system /sys/class/timed_output/vibrator/enable
271 chown system system /sys/class/leds/keyboard-backlight/brightness
272 chown system system /sys/class/leds/lcd-backlight/brightness
273 chown system system /sys/class/leds/button-backlight/brightness
274 chown system system /sys/class/leds/jogball-backlight/brightness
275 chown system system /sys/class/leds/red/brightness
276 chown system system /sys/class/leds/green/brightness
277 chown system system /sys/class/leds/blue/brightness
278 chown system system /sys/class/leds/red/device/grpfreq
279 chown system system /sys/class/leds/red/device/grppwm
280 chown system system /sys/class/leds/red/device/blink
281 chown system system /sys/class/leds/red/brightness
282 chown system system /sys/class/leds/green/brightness
283 chown system system /sys/class/leds/blue/brightness
284 chown system system /sys/class/leds/red/device/grpfreq
285 chown system system /sys/class/leds/red/device/grppwm
286 chown system system /sys/class/leds/red/device/blink
287 chown system system /sys/class/timed_output/vibrator/enable
288 chown system system /sys/module/sco/parameters/disable_esco
289 chown system system /sys/kernel/ipv4/tcp_wmem_min
290 chown system system /sys/kernel/ipv4/tcp_wmem_def
291 chown system system /sys/kernel/ipv4/tcp_wmem_max
292 chown system system /sys/kernel/ipv4/tcp_rmem_min
293 chown system system /sys/kernel/ipv4/tcp_rmem_def
294 chown system system /sys/kernel/ipv4/tcp_rmem_max
295 chown root radio /proc/cmdline
297 chown system system /sys/bus/platform/drivers/msm_sdcc/msm_sdcc.1/polling
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
310 ## Daemon processes to be run by init.
312 insmod /system/lib/modules/unifi_sdio.ko
313 setprop wifi.interface wlan0
314 setprop wlan.driver.status ok
318 domainname localdomain
321 service ueventd /sbin/ueventd
324 service console /system/bin/sh
330 on property:ro.secure=0
333 # adbd is controlled by the persist.service.adb.enable system property
334 service adbd /sbin/adbd
337 # adbd on at boot in emulator
338 on property:ro.kernel.qemu=1
341 on property:persist.service.adb.enable=1
344 on property:persist.service.adb.enable=0
347 service servicemanager /system/bin/servicemanager
350 onrestart restart zygote
351 onrestart restart media
353 service vold /system/bin/vold
354 socket vold stream 0660 root mount
357 service netd /system/bin/netd
358 socket netd stream 0660 root system
359 socket dnsproxyd stream 0660 root inet
361 service debuggerd /system/bin/debuggerd
363 service ril-daemon /system/bin/rild
364 socket rild stream 660 root radio
365 socket rild-debug stream 660 radio system
367 group radio cache inet misc audio sdcard_rw
369 service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
370 socket zygote stream 666
371 onrestart write /sys/android_power/request_state wake
372 onrestart write /sys/power/state on
373 onrestart restart media
374 onrestart restart netd
376 service drm /system/bin/drmserver
378 group system root inet
380 service drmio /system/bin/drmioserver
383 service media /system/bin/mediaserver
385 group system audio camera graphics inet net_bt net_bt_admin net_raw
388 service bootanim /system/bin/bootanimation
394 service dbus /system/bin/dbus-daemon --system --nofork
395 socket dbus stream 660 bluetooth bluetooth
397 group bluetooth net_bt_admin
399 service bluetoothd /system/bin/bluetoothd -n
400 socket bluetooth stream 660 bluetooth bluetooth
401 socket dbus_bluetooth stream 660 bluetooth bluetooth
402 # init.rc does not yet support applying capabilities, so run as root and
403 # let bluetoothd drop uid to bluetooth with the right linux capabilities
404 group bluetooth net_bt_admin misc
407 service hfag /system/bin/sdptool add --channel=10 HFAG
409 group bluetooth net_bt_admin
413 service hsag /system/bin/sdptool add --channel=11 HSAG
415 group bluetooth net_bt_admin
419 service opush /system/bin/sdptool add --channel=12 OPUSH
421 group bluetooth net_bt_admin
425 service pbap /system/bin/sdptool add --channel=19 PBAP
427 group bluetooth net_bt_admin
431 service installd /system/bin/installd
432 socket installd stream 600 system system
434 ##service flash_recovery /system/etc/install-recovery.sh
438 service racoon /system/bin/racoon
439 socket racoon stream 600 system system
440 # racoon will setuid to vpn after getting necessary resources.
445 service mtpd /system/bin/mtpd
446 socket mtpd stream 600 system system
448 group vpn net_admin net_raw
452 service keystore /system/bin/keystore /data/misc/keystore
455 socket keystore stream 666
457 service dumpstate /system/bin/dumpstate -s
458 socket dumpstate stream 0660 shell log
462 service shlcdc_process /system/bin/shlcdc_process
463 service shdisp_process /system/bin/shdisp_process
465 service ifcfg_ralink /system/bin/ifconfig wlan0 up
467 service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd
471 # group system wifi inet
472 socket wpa_wlan0 dgram 660 wifi wifi
475 service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -d wlan0
479 on property:init.svc.wpa_supplicant=stopped
482 service synergy_service /system/bin/logwrapper /system/bin/synergy_service -C /dev/ttyHS0 -U 4000000
485 service shsd_process /system/bin/shsd_process
487 ##service dtvserver /system/bin/dtvserver
488 service sdservice /system/bin/sdservice
490 service obexd /system/bin/obexd
491 socket obex_manager stream 660 root mount
493 service akmd2 /system/bin/akmd2
495 service shusb_process /system/bin/shusb_process
496 service medousa /system/bin/medousa