goroh_kun

IS11Sの/init.rc

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