Guest User

Untitled

a guest
Jun 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.80 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/htc.framework.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
  19. export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/com.htc.framework.jar:/system/framework/com.htc.android.pimlib.jar:/system/framework/com.htc.android.easopen.jar:/system/framework/com.scalado.util.ScaladoUtil.jar
  20.  
  21. export TERMINFO /system/etc/terminfo
  22.  
  23. # Backward compatibility
  24. symlink /system/etc /etc
  25. symlink /sys/kernel/debug /d
  26.  
  27. # create mountpoints
  28. mkdir /mnt 0775 root system
  29. mkdir /mnt/sdcard 0000 system system
  30.  
  31. # Create cgroup mount point for cpu accounting
  32. mkdir /acct
  33. mount cgroup none /acct cpuacct
  34. mkdir /acct/uid
  35.  
  36. # Backwards Compat - XXX: Going away in G*
  37. symlink /mnt/sdcard /sdcard
  38.  
  39. mkdir /system
  40. mkdir /data 0771 system system
  41. mkdir /cache 0771 system cache
  42. mkdir /config 0500 root root
  43.  
  44. # Directory for putting things only root should see.
  45. mkdir /mnt/secure 0700 root root
  46.  
  47. # Directory for staging bindmounts
  48. mkdir /mnt/secure/staging 0700 root root
  49.  
  50. # Directory-target for where the secure container
  51. # imagefile directory will be bind-mounted
  52. mkdir /mnt/secure/asec 0700 root root
  53.  
  54. # Secure container public mount points.
  55. mkdir /mnt/asec 0700 root system
  56. mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
  57.  
  58. #mount rootfs rootfs / ro remount
  59.  
  60. write /proc/sys/kernel/panic_on_oops 1
  61. write /proc/sys/kernel/hung_task_timeout_secs 0
  62. write /proc/cpu/alignment 4
  63. write /proc/sys/kernel/sched_latency_ns 10000000
  64. write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
  65. write /proc/sys/kernel/sched_compat_yield 1
  66. write /proc/sys/kernel/sched_child_runs_first 0
  67.  
  68. # Create cgroup mount points for process groups
  69. mkdir /dev/cpuctl
  70. mount cgroup none /dev/cpuctl cpu
  71. chown system system /dev/cpuctl
  72. chown system system /dev/cpuctl/tasks
  73. chmod 0777 /dev/cpuctl/tasks
  74. write /dev/cpuctl/cpu.shares 1024
  75.  
  76. mkdir /dev/cpuctl/fg_boost
  77. chown system system /dev/cpuctl/fg_boost/tasks
  78. chmod 0777 /dev/cpuctl/fg_boost/tasks
  79. write /dev/cpuctl/fg_boost/cpu.shares 1024
  80.  
  81. mkdir /dev/cpuctl/bg_non_interactive
  82. chown system system /dev/cpuctl/bg_non_interactive/tasks
  83. chmod 0777 /dev/cpuctl/bg_non_interactive/tasks
  84. # 5.0 %
  85. write /dev/cpuctl/bg_non_interactive/cpu.shares 52
  86.  
  87. # mount mtd partitions
  88. # Mount /system rw first to give the filesystem a chance to save a checkpoint
  89. #mount yaffs2 mtd@system /system
  90. #mount yaffs2 mtd@system /system ro remount
  91.  
  92. # We chown/chmod /data again so because mount is run as root + defaults
  93. #mount yaffs2 mtd@userdata /data nosuid nodev
  94. chown system system /data
  95. chmod 0771 /data
  96.  
  97. # Mount compressed filesystems
  98. mount squashfs loop@/system/lib/modules/modules.sqf /system/lib/modules ro
  99. mount squashfs loop@/system/xbin/xbin.sqf /system/xbin ro
  100.  
  101. # Create dump dir and collect dumps.
  102. # Do this before we mount cache so eventually we can use cache for
  103. # storing dumps on platforms which do not have a dedicated dump partition.
  104.  
  105. mkdir /data/dontpanic
  106. chown root log /data/dontpanic
  107. chmod 0750 /data/dontpanic
  108.  
  109. # Collect apanic data, free resources and re-arm trigger
  110. copy /proc/apanic_console /data/dontpanic/apanic_console
  111. chown root log /data/dontpanic/apanic_console
  112. chmod 0640 /data/dontpanic/apanic_console
  113.  
  114. copy /proc/apanic_threads /data/dontpanic/apanic_threads
  115. chown root log /data/dontpanic/apanic_threads
  116. chmod 0640 /data/dontpanic/apanic_threads
  117.  
  118. write /proc/apanic_console 1
  119.  
  120. # Same reason as /data above
  121. #mount yaffs2 mtd@cache /cache nosuid nodev
  122. chown system cache /cache
  123. chmod 0771 /cache
  124.  
  125. # This may have been created by the recovery system with odd permissions
  126. chown system cache /cache/recovery
  127. chmod 0770 /cache/recovery
  128.  
  129. #change permissions on vmallocinfo so we can grab it from bugreports
  130. chown root log /proc/vmallocinfo
  131. chmod 0440 /proc/vmallocinfo
  132.  
  133. #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
  134. chown root system /proc/kmsg
  135. chmod 0440 /proc/kmsg
  136. chown root system /proc/sysrq-trigger
  137. chmod 0220 /proc/sysrq-trigger
  138.  
  139. # create basic filesystem structure
  140. mkdir /data/misc 01771 system misc
  141. mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
  142. mkdir /data/misc/bluetooth 0770 system system
  143. mkdir /data/misc/keystore 0700 keystore keystore
  144. mkdir /data/misc/vpn 0770 system system
  145. mkdir /data/misc/systemkeys 0700 system system
  146. mkdir /data/misc/vpn/profiles 0770 system system
  147. # give system access to wpa_supplicant.conf for backup and restore
  148. mkdir /data/misc/wifi 0770 wifi wifi
  149. chmod 0770 /data/misc/wifi
  150. chmod 0660 /data/misc/wifi/wpa_supplicant.conf
  151. mkdir /data/local 0771 shell shell
  152. mkdir /data/local/tmp 0771 shell shell
  153. mkdir /data/data 0771 system system
  154. mkdir /data/app-private 0771 system system
  155. mkdir /data/app 0771 system system
  156. mkdir /data/property 0700 root root
  157.  
  158. # create dalvik-cache and double-check the perms
  159. mkdir /data/dalvik-cache 0771 system system
  160. chown system system /data/dalvik-cache
  161. chmod 0771 /data/dalvik-cache
  162.  
  163. mkdir /cache/dalvik-cache 0771 system system
  164. chown system system /cache/dalvik-cache
  165. chmod 0771 /cache/dalvik-cache
  166.  
  167. # create the lost+found directories, so as to enforce our permissions
  168. mkdir /data/lost+found 0770
  169. mkdir /cache/lost+found 0770
  170.  
  171. # double check the perms, in case lost+found already exists, and set owner
  172. chown root root /data/lost+found
  173. chmod 0770 /data/lost+found
  174. chown root root /cache/lost+found
  175. chmod 0770 /cache/lost+found
  176.  
  177. # allow net_raw to have access to /dev/socket directory
  178. chown root net_raw /dev/socket
  179. chmod 0775 /dev/socket
  180.  
  181. on boot
  182. # basic network init
  183. ifup lo
  184. hostname localhost
  185. domainname localdomain
  186.  
  187. # set RLIMIT_NICE to allow priorities from 19 to -20
  188. setrlimit 13 40 40
  189.  
  190. # Define the oom_adj values for the classes of processes that can be
  191. # killed by the kernel. These are used in ActivityManagerService.
  192. setprop ro.FOREGROUND_APP_ADJ 0
  193. setprop ro.VISIBLE_APP_ADJ 1
  194. setprop ro.SECONDARY_SERVER_ADJ 2
  195. setprop ro.BACKUP_APP_ADJ 2
  196. setprop ro.HOME_APP_ADJ 4
  197. setprop ro.HIDDEN_APP_MIN_ADJ 7
  198. setprop ro.CONTENT_PROVIDER_ADJ 14
  199. setprop ro.EMPTY_APP_ADJ 15
  200.  
  201. # Define the memory thresholds at which the above process classes will
  202. # be killed. These numbers are in pages (4k).
  203. setprop ro.FOREGROUND_APP_MEM 1536
  204. setprop ro.VISIBLE_APP_MEM 2048
  205. setprop ro.SECONDARY_SERVER_MEM 4096
  206. setprop ro.BACKUP_APP_MEM 4096
  207. setprop ro.HOME_APP_MEM 4096
  208. setprop ro.HIDDEN_APP_MEM 5120
  209. setprop ro.CONTENT_PROVIDER_MEM 5632
  210. setprop ro.EMPTY_APP_MEM 6144
  211.  
  212. # Write value must be consistent with the above properties.
  213. # Note that the driver only supports 6 slots, so we have HOME_APP at the
  214. # same memory level as services.
  215. write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
  216.  
  217. write /proc/sys/vm/overcommit_memory 1
  218. write /proc/sys/vm/min_free_order_shift 4
  219. write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
  220.  
  221. # Set init its forked children's oom_adj.
  222. write /proc/1/oom_adj -16
  223.  
  224. # Tweak background writeout
  225. write /proc/sys/vm/dirty_expire_centisecs 200
  226. write /proc/sys/vm/dirty_background_ratio 5
  227.  
  228. # Permissions for System Server and daemons.
  229. chown radio system /sys/android_power/state
  230. chown radio system /sys/android_power/request_state
  231. chown radio system /sys/android_power/acquire_full_wake_lock
  232. chown radio system /sys/android_power/acquire_partial_wake_lock
  233. chown radio system /sys/android_power/release_wake_lock
  234. chown radio system /sys/power/state
  235. chown radio system /sys/power/wake_lock
  236. chown radio system /sys/power/wake_unlock
  237. chown radio system /sys/camera_led_status/led_ril_status
  238. chown system system /sys/camera_led_status/led_wimax_status
  239. chown system system /sys/camera_led_status/led_hotspot_status
  240. chown media system /sys/android_camera/cam_mode
  241. chmod 0660 /sys/power/state
  242. chmod 0660 /sys/power/wake_lock
  243. chmod 0660 /sys/power/wake_unlock
  244. chown system system /sys/class/timed_output/vibrator/enable
  245. chown system system /sys/class/leds/keyboard-backlight/brightness
  246. chown system system /sys/class/leds/lcd-backlight/brightness
  247. chown system system /sys/class/leds/button-backlight/brightness
  248. chown system system /sys/class/leds/jogball-backlight/brightness
  249. chown system system /sys/class/leds/vtkey-backlight/brightness
  250. chown system system /sys/class/leds/caps/brightness
  251. chown system system /sys/class/leds/func/brightness
  252. chown system system /sys/class/leds/red/brightness
  253. chown system system /sys/class/leds/green/brightness
  254. chown system system /sys/class/leds/blue/brightness
  255. chown system system /sys/class/leds/amber/brightness
  256. chown system system /sys/class/leds/red/device/grpfreq
  257. chown system system /sys/class/leds/red/device/grppwm
  258. chown system system /sys/class/leds/red/device/blink
  259. chown system system /sys/class/leds/red/brightness
  260. chown system system /sys/class/leds/green/brightness
  261. chown system system /sys/class/leds/blue/brightness
  262. chown system system /sys/class/leds/red/device/grpfreq
  263. chown system system /sys/class/leds/red/device/grppwm
  264. chown system system /sys/class/leds/red/device/blink
  265. chown system system /sys/class/leds/green/blink
  266. chown system system /sys/class/leds/green/off_timer
  267. chown system system /sys/class/leds/amber/blink
  268. chown system system /sys/class/leds/amber/off_timer
  269. chown system system /sys/class/timed_output/vibrator/enable
  270. chown system system /sys/module/sco/parameters/disable_esco
  271. chown system system /sys/kernel/ipv4/tcp_wmem_min
  272. chown system system /sys/kernel/ipv4/tcp_wmem_def
  273. chown system system /sys/kernel/ipv4/tcp_wmem_max
  274. chown system system /sys/kernel/ipv4/tcp_rmem_min
  275. chown system system /sys/kernel/ipv4/tcp_rmem_def
  276. chown system system /sys/kernel/ipv4/tcp_rmem_max
  277. chown root radio /proc/cmdline
  278.  
  279. # Define TCP buffer sizes for various networks
  280. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  281. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  282. setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
  283. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  284. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  285. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  286.  
  287. # Include extra init file
  288. import /system/etc/init.local.rc
  289.  
  290. # Run sysinit
  291. exec /system/bin/sysinit
  292.  
  293. class_start default
  294.  
  295. ## Daemon processes to be run by init.
  296. ##
  297. #service dumplog /dumplog.sh
  298. # console
  299.  
  300. service console /system/bin/sh
  301. console
  302.  
  303. # adbd is controlled by the persist.service.adb.enable system property
  304. service adbd /sbin/adbd
  305. disabled
  306.  
  307. # adbd on at boot in emulator
  308. on property:ro.kernel.qemu=1
  309. start adbd
  310.  
  311. on property:persist.service.adb.enable=1
  312. start adbd
  313.  
  314. on property:persist.service.adb.enable=0
  315. stop adbd
  316.  
  317. service servicemanager /system/bin/servicemanager
  318. user system
  319. critical
  320. onrestart restart zygote
  321. onrestart restart media
  322.  
  323. service vold /system/bin/vold
  324. socket vold stream 0660 root mount
  325. ioprio be 2
  326.  
  327. service netd /system/bin/netd
  328. socket netd stream 0660 root system
  329.  
  330. service debuggerd /system/bin/debuggerd
  331.  
  332. service ril-daemon /system/bin/rild -l /system/lib/libhtc_ril_wrapper.so -- -d /dev/smd0
  333. socket rild stream 660 root radio
  334. socket rild-debug stream 660 radio system
  335. user root
  336. group radio cache inet misc audio
  337.  
  338. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  339. socket zygote stream 666
  340. onrestart write /sys/android_power/request_state wake
  341. onrestart write /sys/power/state on
  342. onrestart restart media
  343.  
  344. service media /system/bin/mediaserver
  345. user media
  346. group system audio camera graphics inet net_bt net_bt_admin net_raw
  347. ioprio rt 4
  348.  
  349. service bootanim /system/bin/bootanimation
  350. user graphics
  351. group graphics
  352. disabled
  353. oneshot
  354.  
  355. service dbus /system/bin/dbus-daemon --system --nofork
  356. socket dbus stream 660 bluetooth bluetooth
  357. user bluetooth
  358. group bluetooth net_bt_admin
  359.  
  360. service bluetoothd /system/bin/bluetoothd -n
  361. socket bluetooth stream 660 bluetooth bluetooth
  362. socket dbus_bluetooth stream 660 bluetooth bluetooth
  363. group bluetooth net_bt_admin misc
  364. disabled
  365.  
  366. service hfag /system/bin/sdptool add --channel=10 HFAG
  367. user bluetooth
  368. group bluetooth net_bt_admin
  369. disabled
  370. oneshot
  371.  
  372. service hsag /system/bin/sdptool add --channel=11 HSAG
  373. user bluetooth
  374. group bluetooth net_bt_admin
  375. disabled
  376. oneshot
  377.  
  378. service opush /system/bin/sdptool add --channel=12 OPUSH
  379. user bluetooth
  380. group bluetooth net_bt_admin
  381. disabled
  382. oneshot
  383.  
  384. service pbap /system/bin/sdptool add --channel=19 PBAP
  385. user bluetooth
  386. group bluetooth net_bt_admin
  387. disabled
  388. oneshot
  389.  
  390. service installd /system/bin/installd
  391. socket installd stream 600 system system
  392.  
  393. service racoon /system/bin/racoon
  394. socket racoon stream 600 system system
  395. # racoon will setuid to vpn after getting necessary resources.
  396. group net_admin
  397. disabled
  398. oneshot
  399.  
  400. service mtpd /system/bin/mtpd
  401. socket mtpd stream 600 system system
  402. user vpn
  403. group vpn net_admin net_raw
  404. disabled
  405. oneshot
  406.  
  407. service keystore /system/bin/keystore /data/misc/keystore
  408. user keystore
  409. group keystore
  410. socket keystore stream 666
  411.  
  412. service dumpstate /system/bin/dumpstate -s
  413. socket dumpstate stream 0660 shell log
  414. disabled
  415. oneshot
  416.  
  417.  
  418. service akmd /system/bin/akmd
  419. user compass
  420. group compass misc input
  421.  
  422. service wpa_supplicant /system/bin/wpa_supplicant \
  423. -Dwext -ieth0 -c/data/misc/wifi/wpa_supplicant.conf
  424. #user wifi
  425. #group wifi inet
  426. socket wpa_eth0 dgram 660 wifi wifi
  427. disabled
  428. oneshot
  429.  
  430. service dhcpcd /system/bin/dhcpcd -ABKL eth0
  431. disabled
  432. oneshot
  433.  
  434. service btld /system/bin/logwrapper /system/bin/btld -lpm 1 -hb 3000000
  435. user root
  436. group bluetooth net_bt_admin
  437. disabled
  438. oneshot
  439.  
  440. # for USB internet sharing
  441. service udhcpd /system/bin/udhcpd
  442. disabled
  443. oneshot
  444.  
  445. service netsharing_on /system/bin/netsharing net on
  446. disabled
  447. oneshot
  448.  
  449. service netsharing_off /system/bin/netsharing net off
  450. disabled
  451. oneshot
  452.  
  453. service netsharing_pass /system/bin/netsharing net_pass on
  454. disabled
  455. oneshot
  456.  
  457. service modem /system/xbin/wireless_modem
  458. user system
  459. group system
  460. disabled
  461.  
  462. service zchgd /system/bin/zchgd
  463. user root
  464. group root graphics
  465. oneshot
  466.  
  467. service dumpstate /system/bin/dumpstate -s
  468. socket dumpstate stream 0660 shell log
  469. disabled
  470. oneshot
  471.  
  472. on property:dev.bootcomplete=1
  473. start bootcomplete
  474.  
  475. service bootcomplete /system/bin/bootcomplete
  476. user root
  477. group root
  478. disabled
  479. oneshot
  480.  
  481. service shutdown /system/bin/shutdown
  482. user root
  483. group root
  484. disabled
  485. oneshot
  486.  
  487. service ipd /system/bin/ipd
  488. socket ipd stream 666 root inet
  489.  
  490. # Execute files in /etc/init.d before booting
  491. service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
  492. disabled
  493. oneshot
  494.  
  495. service init_cam /init_cam.sh
  496. oneshot
  497.  
  498. on property:service.modem.enable=1
  499. start modem
  500.  
  501. on property:service.modem.enable=0
  502. stop modem
  503.  
  504. service srv_ser2net /system/bin/ser2net -n
  505. disabled
  506.  
  507. on property:service.ser2net.enable=1
  508. start srv_ser2net
  509.  
  510. on property:service.ser2net.enable=0
  511. stop srv_ser2net
  512.  
  513. service dumpstate /system/bin/dumpstate -s
  514. socket dumpstate stream 0660 shell log
  515. disabled
  516. oneshot
Add Comment
Please, Sign In to add comment