Guest User

Untitled

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