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