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 mount cgroup none /acct cpuacct 28 mkdir /acct/uid 29 30 mkdir /sdcard 31 mkdir /system 32 mkdir /data 33 mkdir /cache 34 mkdir /sideload 35 mkdir /mnt/system 36 mount tmpfs tmpfs /tmp 37 38 chown root shell /tmp 39 chmod 0775 /tmp 40 41 write /proc/sys/kernel/panic_on_oops 1 42 write /proc/sys/vm/max_map_count 1000000 43 44on boot 45 ifup lo 46 hostname localhost 47 domainname localdomain 48 49 class_start default 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 # Remove a file to wake up anything waiting for firmware 62 trigger firmware_mounts_complete 63 64 trigger early-boot 65 trigger boot 66 67service ueventd /system/bin/ueventd 68 critical 69 seclabel u:r:ueventd:s0 70 71service charger /system/bin/charger 72 critical 73 seclabel u:r:charger:s0 74 75service recovery /system/bin/recovery 76 socket recovery stream 422 system system 77 seclabel u:r:recovery:s0 78 79service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery 80 disabled 81 socket adbd stream 660 system system 82 seclabel u:r:adbd:s0 83 84service fastbootd /system/bin/fastbootd 85 disabled 86 group system 87 seclabel u:r:fastbootd:s0 88 89# Restart adbd so it can run as root 90on property:service.adb.root=1 91 restart adbd 92 93on fs && property:sys.usb.configfs=1 94 mount configfs none /config 95 mkdir /config/usb_gadget/g1 0770 shell shell 96 write /config/usb_gadget/g1/idVendor 0x18D1 97 mkdir /config/usb_gadget/g1/strings/0x409 0770 98 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} 99 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} 100 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} 101 mkdir /config/usb_gadget/g1/functions/ffs.adb 102 mkdir /config/usb_gadget/g1/functions/ffs.fastboot 103 mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell 104 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell 105 106on fs && property:sys.usb.configfs=0 107 write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot 108 write /sys/class/android_usb/android0/idVendor 18D1 109 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} 110 write /sys/class/android_usb/android0/iProduct ${ro.product.model} 111 write /sys/class/android_usb/android0/iSerial ${ro.serialno} 112 113on fs 114 mkdir /dev/usb-ffs 0775 shell shell 115 mkdir /dev/usb-ffs/adb 0770 shell shell 116 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 117 mkdir /dev/usb-ffs/fastboot 0770 system system 118 mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000 119 120on property:sys.usb.config=adb 121 start adbd 122 123on property:sys.usb.config=fastboot 124 start fastbootd 125 126on property:sys.usb.config=none && property:sys.usb.configfs=0 127 stop adbd 128 stop fastbootd 129 write /sys/class/android_usb/android0/enable 0 130 setprop sys.usb.state ${sys.usb.config} 131 132on property:sys.usb.config=adb && property:sys.usb.configfs=0 133 write /sys/class/android_usb/android0/idProduct D001 134 write /sys/class/android_usb/android0/functions adb 135 write /sys/class/android_usb/android0/enable 1 136 setprop sys.usb.state ${sys.usb.config} 137 138on property:sys.usb.config=sideload && property:sys.usb.configfs=0 139 write /sys/class/android_usb/android0/idProduct D001 140 write /sys/class/android_usb/android0/functions adb 141 write /sys/class/android_usb/android0/enable 1 142 setprop sys.usb.state ${sys.usb.config} 143 144on property:sys.usb.config=fastboot && property:sys.usb.configfs=0 145 write /sys/class/android_usb/android0/idProduct 4EE0 146 write /sys/class/android_usb/android0/functions fastboot 147 write /sys/class/android_usb/android0/enable 1 148 setprop sys.usb.state ${sys.usb.config} 149 150# Configfs triggers 151on property:sys.usb.config=none && property:sys.usb.configfs=1 152 write /config/usb_gadget/g1/UDC "none" 153 stop adbd 154 stop fastbootd 155 setprop sys.usb.ffs.ready 0 156 rm /config/usb_gadget/g1/configs/b.1/f1 157 setprop sys.usb.state ${sys.usb.config} 158 159on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 160 write /config/usb_gadget/g1/idProduct 0xD001 161 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" 162 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 163 write /config/usb_gadget/g1/UDC ${sys.usb.controller} 164 setprop sys.usb.state ${sys.usb.config} 165 166on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 167 write /config/usb_gadget/g1/idProduct 0xD001 168 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" 169 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 170 write /config/usb_gadget/g1/UDC ${sys.usb.controller} 171 setprop sys.usb.state ${sys.usb.config} 172 173on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 174 write /config/usb_gadget/g1/idProduct 0x4EE0 175 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot" 176 symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1 177 write /config/usb_gadget/g1/UDC ${sys.usb.controller} 178 setprop sys.usb.state ${sys.usb.config} 179