Zvikomborero VIncent Zvikaramba | a25011a | 2016-07-21 16:32:35 -0400 | [diff] [blame^] | 1 | import /init.recovery.${ro.hardware}.rc |
| 2 | |
| 3 | on early-init |
| 4 | # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls. |
| 5 | write /sys/fs/selinux/checkreqprot 0 |
| 6 | |
| 7 | # Set the security context for the init process. |
| 8 | # This should occur before anything else (e.g. ueventd) is started. |
| 9 | setcon u:r:init:s0 |
| 10 | |
| 11 | start ueventd |
| 12 | start healthd |
| 13 | |
| 14 | service set_permissive /sbin/toolbox setenforce 0 |
| 15 | oneshot |
| 16 | seclabel u:r:recovery:s0 |
| 17 | |
| 18 | on init |
| 19 | export PATH /sbin:/system/bin |
| 20 | export LD_LIBRARY_PATH .:/sbin |
| 21 | export ANDROID_ROOT /system |
| 22 | export ANDROID_DATA /data |
| 23 | export EXTERNAL_STORAGE /sdcard |
| 24 | |
| 25 | symlink /system/etc /etc |
| 26 | |
| 27 | mkdir /boot |
| 28 | mkdir /recovery |
| 29 | mkdir /sdcard |
| 30 | mkdir /sdcard1 |
| 31 | mkdir /external_sd |
| 32 | mkdir /.system |
| 33 | mkdir /system |
| 34 | mkdir /data |
| 35 | mkdir /cache |
| 36 | mkdir /sideload |
| 37 | mkdir /preload |
| 38 | mkdir /custom |
| 39 | mkdir /efs |
| 40 | mkdir /tmp |
| 41 | mkdir /carrier |
| 42 | mkdir /firmware 0711 system system |
| 43 | mount tmpfs tmpfs /tmp |
| 44 | |
| 45 | chown root shell /tmp |
| 46 | chmod 0775 /tmp |
| 47 | |
| 48 | write /proc/sys/kernel/panic_on_oops 1 |
| 49 | write /proc/sys/vm/max_map_count 1000000 |
| 50 | |
| 51 | on fs |
| 52 | mount pstore pstore /sys/fs/pstore |
| 53 | |
| 54 | mkdir /dev/usb-ffs 0770 shell shell |
| 55 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 56 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 57 | |
| 58 | write /sys/class/android_usb/android0/enable 0 |
| 59 | write /sys/class/android_usb/android0/idVendor 04e8 |
| 60 | write /sys/class/android_usb/android0/idProduct 6860 |
| 61 | write /sys/class/android_usb/android0/f_ffs/aliases adb |
| 62 | write /sys/class/android_usb/android0/functions mtp,adb |
| 63 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} |
| 64 | write /sys/class/android_usb/android0/iProduct ${ro.product.model} |
| 65 | write /sys/class/android_usb/android0/iSerial ${ro.serialno} |
| 66 | |
| 67 | on boot |
| 68 | ifup lo |
| 69 | hostname localhost |
| 70 | domainname localdomain |
| 71 | |
| 72 | class_start default |
| 73 | |
| 74 | # Load properties from /system/ + /factory after fs mount. |
| 75 | on load_all_props_action |
| 76 | load_all_props |
| 77 | |
| 78 | on firmware_mounts_complete |
| 79 | rm /dev/.booting |
| 80 | |
| 81 | # Mount filesystems and start core system services. |
| 82 | on late-init |
| 83 | trigger early-fs |
| 84 | trigger fs |
| 85 | trigger post-fs |
| 86 | trigger post-fs-data |
| 87 | |
| 88 | # Load properties from /system/ + /factory after fs mount. Place |
| 89 | # this in another action so that the load will be scheduled after the prior |
| 90 | # issued fs triggers have completed. |
| 91 | trigger load_all_props_action |
| 92 | |
| 93 | # Remove a file to wake up anything waiting for firmware |
| 94 | trigger firmware_mounts_complete |
| 95 | |
| 96 | trigger early-boot |
| 97 | trigger boot |
| 98 | |
| 99 | on property:sys.powerctl=* |
| 100 | powerctl ${sys.powerctl} |
| 101 | |
| 102 | on property:sys.storage.ums_enabled=1 |
| 103 | write /sys/class/android_usb/android0/enable 0 |
| 104 | write /sys/class/android_usb/android0/functions adb,mass_storage |
| 105 | write /sys/class/android_usb/android0/enable 1 |
| 106 | |
| 107 | on property:sys.storage.ums_enabled=0 |
| 108 | write /sys/class/android_usb/android0/enable 0 |
| 109 | write /sys/class/android_usb/android0/functions ${sys.usb.config} |
| 110 | write /sys/class/android_usb/android0/enable ${service.adb.root} |
| 111 | |
| 112 | on property:sys.usb.config=none |
| 113 | stop adbd |
| 114 | write /sys/class/android_usb/android0/enable 0 |
| 115 | write /sys/class/android_usb/android0/bDeviceClass 0 |
| 116 | |
| 117 | on property:sys.usb.config=mtp,adb |
| 118 | stop adbd |
| 119 | write /sys/class/android_usb/android0/enable 0 |
| 120 | write /sys/class/android_usb/android0/functions mtp,adb |
| 121 | write /sys/class/android_usb/android0/enable 1 |
| 122 | start adbd |
| 123 | |
| 124 | on property:sys.usb.config=adb |
| 125 | stop adbd |
| 126 | write /sys/class/android_usb/android0/enable 0 |
| 127 | write /sys/class/android_usb/android0/functions adb |
| 128 | write /sys/class/android_usb/android0/enable ${service.adb.root} |
| 129 | start adbd |
| 130 | |
| 131 | service ueventd /sbin/ueventd |
| 132 | critical |
| 133 | seclabel u:r:ueventd:s0 |
| 134 | |
| 135 | service healthd /sbin/healthd -n |
| 136 | critical |
| 137 | seclabel u:r:healthd:s0 |
| 138 | |
| 139 | service recovery /sbin/recovery |
| 140 | seclabel u:r:recovery:s0 |
| 141 | |
| 142 | service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery |
| 143 | disabled |
| 144 | socket adbd stream 660 system system |
| 145 | seclabel u:r:adbd:s0 |
| 146 | |
| 147 | # Always start adbd on userdebug and eng builds |
| 148 | on property:ro.debuggable=1 |
| 149 | #write /sys/class/android_usb/android0/enable 1 |
| 150 | #start adbd |
| 151 | setprop service.adb.root 1 |
| 152 | |
| 153 | # Restart adbd so it can run as root |
| 154 | on property:service.adb.root=1 |
| 155 | write /sys/class/android_usb/android0/enable 0 |
| 156 | restart adbd |
| 157 | write /sys/class/android_usb/android0/enable 1 |