Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Created June 15, 2020 20:55
Show Gist options
  • Save plugnburn/b3b0bcfd926c48ec5373bea84ce59337 to your computer and use it in GitHub Desktop.
Save plugnburn/b3b0bcfd926c48ec5373bea84ce59337 to your computer and use it in GitHub Desktop.
MTK Bootseq: enter alternative boot modes in MediaTek-based smartphones
#!/usr/bin/env python3
# Simple script to enter the necessary boot mode in the MT6572-based (etc) phones
# Depends on pyserial, otherwise fully cross-platform
# Usage: python3 mtk-bootseq.py [MODECMD] [port]
# e.g. python3 mtk-bootseq.py FASTBOOT /dev/tty.usbmodem14200
# and then connect the cable and repeatedly short-press the power on key
# Supported commands depend on the device and its preloader. Here's the list for Sigma S3500 sKai:
# FASTBOOT enters fastboot mode
# METAMETA enters MAUI META mode
# FACTFACT enters (Chinese) factory menu
# FACTORYM enters ATE Signaling Test
# ADVEMETA does normal boot (probably something else as well)
import sys
import time
from serial import Serial
BOOTSEQ = bytes(sys.argv[1], "ascii")
DEVICE = sys.argv[2]
CONFIRM = b"READY" + BOOTSEQ[:-4:-1]
while True:
try:
s = Serial(DEVICE, 115200)
sys.stdout.write("\n")
break
except OSError as e:
sys.stdout.write("."); sys.stdout.flush()
time.sleep(0.1)
while True:
s.write(BOOTSEQ)
resp = s.read(8)
print(resp)
if resp == CONFIRM:
break
print("Boot sequence sent")
Copy link

ghost commented Oct 5, 2020

Thank you for share! It's works also on MT6739.
Now I can put in meta mode in linux and run ModemMeta on virtualbox windows.

@turtle-bazon
Copy link

turtle-bazon commented Jul 2, 2023

How do you connect in VirtualBox's ModemMeta to device?

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