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