android_recovery_motorola_rtwo/recovery/root/init.recovery.qcom.rc
Nicholas Andrew 5439e444a0 rtwo: finalize Virtual A/B recovery support
Enable A/B OTA handling, add the QTI boot-control stack, correct slotted recovery partitions, and sanitize empty Virtual A/B state that blocks Format Data.
2026-06-28 19:58:01 -04:00

102 lines
4.1 KiB
Text

# Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved.
# Copyright (C) 2019-Present A-Team Digital Solutions
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import /init.recovery.qcom_decrypt.rc
import /vendor/etc/init/init.spdaemon.rc
import /vendor/etc/init/init.vendor.qti.spu@1.1-service.rc
import /vendor/etc/init/init.spuservice.rc
import /init.recovery.rtwo.gatekeeper.rc
service rtwo-crypto-identity /system/bin/rtwo-crypto-identity.sh
user root
group root
disabled
oneshot
seclabel u:r:recovery:s0
on early-init
exec_start rtwo-crypto-identity
on init
setprop twrp.defer.decrypt false
# to cut charging battery path
write /sys/class/power_supply/battery/siop_level 0
setprop prepdecrypt.setpatch false
setprop sys.usb.configfs 1
on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
mkdir /dev/block/mapper 0755 root root
symlink /dev/block/mapper/system${ro.boot.slot_suffix} /dev/block/mapper/system
symlink /dev/block/mapper/vendor${ro.boot.slot_suffix} /dev/block/mapper/vendor
symlink /dev/block/mapper/product${ro.boot.slot_suffix} /dev/block/mapper/product
symlink /dev/block/mapper/system_ext${ro.boot.slot_suffix} /dev/block/mapper/system_ext
symlink /dev/block/mapper/system_dlkm${ro.boot.slot_suffix} /dev/block/mapper/system_dlkm
symlink /dev/block/mapper/vendor_dlkm${ro.boot.slot_suffix} /dev/block/mapper/vendor_dlkm
mkdir /persist 0771 root system
mkdir /mnt/vendor 0755 root root
mkdir /mnt/vendor/persist 0771 root system
mount ext4 /dev/block/bootdevice/by-name/persist /persist
mount none /persist /mnt/vendor/persist bind
# Mount slot-selected modem firmware for ADSP, PMIC, and USB-C
mkdir /vendor/firmware_mnt 0755 root root
mount ext4 /dev/block/bootdevice/by-name/modem${ro.boot.slot_suffix} /vendor/firmware_mnt ro
write /proc/sys/kernel/firmware_config/force_sysfs_fallback 1
export ANDROID_ROOT /system_root
# Mount bootdevice
service rtwo-battery-bootstrap /system/bin/rtwo-battery-bootstrap.sh
class core
user root
group root
disabled
oneshot
seclabel u:r:recovery:s0
on boot
start health-hal-2-1
start rtwo-battery-bootstrap
on property:ro.boot.usbcontroller=*
setprop sys.usb.controller ${ro.boot.usbcontroller}
write /sys/class/udc/${ro.boot.usbcontroller}/device/../mode peripheral
service rtwo-vab-state-sanitize /system/bin/rtwo-vab-state-sanitize.sh
class core
user root
group root
disabled
oneshot
seclabel u:r:recovery:s0
on boot
start rtwo-vab-state-sanitize