bigbiff | d58ba18 | 2020-03-23 10:02:29 -0400 | [diff] [blame] | 1 | import /init.recovery.logd.rc |
| 2 | import /init.recovery.ldconfig.rc |
| 3 | import /init.recovery.mksh.rc |
| 4 | import /init.recovery.usb.rc |
| 5 | import /init.recovery.service.rc |
| 6 | import /init.recovery.vold_decrypt.rc |
| 7 | import /init.recovery.${ro.hardware}.rc |
| 8 | |
| 9 | on early-init |
| 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 | |
| 17 | # Set the security context of /postinstall if present. |
| 18 | restorecon /postinstall |
| 19 | |
| 20 | start ueventd |
| 21 | |
| 22 | service set_permissive /sbin/permissive.sh |
| 23 | oneshot |
| 24 | seclabel u:r:recovery:s0 |
| 25 | |
| 26 | on init |
| 27 | export PATH /sbin:/system/bin |
| 28 | export LD_LIBRARY_PATH /sbin |
| 29 | |
| 30 | export ANDROID_ROOT /system |
| 31 | export ANDROID_DATA /data |
| 32 | export EXTERNAL_STORAGE /sdcard |
| 33 | |
| 34 | symlink /proc/self/fd/0 /dev/stdin |
| 35 | symlink /proc/self/fd/1 /dev/stdout |
| 36 | symlink /proc/self/fd/2 /dev/stderr |
| 37 | |
| 38 | symlink /system/bin /bin |
| 39 | symlink /system/etc /etc |
| 40 | |
| 41 | mount cgroup none /acct cpuacct |
| 42 | mkdir /acct/uid |
| 43 | |
| 44 | mkdir /system |
| 45 | mkdir /data |
| 46 | mkdir /cache |
| 47 | mkdir /sideload |
| 48 | mkdir /mnt/system |
| 49 | mount tmpfs tmpfs /tmp |
| 50 | |
| 51 | chown root shell /tmp |
| 52 | chmod 0775 /tmp |
| 53 | |
| 54 | write /proc/sys/kernel/panic_on_oops 1 |
| 55 | write /proc/sys/vm/max_map_count 1000000 |
| 56 | |
| 57 | on fs |
| 58 | mount pstore pstore /sys/fs/pstore |
| 59 | mkdir /dev/usb-ffs 0770 shell shell |
| 60 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 61 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 62 | |
| 63 | on boot |
| 64 | ifup lo |
| 65 | hostname localhost |
| 66 | domainname localdomain |
| 67 | |
| 68 | class_start default |
| 69 | |
| 70 | # Load properties, pre-Android 6.0 |
| 71 | on load_all_props_action |
| 72 | load_all_props |
| 73 | |
| 74 | # Load properties, Android 6.0+ |
| 75 | on load_system_props_action |
| 76 | load_system_props |
| 77 | |
| 78 | # Load properties, Android 6.0+, vendor init lives here |
| 79 | on load_persist_props_action |
| 80 | load_persist_props |
| 81 | |
| 82 | on firmware_mounts_complete |
| 83 | rm /dev/.booting |
| 84 | |
| 85 | # Mount filesystems and start core system services. |
| 86 | on late-init |
| 87 | trigger early-fs |
| 88 | trigger fs |
| 89 | trigger post-fs |
| 90 | trigger post-fs-data |
| 91 | |
| 92 | # Load properties, pre-Android 6.0 |
| 93 | trigger load_all_props_action |
| 94 | |
| 95 | # Load properties from /system/ + /factory after fs mount. Place |
| 96 | # this in another action so that the load will be scheduled after the prior |
| 97 | # issued fs triggers have completed. |
| 98 | trigger load_system_props_action |
| 99 | |
| 100 | # Load properties, Android 6.0+, vendor init lives here |
| 101 | trigger load_persist_props_action |
| 102 | |
| 103 | # Remove a file to wake up anything waiting for firmware |
| 104 | trigger firmware_mounts_complete |
| 105 | |
| 106 | trigger early-boot |
| 107 | trigger boot |
| 108 | |
| 109 | on property:sys.powerctl=* |
| 110 | powerctl ${sys.powerctl} |
| 111 | |
| 112 | service ueventd /sbin/ueventd |
| 113 | critical |
| 114 | seclabel u:r:ueventd:s0 |
| 115 | |
| 116 | service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery |
| 117 | disabled |
| 118 | socket adbd stream 660 system system |
| 119 | seclabel u:r:adbd:s0 |
| 120 | |
| 121 | # Always start adbd on userdebug and eng builds |
| 122 | on property:ro.debuggable=1 |
| 123 | #write /sys/class/android_usb/android0/enable 1 |
| 124 | #start adbd |
| 125 | setprop service.adb.root 1 |
| 126 | |
| 127 | service fastbootd /sbin/fastbootd |
| 128 | disabled |
| 129 | group system |
| 130 | seclabel u:r:fastbootd:s0 |
| 131 | |
| 132 | # Restart adbd so it can run as root |
| 133 | on property:service.adb.root=1 |
| 134 | restart adbd |
| 135 | |
| 136 | # Always start adbd on userdebug and eng builds |
| 137 | on fs && property:ro.debuggable=1 |
| 138 | setprop sys.usb.config adb |
| 139 | |
| 140 | on fs && property:sys.usb.configfs=1 |
| 141 | mount configfs none /config |
| 142 | mkdir /config/usb_gadget/g1 0770 shell shell |
| 143 | write /config/usb_gadget/g1/idVendor 0x18D1 |
| 144 | mkdir /config/usb_gadget/g1/strings/0x409 0770 |
| 145 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
| 146 | write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} |
| 147 | write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} |
| 148 | mkdir /config/usb_gadget/g1/functions/ffs.adb |
| 149 | mkdir /config/usb_gadget/g1/functions/ffs.fastboot |
| 150 | mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell |
| 151 | mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell |
| 152 | |
| 153 | on fs && property:sys.usb.configfs=0 |
| 154 | write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot |
| 155 | write /sys/class/android_usb/android0/idVendor 18D1 |
| 156 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} |
| 157 | write /sys/class/android_usb/android0/iProduct ${ro.product.model} |
| 158 | write /sys/class/android_usb/android0/iSerial ${ro.serialno} |
| 159 | |
| 160 | on fs |
| 161 | mkdir /dev/usb-ffs 0775 shell shell |
| 162 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 163 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 164 | mkdir /dev/usb-ffs/fastboot 0770 system system |
| 165 | mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000 |
| 166 | |
| 167 | on property:sys.usb.config=adb |
| 168 | start adbd |
| 169 | |
| 170 | on property:sys.usb.config=fastboot |
| 171 | start fastbootd |
| 172 | |
| 173 | on property:sys.usb.config=none && property:sys.usb.configfs=0 |
| 174 | stop adbd |
| 175 | stop fastboot |
| 176 | write /sys/class/android_usb/android0/enable 0 |
| 177 | setprop sys.usb.state ${sys.usb.config} |
| 178 | |
| 179 | on property:sys.usb.config=adb && property:sys.usb.configfs=0 |
| 180 | write /sys/class/android_usb/android0/idProduct D001 |
| 181 | write /sys/class/android_usb/android0/functions adb |
| 182 | write /sys/class/android_usb/android0/enable 1 |
| 183 | setprop sys.usb.state ${sys.usb.config} |
| 184 | |
| 185 | on property:sys.usb.config=sideload && property:sys.usb.configfs=0 |
| 186 | write /sys/class/android_usb/android0/idProduct D001 |
| 187 | write /sys/class/android_usb/android0/functions adb |
| 188 | write /sys/class/android_usb/android0/enable 1 |
| 189 | setprop sys.usb.state ${sys.usb.config} |
| 190 | |
| 191 | on property:sys.usb.config=fastboot && property:sys.usb.configfs=0 |
| 192 | write /sys/class/android_usb/android0/idProduct 4EE0 |
| 193 | write /sys/class/android_usb/android0/functions fastboot |
| 194 | write /sys/class/android_usb/android0/enable 1 |
| 195 | setprop sys.usb.state ${sys.usb.config} |
| 196 | |
| 197 | # Configfs triggers |
| 198 | on property:sys.usb.config=none && property:sys.usb.configfs=1 |
| 199 | write /config/usb_gadget/g1/UDC "none" |
| 200 | stop adbd |
| 201 | stop fastbootd |
| 202 | setprop sys.usb.ffs.ready 0 |
| 203 | rm /config/usb_gadget/g1/configs/b.1/f1 |
| 204 | setprop sys.usb.state ${sys.usb.config} |
| 205 | |
| 206 | on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 207 | write /config/usb_gadget/g1/idProduct 0xD001 |
| 208 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| 209 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| 210 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 211 | setprop sys.usb.state ${sys.usb.config} |
| 212 | |
| 213 | on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 214 | write /config/usb_gadget/g1/idProduct 0xD001 |
| 215 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| 216 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| 217 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 218 | setprop sys.usb.state ${sys.usb.config} |
| 219 | |
| 220 | on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 |
| 221 | write /config/usb_gadget/g1/idProduct 0x4EE0 |
| 222 | write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot" |
| 223 | symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1 |
| 224 | write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| 225 | setprop sys.usb.state ${sys.usb.config} |