diff options
Diffstat (limited to 'etc')
-rw-r--r-- | etc/Android.mk | 70 | ||||
-rw-r--r-- | etc/init.rc | 62 | ||||
-rw-r--r-- | etc/init.recovery.logd.rc | 28 | ||||
-rw-r--r-- | etc/init.recovery.service21.rc | 4 | ||||
-rw-r--r-- | etc/init.recovery.service22.rc | 5 | ||||
-rw-r--r-- | etc/init.recovery.usb.rc | 30 |
6 files changed, 180 insertions, 19 deletions
diff --git a/etc/Android.mk b/etc/Android.mk new file mode 100644 index 000000000..decd3e2d6 --- /dev/null +++ b/etc/Android.mk @@ -0,0 +1,70 @@ +# 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 ($(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 5915b8d80..a62b68d84 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -1,20 +1,36 @@ +import /init.recovery.logd.rc +import /init.recovery.usb.rc +import /init.recovery.service.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 start healthd +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 - - mkdir /sdcard + mkdir /boot + mkdir /recovery mkdir /system mkdir /data mkdir /cache @@ -28,19 +44,12 @@ on init write /proc/sys/vm/max_map_count 1000000 on fs + 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/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 boot ifup lo hostname localhost @@ -48,12 +57,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 @@ -62,11 +79,20 @@ 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+ + 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 @@ -84,9 +110,6 @@ service healthd /sbin/healthd -r critical seclabel u:r:healthd: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 @@ -94,8 +117,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.logd.rc b/etc/init.recovery.logd.rc new file mode 100644 index 000000000..4bc21ad0c --- /dev/null +++ b/etc/init.recovery.logd.rc @@ -0,0 +1,28 @@ +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 + +service logd-reinit /sbin/logd --reinit + oneshot + disabled 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..801973671 --- /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 4EE2 + write /sys/class/android_usb/android0/f_ffs/aliases adb + write /sys/class/android_usb/android0/functions mtp,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 |