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.
This commit is contained in:
parent
77e620c438
commit
5439e444a0
15 changed files with 150 additions and 15 deletions
|
|
@ -1,11 +1,12 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2023 The Android Open Source Project
|
# Copyright (C) 2023 The Android Open Source Project
|
||||||
#
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
DEVICE_PATH := device/motorola/rtwo
|
DEVICE_PATH := device/motorola/rtwo
|
||||||
|
|
||||||
|
TW_MAINTAINER := BOBtheBlinker
|
||||||
OF_MAINTAINER := BOBtheBlinker
|
OF_MAINTAINER := BOBtheBlinker
|
||||||
|
|
||||||
# Bootloader
|
# Bootloader
|
||||||
|
|
@ -114,7 +115,22 @@ TARGET_COPY_OUT_VENDOR := vendor
|
||||||
# Properties
|
# Properties
|
||||||
TARGET_VENDOR_PROP += device/motorola/rtwo/vendor.prop
|
TARGET_VENDOR_PROP += device/motorola/rtwo/vendor.prop
|
||||||
|
|
||||||
AB_OTA_UPDATER := false
|
AB_OTA_UPDATER := true
|
||||||
|
|
||||||
|
AB_OTA_PARTITIONS += \
|
||||||
|
boot \
|
||||||
|
dtbo \
|
||||||
|
init_boot \
|
||||||
|
product \
|
||||||
|
recovery \
|
||||||
|
system \
|
||||||
|
system_dlkm \
|
||||||
|
system_ext \
|
||||||
|
vbmeta \
|
||||||
|
vbmeta_system \
|
||||||
|
vendor \
|
||||||
|
vendor_dlkm \
|
||||||
|
vendor_boot
|
||||||
|
|
||||||
# Android Verified Boot
|
# Android Verified Boot
|
||||||
BOARD_AVB_ENABLE := true
|
BOARD_AVB_ENABLE := true
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2023 The Android Open Source Project
|
# Copyright (C) 2023 The Android Open Source Project
|
||||||
#
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved.
|
# 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
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
# * Redistributions of source code must retain the above copyright
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
|
@ -89,3 +89,14 @@ on boot
|
||||||
on property:ro.boot.usbcontroller=*
|
on property:ro.boot.usbcontroller=*
|
||||||
setprop sys.usb.controller ${ro.boot.usbcontroller}
|
setprop sys.usb.controller ${ro.boot.usbcontroller}
|
||||||
write /sys/class/udc/${ro.boot.usbcontroller}/device/../mode peripheral
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
# BOBtheBlinker
|
||||||
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
|
|
||||||
kmsg()
|
kmsg()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
# BOBtheBlinker
|
||||||
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
|
|
||||||
resetprop ro.build.version.release 16
|
resetprop ro.build.version.release 16
|
||||||
resetprop ro.build.version.sdk 36
|
resetprop ro.build.version.sdk 36
|
||||||
|
|
|
||||||
95
recovery/root/system/bin/rtwo-vab-state-sanitize.sh
Executable file
95
recovery/root/system/bin/rtwo-vab-state-sanitize.sh
Executable file
|
|
@ -0,0 +1,95 @@
|
||||||
|
#!/system/bin/sh
|
||||||
|
# BOBtheBlinker
|
||||||
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
|
|
||||||
|
TAG="rtwo-vab-state"
|
||||||
|
META="/metadata"
|
||||||
|
META_DEV="/dev/block/bootdevice/by-name/metadata"
|
||||||
|
OTA_DIR="${META}/ota"
|
||||||
|
STATE_FILE="${OTA_DIR}/state"
|
||||||
|
SNAPSHOT_DIR="${OTA_DIR}/snapshots"
|
||||||
|
LOG_FILE="/tmp/rtwo-vab-state.log"
|
||||||
|
|
||||||
|
log_msg() {
|
||||||
|
echo "${TAG}: $*" >> "${LOG_FILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_msg "starting guarded Virtual A/B state check"
|
||||||
|
|
||||||
|
# Wait for metadata to become mounted, or mount it ourselves once its
|
||||||
|
# block-device node becomes available.
|
||||||
|
COUNT=0
|
||||||
|
while [ "${COUNT}" -lt 80 ]; do
|
||||||
|
if grep -q " ${META} " /proc/mounts; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "${META_DEV}" ]; then
|
||||||
|
mkdir -p "${META}"
|
||||||
|
mount -t f2fs "${META_DEV}" "${META}" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
if grep -q " ${META} " /proc/mounts; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 0.25
|
||||||
|
COUNT=$((COUNT + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! grep -q " ${META} " /proc/mounts; then
|
||||||
|
log_msg "metadata unavailable; leaving OTA state untouched"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "${STATE_FILE}" ]; then
|
||||||
|
log_msg "no OTA state file present"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -s "${STATE_FILE}" ]; then
|
||||||
|
log_msg "OTA state file is non-empty; preserving it"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "${SNAPSHOT_DIR}" ]; then
|
||||||
|
log_msg "snapshot directory missing; preserving state file"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if find "${SNAPSHOT_DIR}" \
|
||||||
|
-mindepth 1 \
|
||||||
|
-maxdepth 1 \
|
||||||
|
-print -quit 2>/dev/null |
|
||||||
|
grep -q .; then
|
||||||
|
log_msg "snapshot directory is not empty; preserving state file"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only the known harmless entries may exist. Anything else could represent
|
||||||
|
# genuine OTA state, so fail safely and preserve everything.
|
||||||
|
UNEXPECTED="$(
|
||||||
|
find "${OTA_DIR}" \
|
||||||
|
-mindepth 1 \
|
||||||
|
-maxdepth 1 \
|
||||||
|
! -name state \
|
||||||
|
! -name snapshots \
|
||||||
|
! -name allow-forward-merge \
|
||||||
|
-print -quit 2>/dev/null
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ -n "${UNEXPECTED}" ]; then
|
||||||
|
log_msg "unexpected OTA entry found: ${UNEXPECTED}; preserving state file"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "${STATE_FILE}"
|
||||||
|
|
||||||
|
if [ -e "${STATE_FILE}" ]; then
|
||||||
|
log_msg "failed to remove empty OTA state file"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sync
|
||||||
|
log_msg "removed empty OTA state file; no snapshots were present"
|
||||||
|
exit 0
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
|
# Copyright (c) 2018-2019 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
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted (subject to the limitations in the
|
# modification, are permitted (subject to the limitations in the
|
||||||
# disclaimer below) provided that the following conditions are met:
|
# disclaimer below) provided that the following conditions are met:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
# mount point fstype device device2 flags
|
# mount point fstype device device2 flags
|
||||||
# Symlinked partitions
|
# Symlinked partitions
|
||||||
/system_image emmc /dev/block/bootdevice/by-name/system flags=backup=0;flashimg;display="System Image"
|
/system_image emmc /dev/block/bootdevice/by-name/system flags=backup=0;flashimg;display="System Image"
|
||||||
|
|
@ -9,23 +10,23 @@
|
||||||
/system_dlkm_image emmc /dev/block/bootdevice/by-name/system_dlkm flags=backup=0;flashimg;display="System_DLKM Image"
|
/system_dlkm_image emmc /dev/block/bootdevice/by-name/system_dlkm flags=backup=0;flashimg;display="System_DLKM Image"
|
||||||
|
|
||||||
# Physical partitions
|
# Physical partitions
|
||||||
/metadata ext4 /dev/block/bootdevice/by-name/metadata flags=backup=1;wipeingui;display="Metadata"
|
/metadata f2fs /dev/block/bootdevice/by-name/metadata flags=backup=1;wipeingui;display="Metadata"
|
||||||
/boot emmc /dev/block/bootdevice/by-name/boot flags=backup=1;flashimg;display="Boot"
|
/boot emmc /dev/block/bootdevice/by-name/boot flags=slotselect;backup=1;flashimg;display="Boot"
|
||||||
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1;flashimg;display="Recovery"
|
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=slotselect;backup=1;flashimg;display="Recovery"
|
||||||
/init_boot emmc /dev/block/bootdevice/by-name/init_boot flags=backup=1;flashimg;display="Init Boot"
|
/init_boot emmc /dev/block/bootdevice/by-name/init_boot flags=slotselect;backup=1;flashimg;display="Init Boot"
|
||||||
/persist ext4 /dev/block/bootdevice/by-name/persist flags=display="Persist"
|
/persist ext4 /dev/block/bootdevice/by-name/persist flags=display="Persist"
|
||||||
/efs ext4 /dev/block/bootdevice/by-name/efs flags=backup=1;display="EFS"
|
/efs ext4 /dev/block/bootdevice/by-name/efs flags=backup=1;display="EFS"
|
||||||
/sec_efs ext4 /dev/block/bootdevice/by-name/sec_efs flags=backup=1;display="SEC EFS"
|
/sec_efs ext4 /dev/block/bootdevice/by-name/sec_efs flags=backup=1;display="SEC EFS"
|
||||||
/modem emmc /dev/block/bootdevice/by-name/modem flags=backup=1;display="Modem"
|
/modem emmc /dev/block/bootdevice/by-name/modem flags=backup=1;display="Modem"
|
||||||
/dsp emmc /dev/block/bootdevice/by-name/dsp
|
/dsp emmc /dev/block/bootdevice/by-name/dsp
|
||||||
/misc emmc /dev/block/bootdevice/by-name/misc
|
/misc emmc /dev/block/bootdevice/by-name/misc
|
||||||
/dtbo emmc /dev/block/bootdevice/by-name/dtbo flags=backup=1;flashimg;display="Dtbo"
|
/dtbo emmc /dev/block/bootdevice/by-name/dtbo flags=slotselect;backup=1;flashimg;display="Dtbo"
|
||||||
/optics_image emmc /dev/block/bootdevice/by-name/optics flags=backup=1;flashimg;display="Optics Image"
|
/optics_image emmc /dev/block/bootdevice/by-name/optics flags=backup=1;flashimg;display="Optics Image"
|
||||||
/prism_image emmc /dev/block/bootdevice/by-name/prism flags=backup=1;flashimg;display="Prism Image"
|
/prism_image emmc /dev/block/bootdevice/by-name/prism flags=backup=1;flashimg;display="Prism Image"
|
||||||
/vbmeta_system emmc /dev/block/bootdevice/by-name/vbmeta_system
|
/vbmeta_system emmc /dev/block/bootdevice/by-name/vbmeta_system flags=slotselect;backup=1;flashimg;display="Vbmeta System"
|
||||||
/vendor_boot emmc /dev/block/bootdevice/by-name/vendor_boot flags=backup=1;flashimg;display="Vendor Boot"
|
/vendor_boot emmc /dev/block/bootdevice/by-name/vendor_boot flags=slotselect;backup=1;flashimg;display="Vendor Boot"
|
||||||
/vbmeta_samsung emmc /dev/block/bootdevice/by-name/vbmeta_samsung
|
/vbmeta_samsung emmc /dev/block/bootdevice/by-name/vbmeta_samsung
|
||||||
/vbmeta emmc /dev/block/bootdevice/by-name/vbmeta flags=backup=1;flashimg;display="Vbmeta"
|
/vbmeta emmc /dev/block/bootdevice/by-name/vbmeta flags=slotselect;backup=1;flashimg;display="Vbmeta"
|
||||||
/vm-bootsys ext4 /dev/block/bootdevice/by-name/vm-bootsys
|
/vm-bootsys ext4 /dev/block/bootdevice/by-name/vm-bootsys
|
||||||
/imagefv emmc /dev/block/bootdevice/by-name/imagefv
|
/imagefv emmc /dev/block/bootdevice/by-name/imagefv
|
||||||
/efuse emmc /dev/block/bootdevice/by-name/efuse
|
/efuse emmc /dev/block/bootdevice/by-name/efuse
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
recovery/root/system/lib64/libboot_control_qti.so
Normal file
BIN
recovery/root/system/lib64/libboot_control_qti.so
Normal file
Binary file not shown.
BIN
recovery/root/system/lib64/librecovery_updater.so
Normal file
BIN
recovery/root/system/lib64/librecovery_updater.so
Normal file
Binary file not shown.
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
|
|
||||||
on init
|
on init
|
||||||
start vendor.keymaster-sb-4-0
|
start vendor.keymaster-sb-4-0
|
||||||
|
|
||||||
|
|
|
||||||
1
recovery/root/vendor/etc/vintf/manifest.xml
vendored
1
recovery/root/vendor/etc/vintf/manifest.xml
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- Copyright (C) 2019-Present A-Team Digital Solutions -->
|
||||||
<!--
|
<!--
|
||||||
Input:
|
Input:
|
||||||
manifest_kalama.xml
|
manifest_kalama.xml
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2023 The Android Open Source Project
|
# Copyright (C) 2023 The Android Open Source Project
|
||||||
#
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
@ -27,3 +27,6 @@ PRODUCT_NAME := twrp_rtwo
|
||||||
PRODUCT_BRAND := motorola
|
PRODUCT_BRAND := motorola
|
||||||
PRODUCT_MODEL := Motorola Edge 40 Pro
|
PRODUCT_MODEL := Motorola Edge 40 Pro
|
||||||
PRODUCT_MANUFACTURER := motorola
|
PRODUCT_MANUFACTURER := motorola
|
||||||
|
|
||||||
|
# Virtual A/B OTA support
|
||||||
|
$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
# Copyright (C) 2019-Present A-Team Digital Solutions
|
||||||
|
|
||||||
# OrangeFox maintainer avatar
|
# OrangeFox maintainer avatar
|
||||||
export OF_MAINTAINER_AVATAR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/maintainer.png"
|
export OF_MAINTAINER_AVATAR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/maintainer.png"
|
||||||
|
export FOX_AB_DEVICE=1
|
||||||
|
export OF_AB_DEVICE_WITH_RECOVERY_PARTITION=1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue