8 # setup the global environment
9 export PATH /sbin:/system/sbin:/system/bin:/system/xbin
10 export LD_LIBRARY_PATH /system/lib
11 export ANDROID_BOOTLOGO 1
12 export ANDROID_ROOT /system
13 export ANDROID_ASSETS /system/app
14 export ANDROID_DATA /data
15 export EXTERNAL_STORAGE /mnt/sdcard
16 export ASEC_MOUNTPOINT /mnt/asec
17 export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
19 # Backward compatibility
20 symlink system/etc /etc
21 symlink system/lib /lib
22 symlink /sys/kernel/debug /d
25 mkdir /mnt 0775 root system
26 mkdir /mnt/sdcard 0000 system system
28 # Create cgroup mount point for cpu accounting
30 mount cgroup none /acct cpuacct
33 # Backwards Compat - XXX: Going away in G*
34 symlink /mnt/sdcard /sdcard
37 mkdir /data 0771 system system
38 mkdir /cache 0770 system cache
39 mkdir /config 0500 root root
41 # Directory for putting things only root should see.
42 mkdir /mnt/secure 0700 root root
44 # Directory for staging bindmounts
45 mkdir /mnt/secure/staging 0700 root root
47 # Directory-target for where the secure container
48 # imagefile directory will be bind-mounted
49 mkdir /mnt/secure/asec 0700 root root
51 # Secure container public mount points.
52 mkdir /mnt/asec 0700 root system
53 mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
55 mount rootfs rootfs / ro remount
57 write /proc/sys/kernel/panic_on_oops 1
58 write /proc/sys/kernel/hung_task_timeout_secs 0
59 write /proc/cpu/alignment 4
60 write /proc/sys/kernel/sched_latency_ns 10000000
61 write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
62 write /proc/sys/kernel/sched_compat_yield 1
63 write /proc/sys/kernel/sched_child_runs_first 0
65 # Create cgroup mount points for process groups
67 mount cgroup none /dev/cpuctl cpu
68 chown system system /dev/cpuctl
69 chown system system /dev/cpuctl/tasks
70 chmod 0777 /dev/cpuctl/tasks
71 write /dev/cpuctl/cpu.shares 1024
73 mkdir /dev/cpuctl/fg_boost
74 chown system system /dev/cpuctl/fg_boost/tasks
75 chmod 0777 /dev/cpuctl/fg_boost/tasks
76 write /dev/cpuctl/fg_boost/cpu.shares 1024
78 mkdir /dev/cpuctl/bg_non_interactive
79 chown system system /dev/cpuctl/bg_non_interactive/tasks
80 chmod 0777 /dev/cpuctl/bg_non_interactive/tasks
82 write /dev/cpuctl/bg_non_interactive/cpu.shares 52
84 # mount mtd partitions
85 # Mount /system rw first to give the filesystem a chance to save a checkpoint
86 # mount yaffs2 mtd@system /system
87 # mount yaffs2 mtd@system /system ro remount
89 # We chown/chmod /data again so because mount is run as root + defaults
90 # mount yaffs2 mtd@userdata /data nosuid nodev
91 chown system system /data
94 # Create dump dir and collect dumps.
95 # Do this before we mount cache so eventually we can use cache for
96 # storing dumps on platforms which do not have a dedicated dump partition.
99 chown root log /data/dontpanic
100 chmod 0750 /data/dontpanic
102 # Collect apanic data, free resources and re-arm trigger
103 copy /proc/apanic_console /data/dontpanic/apanic_console
104 chown root log /data/dontpanic/apanic_console
105 chmod 0640 /data/dontpanic/apanic_console
107 copy /proc/apanic_threads /data/dontpanic/apanic_threads
108 chown root log /data/dontpanic/apanic_threads
109 chmod 0640 /data/dontpanic/apanic_threads
111 write /proc/apanic_console 1
113 # Same reason as /data above
114 # mount yaffs2 mtd@cache /cache nosuid nodev
115 chown system cache /cache
118 # This may have been created by the recovery system with odd permissions
119 chown system cache /cache/recovery
120 chmod 0770 /cache/recovery
122 #change permissions on vmallocinfo so we can grab it from bugreports
123 chown root log /proc/vmallocinfo
124 chmod 0440 /proc/vmallocinfo
126 #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
127 chown root system /proc/kmsg
128 chmod 0440 /proc/kmsg
129 chown root system /proc/sysrq-trigger
130 chmod 0220 /proc/sysrq-trigger
132 # create basic filesystem structure
133 mkdir /data/misc 01771 system misc
134 mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
135 mkdir /data/misc/bluetooth 0770 system system
136 mkdir /data/misc/keystore 0700 keystore keystore
137 mkdir /data/misc/vpn 0770 system system
138 mkdir /data/misc/systemkeys 0700 system system
139 mkdir /data/misc/vpn/profiles 0770 system system
140 # give system access to wpa_supplicant.conf for backup and restore
141 mkdir /data/misc/wifi 0770 wifi wifi
142 mkdir /data/misc/wifi/sockets 0770 wifi wifi
143 mkdir /data/system 0771 system system
144 mkdir /data/system/wpa_supplicant 0770 wifi wifi
145 chmod 0770 /data/misc/wifi
146 chmod 0660 /data/misc/wifi/wpa_supplicant.conf
147 mkdir /data/local 0771 shell shell
148 mkdir /data/local/tmp 0771 shell shell
149 mkdir /data/data 0771 system system
150 mkdir /data/app-private 0771 system system
151 mkdir /data/app 0771 system system
152 mkdir /data/property 0700 root root
153 mkdir /data/misc/dhcp 0770 dhcp dhcp
154 chown dhcp dhcp /data/misc/dhcp
156 # create dalvik-cache and double-check the perms
157 mkdir /data/dalvik-cache 0771 system system
158 chown system system /data/dalvik-cache
159 chmod 0771 /data/dalvik-cache
161 # create the lost+found directories, so as to enforce our permissions
162 mkdir /data/lost+found 0770
163 mkdir /cache/lost+found 0770
165 # double check the perms, in case lost+found already exists, and set owner
166 chown root root /data/lost+found
167 chmod 0770 /data/lost+found
168 chown root root /cache/lost+found
169 chmod 0770 /cache/lost+found
175 domainname localdomain
177 # set RLIMIT_NICE to allow priorities from 19 to -20
180 # Define the oom_adj values for the classes of processes that can be
181 # killed by the kernel. These are used in ActivityManagerService.
182 setprop ro.FOREGROUND_APP_ADJ 0
183 setprop ro.VISIBLE_APP_ADJ 1
184 setprop ro.SECONDARY_SERVER_ADJ 2
185 setprop ro.BACKUP_APP_ADJ 2
186 setprop ro.HOME_APP_ADJ 4
187 setprop ro.HIDDEN_APP_MIN_ADJ 7
188 setprop ro.CONTENT_PROVIDER_ADJ 14
189 setprop ro.EMPTY_APP_ADJ 15
191 # Define the memory thresholds at which the above process classes will
192 # be killed. These numbers are in pages (4k).
193 setprop ro.FOREGROUND_APP_MEM 1536
194 setprop ro.VISIBLE_APP_MEM 2048
195 setprop ro.SECONDARY_SERVER_MEM 4096
196 setprop ro.BACKUP_APP_MEM 4096
197 setprop ro.HOME_APP_MEM 4096
198 setprop ro.HIDDEN_APP_MEM 8192
199 setprop ro.CONTENT_PROVIDER_MEM 8704
200 setprop ro.EMPTY_APP_MEM 16384
202 # Write value must be consistent with the above properties.
203 write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
205 write /proc/sys/vm/overcommit_memory 1
206 write /proc/sys/vm/min_free_order_shift 4
207 write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,8192,8704,16384
209 # Set init its forked children's oom_adj.
210 write /proc/1/oom_adj -16
212 # Tweak background writeout
213 write /proc/sys/vm/dirty_expire_centisecs 200
214 write /proc/sys/vm/dirty_background_ratio 5
216 # Permissions for System Server and daemons.
217 chown radio system /sys/android_power/state
218 chown radio system /sys/android_power/request_state
219 chown radio system /sys/android_power/acquire_full_wake_lock
220 chown radio system /sys/android_power/acquire_partial_wake_lock
221 chown radio system /sys/android_power/release_wake_lock
222 chown radio system /sys/power/state
223 chown radio system /sys/power/wake_lock
224 chown radio system /sys/power/wake_unlock
225 chmod 0660 /sys/power/state
226 chmod 0660 /sys/power/wake_lock
227 chmod 0660 /sys/power/wake_unlock
228 chown system system /sys/class/timed_output/vibrator/enable
229 chown system system /sys/class/leds/keyboard-backlight/brightness
230 chown system system /sys/class/leds/lcd-backlight/brightness
231 chown system system /sys/class/leds/button-backlight/brightness
232 chown system system /sys/class/leds/red/brightness
233 chown system system /sys/class/leds/green/brightness
234 chown system system /sys/class/leds/blue/brightness
235 chown system system /sys/class/leds/red/device/grpfreq
236 chown system system /sys/class/leds/red/device/grppwm
237 chown system system /sys/class/leds/red/device/blink
238 chown system system /sys/class/leds/red/brightness
239 chown system system /sys/class/leds/green/brightness
240 chown system system /sys/class/leds/blue/brightness
241 chown system system /sys/class/leds/red/device/grpfreq
242 chown system system /sys/class/leds/red/device/grppwm
243 chown system system /sys/class/leds/red/device/blink
244 chown system system /sys/class/timed_output/vibrator/enable
245 chown system system /sys/module/sco/parameters/disable_esco
246 chown system system /sys/kernel/ipv4/tcp_wmem_min
247 chown system system /sys/kernel/ipv4/tcp_wmem_def
248 chown system system /sys/kernel/ipv4/tcp_wmem_max
249 chown system system /sys/kernel/ipv4/tcp_rmem_min
250 chown system system /sys/kernel/ipv4/tcp_rmem_def
251 chown system system /sys/kernel/ipv4/tcp_rmem_max
252 chown root radio /proc/cmdline
254 chown bluetooth bluetooth /sys/class/rfkill/rfkill1/state
255 chmod 0660 /sys/class/rfkill/rfkill1/state
257 # Define TCP buffer sizes for various networks
258 # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
259 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
260 setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
261 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
262 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
263 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
265 setprop ro.radio.use-ppp yes
266 setprop ro.radio.noril no
267 setprop status.battery.state Slow
268 setprop status.battery.level 5
269 setprop status.battery.level_raw 50
270 setprop status.battery.level_scale 9
271 setprop alsa.mixer.playback.master Master
272 setprop alsa.mixer.capture.master Capture
273 setprop alsa.mixer.playback.earpiece Master
274 setprop alsa.mixer.capture.earpiece Capture
275 setprop alsa.mixer.playback.headset Master
276 setprop alsa.mixer.playback.speaker Master
278 # merge from system.prop
279 setprop ro.config.sync yes
280 setprop app.setupwizard.disable 1
281 setprop keyguard.no_require_sim 1
282 setprop ro.alarm.volume.adjustable true
283 setprop ro.simulated.phone false
284 setprop dalvik.vm.heapsize 32M
285 setprop ro.config.nocheckin yes
286 setprop ro.com.google.clientidbase android-google
287 setprop rild.libpath /system/lib/libreference-ril.so
288 setprop rild.libargs "-d /dev/ttyUSB1"
292 ## Daemon processes to be run by init.
294 service console /system/bin/sh
297 # adbd is controlled by the persist.service.adb.enable system property
298 service adbd /sbin/adbd
301 # adbd on at boot in emulator
302 on property:ro.kernel.qemu=1
305 on property:persist.service.adb.enable=1
308 on property:persist.service.adb.enable=0
311 service servicemanager /system/bin/servicemanager
314 onrestart restart zygote
315 onrestart restart media
317 service vold /system/bin/vold
318 socket vold stream 0660 root mount
321 service netd /system/bin/netd
322 socket netd stream 0660 root system
324 #service debuggerd /system/bin/debuggerd
326 service ril-daemon /system/bin/rild
327 socket rild stream 660 root radio
328 socket rild-debug stream 660 radio system
330 group radio cache inet misc audio
332 service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
333 socket zygote stream 666
334 onrestart write /sys/android_power/request_state wake
335 onrestart write /sys/power/state on
336 onrestart restart media
338 service alsainit /system/bin/alsa_ctl init
341 service media /system/bin/mediaserver
343 group system audio camera graphics inet net_bt net_bt_admin net_raw
346 service bootanim /system/bin/bootanimation
352 service wpa_supplicant /system/bin/wpa_supplicant -Dawext -c/data/misc/wifi/wpa_supplicant.conf
353 group system wifi inet
357 service dbus /system/bin/dbus-daemon --system --nofork
358 socket dbus stream 660 bluetooth bluetooth
360 group bluetooth net_bt_admin
362 service bluetoothd /system/bin/bluetoothd -n
363 socket bluetooth stream 660 bluetooth bluetooth
364 socket dbus_bluetooth stream 660 bluetooth bluetooth
365 # init.rc does not yet support applying capabilities, so run as root and
366 # let bluetoothd drop uid to bluetooth with the right linux capabilities
367 group bluetooth net_bt_admin misc
370 service hfag /system/bin/sdptool add --channel=10 HFAG
372 group bluetooth net_bt_admin
376 service hsag /system/bin/sdptool add --channel=11 HSAG
378 group bluetooth net_bt_admin
382 service opush /system/bin/sdptool add --channel=12 OPUSH
384 group bluetooth net_bt_admin
388 service pbap /system/bin/sdptool add --channel=19 PBAP
390 group bluetooth net_bt_admin
394 service installd /system/bin/installd
395 socket installd stream 600 system system
397 service racoon /system/bin/racoon
398 socket racoon stream 600 system system
399 # racoon will setuid to vpn after getting necessary resources.
404 service mtpd /system/bin/mtpd
405 socket mtpd stream 600 system system
407 group vpn net_admin net_raw
411 service keystore /system/bin/keystore /data/misc/keystore
414 socket keystore stream 666
416 service dumpstate /system/bin/dumpstate -s
417 socket dumpstate stream 0660 shell log
421 service dhcpcd /system/bin/dhcpcd -o domain_name_servers -ABKL
425 service ppp /system/bin/pppd call gprs
431 service logcat /system/bin/logcat -v time -f /data/log.txt
435 service faketsd /system/bin/faketsd
439 on property:gsm.sim.state=READY
442 on property:gsm.sim.state=UNKNOWN
445 on property:debug.logcat=1
448 on property:debug.logcat=0