blob: d1c4526d7acf859eaa3c76659c367f22c0a3f465 [file] [log] [blame]
Captain Throwback1f127752016-01-19 17:30:20 -05001import /init.recovery.logd.rc
Matt Mowerec009e82015-01-30 13:00:49 -06002import /init.recovery.usb.rc
Ethan Yonkerf1179622016-08-25 15:32:21 -05003import /init.recovery.service.rc
nkk7171c6c502017-01-05 23:55:05 +02004import /init.recovery.vold_decrypt.rc
Matt Mower556411f2013-02-17 16:52:44 -06005import /init.recovery.${ro.hardware}.rc
6
Colin Crossdd6a0412010-05-14 13:42:20 -07007on early-init
Ethan Yonker58b09f12015-10-26 12:42:15 -05008 # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
9 write /sys/fs/selinux/checkreqprot 0
10
11 # Set the security context for the init process.
12 # This should occur before anything else (e.g. ueventd) is started.
13 setcon u:r:init:s0
14
Alex Deymo080f5222016-03-02 14:21:02 -080015 # Set the security context of /postinstall if present.
16 restorecon /postinstall
17
Colin Crossdd6a0412010-05-14 13:42:20 -070018 start ueventd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080019
Ethan Yonkerc798c9c2015-10-09 11:15:26 -050020service set_permissive /sbin/permissive.sh
Ethan Yonker6cb35aa2014-12-16 14:21:42 -060021 oneshot
22 seclabel u:r:recovery:s0
23
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080024on init
Doug Zongker55d65422014-01-14 09:50:35 -080025 export PATH /sbin:/system/bin
that9c3b7e92017-03-14 20:42:45 +010026 export LD_LIBRARY_PATH /sbin
Ethan Yonker34ae4832016-08-24 15:32:18 -050027
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080028 export ANDROID_ROOT /system
29 export ANDROID_DATA /data
30 export EXTERNAL_STORAGE /sdcard
31
Matt Mower556411f2013-02-17 16:52:44 -060032 mkdir /boot
33 mkdir /recovery
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080034 mkdir /system
35 mkdir /data
36 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070037 mkdir /sideload
Doug Zongker55d65422014-01-14 09:50:35 -080038 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080039
Matt Mower556411f2013-02-17 16:52:44 -060040 chown root shell /tmp
41 chmod 0775 /tmp
42
Colin Cross22bcf972014-06-24 13:43:39 -070043 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080044 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070045
Benoit Goby689e06b2014-02-19 17:41:02 -080046on fs
Vojtech Bocek05ec1d42015-03-08 16:32:41 +010047 mount pstore pstore /sys/fs/pstore
Benoit Goby689e06b2014-02-19 17:41:02 -080048 mkdir /dev/usb-ffs 0770 shell shell
49 mkdir /dev/usb-ffs/adb 0770 shell shell
50 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
51
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080052on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080053 ifup lo
54 hostname localhost
55 domainname localdomain
56
57 class_start default
58
Matt Mower4251a9b2015-11-13 14:01:49 -060059# Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070060on load_all_props_action
61 load_all_props
62
Matt Mower4251a9b2015-11-13 14:01:49 -060063# Load properties, Android 6.0+
64on load_system_props_action
65 load_system_props
66
67# Load properties, Android 6.0+, vendor init lives here
68on load_persist_props_action
69 load_persist_props
70
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070071on firmware_mounts_complete
Matt Mower4251a9b2015-11-13 14:01:49 -060072 rm /dev/.booting
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070073
Riley Andrewse739d7e2014-06-24 16:29:16 -070074# Mount filesystems and start core system services.
75on late-init
76 trigger early-fs
77 trigger fs
78 trigger post-fs
79 trigger post-fs-data
80
Matt Mower4251a9b2015-11-13 14:01:49 -060081 # Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070082 trigger load_all_props_action
83
Riley Andrewse739d7e2014-06-24 16:29:16 -070084 # Load properties from /system/ + /factory after fs mount. Place
85 # this in another action so that the load will be scheduled after the prior
86 # issued fs triggers have completed.
Paul Lawrence90c75b02015-07-06 10:44:33 -070087 trigger load_system_props_action
Riley Andrewse739d7e2014-06-24 16:29:16 -070088
Matt Mower4251a9b2015-11-13 14:01:49 -060089 # Load properties, Android 6.0+, vendor init lives here
90 trigger load_persist_props_action
91
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070092 # Remove a file to wake up anything waiting for firmware
93 trigger firmware_mounts_complete
94
Riley Andrewse739d7e2014-06-24 16:29:16 -070095 trigger early-boot
96 trigger boot
97
Doug Zongker77ea71d2013-08-30 12:20:16 -070098on property:sys.powerctl=*
99 powerctl ${sys.powerctl}
100
Colin Crossdd6a0412010-05-14 13:42:20 -0700101service ueventd /sbin/ueventd
102 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500103 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800104
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800105service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700106 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700107 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500108 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800109
Mike Lockwood718a2f72011-06-29 10:22:04 -0400110# Always start adbd on userdebug and eng builds
111on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000112 #write /sys/class/android_usb/android0/enable 1
113 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400114 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800115
Mike Lockwood718a2f72011-06-29 10:22:04 -0400116# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700117on property:service.adb.root=1
118 write /sys/class/android_usb/android0/enable 0
119 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800120 write /sys/class/android_usb/android0/enable 1