blob: 9add2494a4104665061187e87391e374b3f2f2d0 [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 Hughes4dca6f12017-12-06 08:41:50 -080016 symlink /system/bin /bin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080017 symlink /system/etc /etc
18
Elliott Hughes48ebb072016-06-15 15:15:15 -070019 mount cgroup none /acct cpuacct
20 mkdir /acct/uid
21
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080022 mkdir /sdcard
23 mkdir /system
24 mkdir /data
25 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070026 mkdir /sideload
Jiyong Park8b7af4c2018-06-01 11:58:54 +090027 mkdir /mnt/system
Doug Zongker075ef322014-01-14 09:50:35 -080028 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080029
Doug Zongker703ed152012-03-19 15:52:03 -070030 chown root shell /tmp
31 chmod 0775 /tmp
32
Colin Cross22bcf972014-06-24 13:43:39 -070033 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080034 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070035
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080036on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080037 ifup lo
38 hostname localhost
39 domainname localdomain
40
41 class_start default
42
Riley Andrewse739d7e2014-06-24 16:29:16 -070043# Load properties from /system/ + /factory after fs mount.
Paul Lawrence90c75b02015-07-06 10:44:33 -070044on load_system_props_action
45 load_system_props
Riley Andrewse739d7e2014-06-24 16:29:16 -070046
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
57 # Load properties from /system/ + /factory after fs mount. Place
58 # this in another action so that the load will be scheduled after the prior
59 # issued fs triggers have completed.
Paul Lawrence90c75b02015-07-06 10:44:33 -070060 trigger load_system_props_action
Riley Andrewse739d7e2014-06-24 16:29:16 -070061
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070062 # Remove a file to wake up anything waiting for firmware
63 trigger firmware_mounts_complete
64
Riley Andrewse739d7e2014-06-24 16:29:16 -070065 trigger early-boot
66 trigger boot
67
Tom Cherryb2fd1682018-07-24 15:58:29 -070068service ueventd /system/bin/ueventd
Colin Crossdd6a0412010-05-14 13:42:20 -070069 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050070 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080071
Sandeep Patilc4b381c2016-11-01 08:49:51 -070072service charger /charger -r
Todd Poynor2f2c9882013-06-04 13:11:44 -070073 critical
Sandeep Patilc4b381c2016-11-01 08:49:51 -070074 seclabel u:r:charger:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -070075
Hridya Valsarajucfb3c922018-07-26 13:04:06 -070076service recovery /system/bin/recovery
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070077 socket recovery stream 422 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050078 seclabel u:r:recovery:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080079
Jiyong Park8b7af4c2018-06-01 11:58:54 +090080service adbd /system/bin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -070081 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -070082 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050083 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080084
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070085service fastbootd /system/bin/fastbootd
86 disabled
87 group system
88 seclabel u:r:fastbootd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080089
Mike Lockwood718a2f72011-06-29 10:22:04 -040090# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -070091on property:service.adb.root=1
Doug Zongkerfb04b872011-06-23 15:30:34 -070092 restart adbd
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070093
94# Always start adbd on userdebug and eng builds
95on fs && property:ro.debuggable=1
96 setprop sys.usb.config adb
97
98on fs && property:sys.usb.configfs=1
99 mount configfs none /config
100 mkdir /config/usb_gadget/g1 0770 shell shell
101 write /config/usb_gadget/g1/idVendor 0x18D1
102 mkdir /config/usb_gadget/g1/strings/0x409 0770
103 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
104 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
105 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
106 mkdir /config/usb_gadget/g1/functions/ffs.adb
107 mkdir /config/usb_gadget/g1/functions/ffs.fastboot
108 mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell
109 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
110
111on fs && property:sys.usb.configfs=0
112 write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot
113 write /sys/class/android_usb/android0/idVendor 18D1
114 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
115 write /sys/class/android_usb/android0/iProduct ${ro.product.model}
116 write /sys/class/android_usb/android0/iSerial ${ro.serialno}
117
118on fs
119 mkdir /dev/usb-ffs 0775 shell shell
120 mkdir /dev/usb-ffs/adb 0770 shell shell
121 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
122 mkdir /dev/usb-ffs/fastboot 0770 system system
123 mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000
124
125on property:sys.usb.config=adb
126 start adbd
127
128on property:sys.usb.config=fastboot
129 start fastbootd
130
131on property:sys.usb.config=none
132 stop adbd
133 stop fastbootd
134
135on property:sys.usb.config=none && property:sys.usb.configfs=0
136 write /sys/class/android_usb/android0/enable 0
137 setprop sys.usb.state ${sys.usb.config}
138
139on property:sys.usb.config=adb && property:sys.usb.configfs=0
140 write /sys/class/android_usb/android0/idProduct D001
141 write /sys/class/android_usb/android0/functions adb
Doug Zongkerfb04b872011-06-23 15:30:34 -0700142 write /sys/class/android_usb/android0/enable 1
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700143 setprop sys.usb.state ${sys.usb.config}
144
145on property:sys.usb.config=fastboot && property:sys.usb.configfs=0
146 write /sys/class/android_usb/android0/idProduct 4EE0
147 write /sys/class/android_usb/android0/functions fastboot
148 write /sys/class/android_usb/android0/enable 1
149 setprop sys.usb.state ${sys.usb.config}
150
151# Configfs triggers
152on property:sys.usb.config=none && property:sys.usb.configfs=1
153 write /config/usb_gadget/g1/UDC "none"
154 setprop sys.usb.ffs.ready 0
155 rm /config/usb_gadget/g1/configs/b.1/f1
156 setprop sys.usb.state ${sys.usb.config}
157
158on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
159 write /config/usb_gadget/g1/idProduct 0xD001
160 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
161 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
162 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
163 setprop sys.usb.state ${sys.usb.config}
164
165on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
166 write /config/usb_gadget/g1/idProduct 0x4EE0
167 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot"
168 symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1
169 write /config/usb_gadget/g1/UDC ${sys.usb.controller}
170 setprop sys.usb.state ${sys.usb.config}