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 |
Alex Deymo | 080f522 | 2016-03-02 14:21:02 -0800 | [diff] [blame] | 10 | # Set the security context of /postinstall if present. |
| 11 | restorecon /postinstall |
| 12 | |
Andreas Schneider | a4e510e | 2020-03-11 19:19:12 +0100 | [diff] [blame] | 13 | # ueventd wants to write to /acct |
| 14 | mount cgroup none /acct cpuacct |
| 15 | mkdir /acct/uid |
Kiyoung Kim | ea2b683 | 2019-12-17 15:05:54 +0900 | [diff] [blame] | 16 | # Copy prebuilt ld.config.txt into linkerconfig directory |
| 17 | copy /system/etc/ld.config.txt /linkerconfig/ld.config.txt |
Kiyoung Kim | 3a88a17 | 2019-12-09 19:27:57 +0900 | [diff] [blame] | 18 | chmod 444 /linkerconfig/ld.config.txt |
| 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 | 91bd7a7 | 2021-01-03 17:33:01 -0500 | [diff] [blame] | 22 | setprop sys.usb.configfs 0 |
| 23 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 24 | on init |
Doug Zongker | 55d6542 | 2014-01-14 09:50:35 -0800 | [diff] [blame] | 25 | export PATH /sbin:/system/bin |
bigbiff | a957f07 | 2021-03-07 18:20:29 -0500 | [diff] [blame] | 26 | export LD_LIBRARY_PATH /system/lib64:/vendor/lib64/hw |
Ethan Yonker | 34ae483 | 2016-08-24 15:32:18 -0500 | [diff] [blame] | 27 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 28 | export ANDROID_ROOT /system |
| 29 | export ANDROID_DATA /data |
| 30 | export EXTERNAL_STORAGE /sdcard |
| 31 | |
Elliott Hughes | a4495b5 | 2018-08-23 08:31:59 -0700 | [diff] [blame] | 32 | symlink /proc/self/fd/0 /dev/stdin |
| 33 | symlink /proc/self/fd/1 /dev/stdout |
| 34 | symlink /proc/self/fd/2 /dev/stderr |
| 35 | |
Elliott Hughes | 4dca6f1 | 2017-12-06 08:41:50 -0800 | [diff] [blame] | 36 | symlink /system/bin /bin |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 37 | symlink /system/etc /etc |
| 38 | |
Elliott Hughes | 48ebb07 | 2016-06-15 15:15:15 -0700 | [diff] [blame] | 39 | mount cgroup none /acct cpuacct |
| 40 | mkdir /acct/uid |
| 41 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 42 | mkdir /system |
| 43 | mkdir /data |
| 44 | mkdir /cache |
Doug Zongker | 075ad80 | 2014-06-26 15:35:51 -0700 | [diff] [blame] | 45 | mkdir /sideload |
Jiyong Park | 8b7af4c | 2018-06-01 11:58:54 +0900 | [diff] [blame] | 46 | mkdir /mnt/system |
Doug Zongker | 55d6542 | 2014-01-14 09:50:35 -0800 | [diff] [blame] | 47 | mount tmpfs tmpfs /tmp |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 48 | |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 49 | chown root shell /tmp |
| 50 | chmod 0775 /tmp |
| 51 | |
Colin Cross | 22bcf97 | 2014-06-24 13:43:39 -0700 | [diff] [blame] | 52 | write /proc/sys/kernel/panic_on_oops 1 |
Jesse Zhao | 5bf74b2 | 2015-01-08 15:59:23 -0800 | [diff] [blame] | 53 | write /proc/sys/vm/max_map_count 1000000 |
Colin Cross | 22bcf97 | 2014-06-24 13:43:39 -0700 | [diff] [blame] | 54 | |
nebrassy | cd79c90 | 2021-01-19 09:55:04 +0100 | [diff] [blame] | 55 | mkdir /dev/binderfs |
| 56 | mount binder binder /dev/binderfs stats=global |
| 57 | chmod 0755 /dev/binderfs |
| 58 | chmod 0666 /dev/binderfs/hwbinder |
| 59 | chmod 0666 /dev/binderfs/binder |
| 60 | chmod 0666 /dev/binderfs/vndbinder |
| 61 | symlink /dev/binderfs/binder /dev/binder |
| 62 | symlink /dev/binderfs/hwbinder /dev/hwbinder |
| 63 | symlink /dev/binderfs/vndbinder /dev/vndbinder |
| 64 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 65 | on boot |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 66 | ifup lo |
| 67 | hostname localhost |
| 68 | domainname localdomain |
| 69 | |
| 70 | class_start default |
| 71 | |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 72 | on firmware_mounts_complete |
Matt Mower | 4251a9b | 2015-11-13 14:01:49 -0600 | [diff] [blame] | 73 | rm /dev/.booting |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 74 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 75 | # Mount filesystems and start core system services. |
| 76 | on late-init |
| 77 | trigger early-fs |
| 78 | trigger fs |
| 79 | trigger post-fs |
| 80 | trigger post-fs-data |
| 81 | |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 82 | # Remove a file to wake up anything waiting for firmware |
| 83 | trigger firmware_mounts_complete |
| 84 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 85 | trigger early-boot |
| 86 | trigger boot |
| 87 | |
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 88 | service ueventd /system/bin/ueventd |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 89 | critical |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 90 | seclabel u:r:ueventd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 91 | |
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 92 | service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery |
Kenny Root | ecc76ba | 2010-06-28 09:01:22 -0700 | [diff] [blame] | 93 | disabled |
Doug Zongker | cc2958f | 2013-09-11 13:24:32 -0700 | [diff] [blame] | 94 | socket adbd stream 660 system system |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 95 | seclabel u:r:adbd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 96 | |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 97 | # Always start adbd on userdebug and eng builds |
| 98 | on property:ro.debuggable=1 |
Dees_Troy | 0cd4cc2 | 2013-06-09 20:56:38 +0000 | [diff] [blame] | 99 | #write /sys/class/android_usb/android0/enable 1 |
| 100 | #start adbd |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 101 | setprop service.adb.root 1 |
bigbiff | d58ba18 | 2020-03-23 10:02:29 -0400 | [diff] [blame] | 102 | |
bigbiff | 91bd7a7 | 2021-01-03 17:33:01 -0500 | [diff] [blame] | 103 | # Always start adbd on userdebug and eng builds |
| 104 | on fs && property:ro.debuggable=1 |
| 105 | setprop sys.usb.config adb |
| 106 | |
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 107 | service fastbootd /system/bin/fastbootd |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 108 | disabled |
| 109 | group system |
| 110 | seclabel u:r:fastbootd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 111 | |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 112 | # Restart adbd so it can run as root |
Doug Zongker | fb04b87 | 2011-06-23 15:30:34 -0700 | [diff] [blame] | 113 | on property:service.adb.root=1 |
Doug Zongker | fb04b87 | 2011-06-23 15:30:34 -0700 | [diff] [blame] | 114 | restart adbd |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 115 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 116 | on fs && property:sys.usb.configfs=1 |
| 117 | mount configfs none /config |
| 118 | mkdir /config/usb_gadget/g1 0770 shell shell |
| 119 | write /config/usb_gadget/g1/idVendor 0x18D1 |
| 120 | mkdir /config/usb_gadget/g1/strings/0x409 0770 |
| 121 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
| 122 | write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} |
| 123 | write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} |
| 124 | mkdir /config/usb_gadget/g1/functions/ffs.adb |
| 125 | mkdir /config/usb_gadget/g1/functions/ffs.fastboot |
| 126 | mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell |
| 127 | mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell |
| 128 | |
| 129 | on fs && property:sys.usb.configfs=0 |
| 130 | write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot |
| 131 | write /sys/class/android_usb/android0/idVendor 18D1 |
| 132 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} |
| 133 | write /sys/class/android_usb/android0/iProduct ${ro.product.model} |
| 134 | write /sys/class/android_usb/android0/iSerial ${ro.serialno} |
| 135 | |
| 136 | on fs |
Captain Throwback | 82c6693 | 2020-10-13 15:03:11 -0400 | [diff] [blame] | 137 | mount pstore pstore /sys/fs/pstore |
| 138 | mkdir /dev/usb-ffs 0770 shell shell |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 139 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 140 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 141 | mkdir /dev/usb-ffs/fastboot 0770 system system |
| 142 | mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000 |
| 143 | |
| 144 | on property:sys.usb.config=adb |
| 145 | start adbd |
| 146 | |
| 147 | on property:sys.usb.config=fastboot |
| 148 | start fastbootd |
| 149 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 150 | on property:sys.usb.config=none && property:sys.usb.configfs=0 |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 151 | stop adbd |
Dmytro Prokopchuk | df35405 | 2019-11-13 13:30:17 +0200 | [diff] [blame] | 152 | stop fastbootd |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 153 | write /sys/class/android_usb/android0/enable 0 |
| 154 | setprop sys.usb.state ${sys.usb.config} |
| 155 | |
| 156 | on property:sys.usb.config=adb && property:sys.usb.configfs=0 |
| 157 | write /sys/class/android_usb/android0/idProduct D001 |
| 158 | write /sys/class/android_usb/android0/functions adb |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 159 | write /sys/class/android_usb/android0/enable 1 |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 160 | setprop sys.usb.state ${sys.usb.config} |
| 161 | |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 162 | on property:sys.usb.config=sideload && property:sys.usb.configfs=0 |
| 163 | write /sys/class/android_usb/android0/idProduct D001 |
| 164 | write /sys/class/android_usb/android0/functions adb |
| 165 | write /sys/class/android_usb/android0/enable 1 |
| 166 | setprop sys.usb.state ${sys.usb.config} |
| 167 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 168 | on property:sys.usb.config=fastboot && property:sys.usb.configfs=0 |
| 169 | write /sys/class/android_usb/android0/idProduct 4EE0 |
| 170 | write /sys/class/android_usb/android0/functions fastboot |
| 171 | write /sys/class/android_usb/android0/enable 1 |
| 172 | setprop sys.usb.state ${sys.usb.config} |
| 173 | |
| 174 | # Configfs triggers |
| 175 | on property:sys.usb.config=none && property:sys.usb.configfs=1 |
| 176 | write /config/usb_gadget/g1/UDC "none" |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 177 | stop adbd |
| 178 | stop fastbootd |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 179 | setprop sys.usb.ffs.ready 0 |
| 180 | rm /config/usb_gadget/g1/configs/b.1/f1 |
| 181 | setprop sys.usb.state ${sys.usb.config} |
| 182 | |
Hridya Valsaraju | e4ef453 | 2018-08-31 11:57:51 -0700 | [diff] [blame] | 183 | on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 184 | write /config/usb_gadget/g1/idProduct 0xD001 |
| 185 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| 186 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| 187 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 188 | setprop sys.usb.state ${sys.usb.config} |
| 189 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 190 | on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 191 | write /config/usb_gadget/g1/idProduct 0xD001 |
| 192 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| 193 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| 194 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 195 | setprop sys.usb.state ${sys.usb.config} |
| 196 | |
| 197 | on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 198 | write /config/usb_gadget/g1/idProduct 0x4EE0 |
| 199 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot" |
| 200 | symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1 |
| 201 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 202 | setprop sys.usb.state ${sys.usb.config} |