Guest User

Untitled

a guest
Apr 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.45 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 /system rw first to give the filesystem a chance to save a checkpoint
  99. mount ext3 /dev/block/mmcblk0p12 /system
  100. mount ext3 /dev/block/mmcblk0p12 /system ro remount
  101. mount ext3 /dev/block/mmcblk0p16 /data nosuid nodev
  102. mount ext3 /dev/block/mmcblk0p15 /cache nosuid nodev
  103.  
  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. write /sdcard/log.log 3
  308.  
  309. # Run sysinit
  310. exec /system/bin/sysinit
  311.  
  312. class_start default
  313.  
  314. ## Daemon processes to be run by init.
  315. ##
  316. service ueventd /sbin/ueventd
  317. critical
  318.  
  319. write /sdcard/log.log 4
  320.  
  321. service console /system/bin/sh
  322. console
  323. disabled
  324. user shell
  325. group log
  326.  
  327. on property:ro.secure=0
  328. start console
  329.  
  330. # adbd is controlled by the persist.service.adb.enable system property
  331. service adbd /sbin/adbd
  332. disabled
  333.  
  334. # adbd on at boot in emulator
  335. on property:ro.kernel.qemu=1
  336. start adbd
  337.  
  338. on property:persist.service.adb.enable=1
  339. start adbd
  340.  
  341. on property:persist.service.adb.enable=0
  342. stop adbd
  343.  
  344. service servicemanager /system/bin/servicemanager
  345. user system
  346. critical
  347. onrestart restart zygote
  348. onrestart restart media
  349.  
  350. write /sdcard/log.log 5
  351.  
  352. service vold /system/bin/vold
  353. socket vold stream 0660 root mount
  354. ioprio be 2
  355.  
  356. service netd /system/bin/netd
  357. socket netd stream 0660 root system
  358. socket dnsproxyd stream 0660 root inet
  359.  
  360. service debuggerd /system/bin/debuggerd
  361.  
  362. service ril-daemon /system/bin/rild
  363. socket rild stream 660 root radio
  364. socket rild-debug stream 660 radio system
  365. user root
  366. group radio cache inet misc audio sdcard_rw net_admin net_raw qcom_oncrpc diag
  367. write /sdcard/log.log 1
  368.  
  369. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  370. socket zygote stream 666
  371. onrestart write /sys/android_power/request_state wake
  372. onrestart write /sys/power/state on
  373. onrestart restart media
  374. onrestart restart netd
  375. write /sdcard/log.log 2
  376.  
  377. service media /system/bin/mediaserver
  378. user media
  379. group system audio camera graphics inet net_bt net_bt_admin net_raw
  380. ioprio rt 4
  381.  
  382. service bootanim /system/bin/bootanimation
  383. user graphics
  384. group graphics
  385. disabled
  386. oneshot
  387.  
  388. service dbus /system/bin/dbus-daemon --system --nofork
  389. socket dbus stream 660 bluetooth bluetooth
  390. user bluetooth
  391. group bluetooth net_bt_admin
  392.  
  393. service bluetoothd /system/bin/bluetoothd -n
  394. socket bluetooth stream 660 bluetooth bluetooth
  395. socket dbus_bluetooth stream 660 bluetooth bluetooth
  396. # init.rc does not yet support applying capabilities, so run as root and
  397. # let bluetoothd drop uid to bluetooth with the right linux capabilities
  398. group bluetooth net_bt_admin misc
  399. disabled
  400.  
  401. service hfag /system/bin/sdptool add --channel=10 HFAG
  402. user bluetooth
  403. group bluetooth net_bt_admin
  404. disabled
  405. oneshot
  406.  
  407. service hsag /system/bin/sdptool add --channel=11 HSAG
  408. user bluetooth
  409. group bluetooth net_bt_admin
  410. disabled
  411. oneshot
  412.  
  413. service opush /system/bin/sdptool add --channel=12 OPUSH
  414. user bluetooth
  415. group bluetooth net_bt_admin
  416. disabled
  417. oneshot
  418.  
  419. service pbap /system/bin/sdptool add --channel=19 PBAP
  420. user bluetooth
  421. group bluetooth net_bt_admin
  422. disabled
  423. oneshot
  424.  
  425. service installd /system/bin/installd
  426. socket installd stream 600 system system
  427.  
  428. service racoon /system/bin/racoon
  429. socket racoon stream 600 system system
  430. # racoon will setuid to vpn after getting necessary resources.
  431. group net_admin
  432. disabled
  433. oneshot
  434. # NVIDIA daemon service
  435. service nvrm_daemon /system/bin/logwrapper /system/bin/nvrm_daemon
  436. user root
  437. onrestart restart servicemanage
  438. service mtpd /system/bin/mtpd
  439. socket mtpd stream 600 system system
  440. user vpn
  441. group vpn net_admin net_raw
  442. disabled
  443. oneshot
  444.  
  445. service keystore /system/bin/keystore /data/misc/keystore
  446. user keystore
  447. group keystore
  448. socket keystore stream 666
  449.  
  450. service dumpstate /system/bin/dumpstate -s
  451. socket dumpstate stream 0660 shell log
  452. disabled
  453. oneshot
Add Comment
Please, Sign In to add comment