Tested 2026-09-14 on build UKG3.250107.001 / V816.0.25.7.22.UZFAABX (Android TV 14, June 2025 patch).
Result: Magisk 30.7 root, with Widevine L1 and PlayReady still working.
| Item | Value on this box | How to check |
|---|---|---|
| Model | MiTV-AFMU0 |
adb shell getprop ro.product.model |
| Codename | twilight |
adb shell getprop ro.product.name |
| SoC | Amlogic S7D | adb shell getprop ro.board.platform -> s7d |
| Kernel | 5.15 GKI, 32-bit userspace | adb shell uname -a |
| Layout | A/B, dynamic partitions, has init_boot |
adb shell ls /dev/block/by-name/ |
Watch out for the TV Stick 4K ("adastra"). It reports the same ro.product.device=twilight but is a different device, and its images will not boot on the box. Check ro.product.model and ro.product.name instead.
This is a GKI device with init_boot_a/b, so Magisk patches init_boot, not boot. That is the main thing every 2nd Gen guide gets wrong for this box.
Slot B is empty on a fresh unit. init_boot_b, boot_b and vendor_boot_b are all zeros, so there is no A/B fallback if slot A stops booting.
There is no recovery key combo on the remote. Several users have tried. If the box boot-loops you cannot get back to fastboot from software.
The one way back into fastboot from a boot loop is a hardware test-point short. Open the case, have fastboot waiting on the PC, connect power and USB, and the instant the LED first lights, short TP140 to TP180 for two to three seconds. This comes from 4PDA topic 1104313, post 10312, where the poster recovered a box this way.
Fastboot cannot dump partitions on this bootloader. fastboot fetch only works for vendor_boot, and the unprivileged ADB shell cannot read /dev/block. The stock image has to come from firmware, not from the device.
Every brick reported so far came from flashing an init_boot built from a different firmware version. Section 4 shows how to check the fingerprint before you flash.
Unlocking and rooting did not affect Widevine L1 or PlayReady on this box. The DRM keys live in fused TEE storage that the bootloader state does not touch.
- Android platform-tools (
adb,fastboot). The Windowsfastboot.exeworked fine. Scripting was done from WSL over networkadb. - payload-dumper-go to pull images out of the OTA
payload.bin. - Magisk APK (v30.7 used), from https://github.com/topjohnwu/Magisk/releases.
- Python 3 with the
lz4module (pip install lz4) for the fingerprint check. Optional, but worth it.
Plain fastboot. No Mi account, no Mi Unlock Tool, no waiting period.
- Settings -> Device Preferences -> About -> click Build 7 times -> Developer options.
- Turn on OEM unlocking and USB debugging. Turn on network ADB too if you want to work wirelessly later.
- Connect USB to the PC and:
adb reboot bootloader
fastboot devices
fastboot getvar unlocked # expect: no
fastboot flashing unlock
fastboot flashing unlock_critical
fastboot reboot
The box wipes and you set it up again. Afterwards adb shell getprop ro.boot.verifiedbootstate reports orange and fastboot getvar unlocked reports yes. (4PDA post 2114, and confirmed here.)
adb shell getprop ro.build.fingerprint
adb shell getprop ro.bootimage.build.date.utc
Example: Xiaomi/twilight/twilight:14/UKG3.250107.001/V816.0.25.7.22.UZFAABX:user/release-keys, timestamp 1753131656.
Google hosts Xiaomi's Google TV OTAs and they download without a login. Known URLs:
| Build | URL | Size |
|---|---|---|
UKG3.250107.001 / V816.0.25.7.22 (Jul 2025) |
https://android.googleapis.com/packages/ota-api/package/fbc6a620d9d88823fa3b4b4257e7c765eb471cb1.zip | 1,143,553,247 B |
UKG3.250826.001 / V816.0.7.0 (Jan 2026) |
https://android.googleapis.com/packages/ota-api/package/8eebe81e9e0de636b2521f4e18ab7971c995f2b0.zip | 1,235,546,567 B |
For other builds, the first post of the 4PDA thread has a firmware archive. xiaomifirmwareupdater does not list TV products.
Confirm the zip matches your build before extracting anything:
unzip -p <ota>.zip META-INF/com/android/metadata | grep -E "post-build=|post-timestamp="
Both values must equal your device's fingerprint and ro.bootimage.build.date.utc.
unzip <ota>.zip payload.bin
payload-dumper-go -p init_boot,boot,vendor_boot,dtbo,vbmeta -o extracted payload.bin
You only need init_boot.img (8 MB). Keep the others as a recovery kit. None of them need flashing for root.
Check the magic bytes and, if you can, the fingerprint inside the ramdisk. The ramdisk is LZ4-legacy compressed. A short Python check:
import struct, re, lz4.block
d = open("extracted/init_boot.img", "rb").read()
assert d[:8] == b"ANDROID!"
ks, rs = struct.unpack("<II", d[8:16]); pg = 4096
off = pg + ((ks + pg - 1) // pg) * pg; rd = d[off:off + rs]
out = b""; p = 4
while p + 4 <= len(rd):
n = struct.unpack("<I", rd[p:p+4])[0]; p += 4
if n == 0x184c2102: continue
out += lz4.block.decompress(rd[p:p+n], uncompressed_size=8 << 20); p += n
print(re.search(rb"ro\.bootimage\.build\.fingerprint=([^\n]*)", out).group(1).decode())The printed fingerprint must equal adb shell getprop ro.bootimage.build.fingerprint. Record sha256sum extracted/init_boot.img. This file is your rollback image.
Two options. Option B was used here because the Android TV file picker is a pain with a remote.
adb install Magisk.apk
adb push extracted/init_boot.img /sdcard/Download/
Open Magisk -> Install -> "Select and Patch a File" -> pick init_boot.img. Pull /sdcard/Download/magisk_patched-*.img.
The Magisk APK ships the same script the app runs. Extract it and lay the files out flat. The box is armeabi-v7a, so use the 32-bit libs:
mkdir stage && cd stage
unzip -j ../Magisk.apk assets/boot_patch.sh assets/util_functions.sh assets/stub.apk
unzip -p ../Magisk.apk lib/armeabi-v7a/libmagiskboot.so > magiskboot
unzip -p ../Magisk.apk lib/armeabi-v7a/libmagiskinit.so > magiskinit
unzip -p ../Magisk.apk lib/armeabi-v7a/libinit-ld.so > init-ld
unzip -p ../Magisk.apk lib/armeabi-v7a/libmagisk.so > magisk
unzip -p ../Magisk.apk lib/armeabi-v7a/libbusybox.so > busybox
cd ..
adb install Magisk.apk
adb push extracted/init_boot.img /data/local/tmp/
adb shell mkdir -p /data/local/tmp/mg
adb push stage/. /data/local/tmp/mg/
adb shell "cd /data/local/tmp/mg && chmod 755 * && sh ./boot_patch.sh /data/local/tmp/init_boot.img"
adb pull /data/local/tmp/mg/new-boot.img extracted/init_boot_magisk.img
The output should include Stock boot image detected, Pre-init storage partition: metadata and Repack to boot image: [new-boot.img]. The defaults KEEPVERITY=false and KEEPFORCEENCRYPT=false are fine on an unlocked device.
adb shell sha256sum /data/local/tmp/mg/new-boot.img
sha256sum extracted/init_boot_magisk.img # must match
Run the Python check from 4d on the patched image as well. The fingerprint must still be yours, and the cpio should now contain overlay.d/sbin/magisk.xz, .backup/init.xz and friends.
One partition, active slot only. No vbmeta, dtbo, vendor_boot or super changes. The unlock already turned AVB off, so the --disable-verity steps from 2nd Gen guides do not apply.
adb reboot bootloader
fastboot getvar current-slot # expect: a
fastboot flash init_boot_a init_boot_magisk.img
fastboot reboot
You should see Sending 'init_boot_a' (8192 KB) OKAY and Writing 'init_boot_a' OKAY. Boot takes about 20 seconds.
If current-slot says b, flash init_boot_b instead. Read the value rather than assuming it.
The Magisk app shows up as a stub and offers additional setup. Let it run. It may reboot the box once.
adb shell /debug_ramdisk/su -c id # uid=0(root) ... context=u:r:magisk:s0
adb shell /debug_ramdisk/magisk -v # 30.7:MAGISK:R
su is not on the ADB shell's PATH on this box, so use the full path /debug_ramdisk/su. In the Magisk app under Superuser, set Shell to Grant so ADB requests stop prompting.
Same command with the stock image:
fastboot flash init_boot_a init_boot.img
If the box boot-loops and you cannot reach fastboot, use the TP140 to TP180 test-point method from section 1, run fastboot flashing unlock if needed, and flash the stock image.
An A/B OTA installs to the inactive slot and flips to it, which drops root and fills slot B. You have two choices.
To keep updates and keep root: download the OTA but do not reboot. Open Magisk -> Install -> "Install to Inactive Slot (After OTA)", then reboot. Root carries over and slot B becomes a real fallback. (4PDA post 2647.)
To block updates entirely, which is what was done here: system updates on Google TV go through GMS rather than the Xiaomi app, so disable only the GMS update components plus the Xiaomi updater. The change survives reboots and needs no Magisk module.
adb shell /debug_ramdisk/su -c '
pm disable com.google.android.gms/.update.SystemUpdateService
pm disable com.google.android.gms/.update.SystemUpdateGcmTaskService
pm disable com.google.android.gms/.update.SystemUpdatePersistentListenerService
pm disable com.google.android.gms/.update.SystemUpdatePanoActivity
pm disable com.google.android.gms/.update.OtaPanoSetupActivity
pm disable com.google.android.gms/.update.CompleteDialog
pm disable-user --user 0 com.xiaomi.mitv.updateservice
pm clear --user 0 com.xiaomi.mitv.updateservice'
Revert with pm enable on each. One caveat: a future Play system update that touches those components could cause a boot loop. Magisk safe mode kicks in after three failed boots, or you can pm enable them from ADB.
- 4PDA topic 1104313 (unlock post 2114, root post 2129, OTA-with-root post 2647, test-point unbrick post 10312): https://4pda.to/forum/index.php?showtopic=1104313
- Hardware writeup, partition map, OTA blocking recipe: https://github.com/samtheruby/coreelec-android-dualboot-twilight (
research.md,partB-installer/magisk/README.md) - Magisk: https://github.com/topjohnwu/Magisk
- payload-dumper-go: https://github.com/ssut/payload-dumper-go
- 2nd Gen references (for contrast, do not follow the vbmeta/dtbo steps): https://gist.github.com/supechicken/3c8378be3469bc2f82b7b319f202ed82
Thanks a lot for this guide! It helped me root my Xiaomi TV Box S 3rd Gen successfully.
I was on the newer firmware:
V816.0.11.0.UZFAABX
Fingerprint:
Xiaomi/twilight/twilight:14/UKG3.250826.001/V816.0.11.0.UZFAABX:user/release-keys
My active slot was B.
The pre-patched init_boot from the bundle was for V816.0.7.0.UZFAABX, so the installer rejected it with FIRMWARE MISMATCH.
I found the correct OTA through OTAChecker (OTA #2546). Interestingly, the OTA itself is V816.0.7.0, but its post-condition fingerprint is V816.0.11.0.UZFAABX, matching my box.
I downloaded that OTA, extracted the init_boot.img, and then followed your exact method to patch it with Magisk 30.7 using magiskboot and boot_patch.sh.
I then used the installer with my patched image, and it successfully flashed init_boot_b.
After reboot:
uid=0(root) gid=0(root) groups=0(root) context=u:r:magisk:s0
So your method works on `V816.0.11.0.UZFAABX as well. The important part was finding the OTA whose post-condition fingerprint matched the firmware actually installed, rather than simply looking for an OTA with the same version number.
Thanks again for the original work! Hopefully this helps anyone running the newer firmware.