blob: c5138aae1fb2d6672868ccd2232d9a1e9b45b1d8 [file] [log] [blame]
Captain Throwback1f127752016-01-19 17:30:20 -05001import /init.recovery.logd.rc
Captain Throwback170964d2019-10-21 19:42:50 -04002import /init.recovery.ldconfig.rc
Captain Throwback5ab59642019-02-07 17:22:49 -05003import /init.recovery.mksh.rc
Matt Mowerec009e82015-01-30 13:00:49 -06004import /init.recovery.usb.rc
Ethan Yonkerf1179622016-08-25 15:32:21 -05005import /init.recovery.service.rc
nkk7171c6c502017-01-05 23:55:05 +02006import /init.recovery.vold_decrypt.rc
Matt Mower556411f2013-02-17 16:52:44 -06007import /init.recovery.${ro.hardware}.rc
8
Colin Crossdd6a0412010-05-14 13:42:20 -07009on early-init
Ethan Yonker58b09f12015-10-26 12:42:15 -050010 # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
11 write /sys/fs/selinux/checkreqprot 0
12
13 # Set the security context for the init process.
14 # This should occur before anything else (e.g. ueventd) is started.
15 setcon u:r:init:s0
16
Alex Deymo080f5222016-03-02 14:21:02 -080017 # Set the security context of /postinstall if present.
18 restorecon /postinstall
19
Colin Crossdd6a0412010-05-14 13:42:20 -070020 start ueventd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080021
bigbiff26d5d5f2020-03-23 09:56:16 -040022<<<<<<< HEAD
Ethan Yonkerc798c9c2015-10-09 11:15:26 -050023service set_permissive /sbin/permissive.sh
Ethan Yonker6cb35aa2014-12-16 14:21:42 -060024 oneshot
25 seclabel u:r:recovery:s0
bigbiff26d5d5f2020-03-23 09:56:16 -040026=======
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070027 setprop sys.usb.configfs 0
bigbiff26d5d5f2020-03-23 09:56:16 -040028>>>>>>> android-10.0.0_r25
Ethan Yonker6cb35aa2014-12-16 14:21:42 -060029
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080030on init
Doug Zongker55d65422014-01-14 09:50:35 -080031 export PATH /sbin:/system/bin
that9c3b7e92017-03-14 20:42:45 +010032 export LD_LIBRARY_PATH /sbin
Ethan Yonker34ae4832016-08-24 15:32:18 -050033
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080034 export ANDROID_ROOT /system
35 export ANDROID_DATA /data
36 export EXTERNAL_STORAGE /sdcard
37
bigbiff26d5d5f2020-03-23 09:56:16 -040038<<<<<<< HEAD
39=======
Elliott Hughesa4495b52018-08-23 08:31:59 -070040 symlink /proc/self/fd/0 /dev/stdin
41 symlink /proc/self/fd/1 /dev/stdout
42 symlink /proc/self/fd/2 /dev/stderr
43
Elliott Hughes4dca6f12017-12-06 08:41:50 -080044 symlink /system/bin /bin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080045 symlink /system/etc /etc
46
bigbiff26d5d5f2020-03-23 09:56:16 -040047>>>>>>> android-10.0.0_r25
Elliott Hughes48ebb072016-06-15 15:15:15 -070048 mount cgroup none /acct cpuacct
49 mkdir /acct/uid
50
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080051 mkdir /system
52 mkdir /data
53 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070054 mkdir /sideload
Jiyong Park8b7af4c2018-06-01 11:58:54 +090055 mkdir /mnt/system
Doug Zongker55d65422014-01-14 09:50:35 -080056 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080057
Matt Mower556411f2013-02-17 16:52:44 -060058 chown root shell /tmp
59 chmod 0775 /tmp
60
Colin Cross22bcf972014-06-24 13:43:39 -070061 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080062 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070063
bigbiff26d5d5f2020-03-23 09:56:16 -040064<<<<<<< HEAD
Benoit Goby689e06b2014-02-19 17:41:02 -080065on fs
Vojtech Bocek05ec1d42015-03-08 16:32:41 +010066 mount pstore pstore /sys/fs/pstore
Benoit Goby689e06b2014-02-19 17:41:02 -080067 mkdir /dev/usb-ffs 0770 shell shell
68 mkdir /dev/usb-ffs/adb 0770 shell shell
69 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
70
bigbiff26d5d5f2020-03-23 09:56:16 -040071=======
72>>>>>>> android-10.0.0_r25
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080073on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080074 ifup lo
75 hostname localhost
76 domainname localdomain
77
78 class_start default
79
Matt Mower4251a9b2015-11-13 14:01:49 -060080# Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070081on load_all_props_action
82 load_all_props
83
Matt Mower4251a9b2015-11-13 14:01:49 -060084# Load properties, Android 6.0+
85on load_system_props_action
86 load_system_props
87
88# Load properties, Android 6.0+, vendor init lives here
89on load_persist_props_action
90 load_persist_props
91
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070092on firmware_mounts_complete
Matt Mower4251a9b2015-11-13 14:01:49 -060093 rm /dev/.booting
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070094
Riley Andrewse739d7e2014-06-24 16:29:16 -070095# Mount filesystems and start core system services.
96on late-init
97 trigger early-fs
98 trigger fs
99 trigger post-fs
100 trigger post-fs-data
101
Matt Mower4251a9b2015-11-13 14:01:49 -0600102 # Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -0700103 trigger load_all_props_action
104
Riley Andrewse739d7e2014-06-24 16:29:16 -0700105 # Load properties from /system/ + /factory after fs mount. Place
106 # this in another action so that the load will be scheduled after the prior
107 # issued fs triggers have completed.
Paul Lawrence90c75b02015-07-06 10:44:33 -0700108 trigger load_system_props_action
Riley Andrewse739d7e2014-06-24 16:29:16 -0700109
Matt Mower4251a9b2015-11-13 14:01:49 -0600110 # Load properties, Android 6.0+, vendor init lives here
111 trigger load_persist_props_action
112
JP Abgrall9eb8c8b2014-10-20 20:02:57 -0700113 # Remove a file to wake up anything waiting for firmware
114 trigger firmware_mounts_complete
115
Riley Andrewse739d7e2014-06-24 16:29:16 -0700116 trigger early-boot
117 trigger boot
118
bigbiff26d5d5f2020-03-23 09:56:16 -0400119<<<<<<< HEAD
Doug Zongker77ea71d2013-08-30 12:20:16 -0700120on property:sys.powerctl=*
121 powerctl ${sys.powerctl}
122
Colin Crossdd6a0412010-05-14 13:42:20 -0700123service ueventd /sbin/ueventd
124 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500125 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800126
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800127service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
bigbiff26d5d5f2020-03-23 09:56:16 -0400128=======
Tom Cherryb2fd1682018-07-24 15:58:29 -0700129service ueventd /system/bin/ueventd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800130 critical
131 seclabel u:r:ueventd:s0
132
Tao Baoa89c21c2018-09-11 14:50:02 -0700133service charger /system/bin/charger
Todd Poynor2f2c9882013-06-04 13:11:44 -0700134 critical
Sandeep Patilc4b381c2016-11-01 08:49:51 -0700135 seclabel u:r:charger:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -0700136
Hridya Valsarajucfb3c922018-07-26 13:04:06 -0700137service recovery /system/bin/recovery
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700138 socket recovery stream 422 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500139 seclabel u:r:recovery:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800140
Jiyong Park8b7af4c2018-06-01 11:58:54 +0900141service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
bigbiff26d5d5f2020-03-23 09:56:16 -0400142>>>>>>> android-10.0.0_r25
Kenny Rootecc76ba2010-06-28 09:01:22 -0700143 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700144 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500145 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800146
bigbiff26d5d5f2020-03-23 09:56:16 -0400147<<<<<<< HEAD
Mike Lockwood718a2f72011-06-29 10:22:04 -0400148# Always start adbd on userdebug and eng builds
149on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000150 #write /sys/class/android_usb/android0/enable 1
151 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400152 setprop service.adb.root 1
bigbiff26d5d5f2020-03-23 09:56:16 -0400153=======
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700154service fastbootd /system/bin/fastbootd
155 disabled
156 group system
157 seclabel u:r:fastbootd:s0
bigbiff26d5d5f2020-03-23 09:56:16 -0400158>>>>>>> android-10.0.0_r25
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800159
Mike Lockwood718a2f72011-06-29 10:22:04 -0400160# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700161on property:service.adb.root=1
Doug Zongkerfb04b872011-06-23 15:30:34 -0700162 restart adbd
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700163
164# Always start adbd on userdebug and eng builds
165on fs && property:ro.debuggable=1
166 setprop sys.usb.config adb
167
168on fs && property:sys.usb.configfs=1
169 mount configfs none /config
170 mkdir /config/usb_gadget/g1 0770 shell shell
171 write /config/usb_gadget/g1/idVendor 0x18D1
172 mkdir /config/usb_gadget/g1/strings/0x409 0770
173 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
174 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
175 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
176 mkdir /config/usb_gadget/g1/functions/ffs.adb
177 mkdir /config/usb_gadget/g1/functions/ffs.fastboot
178 mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell
179 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
180
181on fs && property:sys.usb.configfs=0
182 write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot
183 write /sys/class/android_usb/android0/idVendor 18D1
184 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
185 write /sys/class/android_usb/android0/iProduct ${ro.product.model}
186 write /sys/class/android_usb/android0/iSerial ${ro.serialno}
187
188on fs
189 mkdir /dev/usb-ffs 0775 shell shell
190 mkdir /dev/usb-ffs/adb 0770 shell shell
191 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
192 mkdir /dev/usb-ffs/fastboot 0770 system system
193 mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000
194
195on property:sys.usb.config=adb
196 start adbd
197
198on property:sys.usb.config=fastboot
199 start fastbootd
200
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700201on property:sys.usb.config=none && property:sys.usb.configfs=0
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700202 stop adbd
203 stop fastboot
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700204 write /sys/class/android_usb/android0/enable 0
205 setprop sys.usb.state ${sys.usb.config}
206
207on property:sys.usb.config=adb && property:sys.usb.configfs=0
208 write /sys/class/android_usb/android0/idProduct D001
209 write /sys/class/android_usb/android0/functions adb
Benoit Goby689e06b2014-02-19 17:41:02 -0800210 write /sys/class/android_usb/android0/enable 1
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700211 setprop sys.usb.state ${sys.usb.config}
212
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700213on property:sys.usb.config=sideload && property:sys.usb.configfs=0
214 write /sys/class/android_usb/android0/idProduct D001
215 write /sys/class/android_usb/android0/functions adb
216 write /sys/class/android_usb/android0/enable 1
217 setprop sys.usb.state ${sys.usb.config}
218
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700219on property:sys.usb.config=fastboot && property:sys.usb.configfs=0
220 write /sys/class/android_usb/android0/idProduct 4EE0
221 write /sys/class/android_usb/android0/functions fastboot
222 write /sys/class/android_usb/android0/enable 1
223 setprop sys.usb.state ${sys.usb.config}
224
225# Configfs triggers
226on property:sys.usb.config=none && property:sys.usb.configfs=1
227 write /config/usb_gadget/g1/UDC "none"
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700228 stop adbd
229 stop fastbootd
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700230 setprop sys.usb.ffs.ready 0
231 rm /config/usb_gadget/g1/configs/b.1/f1
232 setprop sys.usb.state ${sys.usb.config}
233
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700234on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
235 write /config/usb_gadget/g1/idProduct 0xD001
236 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
237 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
238 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
239 setprop sys.usb.state ${sys.usb.config}
240
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700241on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
242 write /config/usb_gadget/g1/idProduct 0xD001
243 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
244 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
245 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
246 setprop sys.usb.state ${sys.usb.config}
247
248on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
249 write /config/usb_gadget/g1/idProduct 0x4EE0
250 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot"
251 symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1
252 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
253 setprop sys.usb.state ${sys.usb.config}