2012-03-14 23:22:54 +01:00
|
|
|
# Copyright (C) 2012 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# IMPORTANT: Do not create world writable files or directories.
|
|
|
|
# This is a common source of Android security bugs.
|
|
|
|
#
|
|
|
|
|
2013-07-24 03:03:37 +02:00
|
|
|
import /init.environ.rc
|
2012-04-04 20:26:59 +02:00
|
|
|
import /init.usb.rc
|
2012-08-28 19:25:13 +02:00
|
|
|
import /init.${ro.hardware}.rc
|
2017-05-18 21:46:34 +02:00
|
|
|
import /vendor/etc/init/hw/init.${ro.hardware}.rc
|
2015-08-29 04:32:45 +02:00
|
|
|
import /init.usb.configfs.rc
|
2014-03-31 12:08:02 +02:00
|
|
|
import /init.${ro.zygote}.rc
|
2011-12-16 23:23:22 +01:00
|
|
|
|
2010-04-21 21:04:20 +02:00
|
|
|
on early-init
|
2011-11-04 20:45:52 +01:00
|
|
|
# Set init and its forked children's oom_adj.
|
2013-09-17 04:32:03 +02:00
|
|
|
write /proc/1/oom_score_adj -1000
|
2011-11-04 20:45:52 +01:00
|
|
|
|
2015-10-10 02:09:10 +02:00
|
|
|
# Disable sysrq from keyboard
|
|
|
|
write /proc/sys/kernel/sysrq 0
|
|
|
|
|
2013-10-01 15:21:47 +02:00
|
|
|
# Set the security context of /adb_keys if present.
|
|
|
|
restorecon /adb_keys
|
|
|
|
|
2016-03-01 02:23:36 +01:00
|
|
|
# Set the security context of /postinstall if present.
|
|
|
|
restorecon /postinstall
|
|
|
|
|
2017-06-01 01:07:53 +02:00
|
|
|
# Mount cgroup mount point for cpu accounting
|
2018-02-12 20:30:46 +01:00
|
|
|
mount cgroup none /acct nodev noexec nosuid cpuacct
|
2018-07-30 22:06:46 +02:00
|
|
|
chmod 0555 /acct
|
2017-06-01 01:07:53 +02:00
|
|
|
mkdir /acct/uid
|
|
|
|
|
|
|
|
# root memory control cgroup, used by lmkd
|
|
|
|
mkdir /dev/memcg 0700 root system
|
2018-02-12 20:30:46 +01:00
|
|
|
mount cgroup none /dev/memcg nodev noexec nosuid memory
|
2018-04-09 18:50:32 +02:00
|
|
|
# memory.pressure_level used by lmkd
|
|
|
|
chown root system /dev/memcg/memory.pressure_level
|
|
|
|
chmod 0040 /dev/memcg/memory.pressure_level
|
2017-06-01 01:07:53 +02:00
|
|
|
# app mem cgroups, used by activity manager, lmkd and zygote
|
|
|
|
mkdir /dev/memcg/apps/ 0755 system system
|
2017-06-28 08:09:03 +02:00
|
|
|
# cgroup for system_server and surfaceflinger
|
|
|
|
mkdir /dev/memcg/system 0550 system system
|
2017-06-01 01:07:53 +02:00
|
|
|
|
2010-04-21 21:04:20 +02:00
|
|
|
start ueventd
|
2009-03-04 04:32:55 +01:00
|
|
|
|
|
|
|
on init
|
2014-06-19 05:35:40 +02:00
|
|
|
sysclktz 0
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2016-01-23 03:02:29 +01:00
|
|
|
# Mix device-specific information into the entropy pool
|
|
|
|
copy /proc/cmdline /dev/urandom
|
|
|
|
copy /default.prop /dev/urandom
|
|
|
|
|
2017-12-06 17:59:02 +01:00
|
|
|
symlink /system/bin /bin
|
2009-03-04 04:32:55 +01:00
|
|
|
symlink /system/etc /etc
|
2017-12-06 17:59:02 +01:00
|
|
|
|
|
|
|
# Backward compatibility.
|
2009-09-19 00:31:23 +02:00
|
|
|
symlink /sys/kernel/debug /d
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2015-02-14 01:47:02 +01:00
|
|
|
# Link /vendor to /system/vendor for devices without a vendor partition.
|
2014-06-26 23:55:04 +02:00
|
|
|
symlink /system/vendor /vendor
|
|
|
|
|
2015-10-27 00:22:11 +01:00
|
|
|
# Create energy-aware scheduler tuning nodes
|
2016-02-23 18:00:36 +01:00
|
|
|
mkdir /dev/stune
|
2018-02-12 20:30:46 +01:00
|
|
|
mount cgroup none /dev/stune nodev noexec nosuid schedtune
|
2016-02-23 18:00:36 +01:00
|
|
|
mkdir /dev/stune/foreground
|
2016-07-11 22:57:31 +02:00
|
|
|
mkdir /dev/stune/background
|
2016-07-11 20:40:15 +02:00
|
|
|
mkdir /dev/stune/top-app
|
2016-12-19 20:01:55 +01:00
|
|
|
mkdir /dev/stune/rt
|
2016-02-23 18:00:36 +01:00
|
|
|
chown system system /dev/stune
|
|
|
|
chown system system /dev/stune/foreground
|
2016-07-11 22:57:31 +02:00
|
|
|
chown system system /dev/stune/background
|
2016-07-11 20:40:15 +02:00
|
|
|
chown system system /dev/stune/top-app
|
2016-12-19 20:01:55 +01:00
|
|
|
chown system system /dev/stune/rt
|
2016-02-23 18:00:36 +01:00
|
|
|
chown system system /dev/stune/tasks
|
|
|
|
chown system system /dev/stune/foreground/tasks
|
2016-07-11 22:57:31 +02:00
|
|
|
chown system system /dev/stune/background/tasks
|
2016-07-11 20:40:15 +02:00
|
|
|
chown system system /dev/stune/top-app/tasks
|
2016-12-19 20:01:55 +01:00
|
|
|
chown system system /dev/stune/rt/tasks
|
2016-02-23 18:00:36 +01:00
|
|
|
chmod 0664 /dev/stune/tasks
|
|
|
|
chmod 0664 /dev/stune/foreground/tasks
|
2016-07-11 22:57:31 +02:00
|
|
|
chmod 0664 /dev/stune/background/tasks
|
2016-07-11 20:40:15 +02:00
|
|
|
chmod 0664 /dev/stune/top-app/tasks
|
2016-12-19 20:01:55 +01:00
|
|
|
chmod 0664 /dev/stune/rt/tasks
|
2015-10-27 00:22:11 +01:00
|
|
|
|
2015-03-16 18:17:47 +01:00
|
|
|
restorecon_recursive /mnt
|
2012-08-18 01:01:16 +02:00
|
|
|
|
2018-02-14 17:35:01 +01:00
|
|
|
mount configfs none /config nodev noexec nosuid
|
2016-02-19 04:48:31 +01:00
|
|
|
chmod 0775 /config/sdcardfs
|
|
|
|
chown system package_info /config/sdcardfs
|
|
|
|
|
2010-02-20 03:25:22 +01:00
|
|
|
mkdir /mnt/secure 0700 root root
|
2015-03-16 18:17:47 +01:00
|
|
|
mkdir /mnt/secure/asec 0700 root root
|
|
|
|
mkdir /mnt/asec 0755 root system
|
|
|
|
mkdir /mnt/obb 0755 root system
|
|
|
|
mkdir /mnt/media_rw 0750 root media_rw
|
|
|
|
mkdir /mnt/user 0755 root root
|
|
|
|
mkdir /mnt/user/0 0755 root root
|
2015-04-06 23:08:54 +02:00
|
|
|
mkdir /mnt/expand 0771 system system
|
2015-12-11 05:29:04 +01:00
|
|
|
mkdir /mnt/appfuse 0711 root root
|
2015-03-16 18:17:47 +01:00
|
|
|
|
2015-06-23 23:30:37 +02:00
|
|
|
# Storage views to support runtime permissions
|
2015-08-06 20:39:44 +02:00
|
|
|
mkdir /mnt/runtime 0700 root root
|
|
|
|
mkdir /mnt/runtime/default 0755 root root
|
|
|
|
mkdir /mnt/runtime/default/self 0755 root root
|
|
|
|
mkdir /mnt/runtime/read 0755 root root
|
|
|
|
mkdir /mnt/runtime/read/self 0755 root root
|
|
|
|
mkdir /mnt/runtime/write 0755 root root
|
|
|
|
mkdir /mnt/runtime/write/self 0755 root root
|
2010-02-20 03:25:22 +01:00
|
|
|
|
2015-03-16 18:17:47 +01:00
|
|
|
# Symlink to keep legacy apps working in multi-user world
|
|
|
|
symlink /storage/self/primary /sdcard
|
2016-04-13 05:36:01 +02:00
|
|
|
symlink /storage/self/primary /mnt/sdcard
|
2015-08-06 20:39:44 +02:00
|
|
|
symlink /mnt/user/0/primary /mnt/runtime/default/self/primary
|
2010-07-15 21:14:44 +02:00
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
write /proc/sys/kernel/panic_on_oops 1
|
|
|
|
write /proc/sys/kernel/hung_task_timeout_secs 0
|
|
|
|
write /proc/cpu/alignment 4
|
2015-07-21 01:01:48 +02:00
|
|
|
|
|
|
|
# scheduler tunables
|
|
|
|
# Disable auto-scaling of scheduler tunables with hotplug. The tunables
|
|
|
|
# will vary across devices in unpredictable ways if allowed to scale with
|
|
|
|
# cpu cores.
|
|
|
|
write /proc/sys/kernel/sched_tunable_scaling 0
|
2009-03-04 04:32:55 +01:00
|
|
|
write /proc/sys/kernel/sched_latency_ns 10000000
|
|
|
|
write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
|
2009-09-16 22:32:23 +02:00
|
|
|
write /proc/sys/kernel/sched_child_runs_first 0
|
2015-07-21 01:01:48 +02:00
|
|
|
|
2011-10-06 20:47:11 +02:00
|
|
|
write /proc/sys/kernel/randomize_va_space 2
|
2011-12-05 23:48:08 +01:00
|
|
|
write /proc/sys/vm/mmap_min_addr 32768
|
2013-02-22 03:36:43 +01:00
|
|
|
write /proc/sys/net/ipv4/ping_group_range "0 2147483647"
|
2015-09-08 20:24:07 +02:00
|
|
|
write /proc/sys/net/unix/max_dgram_qlen 600
|
2012-04-20 01:18:37 +02:00
|
|
|
write /proc/sys/kernel/sched_rt_runtime_us 950000
|
|
|
|
write /proc/sys/kernel/sched_rt_period_us 1000000
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2016-12-07 19:55:45 +01:00
|
|
|
# Assign reasonable ceiling values for socket rcv/snd buffers.
|
|
|
|
# These should almost always be overridden by the target per the
|
|
|
|
# the corresponding technology maximums.
|
|
|
|
write /proc/sys/net/core/rmem_max 262144
|
|
|
|
write /proc/sys/net/core/wmem_max 262144
|
|
|
|
|
2014-04-10 02:44:56 +02:00
|
|
|
# reflect fwmark from incoming packets onto generated replies
|
|
|
|
write /proc/sys/net/ipv4/fwmark_reflect 1
|
|
|
|
write /proc/sys/net/ipv6/fwmark_reflect 1
|
|
|
|
|
|
|
|
# set fwmark on accepted sockets
|
|
|
|
write /proc/sys/net/ipv4/tcp_fwmark_accept 1
|
|
|
|
|
2014-12-03 18:57:00 +01:00
|
|
|
# disable icmp redirects
|
|
|
|
write /proc/sys/net/ipv4/conf/all/accept_redirects 0
|
|
|
|
write /proc/sys/net/ipv6/conf/all/accept_redirects 0
|
|
|
|
|
2017-08-25 21:55:52 +02:00
|
|
|
# /proc/net/fib_trie leaks interface IP addresses
|
|
|
|
chmod 0400 /proc/net/fib_trie
|
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# Create cgroup mount points for process groups
|
2009-10-06 20:22:55 +02:00
|
|
|
mkdir /dev/cpuctl
|
2018-02-12 20:30:46 +01:00
|
|
|
mount cgroup none /dev/cpuctl nodev noexec nosuid cpu
|
2010-01-17 21:21:42 +01:00
|
|
|
chown system system /dev/cpuctl
|
2009-10-06 20:22:55 +02:00
|
|
|
chown system system /dev/cpuctl/tasks
|
2014-10-04 02:02:53 +02:00
|
|
|
chmod 0666 /dev/cpuctl/tasks
|
2012-04-20 01:18:37 +02:00
|
|
|
write /dev/cpuctl/cpu.rt_period_us 1000000
|
2016-06-17 23:02:16 +02:00
|
|
|
write /dev/cpuctl/cpu.rt_runtime_us 950000
|
2009-10-06 20:22:55 +02:00
|
|
|
|
2015-06-08 23:56:29 +02:00
|
|
|
# sets up initial cpusets for ActivityManager
|
|
|
|
mkdir /dev/cpuset
|
2018-02-12 20:30:46 +01:00
|
|
|
mount cpuset none /dev/cpuset nodev noexec nosuid
|
2015-10-15 21:38:15 +02:00
|
|
|
|
|
|
|
# this ensures that the cpusets are present and usable, but the device's
|
|
|
|
# init.rc must actually set the correct cpus
|
2015-06-08 23:56:29 +02:00
|
|
|
mkdir /dev/cpuset/foreground
|
2017-04-14 03:27:35 +02:00
|
|
|
copy /dev/cpuset/cpus /dev/cpuset/foreground/cpus
|
|
|
|
copy /dev/cpuset/mems /dev/cpuset/foreground/mems
|
2015-06-08 23:56:29 +02:00
|
|
|
mkdir /dev/cpuset/background
|
2017-04-14 03:27:35 +02:00
|
|
|
copy /dev/cpuset/cpus /dev/cpuset/background/cpus
|
|
|
|
copy /dev/cpuset/mems /dev/cpuset/background/mems
|
2015-10-15 21:38:15 +02:00
|
|
|
|
2015-09-18 22:18:49 +02:00
|
|
|
# system-background is for system tasks that should only run on
|
|
|
|
# little cores, not on bigs
|
2015-10-15 21:38:15 +02:00
|
|
|
# to be used only by init, so don't change system-bg permissions
|
2015-09-18 22:18:49 +02:00
|
|
|
mkdir /dev/cpuset/system-background
|
2017-04-14 03:27:35 +02:00
|
|
|
copy /dev/cpuset/cpus /dev/cpuset/system-background/cpus
|
|
|
|
copy /dev/cpuset/mems /dev/cpuset/system-background/mems
|
2015-10-15 21:38:15 +02:00
|
|
|
|
2016-01-12 01:16:35 +01:00
|
|
|
mkdir /dev/cpuset/top-app
|
2017-04-14 03:27:35 +02:00
|
|
|
copy /dev/cpuset/cpus /dev/cpuset/top-app/cpus
|
|
|
|
copy /dev/cpuset/mems /dev/cpuset/top-app/mems
|
2016-01-12 01:16:35 +01:00
|
|
|
|
2015-10-15 21:38:15 +02:00
|
|
|
# change permissions for all cpusets we'll touch at runtime
|
2015-06-08 23:56:29 +02:00
|
|
|
chown system system /dev/cpuset
|
|
|
|
chown system system /dev/cpuset/foreground
|
|
|
|
chown system system /dev/cpuset/background
|
2015-10-27 00:22:11 +01:00
|
|
|
chown system system /dev/cpuset/system-background
|
2016-01-12 01:16:35 +01:00
|
|
|
chown system system /dev/cpuset/top-app
|
2015-06-08 23:56:29 +02:00
|
|
|
chown system system /dev/cpuset/tasks
|
|
|
|
chown system system /dev/cpuset/foreground/tasks
|
|
|
|
chown system system /dev/cpuset/background/tasks
|
2015-10-27 00:22:11 +01:00
|
|
|
chown system system /dev/cpuset/system-background/tasks
|
2016-01-12 01:16:35 +01:00
|
|
|
chown system system /dev/cpuset/top-app/tasks
|
2015-11-10 23:31:09 +01:00
|
|
|
|
|
|
|
# set system-background to 0775 so SurfaceFlinger can touch it
|
|
|
|
chmod 0775 /dev/cpuset/system-background
|
|
|
|
|
2015-07-24 00:18:36 +02:00
|
|
|
chmod 0664 /dev/cpuset/foreground/tasks
|
|
|
|
chmod 0664 /dev/cpuset/background/tasks
|
2015-10-27 00:22:11 +01:00
|
|
|
chmod 0664 /dev/cpuset/system-background/tasks
|
2016-01-12 01:16:35 +01:00
|
|
|
chmod 0664 /dev/cpuset/top-app/tasks
|
2015-07-24 00:18:36 +02:00
|
|
|
chmod 0664 /dev/cpuset/tasks
|
2015-06-08 23:56:29 +02:00
|
|
|
|
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# qtaguid will limit access to specific data based on group memberships.
|
|
|
|
# net_bw_acct grants impersonation of socket owners.
|
|
|
|
# net_bw_stats grants access to other apps' detailed tagged-socket stats.
|
2013-01-04 23:34:58 +01:00
|
|
|
chown root net_bw_acct /proc/net/xt_qtaguid/ctrl
|
|
|
|
chown root net_bw_stats /proc/net/xt_qtaguid/stats
|
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# Allow everybody to read the xt_qtaguid resource tracking misc dev.
|
|
|
|
# This is needed by any process that uses socket tagging.
|
2011-09-12 01:12:27 +02:00
|
|
|
chmod 0644 /dev/xt_qtaguid
|
|
|
|
|
2017-10-23 20:57:59 +02:00
|
|
|
mkdir /dev/cg2_bpf
|
2018-02-12 20:30:46 +01:00
|
|
|
mount cgroup2 cg2_bpf /dev/cg2_bpf nodev noexec nosuid
|
2017-10-23 20:57:59 +02:00
|
|
|
chown root root /dev/cg2_bpf
|
|
|
|
chmod 0600 /dev/cg2_bpf
|
2018-02-12 20:30:46 +01:00
|
|
|
mount bpf bpf /sys/fs/bpf nodev noexec nosuid
|
2017-10-23 20:57:59 +02:00
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# Create location for fs_mgr to store abbreviated output from filesystem
|
|
|
|
# checker programs.
|
2013-09-19 02:49:21 +02:00
|
|
|
mkdir /dev/fscklogs 0770 root system
|
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# pstore/ramoops previous console log
|
2018-02-12 20:30:46 +01:00
|
|
|
mount pstore pstore /sys/fs/pstore nodev noexec nosuid
|
2018-06-29 19:32:11 +02:00
|
|
|
chown system log /sys/fs/pstore
|
|
|
|
chmod 0550 /sys/fs/pstore
|
2013-11-22 05:23:54 +01:00
|
|
|
chown system log /sys/fs/pstore/console-ramoops
|
|
|
|
chmod 0440 /sys/fs/pstore/console-ramoops
|
2017-06-27 18:32:32 +02:00
|
|
|
chown system log /sys/fs/pstore/console-ramoops-0
|
|
|
|
chmod 0440 /sys/fs/pstore/console-ramoops-0
|
2014-12-15 16:52:19 +01:00
|
|
|
chown system log /sys/fs/pstore/pmsg-ramoops-0
|
|
|
|
chmod 0440 /sys/fs/pstore/pmsg-ramoops-0
|
2013-11-22 05:23:54 +01:00
|
|
|
|
2015-01-26 19:40:29 +01:00
|
|
|
# enable armv8_deprecated instruction hooks
|
|
|
|
write /proc/sys/abi/swp 1
|
|
|
|
|
2016-02-01 18:59:44 +01:00
|
|
|
# Linux's execveat() syscall may construct paths containing /dev/fd
|
|
|
|
# expecting it to point to /proc/self/fd
|
|
|
|
symlink /proc/self/fd /dev/fd
|
|
|
|
|
2016-06-21 21:04:54 +02:00
|
|
|
export DOWNLOAD_CACHE /data/cache
|
|
|
|
|
2016-08-23 20:58:09 +02:00
|
|
|
# set RLIMIT_NICE to allow priorities from 19 to -20
|
2017-08-28 21:53:56 +02:00
|
|
|
setrlimit nice 40 40
|
|
|
|
|
|
|
|
# Allow up to 32K FDs per process
|
|
|
|
setrlimit nofile 32768 32768
|
2016-08-23 20:58:09 +02:00
|
|
|
|
2017-03-09 02:36:18 +01:00
|
|
|
# This allows the ledtrig-transient properties to be created here so
|
|
|
|
# that they can be chown'd to system:system later on boot
|
|
|
|
write /sys/class/leds/vibrator/trigger "transient"
|
|
|
|
|
2014-06-17 00:06:21 +02:00
|
|
|
# Healthd can trigger a full boot from charger mode by signaling this
|
|
|
|
# property when the power button is held.
|
|
|
|
on property:sys.boot_from_charger_mode=1
|
|
|
|
class_stop charger
|
|
|
|
trigger late-init
|
|
|
|
|
2015-07-01 23:40:56 +02:00
|
|
|
on load_persist_props_action
|
|
|
|
load_persist_props
|
2015-04-20 17:55:02 +02:00
|
|
|
start logd
|
2015-03-11 22:45:05 +01:00
|
|
|
start logd-reinit
|
2014-06-17 00:06:21 +02:00
|
|
|
|
2014-07-12 00:05:23 +02:00
|
|
|
# Indicate to fw loaders that the relevant mounts are up.
|
|
|
|
on firmware_mounts_complete
|
|
|
|
rm /dev/.booting
|
|
|
|
|
2014-06-17 00:06:21 +02:00
|
|
|
# Mount filesystems and start core system services.
|
|
|
|
on late-init
|
|
|
|
trigger early-fs
|
2016-08-23 20:58:09 +02:00
|
|
|
|
|
|
|
# Mount fstab in init.{$device}.rc by mount_all command. Optional parameter
|
|
|
|
# '--early' can be specified to skip entries with 'latemount'.
|
|
|
|
# /system and /vendor must be mounted by the end of the fs stage,
|
|
|
|
# while /data is optional.
|
2014-06-17 00:06:21 +02:00
|
|
|
trigger fs
|
|
|
|
trigger post-fs
|
|
|
|
|
2016-08-23 20:58:09 +02:00
|
|
|
# Mount fstab in init.{$device}.rc by mount_all with '--late' parameter
|
|
|
|
# to only mount entries with 'latemount'. This is needed if '--early' is
|
|
|
|
# specified in the previous mount_all command on the fs stage.
|
|
|
|
# With /system mounted and properties form /system + /factory available,
|
|
|
|
# some services can be started.
|
|
|
|
trigger late-fs
|
|
|
|
|
2015-07-01 23:40:56 +02:00
|
|
|
# Now we can mount /data. File encryption requires keymaster to decrypt
|
2016-08-23 20:58:09 +02:00
|
|
|
# /data, which in turn can only be loaded when system properties are present.
|
2015-07-01 23:40:56 +02:00
|
|
|
trigger post-fs-data
|
2016-08-23 20:58:09 +02:00
|
|
|
|
2017-03-08 23:46:50 +01:00
|
|
|
# Now we can start zygote for devices with file based encryption
|
2017-03-08 21:36:54 +01:00
|
|
|
trigger zygote-start
|
|
|
|
|
2016-08-23 20:58:09 +02:00
|
|
|
# Load persist properties and override properties (if enabled) from /data.
|
2015-07-01 23:40:56 +02:00
|
|
|
trigger load_persist_props_action
|
2014-06-17 00:06:21 +02:00
|
|
|
|
2014-07-16 05:39:41 +02:00
|
|
|
# Remove a file to wake up anything waiting for firmware.
|
|
|
|
trigger firmware_mounts_complete
|
|
|
|
|
2014-06-17 00:06:21 +02:00
|
|
|
trigger early-boot
|
|
|
|
trigger boot
|
|
|
|
|
2010-04-09 21:26:06 +02:00
|
|
|
on post-fs
|
2017-04-18 17:13:06 +02:00
|
|
|
# Load properties from
|
|
|
|
# /system/build.prop,
|
|
|
|
# /odm/build.prop,
|
|
|
|
# /vendor/build.prop and
|
|
|
|
# /factory/factory.prop
|
|
|
|
load_system_props
|
|
|
|
# start essential services
|
2015-04-08 00:32:12 +02:00
|
|
|
start logd
|
2017-04-13 22:50:09 +02:00
|
|
|
start servicemanager
|
2017-03-24 17:23:07 +01:00
|
|
|
start hwservicemanager
|
2017-04-13 22:50:09 +02:00
|
|
|
start vndservicemanager
|
2017-03-24 17:23:07 +01:00
|
|
|
|
2018-02-14 17:36:16 +01:00
|
|
|
# Once everything is setup, no need to modify /.
|
2018-07-11 17:13:34 +02:00
|
|
|
# The bind+remount combination allows this to work in containers.
|
|
|
|
mount rootfs rootfs / remount bind ro nodev
|
2015-06-23 23:30:37 +02:00
|
|
|
# Mount shared so changes propagate into child namespaces
|
2012-08-15 06:00:22 +02:00
|
|
|
mount rootfs rootfs / shared rec
|
2015-06-23 23:30:37 +02:00
|
|
|
# Mount default storage into root namespace
|
2016-03-09 08:41:50 +01:00
|
|
|
mount none /mnt/runtime/default /storage bind rec
|
|
|
|
mount none none /storage slave rec
|
2010-09-09 00:06:45 +02:00
|
|
|
|
2015-12-08 01:57:08 +01:00
|
|
|
# Make sure /sys/kernel/debug (if present) is labeled properly
|
2016-11-15 00:40:18 +01:00
|
|
|
# Note that tracefs may be mounted under debug, so we need to cross filesystems
|
|
|
|
restorecon --recursive --cross-filesystems /sys/kernel/debug
|
2016-11-02 22:23:31 +01:00
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
# We chown/chmod /cache again so because mount is run as root + defaults
|
|
|
|
chown system cache /cache
|
|
|
|
chmod 0770 /cache
|
2012-01-13 14:54:34 +01:00
|
|
|
# We restorecon /cache in case the cache partition has been reset.
|
2014-07-09 21:39:21 +02:00
|
|
|
restorecon_recursive /cache
|
2010-12-04 01:33:31 +01:00
|
|
|
|
2015-05-11 23:08:18 +02:00
|
|
|
# Create /cache/recovery in case it's not there. It'll also fix the odd
|
|
|
|
# permissions if created by the recovery system.
|
|
|
|
mkdir /cache/recovery 0770 system cache
|
2010-12-04 01:33:31 +01:00
|
|
|
|
2016-01-29 02:09:42 +01:00
|
|
|
# Backup/restore mechanism uses the cache partition
|
|
|
|
mkdir /cache/backup_stage 0700 system system
|
|
|
|
mkdir /cache/backup 0700 system system
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
#change permissions on vmallocinfo so we can grab it from bugreports
|
|
|
|
chown root log /proc/vmallocinfo
|
|
|
|
chmod 0440 /proc/vmallocinfo
|
|
|
|
|
2012-09-25 23:22:02 +02:00
|
|
|
chown root log /proc/slabinfo
|
|
|
|
chmod 0440 /proc/slabinfo
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
#change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
|
|
|
|
chown root system /proc/kmsg
|
|
|
|
chmod 0440 /proc/kmsg
|
|
|
|
chown root system /proc/sysrq-trigger
|
|
|
|
chmod 0220 /proc/sysrq-trigger
|
2012-08-03 03:14:33 +02:00
|
|
|
chown system log /proc/last_kmsg
|
|
|
|
chmod 0440 /proc/last_kmsg
|
2010-12-04 01:33:31 +01:00
|
|
|
|
2014-03-26 00:31:07 +01:00
|
|
|
# make the selinux kernel policy world-readable
|
|
|
|
chmod 0444 /sys/fs/selinux/policy
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
# create the lost+found directories, so as to enforce our permissions
|
2011-07-09 01:52:18 +02:00
|
|
|
mkdir /cache/lost+found 0770 root root
|
2010-12-04 01:33:31 +01:00
|
|
|
|
2017-04-06 21:44:59 +02:00
|
|
|
on late-fs
|
2017-06-13 19:15:05 +02:00
|
|
|
# Ensure that tracefs has the correct permissions.
|
|
|
|
# This does not work correctly if it is called in post-fs.
|
|
|
|
chmod 0755 /sys/kernel/debug/tracing
|
|
|
|
|
2017-04-06 21:44:59 +02:00
|
|
|
# HALs required before storage encryption can get unlocked (FBE/FDE)
|
|
|
|
class_start early_hal
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
on post-fs-data
|
2009-03-04 04:32:55 +01:00
|
|
|
# We chown/chmod /data again so because mount is run as root + defaults
|
|
|
|
chown system system /data
|
|
|
|
chmod 0771 /data
|
2012-01-13 14:54:34 +01:00
|
|
|
# We restorecon /data in case the userdata partition has been reset.
|
|
|
|
restorecon /data
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2016-02-02 18:15:59 +01:00
|
|
|
# Make sure we have the device encryption key.
|
2015-04-29 00:07:10 +02:00
|
|
|
start vold
|
|
|
|
installkey /data
|
|
|
|
|
2014-12-05 06:45:02 +01:00
|
|
|
# Start bootcharting as soon as possible after the data partition is
|
|
|
|
# mounted to collect more data.
|
|
|
|
mkdir /data/bootchart 0755 shell shell
|
2016-11-11 02:43:47 +01:00
|
|
|
bootchart start
|
2014-12-05 06:45:02 +01:00
|
|
|
|
2013-09-18 01:18:23 +02:00
|
|
|
# Avoid predictable entropy pool. Carry over entropy from previous boot.
|
|
|
|
copy /data/system/entropy.dat /dev/urandom
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
# create basic filesystem structure
|
2009-03-04 04:32:55 +01:00
|
|
|
mkdir /data/misc 01771 system misc
|
2017-07-14 19:37:57 +02:00
|
|
|
mkdir /data/misc/recovery 0770 system log
|
2017-07-26 22:18:15 +02:00
|
|
|
copy /data/misc/recovery/ro.build.fingerprint /data/misc/recovery/ro.build.fingerprint.1
|
|
|
|
chmod 0440 /data/misc/recovery/ro.build.fingerprint.1
|
|
|
|
chown system log /data/misc/recovery/ro.build.fingerprint.1
|
|
|
|
write /data/misc/recovery/ro.build.fingerprint ${ro.build.fingerprint}
|
|
|
|
chmod 0440 /data/misc/recovery/ro.build.fingerprint
|
|
|
|
chown system log /data/misc/recovery/ro.build.fingerprint
|
2017-07-14 19:37:57 +02:00
|
|
|
mkdir /data/misc/recovery/proc 0770 system log
|
|
|
|
copy /data/misc/recovery/proc/version /data/misc/recovery/proc/version.1
|
|
|
|
chmod 0440 /data/misc/recovery/proc/version.1
|
|
|
|
chown system log /data/misc/recovery/proc/version.1
|
|
|
|
copy /proc/version /data/misc/recovery/proc/version
|
|
|
|
chmod 0440 /data/misc/recovery/proc/version
|
|
|
|
chown system log /data/misc/recovery/proc/version
|
2016-09-20 20:52:14 +02:00
|
|
|
mkdir /data/misc/bluedroid 02770 bluetooth bluetooth
|
2015-06-20 04:12:46 +02:00
|
|
|
# Fix the access permissions and group ownership for 'bt_config.conf'
|
|
|
|
chmod 0660 /data/misc/bluedroid/bt_config.conf
|
2016-09-20 20:52:14 +02:00
|
|
|
chown bluetooth bluetooth /data/misc/bluedroid/bt_config.conf
|
|
|
|
mkdir /data/misc/bluetooth 0770 bluetooth bluetooth
|
|
|
|
mkdir /data/misc/bluetooth/logs 0770 bluetooth bluetooth
|
2009-09-18 04:35:26 +02:00
|
|
|
mkdir /data/misc/keystore 0700 keystore keystore
|
2015-04-16 22:16:24 +02:00
|
|
|
mkdir /data/misc/gatekeeper 0700 system system
|
2011-07-01 07:50:29 +02:00
|
|
|
mkdir /data/misc/keychain 0771 system system
|
2014-07-08 07:09:54 +02:00
|
|
|
mkdir /data/misc/net 0750 root shell
|
2013-07-16 18:46:17 +02:00
|
|
|
mkdir /data/misc/radio 0770 system radio
|
2012-09-27 01:04:27 +02:00
|
|
|
mkdir /data/misc/sms 0770 system radio
|
2017-11-21 21:31:57 +01:00
|
|
|
mkdir /data/misc/carrierid 0770 system radio
|
2018-05-21 16:53:00 +02:00
|
|
|
mkdir /data/misc/apns 0770 system radio
|
2012-10-20 03:10:05 +02:00
|
|
|
mkdir /data/misc/zoneinfo 0775 system system
|
2017-04-27 19:46:59 +02:00
|
|
|
mkdir /data/misc/textclassifier 0771 system system
|
2011-07-09 05:03:03 +02:00
|
|
|
mkdir /data/misc/vpn 0770 system vpn
|
2014-05-22 19:40:21 +02:00
|
|
|
mkdir /data/misc/shared_relro 0771 shared_relro shared_relro
|
2010-01-06 22:18:12 +01:00
|
|
|
mkdir /data/misc/systemkeys 0700 system system
|
2009-07-09 00:42:08 +02:00
|
|
|
mkdir /data/misc/wifi 0770 wifi wifi
|
2014-01-29 19:53:03 +01:00
|
|
|
mkdir /data/misc/wifi/sockets 0770 wifi wifi
|
|
|
|
mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
|
2014-03-10 09:13:07 +01:00
|
|
|
mkdir /data/misc/ethernet 0770 system system
|
2014-01-29 19:53:03 +01:00
|
|
|
mkdir /data/misc/dhcp 0770 dhcp dhcp
|
2014-04-25 16:21:35 +02:00
|
|
|
mkdir /data/misc/user 0771 root root
|
2015-05-06 00:05:39 +02:00
|
|
|
mkdir /data/misc/perfprofd 0775 root root
|
2014-01-29 19:53:03 +01:00
|
|
|
# give system access to wpa_supplicant.conf for backup and restore
|
2009-07-02 21:08:13 +02:00
|
|
|
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
|
2012-03-07 23:52:10 +01:00
|
|
|
mkdir /data/local 0751 root root
|
2013-02-22 23:54:45 +01:00
|
|
|
mkdir /data/misc/media 0700 media media
|
2016-02-24 00:23:46 +01:00
|
|
|
mkdir /data/misc/audioserver 0700 audioserver audioserver
|
2016-03-01 21:45:27 +01:00
|
|
|
mkdir /data/misc/cameraserver 0700 cameraserver cameraserver
|
2015-06-03 14:33:43 +02:00
|
|
|
mkdir /data/misc/vold 0700 root root
|
2015-06-15 11:49:35 +02:00
|
|
|
mkdir /data/misc/boottrace 0771 system shell
|
2015-10-07 20:00:55 +02:00
|
|
|
mkdir /data/misc/update_engine 0700 root root
|
2017-11-03 18:59:36 +01:00
|
|
|
mkdir /data/misc/update_engine_log 02750 root log
|
2015-11-10 20:16:43 +01:00
|
|
|
mkdir /data/misc/trace 0700 root root
|
2017-11-27 18:54:31 +01:00
|
|
|
# create location to store surface and window trace files
|
|
|
|
mkdir /data/misc/wmtrace 0700 system system
|
2016-02-01 20:27:01 +01:00
|
|
|
# profile file layout
|
|
|
|
mkdir /data/misc/profiles 0771 system system
|
|
|
|
mkdir /data/misc/profiles/cur 0771 system system
|
|
|
|
mkdir /data/misc/profiles/ref 0771 system system
|
2016-05-28 23:10:38 +02:00
|
|
|
mkdir /data/misc/profman 0770 system shell
|
2017-02-22 02:27:02 +01:00
|
|
|
mkdir /data/misc/gcov 0770 root root
|
2013-10-01 15:21:47 +02:00
|
|
|
|
2017-03-23 17:23:50 +01:00
|
|
|
mkdir /data/vendor 0771 root root
|
|
|
|
mkdir /data/vendor/hardware 0771 root root
|
|
|
|
|
2012-03-14 23:22:54 +01:00
|
|
|
# For security reasons, /data/local/tmp should always be empty.
|
|
|
|
# Do not place files or directories in /data/local/tmp
|
2009-03-04 04:32:55 +01:00
|
|
|
mkdir /data/local/tmp 0771 shell shell
|
2018-01-18 23:23:51 +01:00
|
|
|
mkdir /data/local/traces 0777 shell shell
|
2009-03-04 04:32:55 +01:00
|
|
|
mkdir /data/data 0771 system system
|
|
|
|
mkdir /data/app-private 0771 system system
|
2015-11-24 00:24:13 +01:00
|
|
|
mkdir /data/app-ephemeral 0771 system system
|
2012-04-13 00:01:52 +02:00
|
|
|
mkdir /data/app-asec 0700 root root
|
2012-09-09 07:39:25 +02:00
|
|
|
mkdir /data/app-lib 0771 system system
|
2009-03-04 04:32:55 +01:00
|
|
|
mkdir /data/app 0771 system system
|
|
|
|
mkdir /data/property 0700 root root
|
2015-01-31 02:38:06 +01:00
|
|
|
mkdir /data/tombstones 0771 system system
|
2017-12-18 20:26:06 +01:00
|
|
|
mkdir /data/vendor/tombstones 0771 root root
|
|
|
|
mkdir /data/vendor/tombstones/wifi 0771 wifi wifi
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2011-07-09 01:52:18 +02:00
|
|
|
# create dalvik-cache, so as to enforce our permissions
|
2014-08-28 00:40:05 +02:00
|
|
|
mkdir /data/dalvik-cache 0771 root root
|
2015-12-08 18:33:07 +01:00
|
|
|
# create the A/B OTA directory, so as to enforce our permissions
|
|
|
|
mkdir /data/ota 0771 root root
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2016-05-26 01:41:08 +02:00
|
|
|
# create the OTA package directory. It will be accessed by GmsCore (cache
|
|
|
|
# group), update_engine and update_verifier.
|
|
|
|
mkdir /data/ota_package 0770 system cache
|
|
|
|
|
2011-05-30 10:24:54 +02:00
|
|
|
# create resource-cache and double-check the perms
|
|
|
|
mkdir /data/resource-cache 0771 system system
|
|
|
|
chown system system /data/resource-cache
|
|
|
|
chmod 0771 /data/resource-cache
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
# create the lost+found directories, so as to enforce our permissions
|
2011-07-09 01:52:18 +02:00
|
|
|
mkdir /data/lost+found 0770 root root
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2012-01-07 00:19:26 +01:00
|
|
|
# create directory for DRM plug-ins - give drm the read/write access to
|
|
|
|
# the following directory.
|
|
|
|
mkdir /data/drm 0770 drm drm
|
2010-07-27 01:38:35 +02:00
|
|
|
|
2013-04-24 04:54:17 +02:00
|
|
|
# create directory for MediaDrm plug-ins - give drm the read/write access to
|
|
|
|
# the following directory.
|
|
|
|
mkdir /data/mediadrm 0770 mediadrm mediadrm
|
|
|
|
|
2015-07-26 06:06:20 +02:00
|
|
|
mkdir /data/anr 0775 system system
|
2014-10-21 06:53:56 +02:00
|
|
|
|
2017-11-21 19:40:25 +01:00
|
|
|
# NFC: create data/nfc for nv storage
|
|
|
|
mkdir /data/nfc 0770 nfc nfc
|
|
|
|
mkdir /data/nfc/param 0770 nfc nfc
|
|
|
|
|
2015-03-26 16:49:42 +01:00
|
|
|
# Create all remaining /data root dirs so that they are made through init
|
|
|
|
# and get proper encryption policy installed
|
|
|
|
mkdir /data/backup 0700 system system
|
|
|
|
mkdir /data/ss 0700 system system
|
2015-11-10 02:07:35 +01:00
|
|
|
|
2015-03-26 16:49:42 +01:00
|
|
|
mkdir /data/system 0775 system system
|
2018-04-17 01:04:38 +02:00
|
|
|
mkdir /data/system/dropbox 0700 system system
|
2015-04-08 01:44:08 +02:00
|
|
|
mkdir /data/system/heapdump 0700 system system
|
2016-04-15 05:09:34 +02:00
|
|
|
mkdir /data/system/users 0775 system system
|
2016-02-03 22:44:44 +01:00
|
|
|
|
|
|
|
mkdir /data/system_de 0770 system system
|
2015-11-10 02:07:35 +01:00
|
|
|
mkdir /data/system_ce 0770 system system
|
2016-02-03 22:44:44 +01:00
|
|
|
|
|
|
|
mkdir /data/misc_de 01771 system misc
|
|
|
|
mkdir /data/misc_ce 01771 system misc
|
2015-11-10 02:07:35 +01:00
|
|
|
|
2015-03-26 16:49:42 +01:00
|
|
|
mkdir /data/user 0711 system system
|
2015-11-10 02:07:35 +01:00
|
|
|
mkdir /data/user_de 0711 system system
|
2016-02-03 22:44:44 +01:00
|
|
|
symlink /data/data /data/user/0
|
2015-03-26 16:49:42 +01:00
|
|
|
|
2016-01-13 17:37:08 +01:00
|
|
|
mkdir /data/media 0770 media_rw media_rw
|
|
|
|
mkdir /data/media/obb 0770 media_rw media_rw
|
|
|
|
|
2016-06-21 21:04:54 +02:00
|
|
|
mkdir /data/cache 0770 system cache
|
|
|
|
mkdir /data/cache/recovery 0770 system cache
|
|
|
|
mkdir /data/cache/backup_stage 0700 system system
|
|
|
|
mkdir /data/cache/backup 0700 system system
|
|
|
|
|
2016-02-01 17:37:13 +01:00
|
|
|
init_user0
|
|
|
|
|
2014-02-06 19:52:52 +01:00
|
|
|
# Set SELinux security contexts on upgrade or policy update.
|
2016-11-15 00:40:18 +01:00
|
|
|
restorecon --recursive --skip-ce /data
|
2014-02-06 19:52:52 +01:00
|
|
|
|
2015-03-31 19:24:29 +02:00
|
|
|
# Check any timezone data in /data is newer than the copy in /system, delete if not.
|
2015-06-03 22:05:28 +02:00
|
|
|
exec - system system -- /system/bin/tzdatacheck /system/usr/share/zoneinfo /data/misc/zoneinfo
|
2015-03-31 19:24:29 +02:00
|
|
|
|
2017-01-25 19:52:15 +01:00
|
|
|
# If there is no post-fs-data action in the init.<device>.rc file, you
|
2010-12-04 01:33:31 +01:00
|
|
|
# must uncomment this line, otherwise encrypted filesystems
|
|
|
|
# won't work.
|
|
|
|
# Set indication (checked by vold) that we have finished this action
|
|
|
|
#setprop vold.post_fs_data_done 1
|
|
|
|
|
2017-04-20 23:37:55 +02:00
|
|
|
# It is recommended to put unnecessary data/ initialization from post-fs-data
|
|
|
|
# to start-zygote in device's init.rc to unblock zygote start.
|
|
|
|
on zygote-start && property:ro.crypto.state=unencrypted
|
|
|
|
# A/B update verifier that marks a successful boot.
|
|
|
|
exec_start update_verifier_nonencrypted
|
|
|
|
start netd
|
|
|
|
start zygote
|
|
|
|
start zygote_secondary
|
|
|
|
|
|
|
|
on zygote-start && property:ro.crypto.state=unsupported
|
|
|
|
# A/B update verifier that marks a successful boot.
|
|
|
|
exec_start update_verifier_nonencrypted
|
|
|
|
start netd
|
|
|
|
start zygote
|
|
|
|
start zygote_secondary
|
|
|
|
|
2017-03-09 21:35:02 +01:00
|
|
|
on zygote-start && property:ro.crypto.state=encrypted && property:ro.crypto.type=file
|
2017-04-20 23:37:55 +02:00
|
|
|
# A/B update verifier that marks a successful boot.
|
|
|
|
exec_start update_verifier_nonencrypted
|
|
|
|
start netd
|
|
|
|
start zygote
|
|
|
|
start zygote_secondary
|
2017-03-09 21:35:02 +01:00
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
on boot
|
2014-06-19 05:35:40 +02:00
|
|
|
# basic network init
|
2009-03-04 04:32:55 +01:00
|
|
|
ifup lo
|
|
|
|
hostname localhost
|
|
|
|
domainname localdomain
|
|
|
|
|
2018-03-13 03:00:50 +01:00
|
|
|
# IPsec SA default expiration length
|
|
|
|
write /proc/sys/net/core/xfrm_acq_expires 3600
|
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# Memory management. Basic kernel parameters, and allow the high
|
|
|
|
# level system server to be able to adjust the kernel OOM driver
|
|
|
|
# parameters to match how it is managing things.
|
2009-03-04 04:32:55 +01:00
|
|
|
write /proc/sys/vm/overcommit_memory 1
|
2009-03-13 21:04:37 +01:00
|
|
|
write /proc/sys/vm/min_free_order_shift 4
|
2011-08-08 01:30:24 +02:00
|
|
|
chown root system /sys/module/lowmemorykiller/parameters/adj
|
2015-03-20 01:07:57 +01:00
|
|
|
chmod 0664 /sys/module/lowmemorykiller/parameters/adj
|
2011-08-08 01:30:24 +02:00
|
|
|
chown root system /sys/module/lowmemorykiller/parameters/minfree
|
2015-03-20 01:07:57 +01:00
|
|
|
chmod 0664 /sys/module/lowmemorykiller/parameters/minfree
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2009-10-13 21:24:47 +02:00
|
|
|
# Tweak background writeout
|
|
|
|
write /proc/sys/vm/dirty_expire_centisecs 200
|
|
|
|
write /proc/sys/vm/dirty_background_ratio 5
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
# Permissions for System Server and daemons.
|
|
|
|
chown radio system /sys/android_power/state
|
|
|
|
chown radio system /sys/android_power/request_state
|
|
|
|
chown radio system /sys/android_power/acquire_full_wake_lock
|
|
|
|
chown radio system /sys/android_power/acquire_partial_wake_lock
|
|
|
|
chown radio system /sys/android_power/release_wake_lock
|
2012-05-03 02:57:50 +02:00
|
|
|
chown system system /sys/power/autosleep
|
2012-03-21 04:33:09 +01:00
|
|
|
chown system system /sys/power/state
|
|
|
|
chown system system /sys/power/wakeup_count
|
2015-11-24 02:18:31 +01:00
|
|
|
chown radio wakelock /sys/power/wake_lock
|
|
|
|
chown radio wakelock /sys/power/wake_unlock
|
2009-03-04 04:32:55 +01:00
|
|
|
chmod 0660 /sys/power/state
|
|
|
|
chmod 0660 /sys/power/wake_lock
|
|
|
|
chmod 0660 /sys/power/wake_unlock
|
2012-04-11 23:48:51 +02:00
|
|
|
|
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
|
2012-12-21 03:52:03 +01:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
|
2012-04-11 23:48:51 +02:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
|
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
|
2012-12-21 03:52:03 +01:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
|
2012-04-11 23:48:51 +02:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
|
2012-04-19 22:17:24 +02:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
|
2012-04-25 00:37:13 +02:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
|
2012-05-04 00:20:48 +02:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
|
2012-04-28 05:21:18 +02:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
|
2012-12-20 02:43:06 +01:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
|
2013-03-25 21:17:13 +01:00
|
|
|
chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
|
2012-04-11 23:48:51 +02:00
|
|
|
|
|
|
|
# Assume SMP uses shared cpufreq policy for all CPUs
|
|
|
|
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
|
|
|
|
chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
|
|
|
|
|
2017-03-09 02:36:18 +01:00
|
|
|
chown system system /sys/class/leds/vibrator/trigger
|
|
|
|
chown system system /sys/class/leds/vibrator/activate
|
|
|
|
chown system system /sys/class/leds/vibrator/brightness
|
|
|
|
chown system system /sys/class/leds/vibrator/duration
|
|
|
|
chown system system /sys/class/leds/vibrator/state
|
2009-03-04 04:32:55 +01:00
|
|
|
chown system system /sys/class/timed_output/vibrator/enable
|
|
|
|
chown system system /sys/class/leds/keyboard-backlight/brightness
|
|
|
|
chown system system /sys/class/leds/lcd-backlight/brightness
|
|
|
|
chown system system /sys/class/leds/button-backlight/brightness
|
2009-03-19 01:39:49 +01:00
|
|
|
chown system system /sys/class/leds/jogball-backlight/brightness
|
2009-03-04 04:32:55 +01:00
|
|
|
chown system system /sys/class/leds/red/brightness
|
|
|
|
chown system system /sys/class/leds/green/brightness
|
|
|
|
chown system system /sys/class/leds/blue/brightness
|
|
|
|
chown system system /sys/class/leds/red/device/grpfreq
|
|
|
|
chown system system /sys/class/leds/red/device/grppwm
|
|
|
|
chown system system /sys/class/leds/red/device/blink
|
|
|
|
chown system system /sys/module/sco/parameters/disable_esco
|
|
|
|
chown system system /sys/kernel/ipv4/tcp_wmem_min
|
|
|
|
chown system system /sys/kernel/ipv4/tcp_wmem_def
|
|
|
|
chown system system /sys/kernel/ipv4/tcp_wmem_max
|
|
|
|
chown system system /sys/kernel/ipv4/tcp_rmem_min
|
|
|
|
chown system system /sys/kernel/ipv4/tcp_rmem_def
|
|
|
|
chown system system /sys/kernel/ipv4/tcp_rmem_max
|
|
|
|
chown root radio /proc/cmdline
|
|
|
|
|
2014-06-19 05:35:40 +02:00
|
|
|
# Define default initial receive window size in segments.
|
2014-02-21 21:05:01 +01:00
|
|
|
setprop net.tcp.default_init_rwnd 60
|
|
|
|
|
2017-03-24 17:23:07 +01:00
|
|
|
# Start standard binderized HAL daemons
|
|
|
|
class_start hal
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
class_start core
|
|
|
|
|
|
|
|
on nonencrypted
|
2014-01-30 19:43:52 +01:00
|
|
|
class_start main
|
2010-12-04 01:33:31 +01:00
|
|
|
class_start late_start
|
|
|
|
|
2014-06-26 22:55:03 +02:00
|
|
|
on property:sys.init_log_level=*
|
|
|
|
loglevel ${sys.init_log_level}
|
|
|
|
|
2011-08-25 00:28:23 +02:00
|
|
|
on charger
|
|
|
|
class_start charger
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
on property:vold.decrypt=trigger_reset_main
|
|
|
|
class_reset main
|
|
|
|
|
2011-03-09 02:01:29 +01:00
|
|
|
on property:vold.decrypt=trigger_load_persist_props
|
|
|
|
load_persist_props
|
2015-04-20 17:55:02 +02:00
|
|
|
start logd
|
2015-03-11 22:45:05 +01:00
|
|
|
start logd-reinit
|
2011-03-09 02:01:29 +01:00
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
on property:vold.decrypt=trigger_post_fs_data
|
|
|
|
trigger post-fs-data
|
|
|
|
|
2011-01-17 23:26:34 +01:00
|
|
|
on property:vold.decrypt=trigger_restart_min_framework
|
2015-12-05 02:45:43 +01:00
|
|
|
# A/B update verifier that marks a successful boot.
|
2017-03-28 22:28:38 +02:00
|
|
|
exec_start update_verifier
|
2011-01-17 23:26:34 +01:00
|
|
|
class_start main
|
|
|
|
|
2010-12-04 01:33:31 +01:00
|
|
|
on property:vold.decrypt=trigger_restart_framework
|
2015-12-05 02:45:43 +01:00
|
|
|
# A/B update verifier that marks a successful boot.
|
2017-03-28 22:28:38 +02:00
|
|
|
exec_start update_verifier
|
2010-12-04 01:33:31 +01:00
|
|
|
class_start main
|
|
|
|
class_start late_start
|
|
|
|
|
|
|
|
on property:vold.decrypt=trigger_shutdown_framework
|
|
|
|
class_reset late_start
|
|
|
|
class_reset main
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2016-11-11 02:43:47 +01:00
|
|
|
on property:sys.boot_completed=1
|
|
|
|
bootchart stop
|
|
|
|
|
2014-02-21 21:05:01 +01:00
|
|
|
# system server cannot write to /proc/sys files,
|
|
|
|
# and chown/chmod does not work for /proc/sys/ entries.
|
|
|
|
# So proxy writes through init.
|
2013-07-25 19:34:30 +02:00
|
|
|
on property:sys.sysctl.extra_free_kbytes=*
|
|
|
|
write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}
|
2014-06-19 05:35:40 +02:00
|
|
|
|
2014-02-21 21:05:01 +01:00
|
|
|
# "tcp_default_init_rwnd" Is too long!
|
|
|
|
on property:sys.sysctl.tcp_def_init_rwnd=*
|
|
|
|
write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}
|
|
|
|
|
2015-09-04 22:23:01 +02:00
|
|
|
on property:security.perf_harden=0
|
|
|
|
write /proc/sys/kernel/perf_event_paranoid 1
|
2018-06-29 23:52:47 +02:00
|
|
|
write /proc/sys/kernel/perf_event_max_sample_rate ${debug.perf_event_max_sample_rate:-100000}
|
|
|
|
write /proc/sys/kernel/perf_cpu_time_max_percent ${debug.perf_cpu_time_max_percent:-25}
|
|
|
|
write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}
|
2015-09-04 22:23:01 +02:00
|
|
|
|
|
|
|
on property:security.perf_harden=1
|
|
|
|
write /proc/sys/kernel/perf_event_paranoid 3
|
2013-07-25 19:34:30 +02:00
|
|
|
|
2017-06-28 07:08:45 +02:00
|
|
|
# on shutdown
|
|
|
|
# In device's init.rc, this trigger can be used to do device-specific actions
|
|
|
|
# before shutdown. e.g disable watchdog and mask error handling
|
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
## Daemon processes to be run by init.
|
|
|
|
##
|
2010-10-28 00:40:23 +02:00
|
|
|
service ueventd /sbin/ueventd
|
2010-12-04 01:33:31 +01:00
|
|
|
class core
|
2010-10-28 00:40:23 +02:00
|
|
|
critical
|
2012-01-13 14:54:34 +01:00
|
|
|
seclabel u:r:ueventd:s0
|
2017-07-05 20:38:44 +02:00
|
|
|
shutdown critical
|
2010-10-28 00:40:23 +02:00
|
|
|
|
2016-11-01 16:45:19 +01:00
|
|
|
service healthd /system/bin/healthd
|
2013-06-20 00:09:35 +02:00
|
|
|
class core
|
|
|
|
critical
|
2015-11-24 02:18:31 +01:00
|
|
|
group root system wakelock
|
2013-06-20 00:09:35 +02:00
|
|
|
|
2009-03-04 04:32:55 +01:00
|
|
|
service console /system/bin/sh
|
2010-12-04 01:33:31 +01:00
|
|
|
class core
|
2009-03-04 04:32:55 +01:00
|
|
|
console
|
2010-10-28 00:40:23 +02:00
|
|
|
disabled
|
|
|
|
user shell
|
2015-11-08 01:52:17 +01:00
|
|
|
group shell log readproc
|
2013-12-23 20:11:02 +01:00
|
|
|
seclabel u:r:shell:s0
|
2017-10-11 20:18:51 +02:00
|
|
|
setenv HOSTNAME console
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2010-11-19 15:12:27 +01:00
|
|
|
on property:ro.debuggable=1
|
2015-11-10 20:16:43 +01:00
|
|
|
# Give writes to anyone for the trace folder on debug builds.
|
|
|
|
# The folder is used to store method traces.
|
|
|
|
chmod 0773 /data/misc/trace
|
2017-11-27 18:54:31 +01:00
|
|
|
# Give reads to anyone for the window trace folder on debug builds.
|
|
|
|
chmod 0775 /data/misc/wmtrace
|
2010-10-28 00:40:23 +02:00
|
|
|
start console
|
2010-04-21 21:04:20 +02:00
|
|
|
|
2014-02-04 21:15:14 +01:00
|
|
|
service flash_recovery /system/bin/install-recovery.sh
|
2010-12-04 01:33:31 +01:00
|
|
|
class main
|
2009-03-04 04:32:55 +01:00
|
|
|
oneshot
|