Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 1 | import /init.recovery.${ro.hardware}.rc |
| 2 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 3 | on early-init |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 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 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 11 | start ueventd |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 12 | start healthd |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 13 | |
Ethan Yonker | 6cb35aa | 2014-12-16 14:21:42 -0600 | [diff] [blame] | 14 | service set_permissive /sbin/toolbox setenforce 0 |
| 15 | oneshot |
| 16 | seclabel u:r:recovery:s0 |
| 17 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 18 | on init |
Doug Zongker | 55d6542 | 2014-01-14 09:50:35 -0800 | [diff] [blame] | 19 | export PATH /sbin:/system/bin |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 20 | export LD_LIBRARY_PATH .:/sbin |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | export ANDROID_ROOT /system |
| 22 | export ANDROID_DATA /data |
| 23 | export EXTERNAL_STORAGE /sdcard |
| 24 | |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 25 | mkdir /boot |
| 26 | mkdir /recovery |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 27 | mkdir /system |
| 28 | mkdir /data |
| 29 | mkdir /cache |
Doug Zongker | 075ad80 | 2014-06-26 15:35:51 -0700 | [diff] [blame] | 30 | mkdir /sideload |
Doug Zongker | 55d6542 | 2014-01-14 09:50:35 -0800 | [diff] [blame] | 31 | mount tmpfs tmpfs /tmp |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 32 | |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 33 | chown root shell /tmp |
| 34 | chmod 0775 /tmp |
| 35 | |
Colin Cross | 22bcf97 | 2014-06-24 13:43:39 -0700 | [diff] [blame] | 36 | write /proc/sys/kernel/panic_on_oops 1 |
| 37 | |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 38 | on fs |
Vojtech Bocek | 05ec1d4 | 2015-03-08 16:32:41 +0100 | [diff] [blame] | 39 | mount pstore pstore /sys/fs/pstore |
| 40 | |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 41 | mkdir /dev/usb-ffs 0770 shell shell |
| 42 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 43 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 44 | |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 45 | write /sys/class/android_usb/android0/enable 0 |
| 46 | write /sys/class/android_usb/android0/idVendor 18D1 |
Ethan Yonker | df7abac | 2014-12-29 10:48:17 -0600 | [diff] [blame] | 47 | write /sys/class/android_usb/android0/idProduct 4EE2 |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 48 | write /sys/class/android_usb/android0/f_ffs/aliases adb |
Ethan Yonker | df7abac | 2014-12-29 10:48:17 -0600 | [diff] [blame] | 49 | write /sys/class/android_usb/android0/functions mtp,adb |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 50 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} |
| 51 | write /sys/class/android_usb/android0/iProduct ${ro.product.model} |
| 52 | write /sys/class/android_usb/android0/iSerial ${ro.serialno} |
| 53 | |
| 54 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 55 | on boot |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 56 | ifup lo |
| 57 | hostname localhost |
| 58 | domainname localdomain |
| 59 | |
| 60 | class_start default |
| 61 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 62 | # Load properties from /system/ + /factory after fs mount. |
| 63 | on load_all_props_action |
| 64 | load_all_props |
| 65 | |
| 66 | # Mount filesystems and start core system services. |
| 67 | on late-init |
| 68 | trigger early-fs |
| 69 | trigger fs |
| 70 | trigger post-fs |
| 71 | trigger post-fs-data |
| 72 | |
| 73 | # Load properties from /system/ + /factory after fs mount. Place |
| 74 | # this in another action so that the load will be scheduled after the prior |
| 75 | # issued fs triggers have completed. |
| 76 | trigger load_all_props_action |
| 77 | |
| 78 | trigger early-boot |
| 79 | trigger boot |
| 80 | |
Doug Zongker | 77ea71d | 2013-08-30 12:20:16 -0700 | [diff] [blame] | 81 | on property:sys.powerctl=* |
| 82 | powerctl ${sys.powerctl} |
| 83 | |
Jason Riordan | 26ff4c0 | 2014-01-16 22:44:15 -0500 | [diff] [blame] | 84 | on property:sys.storage.ums_enabled=1 |
| 85 | write /sys/class/android_usb/android0/enable 0 |
| 86 | write /sys/class/android_usb/android0/functions adb,mass_storage |
| 87 | write /sys/class/android_usb/android0/enable 1 |
| 88 | |
| 89 | on property:sys.storage.ums_enabled=0 |
| 90 | write /sys/class/android_usb/android0/enable 0 |
Ethan Yonker | df7abac | 2014-12-29 10:48:17 -0600 | [diff] [blame] | 91 | write /sys/class/android_usb/android0/functions ${sys.usb.config} |
Jason Riordan | 26ff4c0 | 2014-01-16 22:44:15 -0500 | [diff] [blame] | 92 | write /sys/class/android_usb/android0/enable ${service.adb.root} |
| 93 | |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 94 | on property:sys.usb.config=none |
| 95 | stop adbd |
| 96 | write /sys/class/android_usb/android0/enable 0 |
| 97 | write /sys/class/android_usb/android0/bDeviceClass 0 |
| 98 | |
| 99 | on property:sys.usb.config=mtp,adb |
| 100 | stop adbd |
| 101 | write /sys/class/android_usb/android0/enable 0 |
| 102 | write /sys/class/android_usb/android0/functions mtp,adb |
| 103 | write /sys/class/android_usb/android0/enable 1 |
| 104 | start adbd |
| 105 | |
| 106 | on property:sys.usb.config=adb |
| 107 | stop adbd |
| 108 | write /sys/class/android_usb/android0/enable 0 |
| 109 | write /sys/class/android_usb/android0/functions adb |
| 110 | write /sys/class/android_usb/android0/enable ${service.adb.root} |
| 111 | start adbd |
| 112 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 113 | service ueventd /sbin/ueventd |
| 114 | critical |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 115 | seclabel u:r:ueventd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 116 | |
Todd Poynor | be96809 | 2013-09-13 16:34:12 -0700 | [diff] [blame] | 117 | service healthd /sbin/healthd -r |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 118 | critical |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 119 | seclabel u:r:healthd:s0 |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 120 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 121 | service recovery /sbin/recovery |
| 122 | |
Nick Kralevich | c52c5b8 | 2014-01-18 09:22:50 -0800 | [diff] [blame] | 123 | service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery |
Kenny Root | ecc76ba | 2010-06-28 09:01:22 -0700 | [diff] [blame] | 124 | disabled |
Doug Zongker | cc2958f | 2013-09-11 13:24:32 -0700 | [diff] [blame] | 125 | socket adbd stream 660 system system |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 126 | seclabel u:r:adbd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 127 | |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 128 | # Always start adbd on userdebug and eng builds |
| 129 | on property:ro.debuggable=1 |
Dees_Troy | 0cd4cc2 | 2013-06-09 20:56:38 +0000 | [diff] [blame] | 130 | #write /sys/class/android_usb/android0/enable 1 |
| 131 | #start adbd |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 132 | setprop service.adb.root 1 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 133 | |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 134 | # Restart adbd so it can run as root |
Doug Zongker | fb04b87 | 2011-06-23 15:30:34 -0700 | [diff] [blame] | 135 | on property:service.adb.root=1 |
| 136 | write /sys/class/android_usb/android0/enable 0 |
| 137 | restart adbd |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 138 | write /sys/class/android_usb/android0/enable 1 |