Captain Throwback | 1f12775 | 2016-01-19 17:30:20 -0500 | [diff] [blame] | 1 | import /init.recovery.logd.rc |
Captain Throwback | 170964d | 2019-10-21 19:42:50 -0400 | [diff] [blame] | 2 | import /init.recovery.ldconfig.rc |
Captain Throwback | 5ab5964 | 2019-02-07 17:22:49 -0500 | [diff] [blame] | 3 | import /init.recovery.mksh.rc |
Matt Mower | ec009e8 | 2015-01-30 13:00:49 -0600 | [diff] [blame] | 4 | import /init.recovery.usb.rc |
Ethan Yonker | f117962 | 2016-08-25 15:32:21 -0500 | [diff] [blame] | 5 | import /init.recovery.service.rc |
nkk71 | 71c6c50 | 2017-01-05 23:55:05 +0200 | [diff] [blame] | 6 | import /init.recovery.vold_decrypt.rc |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 7 | import /init.recovery.${ro.hardware}.rc |
| 8 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 9 | on early-init |
Ethan Yonker | 58b09f1 | 2015-10-26 12:42:15 -0500 | [diff] [blame] | 10 | # 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 Deymo | 080f522 | 2016-03-02 14:21:02 -0800 | [diff] [blame] | 17 | # Set the security context of /postinstall if present. |
| 18 | restorecon /postinstall |
| 19 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 20 | start ueventd |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 22 | <<<<<<< HEAD |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 23 | service set_permissive /sbin/permissive.sh |
Ethan Yonker | 6cb35aa | 2014-12-16 14:21:42 -0600 | [diff] [blame] | 24 | oneshot |
| 25 | seclabel u:r:recovery:s0 |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 26 | ======= |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 27 | setprop sys.usb.configfs 0 |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 28 | >>>>>>> android-10.0.0_r25 |
Ethan Yonker | 6cb35aa | 2014-12-16 14:21:42 -0600 | [diff] [blame] | 29 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 30 | on init |
Doug Zongker | 55d6542 | 2014-01-14 09:50:35 -0800 | [diff] [blame] | 31 | export PATH /sbin:/system/bin |
that | 9c3b7e9 | 2017-03-14 20:42:45 +0100 | [diff] [blame] | 32 | export LD_LIBRARY_PATH /sbin |
Ethan Yonker | 34ae483 | 2016-08-24 15:32:18 -0500 | [diff] [blame] | 33 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 34 | export ANDROID_ROOT /system |
| 35 | export ANDROID_DATA /data |
| 36 | export EXTERNAL_STORAGE /sdcard |
| 37 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 38 | <<<<<<< HEAD |
| 39 | ======= |
Elliott Hughes | a4495b5 | 2018-08-23 08:31:59 -0700 | [diff] [blame] | 40 | symlink /proc/self/fd/0 /dev/stdin |
| 41 | symlink /proc/self/fd/1 /dev/stdout |
| 42 | symlink /proc/self/fd/2 /dev/stderr |
| 43 | |
Elliott Hughes | 4dca6f1 | 2017-12-06 08:41:50 -0800 | [diff] [blame] | 44 | symlink /system/bin /bin |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 45 | symlink /system/etc /etc |
| 46 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 47 | >>>>>>> android-10.0.0_r25 |
Elliott Hughes | 48ebb07 | 2016-06-15 15:15:15 -0700 | [diff] [blame] | 48 | mount cgroup none /acct cpuacct |
| 49 | mkdir /acct/uid |
| 50 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 51 | mkdir /system |
| 52 | mkdir /data |
| 53 | mkdir /cache |
Doug Zongker | 075ad80 | 2014-06-26 15:35:51 -0700 | [diff] [blame] | 54 | mkdir /sideload |
Jiyong Park | 8b7af4c | 2018-06-01 11:58:54 +0900 | [diff] [blame] | 55 | mkdir /mnt/system |
Doug Zongker | 55d6542 | 2014-01-14 09:50:35 -0800 | [diff] [blame] | 56 | mount tmpfs tmpfs /tmp |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 57 | |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 58 | chown root shell /tmp |
| 59 | chmod 0775 /tmp |
| 60 | |
Colin Cross | 22bcf97 | 2014-06-24 13:43:39 -0700 | [diff] [blame] | 61 | write /proc/sys/kernel/panic_on_oops 1 |
Jesse Zhao | 5bf74b2 | 2015-01-08 15:59:23 -0800 | [diff] [blame] | 62 | write /proc/sys/vm/max_map_count 1000000 |
Colin Cross | 22bcf97 | 2014-06-24 13:43:39 -0700 | [diff] [blame] | 63 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 64 | <<<<<<< HEAD |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 65 | on fs |
Vojtech Bocek | 05ec1d4 | 2015-03-08 16:32:41 +0100 | [diff] [blame] | 66 | mount pstore pstore /sys/fs/pstore |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 67 | mkdir /dev/usb-ffs 0770 shell shell |
| 68 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 69 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 70 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 71 | ======= |
| 72 | >>>>>>> android-10.0.0_r25 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 73 | on boot |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 74 | ifup lo |
| 75 | hostname localhost |
| 76 | domainname localdomain |
| 77 | |
| 78 | class_start default |
| 79 | |
Matt Mower | 4251a9b | 2015-11-13 14:01:49 -0600 | [diff] [blame] | 80 | # Load properties, pre-Android 6.0 |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 81 | on load_all_props_action |
| 82 | load_all_props |
| 83 | |
Matt Mower | 4251a9b | 2015-11-13 14:01:49 -0600 | [diff] [blame] | 84 | # Load properties, Android 6.0+ |
| 85 | on load_system_props_action |
| 86 | load_system_props |
| 87 | |
| 88 | # Load properties, Android 6.0+, vendor init lives here |
| 89 | on load_persist_props_action |
| 90 | load_persist_props |
| 91 | |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 92 | on firmware_mounts_complete |
Matt Mower | 4251a9b | 2015-11-13 14:01:49 -0600 | [diff] [blame] | 93 | rm /dev/.booting |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 94 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 95 | # Mount filesystems and start core system services. |
| 96 | on late-init |
| 97 | trigger early-fs |
| 98 | trigger fs |
| 99 | trigger post-fs |
| 100 | trigger post-fs-data |
| 101 | |
Matt Mower | 4251a9b | 2015-11-13 14:01:49 -0600 | [diff] [blame] | 102 | # Load properties, pre-Android 6.0 |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 103 | trigger load_all_props_action |
| 104 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 105 | # Load properties from /system/ + /factory after fs mount. Place |
| 106 | # this in another action so that the load will be scheduled after the prior |
| 107 | # issued fs triggers have completed. |
Paul Lawrence | 90c75b0 | 2015-07-06 10:44:33 -0700 | [diff] [blame] | 108 | trigger load_system_props_action |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 109 | |
Matt Mower | 4251a9b | 2015-11-13 14:01:49 -0600 | [diff] [blame] | 110 | # Load properties, Android 6.0+, vendor init lives here |
| 111 | trigger load_persist_props_action |
| 112 | |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 113 | # Remove a file to wake up anything waiting for firmware |
| 114 | trigger firmware_mounts_complete |
| 115 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 116 | trigger early-boot |
| 117 | trigger boot |
| 118 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 119 | <<<<<<< HEAD |
Doug Zongker | 77ea71d | 2013-08-30 12:20:16 -0700 | [diff] [blame] | 120 | on property:sys.powerctl=* |
| 121 | powerctl ${sys.powerctl} |
| 122 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 123 | service ueventd /sbin/ueventd |
| 124 | critical |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 125 | seclabel u:r:ueventd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 126 | |
Nick Kralevich | c52c5b8 | 2014-01-18 09:22:50 -0800 | [diff] [blame] | 127 | service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 128 | ======= |
Tom Cherry | b2fd168 | 2018-07-24 15:58:29 -0700 | [diff] [blame] | 129 | service ueventd /system/bin/ueventd |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 130 | critical |
| 131 | seclabel u:r:ueventd:s0 |
| 132 | |
Tao Bao | a89c21c | 2018-09-11 14:50:02 -0700 | [diff] [blame] | 133 | service charger /system/bin/charger |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 134 | critical |
Sandeep Patil | c4b381c | 2016-11-01 08:49:51 -0700 | [diff] [blame] | 135 | seclabel u:r:charger:s0 |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 136 | |
Hridya Valsaraju | cfb3c92 | 2018-07-26 13:04:06 -0700 | [diff] [blame] | 137 | service recovery /system/bin/recovery |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 138 | socket recovery stream 422 system system |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 139 | seclabel u:r:recovery:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 140 | |
Jiyong Park | 8b7af4c | 2018-06-01 11:58:54 +0900 | [diff] [blame] | 141 | service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 142 | >>>>>>> android-10.0.0_r25 |
Kenny Root | ecc76ba | 2010-06-28 09:01:22 -0700 | [diff] [blame] | 143 | disabled |
Doug Zongker | cc2958f | 2013-09-11 13:24:32 -0700 | [diff] [blame] | 144 | socket adbd stream 660 system system |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 145 | seclabel u:r:adbd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 146 | |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 147 | <<<<<<< HEAD |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 148 | # Always start adbd on userdebug and eng builds |
| 149 | on property:ro.debuggable=1 |
Dees_Troy | 0cd4cc2 | 2013-06-09 20:56:38 +0000 | [diff] [blame] | 150 | #write /sys/class/android_usb/android0/enable 1 |
| 151 | #start adbd |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 152 | setprop service.adb.root 1 |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 153 | ======= |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 154 | service fastbootd /system/bin/fastbootd |
| 155 | disabled |
| 156 | group system |
| 157 | seclabel u:r:fastbootd:s0 |
bigbiff | 26d5d5f | 2020-03-23 09:56:16 -0400 | [diff] [blame^] | 158 | >>>>>>> android-10.0.0_r25 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 159 | |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 160 | # Restart adbd so it can run as root |
Doug Zongker | fb04b87 | 2011-06-23 15:30:34 -0700 | [diff] [blame] | 161 | on property:service.adb.root=1 |
Doug Zongker | fb04b87 | 2011-06-23 15:30:34 -0700 | [diff] [blame] | 162 | restart adbd |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 163 | |
| 164 | # Always start adbd on userdebug and eng builds |
| 165 | on fs && property:ro.debuggable=1 |
| 166 | setprop sys.usb.config adb |
| 167 | |
| 168 | on fs && property:sys.usb.configfs=1 |
| 169 | mount configfs none /config |
| 170 | mkdir /config/usb_gadget/g1 0770 shell shell |
| 171 | write /config/usb_gadget/g1/idVendor 0x18D1 |
| 172 | mkdir /config/usb_gadget/g1/strings/0x409 0770 |
| 173 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
| 174 | write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} |
| 175 | write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} |
| 176 | mkdir /config/usb_gadget/g1/functions/ffs.adb |
| 177 | mkdir /config/usb_gadget/g1/functions/ffs.fastboot |
| 178 | mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell |
| 179 | mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell |
| 180 | |
| 181 | on fs && property:sys.usb.configfs=0 |
| 182 | write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot |
| 183 | write /sys/class/android_usb/android0/idVendor 18D1 |
| 184 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} |
| 185 | write /sys/class/android_usb/android0/iProduct ${ro.product.model} |
| 186 | write /sys/class/android_usb/android0/iSerial ${ro.serialno} |
| 187 | |
| 188 | on fs |
| 189 | mkdir /dev/usb-ffs 0775 shell shell |
| 190 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 191 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 192 | mkdir /dev/usb-ffs/fastboot 0770 system system |
| 193 | mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000 |
| 194 | |
| 195 | on property:sys.usb.config=adb |
| 196 | start adbd |
| 197 | |
| 198 | on property:sys.usb.config=fastboot |
| 199 | start fastbootd |
| 200 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 201 | on property:sys.usb.config=none && property:sys.usb.configfs=0 |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 202 | stop adbd |
| 203 | stop fastboot |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 204 | write /sys/class/android_usb/android0/enable 0 |
| 205 | setprop sys.usb.state ${sys.usb.config} |
| 206 | |
| 207 | on property:sys.usb.config=adb && property:sys.usb.configfs=0 |
| 208 | write /sys/class/android_usb/android0/idProduct D001 |
| 209 | write /sys/class/android_usb/android0/functions adb |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 210 | write /sys/class/android_usb/android0/enable 1 |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 211 | setprop sys.usb.state ${sys.usb.config} |
| 212 | |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 213 | on property:sys.usb.config=sideload && property:sys.usb.configfs=0 |
| 214 | write /sys/class/android_usb/android0/idProduct D001 |
| 215 | write /sys/class/android_usb/android0/functions adb |
| 216 | write /sys/class/android_usb/android0/enable 1 |
| 217 | setprop sys.usb.state ${sys.usb.config} |
| 218 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 219 | on property:sys.usb.config=fastboot && property:sys.usb.configfs=0 |
| 220 | write /sys/class/android_usb/android0/idProduct 4EE0 |
| 221 | write /sys/class/android_usb/android0/functions fastboot |
| 222 | write /sys/class/android_usb/android0/enable 1 |
| 223 | setprop sys.usb.state ${sys.usb.config} |
| 224 | |
| 225 | # Configfs triggers |
| 226 | on property:sys.usb.config=none && property:sys.usb.configfs=1 |
| 227 | write /config/usb_gadget/g1/UDC "none" |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 228 | stop adbd |
| 229 | stop fastbootd |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 230 | setprop sys.usb.ffs.ready 0 |
| 231 | rm /config/usb_gadget/g1/configs/b.1/f1 |
| 232 | setprop sys.usb.state ${sys.usb.config} |
| 233 | |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 234 | on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 235 | write /config/usb_gadget/g1/idProduct 0xD001 |
| 236 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| 237 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| 238 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 239 | setprop sys.usb.state ${sys.usb.config} |
| 240 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 241 | on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 242 | write /config/usb_gadget/g1/idProduct 0xD001 |
| 243 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| 244 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| 245 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 246 | setprop sys.usb.state ${sys.usb.config} |
| 247 | |
| 248 | on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 249 | write /config/usb_gadget/g1/idProduct 0x4EE0 |
| 250 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot" |
| 251 | symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1 |
| 252 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 253 | setprop sys.usb.state ${sys.usb.config} |