Guest User

init.rc-Android-2.1

a guest
Mar 6th, 2012
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.50 KB | None | 0 0
  1.  
  2. on init
  3.  
  4. sysclktz 0
  5.  
  6. loglevel 3
  7.  
  8. # setup the global environment
  9. export PATH /sbin:/system/sbin:/system/bin:/system/xbin:/system/busybox/bin:/system/busybox/sbin:/system/busybox/usr/bin:/system/busybox/usr/sbin
  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 /sdcard
  16. export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
  17.  
  18. # Backward compatibility
  19. symlink /system/etc /etc
  20. symlink /sys/kernel/debug /d
  21.  
  22. # create mountpoints and mount tmpfs on sqlite_stmt_journals
  23. mkdir /sdcard 0000 system system
  24. mkdir /system
  25. mkdir /data 0771 system system
  26. mkdir /cache 0770 system cache
  27. mkdir /config 0500 root root
  28. mkdir /sqlite_stmt_journals 01777 root root
  29. mount tmpfs tmpfs /sqlite_stmt_journals size=4m
  30.  
  31. ## mount rootfs rootfs / ro remount
  32.  
  33. write /proc/sys/kernel/panic_on_oops 1
  34. write /proc/sys/kernel/hung_task_timeout_secs 0
  35. write /proc/cpu/alignment 4
  36. write /proc/sys/kernel/sched_latency_ns 10000000
  37. write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
  38. write /proc/sys/kernel/sched_compat_yield 1
  39. write /proc/sys/kernel/sched_child_runs_first 0
  40.  
  41. # Create cgroup mount points for process groups
  42. mkdir /dev/cpuctl
  43. mount cgroup none /dev/cpuctl cpu
  44. chown system system /dev/cpuctl
  45. chown system system /dev/cpuctl/tasks
  46. chmod 0777 /dev/cpuctl/tasks
  47. write /dev/cpuctl/cpu.shares 1024
  48.  
  49. mkdir /dev/cpuctl/fg_boost
  50. chown system system /dev/cpuctl/fg_boost/tasks
  51. chmod 0777 /dev/cpuctl/fg_boost/tasks
  52. write /dev/cpuctl/fg_boost/cpu.shares 1024
  53.  
  54. mkdir /dev/cpuctl/bg_non_interactive
  55. chown system system /dev/cpuctl/bg_non_interactive/tasks
  56. chmod 0777 /dev/cpuctl/bg_non_interactive/tasks
  57. # 5.0 %
  58. write /dev/cpuctl/bg_non_interactive/cpu.shares 52
  59.  
  60. # mount mtd partitions
  61. # Mount /system rw first to give the filesystem a chance to save a checkpoint
  62. ## mount yaffs2 mtd@system /system
  63. ## mount yaffs2 mtd@system /system ro remount
  64.  
  65. # We chown/chmod /data again so because mount is run as root + defaults
  66. ## mount yaffs2 mtd@userdata /data nosuid nodev
  67. chown system system /data
  68. chmod 0771 /data
  69.  
  70. # Create dump dir and collect dumps.
  71. # Do this before we mount cache so eventually we can use cache for
  72. # storing dumps on platforms which do not have a dedicated dump partition.
  73.  
  74. mkdir /data/dontpanic
  75. chown root log /data/dontpanic
  76. chmod 0750 /data/dontpanic
  77.  
  78. # Collect apanic data, free resources and re-arm trigger
  79. copy /proc/apanic_console /data/dontpanic/apanic_console
  80. chown root log /data/dontpanic/apanic_console
  81. chmod 0640 /data/dontpanic/apanic_console
  82.  
  83. copy /proc/apanic_threads /data/dontpanic/apanic_threads
  84. chown root log /data/dontpanic/apanic_threads
  85. chmod 0640 /data/dontpanic/apanic_threads
  86.  
  87. write /proc/apanic_console 1
  88.  
  89. # Collect ramconsole data
  90. copy /proc/last_kmsg /data/dontpanic/last_kmsg
  91. chown root log /data/dontpanic/last_kmsg
  92. chmod 0640 /data/dontpanic/last_kmsg
  93.  
  94. # Same reason as /data above
  95. ## mount yaffs2 mtd@cache /cache nosuid nodev
  96. chown system cache /cache
  97. chmod 0770 /cache
  98.  
  99. # This may have been created by the recovery system with odd permissions
  100. chown system system /cache/recovery
  101. chmod 0770 /cache/recovery
  102.  
  103. #change permissions on vmallocinfo so we can grab it from bugreports
  104. chown root log /proc/vmallocinfo
  105. chmod 0440 /proc/vmallocinfo
  106.  
  107. # create basic filesystem structure
  108. mkdir /data/misc 01777 system misc
  109. mkdir /data/misc/bluetoothd 0777 bluetooth bluetooth
  110. mkdir /data/misc/keystore 0700 keystore keystore
  111. mkdir /data/misc/vpn 0770 system system
  112. mkdir /data/misc/vpn/profiles 0770 system system
  113. mkdir /data/misc/wifi 0777 wifi wifi
  114. mkdir /data/misc/wifi/sockets 0777 system wifi
  115. chmod 0777 /data/misc/wifi
  116. chmod 0777 /data/misc/wifi/wpa_supplicant.conf
  117. # give system access to wpa_supplicant.conf for backup and restore
  118. chmod 0777 /system/etc/wifi/wpa_supplicant.conf
  119. mkdir /data/misc/dhcp 0770 dhcp dhcp
  120. chown dhcp dhcp /data/misc/dhcp
  121. mkdir /data/local 0771 shell shell
  122. mkdir /data/local/tmp 0771 shell shell
  123. mkdir /data/data 0771 system system
  124. mkdir /data/app-private 0771 system system
  125. mkdir /data/app 0771 system system
  126. mkdir /data/property 0700 root root
  127.  
  128. # create dalvik-cache and double-check the perms
  129. mkdir /data/dalvik-cache 0771 system system
  130. chown system system /data/dalvik-cache
  131. chmod 0771 /data/dalvik-cache
  132.  
  133. # create the lost+found directories, so as to enforce our permissions
  134. mkdir /data/lost+found 0770
  135. mkdir /cache/lost+found 0770
  136.  
  137. # double check the perms, in case lost+found already exists, and set owner
  138. chown root root /data/lost+found
  139. chmod 0770 /data/lost+found
  140. chown root root /cache/lost+found
  141. chmod 0770 /cache/lost+found
  142.  
  143. #===================================================================
  144. #
  145. # debug fs enable for wifi & bluetooth
  146. #
  147. #===================================================================
  148. mount debugfs none /sys/kernel/debug
  149.  
  150. on boot
  151. # basic network init
  152. ifup lo
  153. ifup eth0
  154. ifup eth1
  155. hostname localhost
  156. domainname localdomain
  157.  
  158. # set RLIMIT_NICE to allow priorities from 19 to -20
  159. setrlimit 13 40 40
  160.  
  161. # Define the oom_adj values for the classes of processes that can be
  162. # killed by the kernel. These are used in ActivityManagerService.
  163. setprop ro.FOREGROUND_APP_ADJ 0
  164. setprop ro.VISIBLE_APP_ADJ 1
  165. setprop ro.SECONDARY_SERVER_ADJ 2
  166. setprop ro.BACKUP_APP_ADJ 2
  167. setprop ro.HOME_APP_ADJ 4
  168. setprop ro.HIDDEN_APP_MIN_ADJ 7
  169. setprop ro.CONTENT_PROVIDER_ADJ 14
  170. setprop ro.EMPTY_APP_ADJ 15
  171.  
  172. # Define the memory thresholds at which the above process classes will
  173. # be killed. These numbers are in pages (4k).
  174. setprop ro.FOREGROUND_APP_MEM 1536
  175. setprop ro.VISIBLE_APP_MEM 2048
  176. setprop ro.SECONDARY_SERVER_MEM 4096
  177. setprop ro.BACKUP_APP_MEM 4096
  178. setprop ro.HOME_APP_MEM 4096
  179. setprop ro.HIDDEN_APP_MEM 5120
  180. setprop ro.CONTENT_PROVIDER_MEM 5632
  181. setprop ro.EMPTY_APP_MEM 6144
  182.  
  183. #Wifi
  184. # insmod /system/lib/libwifi/lib80211.ko
  185. # insmod /system/lib/libwifi/lib80211_crypt_ccmp.ko
  186. # insmod /system/lib/libwifi/lib80211_crypt_tkip.ko
  187. # insmod /system/lib/libwifi/lib80211_crypt_wep.ko
  188. # insmod /system/lib/modules/2.6.27/kernel/net/bluetooth/bluetooth.ko
  189. # insmod /system/lib/modules/2.6.27/kernel/drivers/bluetooth/hci_uart.ko
  190. # insmod /system/lib/modules/2.6.27/kernel/net/bluetooth/l2cap.ko
  191. # insmod /system/lib/modules/2.6.27/kernel/net/bluetooth/rfcomm/rfcomm.ko
  192.  
  193. setprop wifi.interface eth1
  194. setprop wlan.interface eth1
  195. setprop wlan.driver.status ok
  196. setprop wlan.modpath /system/lib/libwifi/
  197. setprop wlan.mod1 libertas.ko
  198. setprop wlan.mod2 libertas_sdio.ko
  199. # Write value must be consistent with the above properties.
  200. # Note that the driver only supports 6 slots, so we have HOME_APP at the
  201. # same memory level as services.
  202. write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
  203.  
  204. write /proc/sys/vm/overcommit_memory 1
  205. write /proc/sys/vm/min_free_order_shift 4
  206. write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
  207.  
  208. # Set init its forked children's oom_adj.
  209. write /proc/1/oom_adj -16
  210.  
  211. # Tweak background writeout
  212. write /proc/sys/vm/dirty_expire_centisecs 200
  213. write /proc/sys/vm/dirty_background_ratio 5
  214.  
  215. # Permissions for System Server and daemons.
  216. chown radio system /sys/android_power/state
  217. chown radio system /sys/android_power/request_state
  218. chown radio system /sys/android_power/acquire_full_wake_lock
  219. chown radio system /sys/android_power/acquire_partial_wake_lock
  220. chown radio system /sys/android_power/release_wake_lock
  221. chown radio system /sys/power/state
  222. chown radio system /sys/power/wake_lock
  223. chown radio system /sys/power/wake_unlock
  224. chmod 0660 /sys/power/state
  225. chmod 0660 /sys/power/wake_lock
  226. chmod 0660 /sys/power/wake_unlock
  227. chown system system /sys/class/timed_output/vibrator/enable
  228. chown system system /sys/class/leds/keyboard-backlight/brightness
  229. # chown system system /sys/class/leds/lcd-backlight/brightness
  230. chown system system /sys/class/backlight/pwm-backlight/brightness
  231. chown system system /sys/class/leds/button-backlight/brightness
  232. chown system system /sys/class/leds/jogball-backlight/brightness
  233. chown system system /sys/class/leds/red/brightness
  234. chown system system /sys/class/leds/green/brightness
  235. chown system system /sys/class/leds/blue/brightness
  236. chown system system /sys/class/leds/red/device/grpfreq
  237. chown system system /sys/class/leds/red/device/grppwm
  238. chown system system /sys/class/leds/red/device/blink
  239. chown system system /sys/class/leds/red/brightness
  240. chown system system /sys/class/leds/green/brightness
  241. chown system system /sys/class/leds/blue/brightness
  242. chown system system /sys/class/leds/red/device/grpfreq
  243. chown system system /sys/class/leds/red/device/grppwm
  244. chown system system /sys/class/leds/red/device/blink
  245. chown system system /sys/class/timed_output/vibrator/enable
  246. chown system system /sys/module/sco/parameters/disable_esco
  247. chown system system /sys/kernel/ipv4/tcp_wmem_min
  248. chown system system /sys/kernel/ipv4/tcp_wmem_def
  249. chown system system /sys/kernel/ipv4/tcp_wmem_max
  250. chown system system /sys/kernel/ipv4/tcp_rmem_min
  251. chown system system /sys/kernel/ipv4/tcp_rmem_def
  252. chown system system /sys/kernel/ipv4/tcp_rmem_max
  253. chown root radio /proc/cmdline
  254. #bluetooth power up/down interface
  255. # chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
  256. # chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
  257. # chmod 0660 /sys/class/rfkill/rfkill0/state
  258. # chown bluetooth bluetooth /dev/s3c2410_serial1
  259. chmod 0666 /dev/s3c2410_serial1
  260. chmod 0666 /dev/s3c2410_serial2
  261. chmod 0666 /dev/s3c2410_serial3
  262. chmod 0666 /dev/video0
  263. chmod 0666 /dev/s3c-jpg
  264.  
  265. # Define TCP buffer sizes for various networks
  266. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  267. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  268. setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
  269. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  270. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  271. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  272. setprop net.dns1 202.96.134.133
  273. setprop net.dns2 202.96.128.68
  274.  
  275. class_start default
  276. setprop alsa.mixer.playback.master Front
  277. setprop alsa.mixer.capture.master Capture
  278. setprop alsa.mixer.playback.earpiece Master
  279. setprop alsa.mixer.capture.earpiece Capture
  280. setprop alsa.mixer.playback.headset Master
  281. setprop alsa.mixer.playback.speaker Master
  282.  
  283.  
  284. ## Daemon processes to be run by init.
  285. ##
  286. //service console /system/bin/sh
  287. service console /system/busybox/bin/ash
  288. console
  289.  
  290. # adbd is controlled by the persist.service.adb.enable system property
  291. service adbd /sbin/adbd
  292. disabled
  293.  
  294. # adbd on at boot in emulator
  295. on property:ro.kernel.qemu=1
  296. start adbd
  297.  
  298. on property:persist.service.adb.enable=1
  299. start adbd
  300.  
  301. on property:persist.service.adb.enable=0
  302. stop adbd
  303.  
  304. service servicemanager /system/bin/servicemanager
  305. user system
  306. critical
  307. onrestart restart zygote
  308. onrestart restart media
  309.  
  310. service vold /system/bin/vold
  311. socket vold stream 0660 root mount
  312.  
  313. service nexus /system/bin/nexus
  314. socket nexus stream 0660 root system
  315. disabled
  316.  
  317. #service mountd /system/bin/mountd
  318. # socket mountd stream 0660 root mount
  319.  
  320. service debuggerd /system/bin/debuggerd
  321.  
  322. service ril-daemon /system/bin/rild
  323. socket rild stream 660 root radio
  324. socket rild-debug stream 660 radio system
  325. user root
  326. group radio cache inet misc audio
  327.  
  328. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  329. socket zygote stream 666
  330. onrestart write /sys/android_power/request_state wake
  331. onrestart write /sys/power/state on
  332. onrestart restart media
  333.  
  334. service media /system/bin/mediaserver
  335. user media
  336. group system audio camera graphics inet net_bt net_bt_admin
  337.  
  338. ##service bootsound /system/bin/playmp3
  339. ## user media
  340. ## group audio
  341. ## oneshot
  342.  
  343. service bootanim /system/bin/bootanimation
  344. user graphics
  345. group graphics
  346. disabled
  347. oneshot
  348.  
  349. service dbus /system/bin/dbus-daemon --system --nofork
  350. socket dbus stream 660 bluetooth bluetooth
  351. user bluetooth
  352. group bluetooth net_bt_admin
  353.  
  354. service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant -Dwext -ieth1 -c /system/etc/wifi/wpa_supplicant.conf -dd
  355. group system wifi inet keystore
  356. disabled
  357. oneshot
  358.  
  359. service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -d eth1
  360. disabled
  361. oneshot
  362. group system dhcp
  363.  
  364. on property:init.svc.wpa_supplicant=stopped
  365. stop dhcpcd
  366.  
  367. service bluetoothd /system/bin/logwrapper /system/bin/bluetoothd -d -n
  368. socket bluetooth stream 660 bluetooth bluetooth
  369. socket dbus_bluetooth stream 660 bluetooth bluetooth
  370. # init.rc does not yet support applying capabilities, so run as root and
  371. # let bluetoothd drop uid to bluetooth with the right linux capabilities
  372. group bluetooth net_bt_admin misc
  373. disabled
  374.  
  375. # baudrate change 115200 to 1152000(Bluetooth)
  376. #service changebaudrate /system/bin/logwrapper /system/xbin/bccmd_115200 -t bcsp -d /dev/s3c2410_serial1 psset -r 0x1be 0x126e
  377. # user bluetooth
  378. # group bluetooth net_bt_admin
  379. # disabled
  380. # oneshot
  381.  
  382. #service hciattach /system/bin/logwrapper /system/bin/hciattach -n -s 115200 /dev/s3c2410_serial1 bcsp 115200
  383. #service hciattach /system/bin/logwrapper /system/bin/hciattach -n -s 1152000 /dev/s3c2410_serial1 bcsp 1152000
  384. # user bluetooth
  385. # group bluetooth net_bt_admin misc
  386. # disabled
  387.  
  388. service hfag /system/bin/sdptool add --channel=10 HFAG
  389. user bluetooth
  390. group bluetooth net_bt_admin
  391. disabled
  392. oneshot
  393.  
  394. service hsag /system/bin/sdptool add --channel=11 HSAG
  395. user bluetooth
  396. group bluetooth net_bt_admin
  397. disabled
  398. oneshot
  399.  
  400. service opush /system/bin/sdptool add --channel=12 OPUSH
  401. user bluetooth
  402. group bluetooth net_bt_admin
  403. disabled
  404. oneshot
  405.  
  406. service pbap /system/bin/sdptool add --channel=19 PBAP
  407. user bluetooth
  408. group bluetooth net_bt_admin
  409. disabled
  410. oneshot
  411.  
  412. service installd /system/bin/installd
  413. socket installd stream 600 system system
  414.  
  415. ##service flash_recovery /system/etc/install-recovery.sh
  416. ## oneshot
  417.  
  418. service racoon /system/bin/racoon
  419. socket racoon stream 600 system system
  420. # racoon will setuid to vpn after getting necessary resources.
  421. group net_admin
  422. disabled
  423. oneshot
  424.  
  425. service mtpd /system/bin/mtpd
  426. socket mtpd stream 600 system system
  427. user vpn
  428. group vpn net_admin net_raw
  429. disabled
  430. oneshot
  431.  
  432. service keystore /system/bin/keystore /data/misc/keystore
  433. user keystore
  434. group keystore
  435. socket keystore stream 666
  436.  
  437. service dumpstate /system/bin/dumpstate -s
  438. socket dumpstate stream 0660 shell log
  439. disabled
  440. oneshot
Add Comment
Please, Sign In to add comment