blob: fc32bb8953dc30397699a490d6bcdc2559fbef03 [file] [log] [blame]
Captain Throwback1f127752016-01-19 17:30:20 -05001import /init.recovery.logd.rc
Captain Throwback170964d2019-10-21 19:42:50 -04002import /init.recovery.ldconfig.rc
Captain Throwback5ab59642019-02-07 17:22:49 -05003import /init.recovery.mksh.rc
Matt Mowerec009e82015-01-30 13:00:49 -06004import /init.recovery.usb.rc
Ethan Yonkerf1179622016-08-25 15:32:21 -05005import /init.recovery.service.rc
nkk7171c6c502017-01-05 23:55:05 +02006import /init.recovery.vold_decrypt.rc
Matt Mower556411f2013-02-17 16:52:44 -06007import /init.recovery.${ro.hardware}.rc
8
Colin Crossdd6a0412010-05-14 13:42:20 -07009on early-init
Ethan Yonker58b09f12015-10-26 12:42:15 -050010 # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
11 write /sys/fs/selinux/checkreqprot 0
12
13 # Set the security context for the init process.
14 # This should occur before anything else (e.g. ueventd) is started.
15 setcon u:r:init:s0
16
Alex Deymo080f5222016-03-02 14:21:02 -080017 # Set the security context of /postinstall if present.
18 restorecon /postinstall
19
Andreas Schneiderec350e92020-03-11 19:19:12 +010020 # ueventd wants to write to /acct
21 mount cgroup none /acct cpuacct
22 mkdir /acct/uid
23
Colin Crossdd6a0412010-05-14 13:42:20 -070024 start ueventd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080025
Ethan Yonkerc798c9c2015-10-09 11:15:26 -050026service set_permissive /sbin/permissive.sh
Ethan Yonker6cb35aa2014-12-16 14:21:42 -060027 oneshot
28 seclabel u:r:recovery:s0
29
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080030on init
Doug Zongker55d65422014-01-14 09:50:35 -080031 export PATH /sbin:/system/bin
that9c3b7e92017-03-14 20:42:45 +010032 export LD_LIBRARY_PATH /sbin
Ethan Yonker34ae4832016-08-24 15:32:18 -050033
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080034 export ANDROID_ROOT /system
35 export ANDROID_DATA /data
36 export EXTERNAL_STORAGE /sdcard
37
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080038 mkdir /system
39 mkdir /data
40 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070041 mkdir /sideload
Doug Zongker55d65422014-01-14 09:50:35 -080042 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080043
Matt Mower556411f2013-02-17 16:52:44 -060044 chown root shell /tmp
45 chmod 0775 /tmp
46
Colin Cross22bcf972014-06-24 13:43:39 -070047 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080048 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070049
Benoit Goby689e06b2014-02-19 17:41:02 -080050on fs
Vojtech Bocek05ec1d42015-03-08 16:32:41 +010051 mount pstore pstore /sys/fs/pstore
Benoit Goby689e06b2014-02-19 17:41:02 -080052 mkdir /dev/usb-ffs 0770 shell shell
53 mkdir /dev/usb-ffs/adb 0770 shell shell
54 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
55
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080056on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080057 ifup lo
58 hostname localhost
59 domainname localdomain
60
61 class_start default
62
Matt Mower4251a9b2015-11-13 14:01:49 -060063# Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070064on load_all_props_action
65 load_all_props
66
Matt Mower4251a9b2015-11-13 14:01:49 -060067# Load properties, Android 6.0+
68on load_system_props_action
69 load_system_props
70
71# Load properties, Android 6.0+, vendor init lives here
72on load_persist_props_action
73 load_persist_props
74
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070075on firmware_mounts_complete
Matt Mower4251a9b2015-11-13 14:01:49 -060076 rm /dev/.booting
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070077
Riley Andrewse739d7e2014-06-24 16:29:16 -070078# Mount filesystems and start core system services.
79on late-init
80 trigger early-fs
81 trigger fs
82 trigger post-fs
83 trigger post-fs-data
84
Matt Mower4251a9b2015-11-13 14:01:49 -060085 # Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070086 trigger load_all_props_action
87
Riley Andrewse739d7e2014-06-24 16:29:16 -070088 # Load properties from /system/ + /factory after fs mount. Place
89 # this in another action so that the load will be scheduled after the prior
90 # issued fs triggers have completed.
Paul Lawrence90c75b02015-07-06 10:44:33 -070091 trigger load_system_props_action
Riley Andrewse739d7e2014-06-24 16:29:16 -070092
Matt Mower4251a9b2015-11-13 14:01:49 -060093 # Load properties, Android 6.0+, vendor init lives here
94 trigger load_persist_props_action
95
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070096 # Remove a file to wake up anything waiting for firmware
97 trigger firmware_mounts_complete
98
Riley Andrewse739d7e2014-06-24 16:29:16 -070099 trigger early-boot
100 trigger boot
101
Doug Zongker77ea71d2013-08-30 12:20:16 -0700102on property:sys.powerctl=*
103 powerctl ${sys.powerctl}
104
Colin Crossdd6a0412010-05-14 13:42:20 -0700105service ueventd /sbin/ueventd
106 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500107 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800108
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800109service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700110 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700111 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500112 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800113
Mike Lockwood718a2f72011-06-29 10:22:04 -0400114# Always start adbd on userdebug and eng builds
115on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000116 #write /sys/class/android_usb/android0/enable 1
117 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400118 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800119
Mike Lockwood718a2f72011-06-29 10:22:04 -0400120# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700121on property:service.adb.root=1
122 write /sys/class/android_usb/android0/enable 0
123 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800124 write /sys/class/android_usb/android0/enable 1