blob: 23daa0b009479f8e564edf86b259ff322fe5a870 [file] [log] [blame]
The Android Open Source Project4f6e8d72008-10-21 07:00:00 -07001
2on init
3
4loglevel 3
5
6# setup the global environment
7 export PATH /sbin:/system/sbin:/system/bin:/system/xbin
8 export LD_LIBRARY_PATH /system/lib
9 export ANDROID_BOOTLOGO 1
10 export ANDROID_ROOT /system
11 export ANDROID_ASSETS /system/app
12 export ANDROID_DATA /data
13 export EXTERNAL_STORAGE /sdcard
14 export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
15
16# Backward compatibility
17 symlink /system/etc /etc
18
19# create mountpoints and mount tmpfs on sqlite_stmt_journals
20 mkdir /sdcard 0000 system system
21 mkdir /system
22 mkdir /data 0771 system system
23 mkdir /cache 0770 system cache
24 mkdir /sqlite_stmt_journals 01777 root root
25 mount tmpfs tmpfs /sqlite_stmt_journals size=4m
26
27 mount rootfs rootfs / ro remount
28
29 write /proc/sys/kernel/panic_on_oops 1
30 write /proc/sys/kernel/hung_task_timeout_secs 0
31 write /proc/cpu/alignment 4
32 write /proc/sys/kernel/sched_latency_ns 10000000
33 write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
34
35# mount mtd partitions
36 # Mount /system rw first to give the filesystem a chance to save a checkpoint
37 mount yaffs2 mtd@system /system
38 mount yaffs2 mtd@system /system ro remount
39
40 # We chown/chmod /data again so because mount is run as root + defaults
41 mount yaffs2 mtd@userdata /data nosuid nodev
42 chown system system /data
43 chmod 0771 /data
44
45 # Same reason as /data above
46 mount yaffs2 mtd@cache /cache nosuid nodev
47 chown system cache /cache
48 chmod 0770 /cache
49
50 # This may have been created by the recovery system with odd permissions
51 chown system system /cache/recovery
52 chmod 0770 /cache/recovery
53
54# create basic filesystem structure
55 mkdir /data/misc 01771 system misc
56 mkdir /data/misc/hcid 0770 bluetooth bluetooth
57 mkdir /data/local 0771 shell shell
58 mkdir /data/local/tmp 0771 shell shell
59 mkdir /data/data 0771 system system
60 mkdir /data/app-private 0771 system system
61 mkdir /data/app 0771 system system
62 mkdir /data/property 0700 root root
63
64 # create dalvik-cache and double-check the perms
65 mkdir /data/dalvik-cache 0771 system system
66 chown system system /data/dalvik-cache
67 chmod 0771 /data/dalvik-cache
68
69 # create the lost+found directories, so as to enforce our permissions
70 mkdir /data/lost+found 0770
71 mkdir /cache/lost+found 0770
72
73 # double check the perms, in case lost+found already exists, and set owner
74 chown root root /data/lost+found
75 chmod 0770 /data/lost+found
76 chown root root /cache/lost+found
77 chmod 0770 /cache/lost+found
78
79on boot
80# basic network init
81 ifup lo
82 hostname localhost
83 domainname localdomain
84
85# set RLIMIT_NICE to allow priorities from 19 to -20
86 setrlimit 13 40 40
87
88# Define the oom_adj values for the classes of processes that can be
89# killed by the kernel. These are used in ActivityManagerService.
90 setprop ro.FOREGROUND_APP_ADJ 0
91 setprop ro.VISIBLE_APP_ADJ 1
92 setprop ro.SECONDARY_SERVER_ADJ 2
93 setprop ro.HIDDEN_APP_MIN_ADJ 7
94 setprop ro.CONTENT_PROVIDER_ADJ 14
95 setprop ro.EMPTY_APP_ADJ 15
96
97# Define the memory thresholds at which the above process classes will
98# be killed. These numbers are in pages (4k).
99 setprop ro.FOREGROUND_APP_MEM 1536
100 setprop ro.VISIBLE_APP_MEM 2048
101 setprop ro.SECONDARY_SERVER_MEM 4096
102 setprop ro.HIDDEN_APP_MEM 5120
103 setprop ro.CONTENT_PROVIDER_MEM 5632
104 setprop ro.EMPTY_APP_MEM 6144
105
106# Write value must be consistent with the above properties.
107 write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
108
109 write /proc/sys/vm/overcommit_memory 1
110 write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
111
112 # Set init its forked children's oom_adj.
113 write /proc/1/oom_adj -16
114
115 # Permissions for System Server and daemons.
116 chown radio system /sys/android_power/state
117 chown radio system /sys/android_power/request_state
118 chown radio system /sys/android_power/acquire_full_wake_lock
119 chown radio system /sys/android_power/acquire_partial_wake_lock
120 chown radio system /sys/android_power/release_wake_lock
121 chown system system /sys/class/timed_output/vibrator/enable
122 chown system system /sys/class/leds/keyboard-backlight/brightness
123 chown system system /sys/class/leds/lcd-backlight/brightness
124 chown system system /sys/class/leds/button-backlight/brightness
125 chown system system /sys/class/leds/red/brightness
126 chown system system /sys/class/leds/green/brightness
127 chown system system /sys/class/leds/blue/brightness
128 chown system system /sys/class/leds/red/device/grpfreq
129 chown system system /sys/class/leds/red/device/grppwm
130 chown system system /sys/class/leds/red/device/blink
131 chown system system /sys/class/leds/red/brightness
132 chown system system /sys/class/leds/green/brightness
133 chown system system /sys/class/leds/blue/brightness
134 chown system system /sys/class/leds/red/device/grpfreq
135 chown system system /sys/class/leds/red/device/grppwm
136 chown system system /sys/class/leds/red/device/blink
137 chown system system /sys/class/timed_output/vibrator/enable
138 chown system system /sys/module/sco/parameters/disable_esco
139 chown system system /sys/kernel/ipv4/tcp_wmem_min
140 chown system system /sys/kernel/ipv4/tcp_wmem_def
141 chown system system /sys/kernel/ipv4/tcp_wmem_max
142 chown system system /sys/kernel/ipv4/tcp_rmem_min
143 chown system system /sys/kernel/ipv4/tcp_rmem_def
144 chown system system /sys/kernel/ipv4/tcp_rmem_max
145 chown root radio /proc/cmdline
146
147# Define TCP buffer sizes for various networks
148# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
149 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
150 setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
151 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
152 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
153 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
154
155 class_start default
156
157## Daemon processes to be run by init.
158##
159service console /system/bin/sh
160 console
161
162# adbd is controlled by the persist.service.adb.enable system property
163service adbd /sbin/adbd
164 disabled
165
166# adbd on at boot in emulator
167on property:ro.kernel.qemu=1
168 start adbd
169
170on property:persist.service.adb.enable=1
171 start adbd
172
173on property:persist.service.adb.enable=0
174 stop adbd
175
176service servicemanager /system/bin/servicemanager
177 user system
178 critical
179 onrestart restart zygote
180 onrestart restart media
181
182service mountd /system/bin/mountd
183 socket mountd stream 0660 root mount
184
185service debuggerd /system/bin/debuggerd
186
187service ril-daemon /system/bin/rild
188 socket rild stream 660 root radio
189 socket rild-debug stream 660 radio system
190 user root
191 group radio cache inet misc
192
193service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
194 socket zygote stream 666
195 onrestart write /sys/android_power/request_state wake
196
197service media /system/bin/mediaserver
198 user media
199 group system audio camera graphics inet net_bt net_bt_admin
200
201service bootsound /system/bin/playmp3
202 user media
203 group audio
204 oneshot
205
206service dbus /system/bin/dbus-daemon --system --nofork
207 socket dbus stream 660 bluetooth bluetooth
208 user bluetooth
209 group bluetooth net_bt_admin
210
211service hcid /system/bin/hcid -s -n -f /etc/hcid.conf
212 socket bluetooth stream 660 bluetooth bluetooth
213 socket dbus_bluetooth stream 660 bluetooth bluetooth
214 # init.rc does not yet support applying capabilities, so run as root and
215 # let hcid drop uid to bluetooth with the right linux capabilities
216 group bluetooth net_bt_admin misc
217 disabled
218
219service hfag /system/bin/sdptool add --channel=10 HFAG
220 user bluetooth
221 group bluetooth net_bt_admin
222 disabled
223 oneshot
224
225service hsag /system/bin/sdptool add --channel=11 HSAG
226 user bluetooth
227 group bluetooth net_bt_admin
228 disabled
229 oneshot
230
231service installd /system/bin/installd
232 socket installd stream 600 system system
233
234service flash_recovery /system/bin/flash_image recovery /system/recovery.img
235 oneshot