blob: f77c39ba3a4555b9ab33131a960c3da7a6568813 [file] [log] [blame]
Matt Mower556411f2013-02-17 16:52:44 -06001import /init.recovery.${ro.hardware}.rc
2
Colin Crossdd6a0412010-05-14 13:42:20 -07003on early-init
Stephen Smalley2c9d5b22014-01-13 09:44:42 -05004 # 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 Crossdd6a0412010-05-14 13:42:20 -070011 start ueventd
Todd Poynor2f2c9882013-06-04 13:11:44 -070012 start healthd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080013
Ethan Yonker6cb35aa2014-12-16 14:21:42 -060014service set_permissive /sbin/toolbox setenforce 0
15 oneshot
16 seclabel u:r:recovery:s0
17
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080018on init
Doug Zongker55d65422014-01-14 09:50:35 -080019 export PATH /sbin:/system/bin
Dees_Troy51a0e822012-09-05 15:24:24 -040020 export LD_LIBRARY_PATH .:/sbin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080021 export ANDROID_ROOT /system
22 export ANDROID_DATA /data
23 export EXTERNAL_STORAGE /sdcard
24
Matt Mower556411f2013-02-17 16:52:44 -060025 mkdir /boot
26 mkdir /recovery
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080027 mkdir /system
28 mkdir /data
29 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070030 mkdir /sideload
Doug Zongker55d65422014-01-14 09:50:35 -080031 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080032
Matt Mower556411f2013-02-17 16:52:44 -060033 chown root shell /tmp
34 chmod 0775 /tmp
35
Colin Cross22bcf972014-06-24 13:43:39 -070036 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080037 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070038
Benoit Goby689e06b2014-02-19 17:41:02 -080039on fs
Vojtech Bocek05ec1d42015-03-08 16:32:41 +010040 mount pstore pstore /sys/fs/pstore
41
Benoit Goby689e06b2014-02-19 17:41:02 -080042 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 Mower556411f2013-02-17 16:52:44 -060046 write /sys/class/android_usb/android0/enable 0
47 write /sys/class/android_usb/android0/idVendor 18D1
Ethan Yonkerdf7abac2014-12-29 10:48:17 -060048 write /sys/class/android_usb/android0/idProduct 4EE2
Benoit Goby689e06b2014-02-19 17:41:02 -080049 write /sys/class/android_usb/android0/f_ffs/aliases adb
Ethan Yonkerdf7abac2014-12-29 10:48:17 -060050 write /sys/class/android_usb/android0/functions mtp,adb
Matt Mower556411f2013-02-17 16:52:44 -060051 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 Projectc24a8e62009-03-03 19:28:42 -080055on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080056 ifup lo
57 hostname localhost
58 domainname localdomain
59
60 class_start default
61
Riley Andrewse739d7e2014-06-24 16:29:16 -070062# Load properties from /system/ + /factory after fs mount.
63on load_all_props_action
64 load_all_props
65
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070066on firmware_mounts_complete
67 rm /dev/.booting
68
Riley Andrewse739d7e2014-06-24 16:29:16 -070069# Mount filesystems and start core system services.
70on 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 Abgrall9eb8c8b2014-10-20 20:02:57 -070081 # Remove a file to wake up anything waiting for firmware
82 trigger firmware_mounts_complete
83
Riley Andrewse739d7e2014-06-24 16:29:16 -070084 trigger early-boot
85 trigger boot
86
Doug Zongker77ea71d2013-08-30 12:20:16 -070087on property:sys.powerctl=*
88 powerctl ${sys.powerctl}
89
Jason Riordan26ff4c02014-01-16 22:44:15 -050090on property:sys.storage.ums_enabled=1
91 write /sys/class/android_usb/android0/enable 0
ramsudharsanf846cac2015-04-10 12:38:16 +053092 write /sys/class/android_usb/android0/functions mass_storage,adb
Jason Riordan26ff4c02014-01-16 22:44:15 -050093 write /sys/class/android_usb/android0/enable 1
94
95on property:sys.storage.ums_enabled=0
96 write /sys/class/android_usb/android0/enable 0
Ethan Yonkerdf7abac2014-12-29 10:48:17 -060097 write /sys/class/android_usb/android0/functions ${sys.usb.config}
Jason Riordan26ff4c02014-01-16 22:44:15 -050098 write /sys/class/android_usb/android0/enable ${service.adb.root}
99
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -0400100on 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
105on 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
112on 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 Crossdd6a0412010-05-14 13:42:20 -0700119service ueventd /sbin/ueventd
120 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500121 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800122
Todd Poynorbe968092013-09-13 16:34:12 -0700123service healthd /sbin/healthd -r
Todd Poynor2f2c9882013-06-04 13:11:44 -0700124 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500125 seclabel u:r:healthd:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -0700126
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800127service recovery /sbin/recovery
128
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800129service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700130 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700131 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500132 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800133
Mike Lockwood718a2f72011-06-29 10:22:04 -0400134# Always start adbd on userdebug and eng builds
135on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000136 #write /sys/class/android_usb/android0/enable 1
137 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400138 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800139
Mike Lockwood718a2f72011-06-29 10:22:04 -0400140# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700141on property:service.adb.root=1
142 write /sys/class/android_usb/android0/enable 0
143 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800144 write /sys/class/android_usb/android0/enable 1