Guest User

init.rc-builded-by-me

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