blob: 8a12b7cfd28590b78ed354a8975b035494c489c3 [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
39 mkdir /dev/usb-ffs 0770 shell shell
40 mkdir /dev/usb-ffs/adb 0770 shell shell
41 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
42
Matt Mower556411f2013-02-17 16:52:44 -060043 write /sys/class/android_usb/android0/enable 0
44 write /sys/class/android_usb/android0/idVendor 18D1
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040045 write /sys/class/android_usb/android0/idProduct D002
Benoit Goby689e06b2014-02-19 17:41:02 -080046 write /sys/class/android_usb/android0/f_ffs/aliases adb
Matt Mower556411f2013-02-17 16:52:44 -060047 write /sys/class/android_usb/android0/functions adb
48 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
49 write /sys/class/android_usb/android0/iProduct ${ro.product.model}
50 write /sys/class/android_usb/android0/iSerial ${ro.serialno}
51
52
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080053on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080054 ifup lo
55 hostname localhost
56 domainname localdomain
57
58 class_start default
59
Riley Andrewse739d7e2014-06-24 16:29:16 -070060# Load properties from /system/ + /factory after fs mount.
61on load_all_props_action
62 load_all_props
63
64# Mount filesystems and start core system services.
65on late-init
66 trigger early-fs
67 trigger fs
68 trigger post-fs
69 trigger post-fs-data
70
71 # Load properties from /system/ + /factory after fs mount. Place
72 # this in another action so that the load will be scheduled after the prior
73 # issued fs triggers have completed.
74 trigger load_all_props_action
75
76 trigger early-boot
77 trigger boot
78
Doug Zongker77ea71d2013-08-30 12:20:16 -070079on property:sys.powerctl=*
80 powerctl ${sys.powerctl}
81
Jason Riordan26ff4c02014-01-16 22:44:15 -050082on property:sys.storage.ums_enabled=1
83 write /sys/class/android_usb/android0/enable 0
84 write /sys/class/android_usb/android0/functions adb,mass_storage
85 write /sys/class/android_usb/android0/enable 1
86
87on property:sys.storage.ums_enabled=0
88 write /sys/class/android_usb/android0/enable 0
89 write /sys/class/android_usb/android0/functions adb
90 write /sys/class/android_usb/android0/enable ${service.adb.root}
91
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040092on property:sys.usb.config=none
93 stop adbd
94 write /sys/class/android_usb/android0/enable 0
95 write /sys/class/android_usb/android0/bDeviceClass 0
96
97on property:sys.usb.config=mtp,adb
98 stop adbd
99 write /sys/class/android_usb/android0/enable 0
100 write /sys/class/android_usb/android0/functions mtp,adb
101 write /sys/class/android_usb/android0/enable 1
102 start adbd
103
104on property:sys.usb.config=adb
105 stop adbd
106 write /sys/class/android_usb/android0/enable 0
107 write /sys/class/android_usb/android0/functions adb
108 write /sys/class/android_usb/android0/enable ${service.adb.root}
109 start adbd
110
Colin Crossdd6a0412010-05-14 13:42:20 -0700111service ueventd /sbin/ueventd
112 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500113 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800114
Todd Poynorbe968092013-09-13 16:34:12 -0700115service healthd /sbin/healthd -r
Todd Poynor2f2c9882013-06-04 13:11:44 -0700116 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500117 seclabel u:r:healthd:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -0700118
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800119service recovery /sbin/recovery
120
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800121service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700122 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700123 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500124 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800125
Mike Lockwood718a2f72011-06-29 10:22:04 -0400126# Always start adbd on userdebug and eng builds
127on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000128 #write /sys/class/android_usb/android0/enable 1
129 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400130 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800131
Mike Lockwood718a2f72011-06-29 10:22:04 -0400132# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700133on property:service.adb.root=1
134 write /sys/class/android_usb/android0/enable 0
135 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800136 write /sys/class/android_usb/android0/enable 1