blob: c54de5af2fb3df1d2cce2b01d0df9c8669944854 [file] [log] [blame]
Colin Crossf510f062012-08-08 13:06:26 -07001import /init.recovery.${ro.hardware}.rc
2
Colin Crossdd6a0412010-05-14 13:42:20 -07003on early-init
Alex Deymo6bcc8af2016-03-02 14:21:02 -08004 # Set the security context of /postinstall if present.
5 restorecon /postinstall
6
Colin Crossdd6a0412010-05-14 13:42:20 -07007 start ueventd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -08008
Hridya Valsaraju20c81b32018-07-27 22:09:12 -07009 setprop sys.usb.configfs 0
10
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080011on init
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080012 export ANDROID_ROOT /system
13 export ANDROID_DATA /data
14 export EXTERNAL_STORAGE /sdcard
15
Elliott Hughesa4495b52018-08-23 08:31:59 -070016 symlink /proc/self/fd/0 /dev/stdin
17 symlink /proc/self/fd/1 /dev/stdout
18 symlink /proc/self/fd/2 /dev/stderr
19
Elliott Hughes4dca6f12017-12-06 08:41:50 -080020 symlink /system/bin /bin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080021 symlink /system/etc /etc
22
Elliott Hughes48ebb072016-06-15 15:15:15 -070023 mount cgroup none /acct cpuacct
24 mkdir /acct/uid
25
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080026 mkdir /sdcard
27 mkdir /system
28 mkdir /data
29 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070030 mkdir /sideload
Jiyong Park8b7af4c2018-06-01 11:58:54 +090031 mkdir /mnt/system
Doug Zongker075ef322014-01-14 09:50:35 -080032 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080033
Doug Zongker703ed152012-03-19 15:52:03 -070034 chown root shell /tmp
35 chmod 0775 /tmp
36
Colin Cross22bcf972014-06-24 13:43:39 -070037 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080038 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070039
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080040on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080041 ifup lo
42 hostname localhost
43 domainname localdomain
44
45 class_start default
46
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070047on firmware_mounts_complete
48 rm /dev/.booting
49
Riley Andrewse739d7e2014-06-24 16:29:16 -070050# Mount filesystems and start core system services.
51on late-init
52 trigger early-fs
53 trigger fs
54 trigger post-fs
55 trigger post-fs-data
56
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070057 # Remove a file to wake up anything waiting for firmware
58 trigger firmware_mounts_complete
59
Riley Andrewse739d7e2014-06-24 16:29:16 -070060 trigger early-boot
61 trigger boot
62
Tom Cherryb2fd1682018-07-24 15:58:29 -070063service ueventd /system/bin/ueventd
Colin Crossdd6a0412010-05-14 13:42:20 -070064 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050065 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080066
Tao Baoa89c21c2018-09-11 14:50:02 -070067service charger /system/bin/charger
Todd Poynor2f2c9882013-06-04 13:11:44 -070068 critical
Sandeep Patilc4b381c2016-11-01 08:49:51 -070069 seclabel u:r:charger:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -070070
Hridya Valsarajucfb3c922018-07-26 13:04:06 -070071service recovery /system/bin/recovery
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070072 socket recovery stream 422 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050073 seclabel u:r:recovery:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080074
Jiyong Park8b7af4c2018-06-01 11:58:54 +090075service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -070076 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -070077 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050078 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080079
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070080service fastbootd /system/bin/fastbootd
81 disabled
82 group system
83 seclabel u:r:fastbootd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080084
Mike Lockwood718a2f72011-06-29 10:22:04 -040085# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -070086on property:service.adb.root=1
Doug Zongkerfb04b872011-06-23 15:30:34 -070087 restart adbd
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070088
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070089on fs && property:sys.usb.configfs=1
90 mount configfs none /config
91 mkdir /config/usb_gadget/g1 0770 shell shell
92 write /config/usb_gadget/g1/idVendor 0x18D1
93 mkdir /config/usb_gadget/g1/strings/0x409 0770
94 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
95 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
96 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
97 mkdir /config/usb_gadget/g1/functions/ffs.adb
98 mkdir /config/usb_gadget/g1/functions/ffs.fastboot
99 mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell
100 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
101
102on fs && property:sys.usb.configfs=0
103 write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot
104 write /sys/class/android_usb/android0/idVendor 18D1
105 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
106 write /sys/class/android_usb/android0/iProduct ${ro.product.model}
107 write /sys/class/android_usb/android0/iSerial ${ro.serialno}
108
109on fs
110 mkdir /dev/usb-ffs 0775 shell shell
111 mkdir /dev/usb-ffs/adb 0770 shell shell
112 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
113 mkdir /dev/usb-ffs/fastboot 0770 system system
114 mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000
115
116on property:sys.usb.config=adb
117 start adbd
118
119on property:sys.usb.config=fastboot
120 start fastbootd
121
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700122on property:sys.usb.config=none && property:sys.usb.configfs=0
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700123 stop adbd
124 stop fastboot
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700125 write /sys/class/android_usb/android0/enable 0
126 setprop sys.usb.state ${sys.usb.config}
127
128on property:sys.usb.config=adb && property:sys.usb.configfs=0
129 write /sys/class/android_usb/android0/idProduct D001
130 write /sys/class/android_usb/android0/functions adb
Doug Zongkerfb04b872011-06-23 15:30:34 -0700131 write /sys/class/android_usb/android0/enable 1
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700132 setprop sys.usb.state ${sys.usb.config}
133
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700134on property:sys.usb.config=sideload && property:sys.usb.configfs=0
135 write /sys/class/android_usb/android0/idProduct D001
136 write /sys/class/android_usb/android0/functions adb
137 write /sys/class/android_usb/android0/enable 1
138 setprop sys.usb.state ${sys.usb.config}
139
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700140on property:sys.usb.config=fastboot && property:sys.usb.configfs=0
141 write /sys/class/android_usb/android0/idProduct 4EE0
142 write /sys/class/android_usb/android0/functions fastboot
143 write /sys/class/android_usb/android0/enable 1
144 setprop sys.usb.state ${sys.usb.config}
145
146# Configfs triggers
147on property:sys.usb.config=none && property:sys.usb.configfs=1
148 write /config/usb_gadget/g1/UDC "none"
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700149 stop adbd
150 stop fastbootd
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700151 setprop sys.usb.ffs.ready 0
152 rm /config/usb_gadget/g1/configs/b.1/f1
153 setprop sys.usb.state ${sys.usb.config}
154
Hridya Valsarajue4ef4532018-08-31 11:57:51 -0700155on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
156 write /config/usb_gadget/g1/idProduct 0xD001
157 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
158 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
159 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
160 setprop sys.usb.state ${sys.usb.config}
161
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700162on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
163 write /config/usb_gadget/g1/idProduct 0xD001
164 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
165 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
166 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
167 setprop sys.usb.state ${sys.usb.config}
168
169on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
170 write /config/usb_gadget/g1/idProduct 0x4EE0
171 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot"
172 symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1
173 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
174 setprop sys.usb.state ${sys.usb.config}