blob: e6d8aec7461b2313f0e8d4b51ed91607e176dcc9 [file] [log] [blame]
Matt Mowerec009e82015-01-30 13:00:49 -06001import /init.recovery.usb.rc
Matt Mower556411f2013-02-17 16:52:44 -06002import /init.recovery.${ro.hardware}.rc
3
Colin Crossdd6a0412010-05-14 13:42:20 -07004on early-init
Ethan Yonker58b09f12015-10-26 12:42:15 -05005 # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
6 write /sys/fs/selinux/checkreqprot 0
7
8 # Set the security context for the init process.
9 # This should occur before anything else (e.g. ueventd) is started.
10 setcon u:r:init:s0
11
Colin Crossdd6a0412010-05-14 13:42:20 -070012 start ueventd
Todd Poynor2f2c9882013-06-04 13:11:44 -070013 start healthd
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080014
Ethan Yonkerc798c9c2015-10-09 11:15:26 -050015service set_permissive /sbin/permissive.sh
Ethan Yonker6cb35aa2014-12-16 14:21:42 -060016 oneshot
17 seclabel u:r:recovery:s0
18
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080019on init
Doug Zongker55d65422014-01-14 09:50:35 -080020 export PATH /sbin:/system/bin
Dees_Troy51a0e822012-09-05 15:24:24 -040021 export LD_LIBRARY_PATH .:/sbin
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080022 export ANDROID_ROOT /system
23 export ANDROID_DATA /data
24 export EXTERNAL_STORAGE /sdcard
25
Matt Mower556411f2013-02-17 16:52:44 -060026 mkdir /boot
27 mkdir /recovery
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080028 mkdir /system
29 mkdir /data
30 mkdir /cache
Doug Zongker075ad802014-06-26 15:35:51 -070031 mkdir /sideload
Doug Zongker55d65422014-01-14 09:50:35 -080032 mount tmpfs tmpfs /tmp
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080033
Matt Mower556411f2013-02-17 16:52:44 -060034 chown root shell /tmp
35 chmod 0775 /tmp
36
Colin Cross22bcf972014-06-24 13:43:39 -070037 write /proc/sys/kernel/panic_on_oops 1
Jesse Zhao5bf74b22015-01-08 15:59:23 -080038 write /proc/sys/vm/max_map_count 1000000
Colin Cross22bcf972014-06-24 13:43:39 -070039
Benoit Goby689e06b2014-02-19 17:41:02 -080040on fs
Vojtech Bocek05ec1d42015-03-08 16:32:41 +010041 mount pstore pstore /sys/fs/pstore
42
Benoit Goby689e06b2014-02-19 17:41:02 -080043 mkdir /dev/usb-ffs 0770 shell shell
44 mkdir /dev/usb-ffs/adb 0770 shell shell
45 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
46
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080047on boot
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080048 ifup lo
49 hostname localhost
50 domainname localdomain
51
52 class_start default
53
Matt Mower4251a9b2015-11-13 14:01:49 -060054# Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070055on load_all_props_action
56 load_all_props
57
Matt Mower4251a9b2015-11-13 14:01:49 -060058# Load properties, Android 6.0+
59on load_system_props_action
60 load_system_props
61
62# Load properties, Android 6.0+, vendor init lives here
63on load_persist_props_action
64 load_persist_props
65
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070066on firmware_mounts_complete
Matt Mower4251a9b2015-11-13 14:01:49 -060067 rm /dev/.booting
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070068
Riley Andrewse739d7e2014-06-24 16:29:16 -070069# Mount filesystems and start core system services.
70on late-init
71 trigger early-fs
72 trigger fs
73 trigger post-fs
74 trigger post-fs-data
75
Matt Mower4251a9b2015-11-13 14:01:49 -060076 # Load properties, pre-Android 6.0
Riley Andrewse739d7e2014-06-24 16:29:16 -070077 trigger load_all_props_action
78
Matt Mower4251a9b2015-11-13 14:01:49 -060079 # Load properties, Android 6.0+
80 trigger load_system_props_action
81
82 # Load properties, Android 6.0+, vendor init lives here
83 trigger load_persist_props_action
84
JP Abgrall9eb8c8b2014-10-20 20:02:57 -070085 # Remove a file to wake up anything waiting for firmware
86 trigger firmware_mounts_complete
87
Riley Andrewse739d7e2014-06-24 16:29:16 -070088 trigger early-boot
89 trigger boot
90
Doug Zongker77ea71d2013-08-30 12:20:16 -070091on property:sys.powerctl=*
92 powerctl ${sys.powerctl}
93
Colin Crossdd6a0412010-05-14 13:42:20 -070094service ueventd /sbin/ueventd
95 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -050096 seclabel u:r:ueventd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080097
Todd Poynorbe968092013-09-13 16:34:12 -070098service healthd /sbin/healthd -r
Todd Poynor2f2c9882013-06-04 13:11:44 -070099 critical
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500100 seclabel u:r:healthd:s0
Todd Poynor2f2c9882013-06-04 13:11:44 -0700101
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800102service recovery /sbin/recovery
103
Nick Kralevichc52c5b82014-01-18 09:22:50 -0800104service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
Kenny Rootecc76ba2010-06-28 09:01:22 -0700105 disabled
Doug Zongkercc2958f2013-09-11 13:24:32 -0700106 socket adbd stream 660 system system
Stephen Smalley2c9d5b22014-01-13 09:44:42 -0500107 seclabel u:r:adbd:s0
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800108
Mike Lockwood718a2f72011-06-29 10:22:04 -0400109# Always start adbd on userdebug and eng builds
110on property:ro.debuggable=1
Dees_Troy0cd4cc22013-06-09 20:56:38 +0000111 #write /sys/class/android_usb/android0/enable 1
112 #start adbd
Dees_Troy51a0e822012-09-05 15:24:24 -0400113 setprop service.adb.root 1
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800114
Mike Lockwood718a2f72011-06-29 10:22:04 -0400115# Restart adbd so it can run as root
Doug Zongkerfb04b872011-06-23 15:30:34 -0700116on property:service.adb.root=1
117 write /sys/class/android_usb/android0/enable 0
118 restart adbd
Benoit Goby689e06b2014-02-19 17:41:02 -0800119 write /sys/class/android_usb/android0/enable 1