Advertisement
dunc001

Ray_Lupus_ICS_init.rc

Jan 23rd, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.15 KB | None | 0 0
  1. on early-init
  2. # Set init and its forked children's oom_adj.
  3. write /proc/1/oom_adj -16
  4.  
  5. start ueventd
  6.  
  7. # create mountpoints
  8. mkdir /mnt 0775 root system
  9.  
  10. on init
  11.  
  12. sysclktz 0
  13.  
  14. loglevel 3
  15.  
  16. # setup the global environment
  17. export PATH /system/xbin:/system/bin:/system/xbin:/system/sbin:/vendor/bin
  18. export LD_LIBRARY_PATH /vendor/lib:/system/lib
  19. export ANDROID_BOOTLOGO 1
  20. export ANDROID_ROOT /system
  21. export ANDROID_ASSETS /system/app
  22. export ANDROID_DATA /data
  23. export ASEC_MOUNTPOINT /mnt/asec
  24. export LOOP_MOUNTPOINT /mnt/obb
  25. export SD_EXT_DIRECTORY /sd-ext
  26. export USB_STORAGE /storage
  27. export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar
  28.  
  29. # Backward compatibility
  30. symlink /system/etc /etc
  31. symlink /sys/kernel/debug /d
  32.  
  33. # Right now vendor lives on the same filesystem as system,
  34. # but someday that may change.
  35. symlink /system/vendor /vendor
  36.  
  37. # Create cgroup mount point for cpu accounting
  38. mkdir /acct
  39. mount cgroup none /acct cpuacct
  40. mkdir /acct/uid
  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. # SD-EXT
  66. mkdir /sd-ext 0771 system system
  67. symlink /sd-ext /mnt/sd-ext
  68.  
  69. # USB Storage
  70. mkdir /storage 0771 system system
  71. symlink /storage /mnt/storage
  72.  
  73. write /proc/sys/kernel/panic_on_oops 1
  74. write /proc/sys/kernel/hung_task_timeout_secs 0
  75. write /proc/cpu/alignment 4
  76. write /proc/sys/kernel/sched_latency_ns 10000000
  77. write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
  78. write /proc/sys/kernel/sched_compat_yield 1
  79. write /proc/sys/kernel/sched_child_runs_first 0
  80. write /proc/sys/kernel/randomize_va_space 2
  81.  
  82. # Create cgroup mount points for process groups
  83. mkdir /dev/cpuctl
  84. mount cgroup none /dev/cpuctl cpu
  85. chown system system /dev/cpuctl
  86. chown system system /dev/cpuctl/tasks
  87. chmod 0777 /dev/cpuctl/tasks
  88. write /dev/cpuctl/cpu.shares 1024
  89.  
  90. mkdir /dev/cpuctl/fg_boost
  91. chown system system /dev/cpuctl/fg_boost/tasks
  92. chmod 0777 /dev/cpuctl/fg_boost/tasks
  93. write /dev/cpuctl/fg_boost/cpu.shares 1024
  94.  
  95. mkdir /dev/cpuctl/bg_non_interactive
  96. chown system system /dev/cpuctl/bg_non_interactive/tasks
  97. chmod 0777 /dev/cpuctl/bg_non_interactive/tasks
  98. # 5.0 %
  99. write /dev/cpuctl/bg_non_interactive/cpu.shares 52
  100.  
  101. # Allow everybody to read the xt_qtaguid resource tracking misc dev.
  102. # This is needed by any process that uses socket tagging.
  103. chmod 0644 /dev/xt_qtaguid
  104.  
  105. on post-fs
  106. # once everything is setup, no need to modify /
  107. mount rootfs rootfs / ro remount
  108.  
  109. # We chown/chmod /cache again so because mount is run as root + defaults
  110. chown system cache /cache
  111. chmod 0770 /cache
  112.  
  113. # This may have been created by the recovery system with odd permissions
  114. mkdir /cache/recovery
  115. chown system cache /cache/recovery
  116. chmod 0770 /cache/recovery
  117.  
  118. #change permissions on vmallocinfo so we can grab it from bugreports
  119. chown root log /proc/vmallocinfo
  120. chmod 0440 /proc/vmallocinfo
  121.  
  122. #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
  123. chown root system /proc/kmsg
  124. chmod 0440 /proc/kmsg
  125. chown root system /proc/sysrq-trigger
  126. chmod 0220 /proc/sysrq-trigger
  127.  
  128. # create the lost+found directories, so as to enforce our permissions
  129. mkdir /cache/lost+found 0770 root root
  130.  
  131. on post-fs-data
  132. # We chown/chmod /data again so because mount is run as root + defaults
  133. chown system system /data
  134. chmod 0771 /data
  135.  
  136. # Create dump dir and collect dumps.
  137. # Do this before we mount cache so eventually we can use cache for
  138. # storing dumps on platforms which do not have a dedicated dump partition.
  139. mkdir /data/dontpanic 0750 root log
  140.  
  141. # Collect apanic data, free resources and re-arm trigger
  142. copy /proc/apanic_console /data/dontpanic/apanic_console
  143. chown root log /data/dontpanic/apanic_console
  144. chmod 0640 /data/dontpanic/apanic_console
  145.  
  146. copy /proc/apanic_threads /data/dontpanic/apanic_threads
  147. chown root log /data/dontpanic/apanic_threads
  148. chmod 0640 /data/dontpanic/apanic_threads
  149.  
  150. write /proc/apanic_console 1
  151.  
  152. # create basic filesystem structure
  153. mkdir /data/misc 01771 system misc
  154. mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
  155. mkdir /data/misc/bluetooth 0770 system system
  156. mkdir /data/misc/keystore 0700 keystore keystore
  157. mkdir /data/misc/keychain 0771 system system
  158. mkdir /data/misc/vpn 0770 system vpn
  159. mkdir /data/misc/systemkeys 0700 system system
  160. # give system access to wpa_supplicant.conf for backup and restore
  161. mkdir /data/misc/wifi 0770 wifi wifi
  162. chmod 0660 /data/misc/wifi/wpa_supplicant.conf
  163. mkdir /data/local 0771 shell shell
  164. mkdir /data/local/tmp 0771 shell shell
  165. mkdir /data/data 0771 system system
  166. mkdir /data/app-private 0771 system system
  167. mkdir /data/app 0771 system system
  168. mkdir /data/property 0700 root root
  169.  
  170. # create dalvik-cache, so as to enforce our permissions
  171. mkdir /data/dalvik-cache 0771 system system
  172.  
  173. # create resource-cache and double-check the perms
  174. mkdir /data/resource-cache 0771 system system
  175. chown system system /data/resource-cache
  176. chmod 0771 /data/resource-cache
  177.  
  178. # create the lost+found directories, so as to enforce our permissions
  179. mkdir /data/lost+found 0770 root root
  180.  
  181. # create directory for DRM plug-ins
  182. mkdir /data/drm 0774 drm drm
  183.  
  184. # If there is no fs-post-data action in the init.<device>.rc file, you
  185. # must uncomment this line, otherwise encrypted filesystems
  186. # won't work.
  187. # Set indication (checked by vold) that we have finished this action
  188. #setprop vold.post_fs_data_done 1
  189.  
  190. chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
  191. chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
  192. chown system system /sys/class/android_usb/android0/f_rndis/ethaddr
  193. chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr
  194.  
  195. on boot
  196. # basic network init
  197. ifup lo
  198. hostname localhost
  199. domainname localdomain
  200.  
  201. # set RLIMIT_NICE to allow priorities from 19 to -20
  202. setrlimit 13 40 40
  203.  
  204. # Memory management. Basic kernel parameters, and allow the high
  205. # level system server to be able to adjust the kernel OOM driver
  206. # paramters to match how it is managing things.
  207. write /proc/sys/vm/overcommit_memory 1
  208. write /proc/sys/vm/min_free_order_shift 4
  209. chown root system /sys/module/lowmemorykiller/parameters/adj
  210. chmod 0664 /sys/module/lowmemorykiller/parameters/adj
  211. chown root system /sys/module/lowmemorykiller/parameters/minfree
  212. chmod 0664 /sys/module/lowmemorykiller/parameters/minfree
  213.  
  214. # Tweak background writeout
  215. write /proc/sys/vm/dirty_expire_centisecs 200
  216. write /proc/sys/vm/dirty_background_ratio 5
  217.  
  218. # Permissions for System Server and daemons.
  219. chown radio system /sys/android_power/state
  220. chown radio system /sys/android_power/request_state
  221. chown radio system /sys/android_power/acquire_full_wake_lock
  222. chown radio system /sys/android_power/acquire_partial_wake_lock
  223. chown radio system /sys/android_power/release_wake_lock
  224. chown radio system /sys/power/state
  225. chown radio system /sys/power/wake_lock
  226. chown radio system /sys/power/wake_unlock
  227. chmod 0660 /sys/power/state
  228. chmod 0660 /sys/power/wake_lock
  229. chmod 0660 /sys/power/wake_unlock
  230. chown system system /sys/class/timed_output/vibrator/enable
  231. chown system system /sys/class/leds/keyboard-backlight/brightness
  232. chown system system /sys/class/leds/lcd-backlight/brightness
  233. chown system system /sys/class/leds/button-backlight/brightness
  234. chown system system /sys/class/leds/jogball-backlight/brightness
  235. chown system system /sys/class/leds/red/brightness
  236. chown system system /sys/class/leds/green/brightness
  237. chown system system /sys/class/leds/blue/brightness
  238. chown system system /sys/class/leds/red/device/grpfreq
  239. chown system system /sys/class/leds/red/device/grppwm
  240. chown system system /sys/class/leds/red/device/blink
  241. chown system system /sys/class/timed_output/vibrator/enable
  242. chown system system /sys/module/sco/parameters/disable_esco
  243. chown system system /sys/kernel/ipv4/tcp_wmem_min
  244. chown system system /sys/kernel/ipv4/tcp_wmem_def
  245. chown system system /sys/kernel/ipv4/tcp_wmem_max
  246. chown system system /sys/kernel/ipv4/tcp_rmem_min
  247. chown system system /sys/kernel/ipv4/tcp_rmem_def
  248. chown system system /sys/kernel/ipv4/tcp_rmem_max
  249. chown root radio /proc/cmdline
  250.  
  251. # Define TCP buffer sizes for various networks
  252. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  253. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  254. setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576
  255. setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
  256. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  257. setprop net.tcp.buffersize.hspa 4094,87380,262144,4096,16384,262144
  258. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  259. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  260.  
  261. # Set this property so surfaceflinger is not started by system_init
  262. setprop system_init.startsurfaceflinger 0
  263.  
  264. #DooMLoRD: launching autoroot
  265. # start auto
  266.  
  267. #DooMLoRD: init.d scripts support
  268. exec sysinitsupport
  269.  
  270. class_start core
  271. class_start main
  272.  
  273. on nonencrypted
  274. class_start late_start
  275.  
  276. on charger
  277. class_start charger
  278.  
  279. on property:vold.decrypt=trigger_reset_main
  280. class_reset main
  281.  
  282. on property:vold.decrypt=trigger_load_persist_props
  283. load_persist_props
  284.  
  285. on property:vold.decrypt=trigger_post_fs_data
  286. trigger post-fs-data
  287.  
  288. on property:vold.decrypt=trigger_restart_min_framework
  289. class_start main
  290.  
  291. on property:vold.decrypt=trigger_restart_framework
  292. class_start main
  293. class_start late_start
  294.  
  295. on property:vold.decrypt=trigger_shutdown_framework
  296. class_reset late_start
  297. class_reset main
  298.  
  299. # Used to disable USB when switching states
  300. on property:sys.usb.config=none
  301. stop adbd
  302. write /sys/class/android_usb/android0/enable 0
  303. write /sys/class/android_usb/android0/bDeviceClass 0
  304. setprop sys.usb.state $sys.usb.config
  305.  
  306. # adb only USB configuration
  307. # This should only be used during device bringup
  308. # and as a fallback if the USB manager fails to set a standard configuration
  309. on property:sys.usb.config=adb
  310. write /sys/class/android_usb/android0/enable 0
  311. write /sys/class/android_usb/android0/idVendor 18d1
  312. write /sys/class/android_usb/android0/idProduct D002
  313. write /sys/class/android_usb/android0/functions $sys.usb.config
  314. write /sys/class/android_usb/android0/enable 1
  315. start adbd
  316. setprop sys.usb.state $sys.usb.config
  317.  
  318. # USB accessory configuration
  319. on property:sys.usb.config=accessory
  320. write /sys/class/android_usb/android0/enable 0
  321. write /sys/class/android_usb/android0/idVendor 18d1
  322. write /sys/class/android_usb/android0/idProduct 2d00
  323. write /sys/class/android_usb/android0/functions $sys.usb.config
  324. write /sys/class/android_usb/android0/enable 1
  325. setprop sys.usb.state $sys.usb.config
  326.  
  327. # USB accessory configuration, with adb
  328. on property:sys.usb.config=accessory,adb
  329. write /sys/class/android_usb/android0/enable 0
  330. write /sys/class/android_usb/android0/idVendor 18d1
  331. write /sys/class/android_usb/android0/idProduct 2d01
  332. write /sys/class/android_usb/android0/functions $sys.usb.config
  333. write /sys/class/android_usb/android0/enable 1
  334. start adbd
  335. setprop sys.usb.state $sys.usb.config
  336.  
  337. # Used to set USB configuration at boot and to switch the configuration
  338. # when changing the default configuration
  339. on property:persist.sys.usb.config=*
  340. setprop sys.usb.config $persist.sys.usb.config
  341.  
  342. ## Daemon processes to be run by init.
  343. ##
  344.  
  345. #DooMLoRD: new init.d scripts support
  346. #service sysinitsupport /sbin/sysinitsupport.sh
  347. # class main
  348. # disabled
  349. # oneshot
  350.  
  351. #service auto /sbin/auto.sh
  352. # class main
  353. # disabled
  354. # oneshot
  355.  
  356. service ueventd /sbin/ueventd
  357. class core
  358. critical
  359.  
  360. service console /system/bin/sh
  361. class core
  362. console
  363. disabled
  364. user shell
  365. group log
  366.  
  367. on property:ro.debuggable=1
  368. start console
  369.  
  370. # adbd is controlled via property triggers in init.<platform>.usb.rc
  371. service adbd /sbin/adbd
  372. class core
  373. disabled
  374.  
  375. # adbd on at boot in emulator
  376. on property:ro.kernel.qemu=1
  377. start adbd
  378.  
  379. # This property trigger has added to imitiate the previous behavior of "adb root".
  380. # The adb gadget driver used to reset the USB bus when the adbd daemon exited,
  381. # and the host side adb relied on this behavior to force it to reconnect with the
  382. # new adbd instance after init relaunches it. So now we force the USB bus to reset
  383. # here when adbd sets the service.adb.root property to 1. We also restart adbd here
  384. # rather than waiting for init to notice its death and restarting it so the timing
  385. # of USB resetting and adb restarting more closely matches the previous behavior.
  386. on property:service.adb.root=1
  387. write /sys/class/android_usb/android0/enable 0
  388. restart adbd
  389. write /sys/class/android_usb/android0/enable 1
  390.  
  391. service servicemanager /system/bin/servicemanager
  392. class core
  393. user system
  394. group system
  395. critical
  396. onrestart restart zygote
  397. onrestart restart media
  398. onrestart restart surfaceflinger
  399. onrestart restart drm
  400.  
  401. service vold /system/bin/vold
  402. class core
  403. socket vold stream 0660 root mount
  404. ioprio be 2
  405.  
  406. service netd /system/bin/netd
  407. class main
  408. socket netd stream 0660 root system dbus_access
  409. socket dnsproxyd stream 0660 root inet
  410.  
  411. service debuggerd /system/bin/debuggerd
  412. class main
  413.  
  414. service ril-daemon /system/bin/rild
  415. class main
  416. socket rild stream 660 root radio
  417. socket rild-debug stream 660 radio system
  418. user root
  419. group radio cache inet misc audio sdcard_rw log dbus_access
  420.  
  421. service surfaceflinger /system/bin/surfaceflinger
  422. class main
  423. user system
  424. group graphics
  425. onrestart restart zygote
  426.  
  427. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  428. class main
  429. socket zygote stream 666
  430. onrestart write /proc/sysrq-trigger c
  431. onrestart write /sys/android_power/request_state wake
  432. onrestart write /sys/power/state on
  433. # onrestart restart media
  434. onrestart restart netd
  435.  
  436. service drm /system/bin/drmserver
  437. class main
  438. user drm
  439. group system inet drmrpc
  440.  
  441. service bootanim /system/bin/bootanimation
  442. class main
  443. user graphics
  444. group graphics
  445. disabled
  446. oneshot
  447.  
  448. service dbus /system/bin/dbus-daemon --system --nofork
  449. class main
  450. socket dbus stream 660 bluetooth bluetooth
  451. socket dbus_ste stream 660 bluetooth dbus_access
  452. user bluetooth
  453. group bluetooth net_bt_admin dbus_access
  454.  
  455. service bluetoothd /system/bin/bluetoothd -n
  456. class main
  457. socket bluetooth stream 660 bluetooth bluetooth
  458. socket dbus_bluetooth stream 660 bluetooth bluetooth
  459. # init.rc does not yet support applying capabilities, so run as root and
  460. # let bluetoothd drop uid to bluetooth with the right linux capabilities
  461. group bluetooth net_bt_admin misc
  462. disabled
  463.  
  464. service installd /system/bin/installd
  465. class main
  466. socket installd stream 600 system system
  467.  
  468. service flash_recovery /system/etc/install-recovery.sh
  469. class main
  470. oneshot
  471.  
  472. service racoon /system/bin/racoon
  473. class main
  474. socket racoon stream 600 system system
  475. # IKE uses UDP port 500. Racoon will setuid to vpn after binding the port.
  476. group vpn net_admin inet
  477. disabled
  478. oneshot
  479.  
  480. service mtpd /system/bin/mtpd
  481. class main
  482. socket mtpd stream 600 system system
  483. user vpn
  484. group vpn net_admin inet net_raw
  485. disabled
  486. oneshot
  487.  
  488. service keystore /system/bin/keystore /data/misc/keystore
  489. class main
  490. user keystore
  491. group keystore
  492. socket keystore stream 666
  493.  
  494. service dumpstate /system/bin/dumpstate -s
  495. class main
  496. socket dumpstate stream 0660 shell log
  497. disabled
  498. oneshot
  499.  
  500. #DooMLoRD: run my mods
  501. service mymods /sbin/execute_mods.sh
  502. class main
  503. oneshot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement