Skip to content

Instantly share code, notes, and snippets.

@muink
Last active August 13, 2025 13:40
Show Gist options
  • Select an option

  • Save muink/9359e5a944bc5ba16f1da6f94d42621d to your computer and use it in GitHub Desktop.

Select an option

Save muink/9359e5a944bc5ba16f1da6f94d42621d to your computer and use it in GitHub Desktop.
Applying Incremental OTA on a rooted Android device with AB partition

Applying Incremental OTA on a rooted Android device with AB partition

Take Oneplus 13 as an example

  1. Get the factory image of the current system version
    • Confirm the modified partitions, init_boot / boot / dtbo / recovery ?
      • If you are unsure, you can use md5 comparison or apply the new version using the Full OTA or flash the new factory images, then enter the standard root process
    • Get the factory images of these partitions
      • Can use payload-dumper to extract it from the stock Full OTA package of the current system version
  2. Restore the current system to stock
    • Run the following command in Termux on your phone or adb shell on your computer:
# Execute as root user
su

# Get the active slot suffix (e.g., _a or _b)
ACT=$(getprop ro.boot.slot_suffix)

# Restore to stock
dd if=/sdcard/<factory init_boot>.img  of=/dev/block/bootdevice/by-name/init_boot${ACT} # init_boot_a or init_boot_b if you need restore
dd if=/sdcard/<factory boot>.img       of=/dev/block/bootdevice/by-name/boot${ACT}      # boot_a or boot_b if you need restore
dd if=/sdcard/<factory dtbo>.img       of=/dev/block/bootdevice/by-name/dtbo${ACT}      # dtbo_a or dtbo_b if you need restore
dd if=/sdcard/<factory recovery>.img   of=/dev/block/bootdevice/by-name/recovery${ACT}  # recovery_a or recovery_b if you need restore

exit
  1. Apply the system update in Settings > System & Update > Software Update, but don't restart

    • If this fails, apply the new version using the Full OTA or flash the new factory images, then enter the standard root process
  2. Install root to inactive Slot

    • Launch your root manager (e.g., Magisk, KSU, or Apatch)
    • Select the top option (this may be Install or something similar)
    • Choose "Install to inactive slot", but don't restart
  3. Final Restart

    • Go back to the Software Update app from step 3 and hit the Restart button

ref:
How to install incremental update on all variants rooted NA, IN, EU, GLO & CN **UPDATED 12/23/2024
Root installation with Apatch and OTA update + Root detection fixes

在已 root 的 AB 分区 Android 设备上应用增量 OTA

以 Oneplus 13 为例

  1. 获取当前系统版本的工厂镜像
    • 确认已修改的分区, init_boot / boot / dtbo / recovery ?
      • 如果不确定的话, 可以用 md5 比对或直接应用新版本全量 OTA 或刷入新版本工厂镜像, 然后进入标准 root 流程
    • 取得这些分区的工厂镜像
      • 可以使用 payload-dumper 从当前系统版本的原厂全量 OTA 包中提取
  2. 将当前系统恢复到原厂
    • 在手机上的 Termux 或电脑上使用 adb shell 执行以下命令:
# 以 root 用户执行
su

# 获取活动插槽后缀 (例如, _a 或 _b)
ACT=$(getprop ro.boot.slot_suffix)

# 恢复到原厂
dd if=/sdcard/<工厂 init_boot>.img  of=/dev/block/bootdevice/by-name/init_boot${ACT} # init_boot_a 或 init_boot_b 如果需要恢复
dd if=/sdcard/<工厂 boot>.img       of=/dev/block/bootdevice/by-name/boot${ACT}      # boot_a 或 boot_b 如果需要恢复
dd if=/sdcard/<工厂 dtbo>.img       of=/dev/block/bootdevice/by-name/dtbo${ACT}      # dtbo_a 或 dtbo_b 如果需要恢复
dd if=/sdcard/<工厂 recovery>.img   of=/dev/block/bootdevice/by-name/recovery${ACT}  # recovery_a 或 recovery_b 如果需要恢复

exit
  1. 在 设置 > 系统和更新 > 软件更新 中应用系统更新, 但不要重启

    • 如果失败, 请直接应用新版本全量 OTA 或刷入新版本工厂镜像, 然后进入标准 root 流程
  2. 将 root 安装到非活动插槽

    • 启动您的 root 管理器 (例如, Magisk, KernelSUApatch)
    • 选择顶部选项 (可能是 安装 或类似的选项)
    • 选择 安装到非活动插槽, 但不要重启
  3. 最终重启

    • 返回步骤 3 中的 软件更新 并点击 重新启动

参考:
How to install incremental update on all variants rooted NA, IN, EU, GLO & CN **UPDATED 12/23/2024
Root installation with Apatch and OTA update + Root detection fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment