summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/Android.mk90
-rw-r--r--etc/init.rc69
-rw-r--r--etc/init.recovery.hlthchrg25.rc5
-rw-r--r--etc/init.recovery.hlthchrg26.rc5
-rw-r--r--etc/init.recovery.logd.rc30
-rw-r--r--etc/init.recovery.service21.rc4
-rw-r--r--etc/init.recovery.service22.rc5
-rw-r--r--etc/init.recovery.usb.rc30
8 files changed, 212 insertions, 26 deletions
diff --git a/etc/Android.mk b/etc/Android.mk
new file mode 100644
index 000000000..cda0f372e
--- /dev/null
+++ b/etc/Android.mk
@@ -0,0 +1,90 @@
+# Copyright (C) 2015 TeamWin Recovery Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+ifneq ($(TW_EXCLUDE_DEFAULT_USB_INIT), true)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.recovery.usb.rc
+LOCAL_MODULE_TAGS := eng
+LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+
+# Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
+# during ramdisk creation and only allows init.recovery.*.rc files to be copied
+# from TARGET_ROOT_OUT thereafter
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
+endif
+
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 22; echo $$?),0)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := init.recovery.service.rc
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+ LOCAL_SRC_FILES := init.recovery.service22.rc
+ include $(BUILD_PREBUILT)
+else
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := init.recovery.service.rc
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+ LOCAL_SRC_FILES := init.recovery.service21.rc
+ include $(BUILD_PREBUILT)
+endif
+
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := init.recovery.hlthchrg.rc
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+ LOCAL_SRC_FILES := init.recovery.hlthchrg26.rc
+ include $(BUILD_PREBUILT)
+else
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := init.recovery.hlthchrg.rc
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+ LOCAL_SRC_FILES := init.recovery.hlthchrg25.rc
+ include $(BUILD_PREBUILT)
+endif
+
+ifeq ($(TWRP_INCLUDE_LOGCAT), true)
+ ifeq ($(TARGET_USES_LOGD), true)
+
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := init.recovery.logd.rc
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+
+ # Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
+ # during ramdisk creation and only allows init.recovery.*.rc files to be copied
+ # from TARGET_ROOT_OUT thereafter
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+ LOCAL_SRC_FILES := $(LOCAL_MODULE)
+ include $(BUILD_PREBUILT)
+ endif
+endif
diff --git a/etc/init.rc b/etc/init.rc
index d8121cc4e..d1c4526d7 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -1,22 +1,36 @@
+import /init.recovery.logd.rc
+import /init.recovery.usb.rc
+import /init.recovery.service.rc
+import /init.recovery.vold_decrypt.rc
import /init.recovery.${ro.hardware}.rc
on early-init
+ # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
+ write /sys/fs/selinux/checkreqprot 0
+
+ # Set the security context for the init process.
+ # This should occur before anything else (e.g. ueventd) is started.
+ setcon u:r:init:s0
+
# Set the security context of /postinstall if present.
restorecon /postinstall
start ueventd
+service set_permissive /sbin/permissive.sh
+ oneshot
+ seclabel u:r:recovery:s0
+
on init
+ export PATH /sbin:/system/bin
+ export LD_LIBRARY_PATH /sbin
+
export ANDROID_ROOT /system
export ANDROID_DATA /data
export EXTERNAL_STORAGE /sdcard
- symlink /system/etc /etc
-
- mount cgroup none /acct cpuacct
- mkdir /acct/uid
-
- mkdir /sdcard
+ mkdir /boot
+ mkdir /recovery
mkdir /system
mkdir /data
mkdir /cache
@@ -30,19 +44,11 @@ on init
write /proc/sys/vm/max_map_count 1000000
on fs
- write /sys/class/android_usb/android0/f_ffs/aliases adb
+ mount pstore pstore /sys/fs/pstore
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct D001
- write /sys/class/android_usb/android0/functions adb
- write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
- write /sys/class/android_usb/android0/iProduct ${ro.product.model}
- write /sys/class/android_usb/android0/iSerial ${ro.serialno}
-
on boot
ifup lo
hostname localhost
@@ -50,12 +56,20 @@ on boot
class_start default
-# Load properties from /system/ + /factory after fs mount.
+# Load properties, pre-Android 6.0
+on load_all_props_action
+ load_all_props
+
+# Load properties, Android 6.0+
on load_system_props_action
load_system_props
+# Load properties, Android 6.0+, vendor init lives here
+on load_persist_props_action
+ load_persist_props
+
on firmware_mounts_complete
- rm /dev/.booting
+ rm /dev/.booting
# Mount filesystems and start core system services.
on late-init
@@ -64,28 +78,30 @@ on late-init
trigger post-fs
trigger post-fs-data
+ # Load properties, pre-Android 6.0
+ trigger load_all_props_action
+
# Load properties from /system/ + /factory after fs mount. Place
# this in another action so that the load will be scheduled after the prior
# issued fs triggers have completed.
trigger load_system_props_action
+ # Load properties, Android 6.0+, vendor init lives here
+ trigger load_persist_props_action
+
# Remove a file to wake up anything waiting for firmware
trigger firmware_mounts_complete
trigger early-boot
trigger boot
+on property:sys.powerctl=*
+ powerctl ${sys.powerctl}
+
service ueventd /sbin/ueventd
critical
seclabel u:r:ueventd:s0
-service charger /charger -r
- critical
- seclabel u:r:charger:s0
-
-service recovery /sbin/recovery
- seclabel u:r:recovery:s0
-
service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
disabled
socket adbd stream 660 system system
@@ -93,8 +109,9 @@ service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
# Always start adbd on userdebug and eng builds
on property:ro.debuggable=1
- write /sys/class/android_usb/android0/enable 1
- start adbd
+ #write /sys/class/android_usb/android0/enable 1
+ #start adbd
+ setprop service.adb.root 1
# Restart adbd so it can run as root
on property:service.adb.root=1
diff --git a/etc/init.recovery.hlthchrg25.rc b/etc/init.recovery.hlthchrg25.rc
new file mode 100644
index 000000000..62b24894d
--- /dev/null
+++ b/etc/init.recovery.hlthchrg25.rc
@@ -0,0 +1,5 @@
+# healthd for pre Android 8.0
+
+service healthd /sbin/healthd -r
+ critical
+ seclabel u:r:healthd:s0
diff --git a/etc/init.recovery.hlthchrg26.rc b/etc/init.recovery.hlthchrg26.rc
new file mode 100644
index 000000000..8a49c86fd
--- /dev/null
+++ b/etc/init.recovery.hlthchrg26.rc
@@ -0,0 +1,5 @@
+# charger for Android 8.0 and up
+
+service charger /charger -r
+ critical
+ seclabel u:r:charger:s0
diff --git a/etc/init.recovery.logd.rc b/etc/init.recovery.logd.rc
new file mode 100644
index 000000000..7bdbfb8bc
--- /dev/null
+++ b/etc/init.recovery.logd.rc
@@ -0,0 +1,30 @@
+on load_all_props_action
+ start logd
+ start logd-reinit
+
+on load_persist_props_action
+ start logd
+ start logd-reinit
+
+on post-fs
+ start logd
+
+on post-fs-data
+ start logd
+
+on property:vold.decrypt=trigger_load_persist_props
+ start logd
+ start logd-reinit
+
+service logd /sbin/logd
+ class core
+ socket logd stream 0666 logd logd
+ socket logdr seqpacket 0666 logd logd
+ socket logdw dgram 0222 logd logd
+ group root system
+ seclabel u:r:logd:s0
+
+service logd-reinit /sbin/logd --reinit
+ oneshot
+ disabled
+ seclabel u:r:logd:s0
diff --git a/etc/init.recovery.service21.rc b/etc/init.recovery.service21.rc
new file mode 100644
index 000000000..892b226ff
--- /dev/null
+++ b/etc/init.recovery.service21.rc
@@ -0,0 +1,4 @@
+on boot
+
+# For starting recovery on 4.4 and older
+service recovery /sbin/recovery
diff --git a/etc/init.recovery.service22.rc b/etc/init.recovery.service22.rc
new file mode 100644
index 000000000..bb2853c1a
--- /dev/null
+++ b/etc/init.recovery.service22.rc
@@ -0,0 +1,5 @@
+on boot
+
+# For starting recovery on 5.0 and newer
+service recovery /sbin/recovery
+ seclabel u:r:recovery:s0
diff --git a/etc/init.recovery.usb.rc b/etc/init.recovery.usb.rc
new file mode 100644
index 000000000..8ef20e0ec
--- /dev/null
+++ b/etc/init.recovery.usb.rc
@@ -0,0 +1,30 @@
+on fs
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18D1
+ write /sys/class/android_usb/android0/idProduct D001
+ write /sys/class/android_usb/android0/f_ffs/aliases adb
+ write /sys/class/android_usb/android0/functions adb
+ write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
+ write /sys/class/android_usb/android0/iProduct ${ro.product.model}
+ write /sys/class/android_usb/android0/iSerial ${ro.serialno}
+
+on property:sys.usb.config=none
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/bDeviceClass 0
+
+on property:sys.usb.config=mass_storage,adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+
+on property:sys.usb.config=mtp,adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+
+on property:sys.usb.config=adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable ${service.adb.root}
+ start adbd