Guest User

Untitled

a guest
May 26th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.29 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 /cache/download 0771 system cache
  175.  
  176. # create dalvik-cache and double-check the perms
  177. mkdir /data/dalvik-cache 0771 system system
  178. chown system system /data/dalvik-cache
  179. chmod 0771 /data/dalvik-cache
  180.  
  181. mkdir /cache/dalvik-cache 0771 system system
  182. chown system system /cache/dalvik-cache
  183. chmod 0771 /cache/dalvik-cache
  184.  
  185. # create the lost+found directories, so as to enforce our permissions
  186. mkdir /data/lost+found 0770
  187. mkdir /cache/lost+found 0770
  188.  
  189. # double check the perms, in case lost+found already exists, and set owner
  190. chown root root /data/lost+found
  191. chmod 0770 /data/lost+found
  192. chown root root /cache/lost+found
  193. chmod 0770 /cache/lost+found
  194.  
  195. # allow net_raw to have access to /dev/socket directory
  196. chown root net_raw /dev/socket
  197. chmod 0775 /dev/socket
  198.  
  199. # allow system to modify cpufreq control files
  200. chown root system /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  201. chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  202. chown root system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  203. chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  204. chown root system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  205. chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  206.  
  207. on boot
  208. # basic network init
  209. ifup lo
  210. hostname localhost
  211. domainname localdomain
  212.  
  213. # set RLIMIT_NICE to allow priorities from 19 to -20
  214. setrlimit 13 40 40
  215.  
  216. # Define the oom_adj values for the classes of processes that can be
  217. # killed by the kernel. These are used in ActivityManagerService.
  218. setprop ro.FOREGROUND_APP_ADJ 0
  219. setprop ro.VISIBLE_APP_ADJ 1
  220. setprop ro.PERCEPTIBLE_APP_ADJ 2
  221. setprop ro.HEAVY_WEIGHT_APP_ADJ 3
  222. setprop ro.SECONDARY_SERVER_ADJ 4
  223. setprop ro.BACKUP_APP_ADJ 5
  224. setprop ro.HOME_APP_ADJ 6
  225. setprop ro.HIDDEN_APP_MIN_ADJ 7
  226. setprop ro.EMPTY_APP_ADJ 15
  227.  
  228. # Define the memory thresholds at which the above process classes will
  229. # be killed. These numbers are in pages (4k).
  230. setprop ro.FOREGROUND_APP_MEM 2048
  231. setprop ro.VISIBLE_APP_MEM 3072
  232. setprop ro.PERCEPTIBLE_APP_MEM 4096
  233. setprop ro.HEAVY_WEIGHT_APP_MEM 4096
  234. setprop ro.SECONDARY_SERVER_MEM 6144
  235. setprop ro.BACKUP_APP_MEM 6144
  236. setprop ro.HOME_APP_MEM 6144
  237. setprop ro.HIDDEN_APP_MEM 7168
  238. setprop ro.EMPTY_APP_MEM 8192
  239.  
  240. # Write value must be consistent with the above properties.
  241. # Note that the driver only supports 6 slots, so we have combined some of
  242. # the classes into the same memory level; the associated processes of higher
  243. # classes will still be killed first.
  244. write /sys/module/lowmemorykiller/parameters/adj 0,1,2,4,7,15
  245.  
  246. write /proc/sys/vm/overcommit_memory 1
  247. write /proc/sys/vm/min_free_order_shift 4
  248. write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192
  249.  
  250. # Set init its forked children's oom_adj.
  251. write /proc/1/oom_adj -16
  252.  
  253. # Tweak background writeout
  254. write /proc/sys/vm/dirty_expire_centisecs 200
  255. write /proc/sys/vm/dirty_background_ratio 5
  256.  
  257. # Permissions for System Server and daemons.
  258. chown radio system /sys/android_power/state
  259. chown radio system /sys/android_power/request_state
  260. chown radio system /sys/android_power/acquire_full_wake_lock
  261. chown radio system /sys/android_power/acquire_partial_wake_lock
  262. chown radio system /sys/android_power/release_wake_lock
  263. chown radio system /sys/power/state
  264. chown radio system /sys/power/wake_lock
  265. chown radio system /sys/power/wake_unlock
  266. chmod 0660 /sys/power/state
  267. chmod 0660 /sys/power/wake_lock
  268. chmod 0660 /sys/power/wake_unlock
  269. chown system system /sys/class/timed_output/vibrator/enable
  270. chown system system /sys/class/leds/keyboard-backlight/brightness
  271. chown system system /sys/class/leds/lcd-backlight/brightness
  272. chown system system /sys/class/leds/button-backlight/brightness
  273. chown system system /sys/class/leds/jogball-backlight/brightness
  274. chown system system /sys/class/leds/red/brightness
  275. chown system system /sys/class/leds/green/brightness
  276. chown system system /sys/class/leds/blue/brightness
  277. chown system system /sys/class/leds/red/device/grpfreq
  278. chown system system /sys/class/leds/red/device/grppwm
  279. chown system system /sys/class/leds/red/device/blink
  280. chown system system /sys/class/leds/red/brightness
  281. chown system system /sys/class/leds/green/brightness
  282. chown system system /sys/class/leds/blue/brightness
  283. chown system system /sys/class/leds/red/device/grpfreq
  284. chown system system /sys/class/leds/red/device/grppwm
  285. chown system system /sys/class/leds/red/device/blink
  286. chown system system /sys/class/timed_output/vibrator/enable
  287. chown system system /sys/module/sco/parameters/disable_esco
  288. chown system system /sys/kernel/ipv4/tcp_wmem_min
  289. chown system system /sys/kernel/ipv4/tcp_wmem_def
  290. chown system system /sys/kernel/ipv4/tcp_wmem_max
  291. chown system system /sys/kernel/ipv4/tcp_rmem_min
  292. chown system system /sys/kernel/ipv4/tcp_rmem_def
  293. chown system system /sys/kernel/ipv4/tcp_rmem_max
  294. chown root radio /proc/cmdline
  295.  
  296. # Define TCP buffer sizes for various networks
  297. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  298. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  299. setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
  300. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  301. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  302. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  303.  
  304. # Include extra init file
  305. import /system/etc/init.local.rc
  306.  
  307. # Run sysinit
  308. exec /system/bin/sysinit
  309.  
  310. class_start default
  311.  
  312. ## Daemon processes to be run by init.
  313. ##
  314. service ueventd /sbin/ueventd
  315. critical
  316.  
  317. service console /system/bin/sh
  318. console
  319. disabled
  320. user shell
  321. group log
  322.  
  323. on property:ro.secure=0
  324. start console
  325.  
  326. # adbd is controlled by the persist.service.adb.enable system property
  327. service adbd /sbin/adbd
  328. disabled
  329.  
  330. # adbd on at boot in emulator
  331. on property:ro.kernel.qemu=1
  332. start adbd
  333.  
  334. on property:persist.service.adb.enable=1
  335. start adbd
  336.  
  337. on property:persist.service.adb.enable=0
  338. stop adbd
  339.  
  340. service servicemanager /system/bin/servicemanager
  341. user system
  342. critical
  343. onrestart restart zygote
  344. onrestart restart media
  345.  
  346. service vold /system/bin/vold
  347. socket vold stream 0660 root mount
  348. ioprio be 2
  349.  
  350. service netd /system/bin/netd
  351. socket netd stream 0660 root system
  352. socket dnsproxyd stream 0660 root inet
  353.  
  354. service debuggerd /system/bin/debuggerd
  355.  
  356. service ril-daemon /system/bin/rild
  357. socket rild stream 660 root radio
  358. socket rild-debug stream 660 radio system
  359. user root
  360. group radio cache inet misc audio sdcard_rw net_admin net_raw qcom_oncrpc diag
  361.  
  362. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  363. socket zygote stream 666
  364. onrestart write /sys/android_power/request_state wake
  365. onrestart write /sys/power/state on
  366. onrestart restart media
  367. onrestart restart netd
  368.  
  369. service media /system/bin/mediaserver
  370. user media
  371. group system audio camera graphics inet net_bt net_bt_admin net_raw
  372. ioprio rt 4
  373.  
  374. service bootanim /system/bin/bootanimation
  375. user graphics
  376. group graphics
  377. disabled
  378. oneshot
  379.  
  380. service dbus /system/bin/dbus-daemon --system --nofork
  381. socket dbus stream 660 bluetooth bluetooth
  382. user bluetooth
  383. group bluetooth net_bt_admin
  384.  
  385. service bluetoothd /system/bin/bluetoothd -n
  386. socket bluetooth stream 660 bluetooth bluetooth
  387. socket dbus_bluetooth stream 660 bluetooth bluetooth
  388. # init.rc does not yet support applying capabilities, so run as root and
  389. # let bluetoothd drop uid to bluetooth with the right linux capabilities
  390. group bluetooth net_bt_admin misc
  391. disabled
  392.  
  393. service hfag /system/bin/sdptool add --channel=10 HFAG
  394. user bluetooth
  395. group bluetooth net_bt_admin
  396. disabled
  397. oneshot
  398.  
  399. service hsag /system/bin/sdptool add --channel=11 HSAG
  400. user bluetooth
  401. group bluetooth net_bt_admin
  402. disabled
  403. oneshot
  404.  
  405. service opush /system/bin/sdptool add --channel=12 OPUSH
  406. user bluetooth
  407. group bluetooth net_bt_admin
  408. disabled
  409. oneshot
  410.  
  411. service pbap /system/bin/sdptool add --channel=19 PBAP
  412. user bluetooth
  413. group bluetooth net_bt_admin
  414. disabled
  415. oneshot
  416.  
  417. service map /system/bin/sdptool add --channel=16 MAS
  418. user bluetooth
  419. group bluetooth net_bt_admin
  420. disabled
  421. oneshot
  422.  
  423. service installd /system/bin/installd
  424. socket installd stream 600 system system
  425.  
  426. service racoon /system/bin/racoon
  427. socket racoon stream 600 system system
  428. # racoon will setuid to vpn after getting necessary resources.
  429. group net_admin
  430. disabled
  431. oneshot
  432.  
  433. service mtpd /system/bin/mtpd
  434. socket mtpd stream 600 system system
  435. user vpn
  436. group vpn net_admin net_raw
  437. disabled
  438. oneshot
  439.  
  440. service keystore /system/bin/keystore /data/misc/keystore
  441. user keystore
  442. group keystore
  443. socket keystore stream 666
  444.  
  445. service dumpstate /system/bin/dumpstate -s
  446. socket dumpstate stream 0660 shell log
  447. disabled
  448. oneshot
Add Comment
Please, Sign In to add comment