Guest User

Untitled

a guest
Jun 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.25 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
  10. export LD_LIBRARY_PATH /system/lib
  11. export ANDROID_BOOTLOGO 1
  12. export ANDROID_CACHE /cache
  13. export ANDROID_ROOT /system
  14. export ANDROID_ASSETS /system/app
  15. export ANDROID_DATA /data
  16. export EXTERNAL_STORAGE /mnt/sdcard
  17. export ASEC_MOUNTPOINT /mnt/asec
  18. export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
  19. export TERMINFO /system/etc/terminfo
  20.  
  21. # Backward compatibility
  22. symlink /system/etc /etc
  23. symlink /sys/kernel/debug /d
  24.  
  25. # create mountpoints
  26. mkdir /mnt 0775 root system
  27. mkdir /mnt/sdcard 0000 system system
  28.  
  29. # Create cgroup mount point for cpu accounting
  30. mkdir /acct
  31. mount cgroup none /acct cpuacct
  32. mkdir /acct/uid
  33.  
  34. # Backwards Compat - XXX: Going away in G*
  35. symlink /mnt/sdcard /sdcard
  36.  
  37. mkdir /system
  38. mkdir /data 0771 system system
  39. mkdir /cache 0771 system cache
  40. mkdir /config 0500 root root
  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. # Mount compressed filesystems
  96. mount squashfs loop@/system/lib/modules/modules.sqf /system/lib/modules ro
  97. mount squashfs loop@/system/xbin/xbin.sqf /system/xbin ro
  98.  
  99. # Create dump dir and collect dumps.
  100. # Do this before we mount cache so eventually we can use cache for
  101. # storing dumps on platforms which do not have a dedicated dump partition.
  102.  
  103. mkdir /data/dontpanic
  104. chown root log /data/dontpanic
  105. chmod 0750 /data/dontpanic
  106.  
  107. # Collect apanic data, free resources and re-arm trigger
  108. copy /proc/apanic_console /data/dontpanic/apanic_console
  109. chown root log /data/dontpanic/apanic_console
  110. chmod 0640 /data/dontpanic/apanic_console
  111.  
  112. copy /proc/apanic_threads /data/dontpanic/apanic_threads
  113. chown root log /data/dontpanic/apanic_threads
  114. chmod 0640 /data/dontpanic/apanic_threads
  115.  
  116. write /proc/apanic_console 1
  117.  
  118. # Same reason as /data above
  119. #mount yaffs2 mtd@cache /cache nosuid nodev
  120. chown system cache /cache
  121. chmod 0771 /cache
  122.  
  123. # This may have been created by the recovery system with odd permissions
  124. chown system cache /cache/recovery
  125. chmod 0770 /cache/recovery
  126.  
  127. #change permissions on vmallocinfo so we can grab it from bugreports
  128. chown root log /proc/vmallocinfo
  129. chmod 0440 /proc/vmallocinfo
  130.  
  131. #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
  132. chown root system /proc/kmsg
  133. chmod 0440 /proc/kmsg
  134. chown root system /proc/sysrq-trigger
  135. chmod 0220 /proc/sysrq-trigger
  136.  
  137. # create basic filesystem structure
  138. mkdir /data/misc 01771 system misc
  139. mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
  140. mkdir /data/misc/bluetooth 0770 system system
  141. mkdir /data/misc/keystore 0700 keystore keystore
  142. mkdir /data/misc/vpn 0770 system system
  143. mkdir /data/misc/systemkeys 0700 system system
  144. mkdir /data/misc/vpn/profiles 0770 system system
  145. # give system access to wpa_supplicant.conf for backup and restore
  146. mkdir /data/misc/wifi 0770 wifi wifi
  147. chmod 0770 /data/misc/wifi
  148. chmod 0660 /data/misc/wifi/wpa_supplicant.conf
  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. mkdir /cache/dalvik-cache 0771 system system
  162. chown system system /cache/dalvik-cache
  163. chmod 0771 /cache/dalvik-cache
  164.  
  165. # create the lost+found directories, so as to enforce our permissions
  166. mkdir /data/lost+found 0770
  167. mkdir /cache/lost+found 0770
  168.  
  169. # double check the perms, in case lost+found already exists, and set owner
  170. chown root root /data/lost+found
  171. chmod 0770 /data/lost+found
  172. chown root root /cache/lost+found
  173. chmod 0770 /cache/lost+found
  174.  
  175. # allow net_raw to have access to /dev/socket directory
  176. chown root net_raw /dev/socket
  177. chmod 0775 /dev/socket
  178.  
  179. on boot
  180. # basic network init
  181. ifup lo
  182. hostname localhost
  183. domainname localdomain
  184.  
  185. # set RLIMIT_NICE to allow priorities from 19 to -20
  186. setrlimit 13 40 40
  187.  
  188. # Define the oom_adj values for the classes of processes that can be
  189. # killed by the kernel. These are used in ActivityManagerService.
  190. setprop ro.FOREGROUND_APP_ADJ 0
  191. setprop ro.VISIBLE_APP_ADJ 1
  192. setprop ro.SECONDARY_SERVER_ADJ 2
  193. setprop ro.BACKUP_APP_ADJ 2
  194. setprop ro.HOME_APP_ADJ 4
  195. setprop ro.HIDDEN_APP_MIN_ADJ 7
  196. setprop ro.CONTENT_PROVIDER_ADJ 14
  197. setprop ro.EMPTY_APP_ADJ 15
  198.  
  199. # Define the memory thresholds at which the above process classes will
  200. # be killed. These numbers are in pages (4k).
  201. setprop ro.FOREGROUND_APP_MEM 1536
  202. setprop ro.VISIBLE_APP_MEM 2048
  203. setprop ro.SECONDARY_SERVER_MEM 4096
  204. setprop ro.BACKUP_APP_MEM 4096
  205. setprop ro.HOME_APP_MEM 4096
  206. setprop ro.HIDDEN_APP_MEM 5120
  207. setprop ro.CONTENT_PROVIDER_MEM 5632
  208. setprop ro.EMPTY_APP_MEM 6144
  209.  
  210. # Write value must be consistent with the above properties.
  211. # Note that the driver only supports 6 slots, so we have HOME_APP at the
  212. # same memory level as services.
  213. write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
  214.  
  215. write /proc/sys/vm/overcommit_memory 1
  216. write /proc/sys/vm/min_free_order_shift 4
  217. write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
  218.  
  219. # Set init its forked children's oom_adj.
  220. write /proc/1/oom_adj -16
  221.  
  222. # Tweak background writeout
  223. write /proc/sys/vm/dirty_expire_centisecs 200
  224. write /proc/sys/vm/dirty_background_ratio 5
  225.  
  226. # Permissions for System Server and daemons.
  227. chown radio system /sys/android_power/state
  228. chown radio system /sys/android_power/request_state
  229. chown radio system /sys/android_power/acquire_full_wake_lock
  230. chown radio system /sys/android_power/acquire_partial_wake_lock
  231. chown radio system /sys/android_power/release_wake_lock
  232. chown radio system /sys/power/state
  233. chown radio system /sys/power/wake_lock
  234. chown radio system /sys/power/wake_unlock
  235. chown radio system /sys/camera_led_status/led_ril_status
  236. chown system system /sys/camera_led_status/led_wimax_status
  237. chown system system /sys/camera_led_status/led_hotspot_status
  238. chown media system /sys/android_camera/cam_mode
  239. chmod 0660 /sys/power/state
  240. chmod 0660 /sys/power/wake_lock
  241. chmod 0660 /sys/power/wake_unlock
  242. chown system system /sys/class/timed_output/vibrator/enable
  243. chown system system /sys/class/leds/keyboard-backlight/brightness
  244. chown system system /sys/class/leds/lcd-backlight/brightness
  245. chown system system /sys/class/leds/button-backlight/brightness
  246. chown system system /sys/class/leds/jogball-backlight/brightness
  247. chown system system /sys/class/leds/vtkey-backlight/brightness
  248. chown system system /sys/class/leds/caps/brightness
  249. chown system system /sys/class/leds/func/brightness
  250. chown system system /sys/class/leds/red/brightness
  251. chown system system /sys/class/leds/green/brightness
  252. chown system system /sys/class/leds/blue/brightness
  253. chown system system /sys/class/leds/amber/brightness
  254. chown system system /sys/class/leds/red/device/grpfreq
  255. chown system system /sys/class/leds/red/device/grppwm
  256. chown system system /sys/class/leds/red/device/blink
  257. chown system system /sys/class/leds/red/brightness
  258. chown system system /sys/class/leds/green/brightness
  259. chown system system /sys/class/leds/blue/brightness
  260. chown system system /sys/class/leds/red/device/grpfreq
  261. chown system system /sys/class/leds/red/device/grppwm
  262. chown system system /sys/class/leds/red/device/blink
  263. chown system system /sys/class/leds/green/blink
  264. chown system system /sys/class/leds/green/off_timer
  265. chown system system /sys/class/leds/amber/blink
  266. chown system system /sys/class/leds/amber/off_timer
  267. chown system system /sys/class/timed_output/vibrator/enable
  268. chown system system /sys/module/sco/parameters/disable_esco
  269. chown system system /sys/kernel/ipv4/tcp_wmem_min
  270. chown system system /sys/kernel/ipv4/tcp_wmem_def
  271. chown system system /sys/kernel/ipv4/tcp_wmem_max
  272. chown system system /sys/kernel/ipv4/tcp_rmem_min
  273. chown system system /sys/kernel/ipv4/tcp_rmem_def
  274. chown system system /sys/kernel/ipv4/tcp_rmem_max
  275. chown root radio /proc/cmdline
  276.  
  277. # Define TCP buffer sizes for various networks
  278. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  279. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  280. setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
  281. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  282. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  283. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  284.  
  285. # Include extra init file
  286. import /system/etc/init.local.rc
  287.  
  288. # Run sysinit
  289. exec /system/bin/sysinit
  290.  
  291. class_start default
  292.  
  293. ## Daemon processes to be run by init.
  294. ##
  295. #service dumplog /dumplog.sh
  296. # console
  297.  
  298. service console /system/bin/sh
  299. console
  300.  
  301. # adbd is controlled by the persist.service.adb.enable system property
  302. service adbd /sbin/adbd
  303. disabled
  304.  
  305. # adbd on at boot in emulator
  306. on property:ro.kernel.qemu=1
  307. start adbd
  308.  
  309. on property:persist.service.adb.enable=1
  310. start adbd
  311.  
  312. on property:persist.service.adb.enable=0
  313. stop adbd
  314.  
  315. service servicemanager /system/bin/servicemanager
  316. user system
  317. critical
  318. onrestart restart zygote
  319. onrestart restart media
  320.  
  321. service vold /system/bin/vold
  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 -l /system/lib/libhtc_ril_wrapper.so -- -d /dev/smd0
  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
  335.  
  336. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  337. socket zygote stream 666
  338. onrestart write /sys/android_power/request_state wake
  339. onrestart write /sys/power/state on
  340. onrestart restart media
  341.  
  342. service media /system/bin/mediaserver
  343. user media
  344. group system audio camera graphics inet net_bt net_bt_admin net_raw
  345. ioprio rt 4
  346.  
  347. service bootanim /system/bin/bootanimation
  348. user graphics
  349. group graphics
  350. disabled
  351. oneshot
  352.  
  353. service dbus /system/bin/dbus-daemon --system --nofork
  354. socket dbus stream 660 bluetooth bluetooth
  355. user bluetooth
  356. group bluetooth net_bt_admin
  357.  
  358. service bluetoothd /system/bin/bluetoothd -n
  359. socket bluetooth stream 660 bluetooth bluetooth
  360. socket dbus_bluetooth stream 660 bluetooth bluetooth
  361. group bluetooth net_bt_admin misc
  362. disabled
  363.  
  364. service hfag /system/bin/sdptool add --channel=10 HFAG
  365. user bluetooth
  366. group bluetooth net_bt_admin
  367. disabled
  368. oneshot
  369.  
  370. service hsag /system/bin/sdptool add --channel=11 HSAG
  371. user bluetooth
  372. group bluetooth net_bt_admin
  373. disabled
  374. oneshot
  375.  
  376. service opush /system/bin/sdptool add --channel=12 OPUSH
  377. user bluetooth
  378. group bluetooth net_bt_admin
  379. disabled
  380. oneshot
  381.  
  382. service pbap /system/bin/sdptool add --channel=19 PBAP
  383. user bluetooth
  384. group bluetooth net_bt_admin
  385. disabled
  386. oneshot
  387.  
  388. service installd /system/bin/installd
  389. socket installd stream 600 system system
  390.  
  391. service racoon /system/bin/racoon
  392. socket racoon stream 600 system system
  393. # racoon will setuid to vpn after getting necessary resources.
  394. group net_admin
  395. disabled
  396. oneshot
  397.  
  398. service mtpd /system/bin/mtpd
  399. socket mtpd stream 600 system system
  400. user vpn
  401. group vpn net_admin net_raw
  402. disabled
  403. oneshot
  404.  
  405. service keystore /system/bin/keystore /data/misc/keystore
  406. user keystore
  407. group keystore
  408. socket keystore stream 666
  409.  
  410. service dumpstate /system/bin/dumpstate -s
  411. socket dumpstate stream 0660 shell log
  412. disabled
  413. oneshot
Add Comment
Please, Sign In to add comment