bkerler / mtkclient

MTK reverse engineering and flash tool
GNU General Public License v3.0
2.68k stars 525 forks source link

MT8127 - error on disabling watchdog - amazon fire 7 #180

Closed kayshinonome closed 3 months ago

kayshinonome commented 2 years ago

Output

Port - Device detected :)
Preloader -     CPU:            MT8127/MT3367()
Preloader -     HW version:     0x0
Preloader -     WDT:            0x10007000
Preloader -     Uart:           0x11002000
Preloader -     Brom payload addr:  0x100a00
Preloader -     DA payload addr:    0x201000
Preloader -     Var1:           0xa
Preloader - Disabling Watchdog...
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/mtk", line 1369, in <module>
    mtk = Main(args).run()
  File "/usr/lib/python-exec/python3.9/mtk", line 518, in run
    if mtk.preloader.init():
  File "/usr/lib/python3.9/site-packages/mtkclient/Library/mtk_preloader.py", line 190, in init
    self.setreg_disablewatchdogtimer(self.config.hwcode)  # D4
  File "/usr/lib/python3.9/site-packages/mtkclient/Library/mtk_preloader.py", line 325, in setreg_disablewatchdogtimer
    res = self.write32(addr, [value])
  File "/usr/lib/python3.9/site-packages/mtkclient/Library/mtk_preloader.py", line 247, in write32
    if status > 0xFF:
TypeError: '>' not supported between instances of 'list' and 'int'

uname -a

Linux latitude-e6430 5.10.76-gentoo-r1-x86_64 #1 SMP Thu Nov 25 14:35:41 CST 2021 x86_64 Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz GenuineIntel GNU/Linux

python version

Python 3.9.8
bkerler commented 2 years ago

I will have a look

kayshinonome commented 2 years ago

Thank you ^^

justsilencia commented 2 years ago

Was there any luck resolving this issue? I'm looking into tinkering with an Amazon Fire 7 9th gen; just wondering if it's a bad idea.

kayshinonome commented 2 years ago

I've tried the latest commit and no luck. However I think tinkering with it is safe, the thing is ancient

justsilencia commented 2 years ago

Thanks for the update. Actually my concern wasn't whether it's safe; I don't actually have the tablet yet. I'm looking for a cheap one to purchase to do some testing with and this looked like a good candidate. Then I ran into your issue... Thanks again.

kayshinonome commented 2 years ago

No problem

justsilencia commented 2 years ago

Quick question (sorry for polluting your issue). I noticed it says your chipset is MT8127/MT3367. My understanding was that this device uses MT8163 chipset. What generation is your Fire 7?

kayshinonome commented 2 years ago

Am unsure but I know it's this https://m.gsmarena.com/amazon_fire_7-7609.php

bkerler commented 2 years ago

Please retry and send full error log using --debugmode.

kayshinonome commented 2 years ago

log.txt

This thing took quite a while to detect... i think the tablet is odd

bkerler commented 2 years ago

Please try commit b30d65c

charles-atredis commented 8 months ago

I am running into the same issue on an MT8163 Amazon Fire 7. Is there a command loop in the preloader similar to the BROM image? And if so, can you point me towards an idb or example where to find it? I thought it'd see if I can make any progress troubleshooting.

Also, I believe the title is a bit of a misnomer. The watchdog timer does get disabled since it remains in preloader mode instead of continuing boot. However, the usb repeatedly times out as in the logs shown above. I confirmed the same behavior on the b30d65c commit, main branch, and LiveOS version.

charles-atredis commented 8 months ago

So I think you can probably close this -- just checked the preloader and the fire has removed several of the commands. The only supported commands are below. It's likely looping infinitely and the call to platform_wdt_kick at the top of the loop is what is keeping the device into preloader mode as opposed to what I expected / hoped that it was a tweak in how the Fire device was doing flushes. Anyway, cheers.

0xD5 CMD_JUMP_DA 0xD7 CMD_SEND_DA 0xD8 CMD_GET_TARGET_CONFIG 0xFC CMD_GET_HW_SW_VER 0xFD CMD_GET_HW_CODE 0xFE CMD_GET_BL_VER

Skorpion96 commented 7 months ago

same issue on my fire hd8 2018:.......Port - Device detected :) Preloader - CPU: MT8163() Preloader - HW version: 0x0 Preloader - WDT: 0x10007000 Preloader - Uart: 0x11002000 Preloader - Brom payload addr: 0x100a00 Preloader - DA payload addr: 0x201000 Preloader - CQ_DMA addr: 0x10212c00 Preloader - Var1: 0xb1 Preloader - Disabling Watchdog... Traceback (most recent call last): File "/media/x/Dati/github-repos/mtkclient-1.52/mtk", line 1842, in mtk = Main(args).run() File "/media/x/Dati/github-repos/mtkclient-1.52/mtk", line 631, in run if mtk.preloader.init(): File "/media/x/Dati/github-repos/mtkclient-1.52/mtkclient/Library/mtk_preloader.py", line 175, in init self.setreg_disablewatchdogtimer(self.config.hwcode) # D4 File "/media/x/Dati/github-repos/mtkclient-1.52/mtkclient/Library/mtk_preloader.py", line 304, in setreg_disablewatchdogtimer res = self.write32(addr, [value]) File "/media/x/Dati/github-repos/mtkclient-1.52/mtkclient/Library/mtk_preloader.py", line 235, in write32 if status > 0xFF: TypeError: '>' not supported between instances of 'list' and 'int' looking at preloader look at what i found Schermata del 2024-04-08 16-00-15 preloader.zip

bkerler commented 3 months ago

only option is to a) backup preloader and then b) use mtk.py stage and then use stage2.py to erase the preloader