blob: d0d8ed91baf0521bb3cd95d51f34b8894bd0d024 [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
37
Benoit Goby689e06b2014-02-19 17:41:02 -080038on fs
Vojtech Bocek05ec1d42015-03-08 16:32:41 +010039 mount pstore pstore /sys/fs/pstore
40
Benoit Goby689e06b2014-02-19 17:41:02 -080041 mkdir /dev/usb-ffs 0770 shell shell
42 mkdir /dev/usb-ffs/adb 0770 shell shell
43 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
44
Matt Mower556411f2013-02-17 16:52:44 -060045 write /sys/class/android_usb/android0/enable 0
46 write /sys/class/android_usb/android0/idVendor 18D1
Ethan Yonkerdf7abac2014-12-29 10:48:17 -060047 write /sys/class/android_usb/android0/idProduct 4EE2
Benoit Goby689e06b2014-02-19 17:41:02 -080048 write /sys/class/android_usb/android0/f_ffs/aliases adb
Ethan Yonkerdf7abac2014-12-29 10:48:17 -060049 write /sys/class/android_usb/android0/functions mtp,adb
Matt Mower556411f2013-02-17 16:52:44 -060050 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
51 write /sys/class/android_usb/android0/iProduct ${ro.product.model}
52 write /sys/class/android_usb/android0/iSerial ${ro.serialno}
53
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
66# Mount filesystems and start core system services.
67on late-init
68 trigger early-fs
69 trigger fs
70 trigger post-fs
71 trigger post-fs-data
72
73 # Load properties from /system/ + /factory after fs mount. Place
74 # this in another action so that the load will be scheduled after the prior
75 # issued fs triggers have completed.
76 trigger load_all_props_action
77
78 trigger early-boot
79 trigger boot
80
Doug Zongker77ea71d2013-08-30 12:20:16 -070081on property:sys.powerctl=*
82 powerctl ${sys.powerctl}
83
Jason Riordan26ff4c02014-01-16 22:44:15 -050084on property:sys.storage.ums_enabled=1
85 write /sys/class/android_usb/android0/enable 0
86 write /sys/class/android_usb/android0/functions adb,mass_storage
87 write /sys/class/android_usb/android0/enable 1
88
89on property:sys.storage.ums_enabled=0
90 write /sys/class/android_usb/android0/enable 0
Ethan Yonkerdf7abac2014-12-29 10:48:17 -060091 write /sys/class/android_usb/android0/functions ${sys.usb.config}
Jason Riordan26ff4c02014-01-16 22:44:15 -050092 write /sys/class/android_usb/android0/enable ${service.adb.root}
93
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040094on property:sys.usb.config=none
95 stop adbd
96 write /sys/class/android_usb/android0/enable 0
97 write /sys/class/android_usb/android0/bDeviceClass 0
98
99on property:sys.usb.config=mtp,adb
100 stop adbd
101 write /sys/class/android_usb/android0/enable 0
102 write /sys/class/android_usb/android0/functions mtp,adb
103 write /sys/class/android_usb/android0/enable 1
104 start adbd
105
106on property:sys.usb.config=adb
107 stop adbd
108 write /sys/class/android_usb/android0/enable 0
109 write /sys/class/android_usb/android0/functions adb
110 write /sys/class/android_usb/android0/enable ${service.adb.root}
111 start adbd
112
Colin Crossdd6a0412010-05-14 13:42:20 -0700113service ueventd /sbin/ueventd
114 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500115 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800116
Todd Poynorbe968092013-09-13 16:34:12 -0700117service healthd /sbin/healthd -r
Todd Poynor2f2c9882013-06-04 13:11:44 -0700118 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500119 seclabel u:r:healthd:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -0700120
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800121service recovery /sbin/recovery
122
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800123service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700124 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700125 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500126 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800127
Mike Lockwood718a2f72011-06-29 10:22:04 -0400128# Always start adbd on userdebug and eng builds
129on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000130 #write /sys/class/android_usb/android0/enable 1
131 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400132 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800133
Mike Lockwood718a2f72011-06-29 10:22:04 -0400134# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700135on property:service.adb.root=1
136 write /sys/class/android_usb/android0/enable 0
137 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800138 write /sys/class/android_usb/android0/enable 1