Home | History | Annotate | Download | only in rootdir
      1 # Copyright (C) 2012 The Android Open Source Project
      2 #
      3 # IMPORTANT: Do not create world writable files or directories.
      4 # This is a common source of Android security bugs.
      5 #
      6 
      7 import /init.environ.rc
      8 import /init.usb.rc
      9 import /init.${ro.hardware}.rc
     10 import /init.usb.configfs.rc
     11 import /init.${ro.zygote}.rc
     12 
     13 on early-init
     14     # Set init and its forked children's oom_adj.
     15     write /proc/1/oom_score_adj -1000
     16 
     17     # Disable sysrq from keyboard
     18     write /proc/sys/kernel/sysrq 0
     19 
     20     # Set the security context of /adb_keys if present.
     21     restorecon /adb_keys
     22 
     23     # Shouldn't be necessary, but sdcard won't start without it. http://b/22568628.
     24     mkdir /mnt 0775 root system
     25 
     26     # Set the security context of /postinstall if present.
     27     restorecon /postinstall
     28 
     29     start ueventd
     30 
     31 on init
     32     sysclktz 0
     33 
     34     # Mix device-specific information into the entropy pool
     35     copy /proc/cmdline /dev/urandom
     36     copy /default.prop /dev/urandom
     37 
     38     # Backward compatibility.
     39     symlink /system/etc /etc
     40     symlink /sys/kernel/debug /d
     41 
     42     # Link /vendor to /system/vendor for devices without a vendor partition.
     43     symlink /system/vendor /vendor
     44 
     45     # Mount cgroup mount point for cpu accounting
     46     mount cgroup none /acct cpuacct
     47     mkdir /acct/uid
     48 
     49     # Create energy-aware scheduler tuning nodes
     50     mkdir /dev/stune
     51     mount cgroup none /dev/stune schedtune
     52     mkdir /dev/stune/foreground
     53     chown system system /dev/stune
     54     chown system system /dev/stune/foreground
     55     chown system system /dev/stune/tasks
     56     chown system system /dev/stune/foreground/tasks
     57     chmod 0664 /dev/stune/tasks
     58     chmod 0664 /dev/stune/foreground/tasks
     59 
     60     # Mount staging areas for devices managed by vold
     61     # See storage config details at http://source.android.com/tech/storage/
     62     mount tmpfs tmpfs /mnt mode=0755,uid=0,gid=1000
     63     restorecon_recursive /mnt
     64 
     65     mount configfs none /config
     66     chmod 0775 /config/sdcardfs
     67     chown system package_info /config/sdcardfs
     68 
     69     mkdir /mnt/secure 0700 root root
     70     mkdir /mnt/secure/asec 0700 root root
     71     mkdir /mnt/asec 0755 root system
     72     mkdir /mnt/obb 0755 root system
     73     mkdir /mnt/media_rw 0750 root media_rw
     74     mkdir /mnt/user 0755 root root
     75     mkdir /mnt/user/0 0755 root root
     76     mkdir /mnt/expand 0771 system system
     77     mkdir /mnt/appfuse 0711 root root
     78 
     79     # Storage views to support runtime permissions
     80     mkdir /mnt/runtime 0700 root root
     81     mkdir /mnt/runtime/default 0755 root root
     82     mkdir /mnt/runtime/default/self 0755 root root
     83     mkdir /mnt/runtime/read 0755 root root
     84     mkdir /mnt/runtime/read/self 0755 root root
     85     mkdir /mnt/runtime/write 0755 root root
     86     mkdir /mnt/runtime/write/self 0755 root root
     87 
     88     # Symlink to keep legacy apps working in multi-user world
     89     symlink /storage/self/primary /sdcard
     90     symlink /storage/self/primary /mnt/sdcard
     91     symlink /mnt/user/0/primary /mnt/runtime/default/self/primary
     92 
     93     # root memory control cgroup, used by lmkd
     94     mkdir /dev/memcg 0700 root system
     95     mount cgroup none /dev/memcg memory
     96     # app mem cgroups, used by activity manager, lmkd and zygote
     97     mkdir /dev/memcg/apps/ 0755 system system
     98 
     99     write /proc/sys/kernel/panic_on_oops 1
    100     write /proc/sys/kernel/hung_task_timeout_secs 0
    101     write /proc/cpu/alignment 4
    102 
    103     # scheduler tunables
    104     # Disable auto-scaling of scheduler tunables with hotplug. The tunables
    105     # will vary across devices in unpredictable ways if allowed to scale with
    106     # cpu cores.
    107     write /proc/sys/kernel/sched_tunable_scaling 0
    108     write /proc/sys/kernel/sched_latency_ns 10000000
    109     write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
    110     write /proc/sys/kernel/sched_compat_yield 1
    111     write /proc/sys/kernel/sched_child_runs_first 0
    112 
    113     write /proc/sys/kernel/randomize_va_space 2
    114     write /proc/sys/kernel/kptr_restrict 2
    115     write /proc/sys/vm/mmap_min_addr 32768
    116     write /proc/sys/net/ipv4/ping_group_range "0 2147483647"
    117     write /proc/sys/net/unix/max_dgram_qlen 600
    118     write /proc/sys/kernel/sched_rt_runtime_us 950000
    119     write /proc/sys/kernel/sched_rt_period_us 1000000
    120 
    121     # reflect fwmark from incoming packets onto generated replies
    122     write /proc/sys/net/ipv4/fwmark_reflect 1
    123     write /proc/sys/net/ipv6/fwmark_reflect 1
    124 
    125     # set fwmark on accepted sockets
    126     write /proc/sys/net/ipv4/tcp_fwmark_accept 1
    127 
    128     # disable icmp redirects
    129     write /proc/sys/net/ipv4/conf/all/accept_redirects 0
    130     write /proc/sys/net/ipv6/conf/all/accept_redirects 0
    131 
    132     # Create cgroup mount points for process groups
    133     mkdir /dev/cpuctl
    134     mount cgroup none /dev/cpuctl cpu
    135     chown system system /dev/cpuctl
    136     chown system system /dev/cpuctl/tasks
    137     chmod 0666 /dev/cpuctl/tasks
    138     write /dev/cpuctl/cpu.shares 1024
    139     write /dev/cpuctl/cpu.rt_runtime_us 800000
    140     write /dev/cpuctl/cpu.rt_period_us 1000000
    141 
    142     mkdir /dev/cpuctl/bg_non_interactive
    143     chown system system /dev/cpuctl/bg_non_interactive/tasks
    144     chmod 0666 /dev/cpuctl/bg_non_interactive/tasks
    145     # 5.0 %
    146     write /dev/cpuctl/bg_non_interactive/cpu.shares 52
    147     write /dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us 700000
    148     write /dev/cpuctl/bg_non_interactive/cpu.rt_period_us 1000000
    149 
    150     # sets up initial cpusets for ActivityManager
    151     mkdir /dev/cpuset
    152     mount cpuset none /dev/cpuset
    153 
    154     # this ensures that the cpusets are present and usable, but the device's
    155     # init.rc must actually set the correct cpus
    156     mkdir /dev/cpuset/foreground
    157     write /dev/cpuset/foreground/cpus 0
    158     write /dev/cpuset/foreground/mems 0
    159     mkdir /dev/cpuset/foreground/boost
    160     write /dev/cpuset/foreground/boost/cpus 0
    161     write /dev/cpuset/foreground/boost/mems 0
    162     mkdir /dev/cpuset/background
    163     write /dev/cpuset/background/cpus 0
    164     write /dev/cpuset/background/mems 0
    165 
    166     # system-background is for system tasks that should only run on
    167     # little cores, not on bigs
    168     # to be used only by init, so don't change system-bg permissions
    169     mkdir /dev/cpuset/system-background
    170     write /dev/cpuset/system-background/cpus 0
    171     write /dev/cpuset/system-background/mems 0
    172 
    173     mkdir /dev/cpuset/top-app
    174     write /dev/cpuset/top-app/cpus 0
    175     write /dev/cpuset/top-app/mems 0
    176 
    177     # change permissions for all cpusets we'll touch at runtime
    178     chown system system /dev/cpuset
    179     chown system system /dev/cpuset/foreground
    180     chown system system /dev/cpuset/foreground/boost
    181     chown system system /dev/cpuset/background
    182     chown system system /dev/cpuset/system-background
    183     chown system system /dev/cpuset/top-app
    184     chown system system /dev/cpuset/tasks
    185     chown system system /dev/cpuset/foreground/tasks
    186     chown system system /dev/cpuset/foreground/boost/tasks
    187     chown system system /dev/cpuset/background/tasks
    188     chown system system /dev/cpuset/system-background/tasks
    189     chown system system /dev/cpuset/top-app/tasks
    190 
    191     # set system-background to 0775 so SurfaceFlinger can touch it
    192     chmod 0775 /dev/cpuset/system-background
    193 
    194     chmod 0664 /dev/cpuset/foreground/tasks
    195     chmod 0664 /dev/cpuset/foreground/boost/tasks
    196     chmod 0664 /dev/cpuset/background/tasks
    197     chmod 0664 /dev/cpuset/system-background/tasks
    198     chmod 0664 /dev/cpuset/top-app/tasks
    199     chmod 0664 /dev/cpuset/tasks
    200 
    201 
    202     # qtaguid will limit access to specific data based on group memberships.
    203     #   net_bw_acct grants impersonation of socket owners.
    204     #   net_bw_stats grants access to other apps' detailed tagged-socket stats.
    205     chown root net_bw_acct /proc/net/xt_qtaguid/ctrl
    206     chown root net_bw_stats /proc/net/xt_qtaguid/stats
    207 
    208     # Allow everybody to read the xt_qtaguid resource tracking misc dev.
    209     # This is needed by any process that uses socket tagging.
    210     chmod 0644 /dev/xt_qtaguid
    211 
    212     # Create location for fs_mgr to store abbreviated output from filesystem
    213     # checker programs.
    214     mkdir /dev/fscklogs 0770 root system
    215 
    216     # pstore/ramoops previous console log
    217     mount pstore pstore /sys/fs/pstore
    218     chown system log /sys/fs/pstore/console-ramoops
    219     chmod 0440 /sys/fs/pstore/console-ramoops
    220     chown system log /sys/fs/pstore/pmsg-ramoops-0
    221     chmod 0440 /sys/fs/pstore/pmsg-ramoops-0
    222 
    223     # enable armv8_deprecated instruction hooks
    224     write /proc/sys/abi/swp 1
    225 
    226     # Linux's execveat() syscall may construct paths containing /dev/fd
    227     # expecting it to point to /proc/self/fd
    228     symlink /proc/self/fd /dev/fd
    229 
    230 # Healthd can trigger a full boot from charger mode by signaling this
    231 # property when the power button is held.
    232 on property:sys.boot_from_charger_mode=1
    233     class_stop charger
    234     trigger late-init
    235 
    236 # Load properties from /system/ + /factory after fs mount.
    237 on load_system_props_action
    238     load_system_props
    239 
    240 on load_persist_props_action
    241     load_persist_props
    242     start logd
    243     start logd-reinit
    244 
    245 # Indicate to fw loaders that the relevant mounts are up.
    246 on firmware_mounts_complete
    247     rm /dev/.booting
    248 
    249 # Mount filesystems and start core system services.
    250 on late-init
    251     trigger early-fs
    252     trigger fs
    253     trigger post-fs
    254 
    255     # Load properties from /system/ + /factory after fs mount. Place
    256     # this in another action so that the load will be scheduled after the prior
    257     # issued fs triggers have completed.
    258     trigger load_system_props_action
    259 
    260     # Now we can mount /data. File encryption requires keymaster to decrypt
    261     # /data, which in turn can only be loaded when system properties are present
    262     trigger post-fs-data
    263     trigger load_persist_props_action
    264 
    265     # Remove a file to wake up anything waiting for firmware.
    266     trigger firmware_mounts_complete
    267 
    268     trigger early-boot
    269     trigger boot
    270 
    271 
    272 on post-fs
    273     start logd
    274     # once everything is setup, no need to modify /
    275     mount rootfs rootfs / ro remount
    276     # Mount shared so changes propagate into child namespaces
    277     mount rootfs rootfs / shared rec
    278     # Mount default storage into root namespace
    279     mount none /mnt/runtime/default /storage slave bind rec
    280 
    281     # Make sure /sys/kernel/debug (if present) is labeled properly
    282     restorecon_recursive /sys/kernel/debug
    283 
    284     # We chown/chmod /cache again so because mount is run as root + defaults
    285     chown system cache /cache
    286     chmod 0770 /cache
    287     # We restorecon /cache in case the cache partition has been reset.
    288     restorecon_recursive /cache
    289 
    290     # Create /cache/recovery in case it's not there. It'll also fix the odd
    291     # permissions if created by the recovery system.
    292     mkdir /cache/recovery 0770 system cache
    293 
    294     # Backup/restore mechanism uses the cache partition
    295     mkdir /cache/backup_stage 0700 system system
    296     mkdir /cache/backup 0700 system system
    297 
    298     #change permissions on vmallocinfo so we can grab it from bugreports
    299     chown root log /proc/vmallocinfo
    300     chmod 0440 /proc/vmallocinfo
    301 
    302     chown root log /proc/slabinfo
    303     chmod 0440 /proc/slabinfo
    304 
    305     #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
    306     chown root system /proc/kmsg
    307     chmod 0440 /proc/kmsg
    308     chown root system /proc/sysrq-trigger
    309     chmod 0220 /proc/sysrq-trigger
    310     chown system log /proc/last_kmsg
    311     chmod 0440 /proc/last_kmsg
    312 
    313     # make the selinux kernel policy world-readable
    314     chmod 0444 /sys/fs/selinux/policy
    315 
    316     # create the lost+found directories, so as to enforce our permissions
    317     mkdir /cache/lost+found 0770 root root
    318 
    319 on post-fs-data
    320     # We chown/chmod /data again so because mount is run as root + defaults
    321     chown system system /data
    322     chmod 0771 /data
    323     # We restorecon /data in case the userdata partition has been reset.
    324     restorecon /data
    325 
    326     # start debuggerd to make debugging early-boot crashes easier.
    327     start debuggerd
    328     start debuggerd64
    329 
    330     # Make sure we have the device encryption key.
    331     start vold
    332     installkey /data
    333 
    334     # Start bootcharting as soon as possible after the data partition is
    335     # mounted to collect more data.
    336     mkdir /data/bootchart 0755 shell shell
    337     bootchart_init
    338 
    339     # Avoid predictable entropy pool. Carry over entropy from previous boot.
    340     copy /data/system/entropy.dat /dev/urandom
    341 
    342     # create basic filesystem structure
    343     mkdir /data/misc 01771 system misc
    344     mkdir /data/misc/bluedroid 02770 bluetooth net_bt_stack
    345     # Fix the access permissions and group ownership for 'bt_config.conf'
    346     chmod 0660 /data/misc/bluedroid/bt_config.conf
    347     chown bluetooth net_bt_stack /data/misc/bluedroid/bt_config.conf
    348     mkdir /data/misc/bluetooth 0770 system system
    349     mkdir /data/misc/keystore 0700 keystore keystore
    350     mkdir /data/misc/gatekeeper 0700 system system
    351     mkdir /data/misc/keychain 0771 system system
    352     mkdir /data/misc/net 0750 root shell
    353     mkdir /data/misc/radio 0770 system radio
    354     mkdir /data/misc/sms 0770 system radio
    355     mkdir /data/misc/zoneinfo 0775 system system
    356     mkdir /data/misc/vpn 0770 system vpn
    357     mkdir /data/misc/shared_relro 0771 shared_relro shared_relro
    358     mkdir /data/misc/systemkeys 0700 system system
    359     mkdir /data/misc/wifi 0770 wifi wifi
    360     mkdir /data/misc/wifi/sockets 0770 wifi wifi
    361     mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
    362     mkdir /data/misc/ethernet 0770 system system
    363     mkdir /data/misc/dhcp 0770 dhcp dhcp
    364     mkdir /data/misc/user 0771 root root
    365     mkdir /data/misc/perfprofd 0775 root root
    366     # give system access to wpa_supplicant.conf for backup and restore
    367     chmod 0660 /data/misc/wifi/wpa_supplicant.conf
    368     mkdir /data/local 0751 root root
    369     mkdir /data/misc/media 0700 media media
    370     mkdir /data/misc/audioserver 0700 audioserver audioserver
    371     mkdir /data/misc/cameraserver 0700 cameraserver cameraserver
    372     mkdir /data/misc/vold 0700 root root
    373     mkdir /data/misc/boottrace 0771 system shell
    374     mkdir /data/misc/update_engine 0700 root root
    375     mkdir /data/misc/trace 0700 root root
    376     # profile file layout
    377     mkdir /data/misc/profiles 0771 system system
    378     mkdir /data/misc/profiles/cur 0771 system system
    379     mkdir /data/misc/profiles/ref 0771 system system
    380     mkdir /data/misc/profman 0770 system shell
    381 
    382     # For security reasons, /data/local/tmp should always be empty.
    383     # Do not place files or directories in /data/local/tmp
    384     mkdir /data/local/tmp 0771 shell shell
    385     mkdir /data/data 0771 system system
    386     mkdir /data/app-private 0771 system system
    387     mkdir /data/app-ephemeral 0771 system system
    388     mkdir /data/app-asec 0700 root root
    389     mkdir /data/app-lib 0771 system system
    390     mkdir /data/app 0771 system system
    391     mkdir /data/property 0700 root root
    392     mkdir /data/tombstones 0771 system system
    393 
    394     # create dalvik-cache, so as to enforce our permissions
    395     mkdir /data/dalvik-cache 0771 root root
    396     # create the A/B OTA directory, so as to enforce our permissions
    397     mkdir /data/ota 0771 root root
    398 
    399     # create resource-cache and double-check the perms
    400     mkdir /data/resource-cache 0771 system system
    401     chown system system /data/resource-cache
    402     chmod 0771 /data/resource-cache
    403 
    404     # create the lost+found directories, so as to enforce our permissions
    405     mkdir /data/lost+found 0770 root root
    406 
    407     # create directory for DRM plug-ins - give drm the read/write access to
    408     # the following directory.
    409     mkdir /data/drm 0770 drm drm
    410 
    411     # create directory for MediaDrm plug-ins - give drm the read/write access to
    412     # the following directory.
    413     mkdir /data/mediadrm 0770 mediadrm mediadrm
    414 
    415     mkdir /data/anr 0775 system system
    416 
    417     # symlink to bugreport storage location
    418     rm /data/bugreports
    419     symlink /data/user_de/0/com.android.shell/files/bugreports /data/bugreports
    420 
    421     # Separate location for storing security policy files on data
    422     mkdir /data/security 0711 system system
    423 
    424     # Create all remaining /data root dirs so that they are made through init
    425     # and get proper encryption policy installed
    426     mkdir /data/backup 0700 system system
    427     mkdir /data/ss 0700 system system
    428 
    429     mkdir /data/system 0775 system system
    430     mkdir /data/system/heapdump 0700 system system
    431     mkdir /data/system/users 0775 system system
    432 
    433     mkdir /data/system_de 0770 system system
    434     mkdir /data/system_ce 0770 system system
    435 
    436     mkdir /data/misc_de 01771 system misc
    437     mkdir /data/misc_ce 01771 system misc
    438 
    439     mkdir /data/user 0711 system system
    440     mkdir /data/user_de 0711 system system
    441     symlink /data/data /data/user/0
    442 
    443     mkdir /data/media 0770 media_rw media_rw
    444     mkdir /data/media/obb 0770 media_rw media_rw
    445 
    446     init_user0
    447 
    448     # Reload policy from /data/security if present.
    449     setprop selinux.reload_policy 1
    450 
    451     # Set SELinux security contexts on upgrade or policy update.
    452     restorecon_recursive /data
    453 
    454     # Check any timezone data in /data is newer than the copy in /system, delete if not.
    455     exec - system system -- /system/bin/tzdatacheck /system/usr/share/zoneinfo /data/misc/zoneinfo
    456 
    457     # If there is no fs-post-data action in the init.<device>.rc file, you
    458     # must uncomment this line, otherwise encrypted filesystems
    459     # won't work.
    460     # Set indication (checked by vold) that we have finished this action
    461     #setprop vold.post_fs_data_done 1
    462 
    463 on boot
    464     # basic network init
    465     ifup lo
    466     hostname localhost
    467     domainname localdomain
    468 
    469     # set RLIMIT_NICE to allow priorities from 19 to -20
    470     setrlimit 13 40 40
    471 
    472     # Memory management.  Basic kernel parameters, and allow the high
    473     # level system server to be able to adjust the kernel OOM driver
    474     # parameters to match how it is managing things.
    475     write /proc/sys/vm/overcommit_memory 1
    476     write /proc/sys/vm/min_free_order_shift 4
    477     chown root system /sys/module/lowmemorykiller/parameters/adj
    478     chmod 0664 /sys/module/lowmemorykiller/parameters/adj
    479     chown root system /sys/module/lowmemorykiller/parameters/minfree
    480     chmod 0664 /sys/module/lowmemorykiller/parameters/minfree
    481 
    482     # Tweak background writeout
    483     write /proc/sys/vm/dirty_expire_centisecs 200
    484     write /proc/sys/vm/dirty_background_ratio  5
    485 
    486     # Permissions for System Server and daemons.
    487     chown radio system /sys/android_power/state
    488     chown radio system /sys/android_power/request_state
    489     chown radio system /sys/android_power/acquire_full_wake_lock
    490     chown radio system /sys/android_power/acquire_partial_wake_lock
    491     chown radio system /sys/android_power/release_wake_lock
    492     chown system system /sys/power/autosleep
    493     chown system system /sys/power/state
    494     chown system system /sys/power/wakeup_count
    495     chown radio wakelock /sys/power/wake_lock
    496     chown radio wakelock /sys/power/wake_unlock
    497     chmod 0660 /sys/power/state
    498     chmod 0660 /sys/power/wake_lock
    499     chmod 0660 /sys/power/wake_unlock
    500 
    501     chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    502     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    503     chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack
    504     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
    505     chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
    506     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
    507     chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
    508     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
    509     chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
    510     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
    511     chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    512     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    513     chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
    514     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
    515     chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
    516     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
    517     chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
    518     chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost
    519     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
    520     chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
    521     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
    522     chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
    523     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
    524 
    525     # Assume SMP uses shared cpufreq policy for all CPUs
    526     chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    527     chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    528 
    529     chown system system /sys/class/timed_output/vibrator/enable
    530     chown system system /sys/class/leds/keyboard-backlight/brightness
    531     chown system system /sys/class/leds/lcd-backlight/brightness
    532     chown system system /sys/class/leds/button-backlight/brightness
    533     chown system system /sys/class/leds/jogball-backlight/brightness
    534     chown system system /sys/class/leds/red/brightness
    535     chown system system /sys/class/leds/green/brightness
    536     chown system system /sys/class/leds/blue/brightness
    537     chown system system /sys/class/leds/red/device/grpfreq
    538     chown system system /sys/class/leds/red/device/grppwm
    539     chown system system /sys/class/leds/red/device/blink
    540     chown system system /sys/class/timed_output/vibrator/enable
    541     chown system system /sys/module/sco/parameters/disable_esco
    542     chown system system /sys/kernel/ipv4/tcp_wmem_min
    543     chown system system /sys/kernel/ipv4/tcp_wmem_def
    544     chown system system /sys/kernel/ipv4/tcp_wmem_max
    545     chown system system /sys/kernel/ipv4/tcp_rmem_min
    546     chown system system /sys/kernel/ipv4/tcp_rmem_def
    547     chown system system /sys/kernel/ipv4/tcp_rmem_max
    548     chown root radio /proc/cmdline
    549 
    550     # Define default initial receive window size in segments.
    551     setprop net.tcp.default_init_rwnd 60
    552 
    553     class_start core
    554 
    555 on nonencrypted
    556     # A/B update verifier that marks a successful boot.
    557     exec - root -- /system/bin/update_verifier nonencrypted
    558     class_start main
    559     class_start late_start
    560 
    561 on property:sys.init_log_level=*
    562     loglevel ${sys.init_log_level}
    563 
    564 on charger
    565     class_start charger
    566 
    567 on property:vold.decrypt=trigger_reset_main
    568     class_reset main
    569 
    570 on property:vold.decrypt=trigger_load_persist_props
    571     load_persist_props
    572     start logd
    573     start logd-reinit
    574 
    575 on property:vold.decrypt=trigger_post_fs_data
    576     trigger post-fs-data
    577 
    578 on property:vold.decrypt=trigger_restart_min_framework
    579     # A/B update verifier that marks a successful boot.
    580     exec - root -- /system/bin/update_verifier trigger_restart_min_framework
    581     class_start main
    582 
    583 on property:vold.decrypt=trigger_restart_framework
    584     # A/B update verifier that marks a successful boot.
    585     exec - root -- /system/bin/update_verifier trigger_restart_framework
    586     class_start main
    587     class_start late_start
    588 
    589 on property:vold.decrypt=trigger_shutdown_framework
    590     class_reset late_start
    591     class_reset main
    592 
    593 on property:sys.powerctl=*
    594     powerctl ${sys.powerctl}
    595 
    596 # system server cannot write to /proc/sys files,
    597 # and chown/chmod does not work for /proc/sys/ entries.
    598 # So proxy writes through init.
    599 on property:sys.sysctl.extra_free_kbytes=*
    600     write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}
    601 
    602 # "tcp_default_init_rwnd" Is too long!
    603 on property:sys.sysctl.tcp_def_init_rwnd=*
    604     write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}
    605 
    606 on property:security.perf_harden=0
    607     write /proc/sys/kernel/perf_event_paranoid 1
    608 
    609 on property:security.perf_harden=1
    610     write /proc/sys/kernel/perf_event_paranoid 3
    611 
    612 ## Daemon processes to be run by init.
    613 ##
    614 service ueventd /sbin/ueventd
    615     class core
    616     critical
    617     seclabel u:r:ueventd:s0
    618 
    619 service healthd /sbin/healthd
    620     class core
    621     critical
    622     seclabel u:r:healthd:s0
    623     group root system wakelock
    624 
    625 service console /system/bin/sh
    626     class core
    627     console
    628     disabled
    629     user shell
    630     group shell log readproc
    631     seclabel u:r:shell:s0
    632 
    633 on property:ro.debuggable=1
    634     # Give writes to anyone for the trace folder on debug builds.
    635     # The folder is used to store method traces.
    636     chmod 0773 /data/misc/trace
    637     start console
    638 
    639 service flash_recovery /system/bin/install-recovery.sh
    640     class main
    641     oneshot
    642