mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-11-30 19:26:56 -05:00
Add meta boot via payload
This commit is contained in:
parent
e6458de7fa
commit
534c0d0a97
4 changed files with 27 additions and 0 deletions
|
@ -164,6 +164,15 @@ python mtk reset
|
|||
10. Disconnect usb cable and enjoy your rooted phone :)
|
||||
|
||||
|
||||
### Boot to meta mode via payload
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
python mtk payload --metamode FASTBOOT
|
||||
```
|
||||
|
||||
|
||||
### Unlock bootloader
|
||||
|
||||
1. Erase metadata and userdata (and md_udc if existing):
|
||||
|
|
8
mtk
8
mtk
|
@ -627,6 +627,13 @@ class Main(metaclass=LogBase):
|
|||
if self.args.ptype is not None:
|
||||
ptype = self.args.ptype
|
||||
plt.runpayload(filename=payloadfile)
|
||||
if args.metamode:
|
||||
mtk.port.run_handshake()
|
||||
mtk.preloader.jump_bl()
|
||||
mtk.port.close(reset=True)
|
||||
meta=META(mtk,loglevel)
|
||||
if meta.init(metamode=args.metamode, display=True):
|
||||
self.info(f"Successfully set meta mode : {args.metamode}")
|
||||
mtk.port.close(reset=True)
|
||||
self.close()
|
||||
elif cmd == "gettargetconfig":
|
||||
|
@ -1753,6 +1760,7 @@ if __name__ == '__main__':
|
|||
parser_dumppreloader.add_argument('--socid', help='Read Soc ID')
|
||||
|
||||
parser_payload.add_argument('--payload', type=str, help='Payload filename (optional)')
|
||||
parser_payload.add_argument('--metamode', type=str, default=None, help='metamode to use '+metamodes)
|
||||
parser_payload.add_argument('--loader', type=str, help='Use specific loader, disable autodetection')
|
||||
parser_payload.add_argument('--filename', help='Optional payload to load')
|
||||
parser_payload.add_argument('--vid', type=str, help='Set usb vendor id used for MTK Preloader')
|
||||
|
|
|
@ -67,6 +67,7 @@ class META(metaclass=LogBase):
|
|||
resp = bytearray(EP_IN(maxinsize))
|
||||
if resp==b"READY":
|
||||
return True
|
||||
self.warning(resp)
|
||||
else:
|
||||
if cdc.connected:
|
||||
cdc.close()
|
||||
|
|
|
@ -262,6 +262,15 @@ class Preloader(metaclass=LogBase):
|
|||
self.usbread(1)
|
||||
self.usbread(2)
|
||||
|
||||
def jump_bl(self):
|
||||
if self.echo(self.Cmd.JUMP_BL.value):
|
||||
status = self.rword()
|
||||
if status <= 0xFF:
|
||||
status2 = self.rword()
|
||||
if status <= 0xFF:
|
||||
return True
|
||||
return False
|
||||
|
||||
def jump_to_partition(self, partitionname):
|
||||
if isinstance(partitionname, str):
|
||||
partitionname = bytes(partitionname, 'utf-8')[:64]
|
||||
|
|
Loading…
Reference in a new issue