blob: 67b6a6f147b10da03b6d6d1c6de324547e2dee0d [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
14on init
Doug Zongker55d65422014-01-14 09:50:35 -080015 export PATH /sbin:/system/bin
Dees_Troy51a0e822012-09-05 15:24:24 -040016 export LD_LIBRARY_PATH .:/sbin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080017 export ANDROID_ROOT /system
18 export ANDROID_DATA /data
19 export EXTERNAL_STORAGE /sdcard
20
Matt Mower556411f2013-02-17 16:52:44 -060021 mkdir /boot
22 mkdir /recovery
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080023 mkdir /system
24 mkdir /data
25 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070026 mkdir /sideload
Doug Zongker55d65422014-01-14 09:50:35 -080027 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080028
Matt Mower556411f2013-02-17 16:52:44 -060029 chown root shell /tmp
30 chmod 0775 /tmp
31
Colin Cross22bcf972014-06-24 13:43:39 -070032 write /proc/sys/kernel/panic_on_oops 1
33
Benoit Goby689e06b2014-02-19 17:41:02 -080034on fs
35 mkdir /dev/usb-ffs 0770 shell shell
36 mkdir /dev/usb-ffs/adb 0770 shell shell
37 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
38
Matt Mower556411f2013-02-17 16:52:44 -060039 write /sys/class/android_usb/android0/enable 0
40 write /sys/class/android_usb/android0/idVendor 18D1
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040041 write /sys/class/android_usb/android0/idProduct D002
Benoit Goby689e06b2014-02-19 17:41:02 -080042 write /sys/class/android_usb/android0/f_ffs/aliases adb
Matt Mower556411f2013-02-17 16:52:44 -060043 write /sys/class/android_usb/android0/functions adb
44 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
45 write /sys/class/android_usb/android0/iProduct ${ro.product.model}
46 write /sys/class/android_usb/android0/iSerial ${ro.serialno}
47
48
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080049on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080050 ifup lo
51 hostname localhost
52 domainname localdomain
53
54 class_start default
55
Riley Andrewse739d7e2014-06-24 16:29:16 -070056# Load properties from /system/ + /factory after fs mount.
57on load_all_props_action
58 load_all_props
59
60# Mount filesystems and start core system services.
61on late-init
62 trigger early-fs
63 trigger fs
64 trigger post-fs
65 trigger post-fs-data
66
67 # Load properties from /system/ + /factory after fs mount. Place
68 # this in another action so that the load will be scheduled after the prior
69 # issued fs triggers have completed.
70 trigger load_all_props_action
71
72 trigger early-boot
73 trigger boot
74
Doug Zongker77ea71d2013-08-30 12:20:16 -070075on property:sys.powerctl=*
76 powerctl ${sys.powerctl}
77
Jason Riordan26ff4c02014-01-16 22:44:15 -050078on property:sys.storage.ums_enabled=1
79 write /sys/class/android_usb/android0/enable 0
80 write /sys/class/android_usb/android0/functions adb,mass_storage
81 write /sys/class/android_usb/android0/enable 1
82
83on property:sys.storage.ums_enabled=0
84 write /sys/class/android_usb/android0/enable 0
85 write /sys/class/android_usb/android0/functions adb
86 write /sys/class/android_usb/android0/enable ${service.adb.root}
87
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040088on property:sys.usb.config=none
89 stop adbd
90 write /sys/class/android_usb/android0/enable 0
91 write /sys/class/android_usb/android0/bDeviceClass 0
92
93on property:sys.usb.config=mtp,adb
94 stop adbd
95 write /sys/class/android_usb/android0/enable 0
96 write /sys/class/android_usb/android0/functions mtp,adb
97 write /sys/class/android_usb/android0/enable 1
98 start adbd
99
100on property:sys.usb.config=adb
101 stop adbd
102 write /sys/class/android_usb/android0/enable 0
103 write /sys/class/android_usb/android0/functions adb
104 write /sys/class/android_usb/android0/enable ${service.adb.root}
105 start adbd
106
Colin Crossdd6a0412010-05-14 13:42:20 -0700107service ueventd /sbin/ueventd
108 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500109 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800110
Todd Poynorbe968092013-09-13 16:34:12 -0700111service healthd /sbin/healthd -r
Todd Poynor2f2c9882013-06-04 13:11:44 -0700112 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500113 seclabel u:r:healthd:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -0700114
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800115service recovery /sbin/recovery
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500116 seclabel u:r:recovery:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800117
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800118service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700119 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700120 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500121 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800122
Mike Lockwood718a2f72011-06-29 10:22:04 -0400123# Always start adbd on userdebug and eng builds
124on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000125 #write /sys/class/android_usb/android0/enable 1
126 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400127 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800128
Mike Lockwood718a2f72011-06-29 10:22:04 -0400129# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700130on property:service.adb.root=1
131 write /sys/class/android_usb/android0/enable 0
132 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800133 write /sys/class/android_usb/android0/enable 1