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 |
Jesse Zhao | 5bf74b2 | 2015-01-08 15:59:23 -0800 | [diff] [blame] | 37 | write /proc/sys/vm/max_map_count 1000000 |
Colin Cross | 22bcf97 | 2014-06-24 13:43:39 -0700 | [diff] [blame] | 38 | |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 39 | on fs |
Vojtech Bocek | 05ec1d4 | 2015-03-08 16:32:41 +0100 | [diff] [blame] | 40 | mount pstore pstore /sys/fs/pstore |
| 41 | |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 42 | mkdir /dev/usb-ffs 0770 shell shell |
| 43 | mkdir /dev/usb-ffs/adb 0770 shell shell |
| 44 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| 45 | |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 46 | write /sys/class/android_usb/android0/enable 0 |
| 47 | write /sys/class/android_usb/android0/idVendor 18D1 |
Ethan Yonker | df7abac | 2014-12-29 10:48:17 -0600 | [diff] [blame] | 48 | write /sys/class/android_usb/android0/idProduct 4EE2 |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 49 | write /sys/class/android_usb/android0/f_ffs/aliases adb |
Ethan Yonker | df7abac | 2014-12-29 10:48:17 -0600 | [diff] [blame] | 50 | write /sys/class/android_usb/android0/functions mtp,adb |
Matt Mower | 556411f | 2013-02-17 16:52:44 -0600 | [diff] [blame] | 51 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} |
| 52 | write /sys/class/android_usb/android0/iProduct ${ro.product.model} |
| 53 | write /sys/class/android_usb/android0/iSerial ${ro.serialno} |
| 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 | |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 66 | on firmware_mounts_complete |
| 67 | rm /dev/.booting |
| 68 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 69 | # Mount filesystems and start core system services. |
| 70 | on late-init |
| 71 | trigger early-fs |
| 72 | trigger fs |
| 73 | trigger post-fs |
| 74 | trigger post-fs-data |
| 75 | |
| 76 | # Load properties from /system/ + /factory after fs mount. Place |
| 77 | # this in another action so that the load will be scheduled after the prior |
| 78 | # issued fs triggers have completed. |
| 79 | trigger load_all_props_action |
| 80 | |
JP Abgrall | 9eb8c8b | 2014-10-20 20:02:57 -0700 | [diff] [blame] | 81 | # Remove a file to wake up anything waiting for firmware |
| 82 | trigger firmware_mounts_complete |
| 83 | |
Riley Andrews | e739d7e | 2014-06-24 16:29:16 -0700 | [diff] [blame] | 84 | trigger early-boot |
| 85 | trigger boot |
| 86 | |
Doug Zongker | 77ea71d | 2013-08-30 12:20:16 -0700 | [diff] [blame] | 87 | on property:sys.powerctl=* |
| 88 | powerctl ${sys.powerctl} |
| 89 | |
Jason Riordan | 26ff4c0 | 2014-01-16 22:44:15 -0500 | [diff] [blame] | 90 | on property:sys.storage.ums_enabled=1 |
| 91 | write /sys/class/android_usb/android0/enable 0 |
ramsudharsan | f846cac | 2015-04-10 12:38:16 +0530 | [diff] [blame^] | 92 | write /sys/class/android_usb/android0/functions mass_storage,adb |
Jason Riordan | 26ff4c0 | 2014-01-16 22:44:15 -0500 | [diff] [blame] | 93 | write /sys/class/android_usb/android0/enable 1 |
| 94 | |
| 95 | on property:sys.storage.ums_enabled=0 |
| 96 | write /sys/class/android_usb/android0/enable 0 |
Ethan Yonker | df7abac | 2014-12-29 10:48:17 -0600 | [diff] [blame] | 97 | write /sys/class/android_usb/android0/functions ${sys.usb.config} |
Jason Riordan | 26ff4c0 | 2014-01-16 22:44:15 -0500 | [diff] [blame] | 98 | write /sys/class/android_usb/android0/enable ${service.adb.root} |
| 99 | |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 100 | on property:sys.usb.config=none |
| 101 | stop adbd |
| 102 | write /sys/class/android_usb/android0/enable 0 |
| 103 | write /sys/class/android_usb/android0/bDeviceClass 0 |
| 104 | |
| 105 | on property:sys.usb.config=mtp,adb |
| 106 | stop adbd |
| 107 | write /sys/class/android_usb/android0/enable 0 |
| 108 | write /sys/class/android_usb/android0/functions mtp,adb |
| 109 | write /sys/class/android_usb/android0/enable 1 |
| 110 | start adbd |
| 111 | |
| 112 | on property:sys.usb.config=adb |
| 113 | stop adbd |
| 114 | write /sys/class/android_usb/android0/enable 0 |
| 115 | write /sys/class/android_usb/android0/functions adb |
| 116 | write /sys/class/android_usb/android0/enable ${service.adb.root} |
| 117 | start adbd |
| 118 | |
Colin Cross | dd6a041 | 2010-05-14 13:42:20 -0700 | [diff] [blame] | 119 | service ueventd /sbin/ueventd |
| 120 | critical |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 121 | seclabel u:r:ueventd:s0 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 122 | |
Todd Poynor | be96809 | 2013-09-13 16:34:12 -0700 | [diff] [blame] | 123 | service healthd /sbin/healthd -r |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 124 | critical |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 125 | seclabel u:r:healthd:s0 |
Todd Poynor | 2f2c988 | 2013-06-04 13:11:44 -0700 | [diff] [blame] | 126 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 127 | service recovery /sbin/recovery |
| 128 | |
Nick Kralevich | c52c5b8 | 2014-01-18 09:22:50 -0800 | [diff] [blame] | 129 | 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] | 130 | disabled |
Doug Zongker | cc2958f | 2013-09-11 13:24:32 -0700 | [diff] [blame] | 131 | socket adbd stream 660 system system |
Stephen Smalley | 2c9d5b2 | 2014-01-13 09:44:42 -0500 | [diff] [blame] | 132 | seclabel u:r:adbd:s0 |
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 | # Always start adbd on userdebug and eng builds |
| 135 | on property:ro.debuggable=1 |
Dees_Troy | 0cd4cc2 | 2013-06-09 20:56:38 +0000 | [diff] [blame] | 136 | #write /sys/class/android_usb/android0/enable 1 |
| 137 | #start adbd |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 138 | setprop service.adb.root 1 |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 139 | |
Mike Lockwood | 718a2f7 | 2011-06-29 10:22:04 -0400 | [diff] [blame] | 140 | # Restart adbd so it can run as root |
Doug Zongker | fb04b87 | 2011-06-23 15:30:34 -0700 | [diff] [blame] | 141 | on property:service.adb.root=1 |
| 142 | write /sys/class/android_usb/android0/enable 0 |
| 143 | restart adbd |
Benoit Goby | 689e06b | 2014-02-19 17:41:02 -0800 | [diff] [blame] | 144 | write /sys/class/android_usb/android0/enable 1 |