Coder Social home page Coder Social logo

mtk_uartboot's People

Contributors

981213 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mtk_uartboot's Issues

Error: called `Result::unwrap()` on an `Err` value: Custom { kind: TimedOut, error: "Operation timed out" }

❯ ./mtk_uartboot
mtk_uartboot - 0.1.0

Running on MacOS Sonoma. Using an FT232 UART device.

❯ RUST_BACKTRACE=full ./mtk_uartboot -p bl2-mt7622-1ddr-ram.bin -a -f openwrt-mediatek-mt7622-linksys_e8450-ubi-bl31-uboot.fip -s /dev/cu.usbserial-A50285BI
mtk_uartboot - 0.1.0
Using serial port: /dev/cu.usbserial-A50285BI
Handshake...
hw code: 0x7622
hw sub code: 0x8a00
hw ver: 0xcb00
sw ver: 0x100
Baud rate set to 460800
sending payload to 0x201000...
Checksum: 0xfcf1
Setting baudrate back to 115200
Jumping to 0x201000 in aarch64...
Waiting for BL2. Message below:
==================================
NOTICE:  BL2: v2.10.0	(release):v2.10.0-mtk
NOTICE:  BL2: Built : 13:17:01, Mar  1 2024
NOTICE:  WDT: Cold boot
NOTICE:  CPU: MT7622
NOTICE:  WDT: disabled
NOTICE:  Starting UART download handshake ...
==================================
BL2 UART DL version: 0x10
Baudrate set to: 921600
thread 'main' panicked at src/bl2.rs:59:53:
called `Result::unwrap()` on an `Err` value: Custom { kind: TimedOut, error: "Operation timed out" }
stack backtrace:
   0:        0x1041eead4 - __mh_execute_header
   1:        0x104203f30 - __mh_execute_header
   2:        0x1041ed118 - __mh_execute_header
   3:        0x1041ee908 - __mh_execute_header
   4:        0x1041efc0c - __mh_execute_header
   5:        0x1041ef954 - __mh_execute_header
   6:        0x1041f0054 - __mh_execute_header
   7:        0x1041eff48 - __mh_execute_header
   8:        0x1041eef58 - __mh_execute_header
   9:        0x1041efcd0 - __mh_execute_header
  10:        0x10420b620 - __mh_execute_header
  11:        0x10420b91c - __mh_execute_header
  12:        0x104190594 - __mh_execute_header
  13:        0x1041906a0 - __mh_execute_header
  14:        0x10418cfbc - __mh_execute_header
[1]    85508 abort      RUST_BACKTRACE=full ./mtk_uartboot -p bl2-mt7622-1ddr-ram.bin -a -f  -s

Using the utility

Hi
Thanks for coding the utility. I have Mediatek 7981 based router Xiaomi ax3000t which has erased bootloader and no other means to reflash the uboot.

Using your utility, Do i need to follow any special procedure on the device itself ??

Thanks a lot !!

Doesn't work on ARM (Not a bug, just wanting to leave a comment)

not an issue with the program itself, just wanted to comment if you could possibly release an ARM version (if it's even possible) to be used with a Raspberry Pi 4 (I use one as my serial adapter, router is connected to UART4 on the RPI since i don't have a usb uart adapter)

EDIT: I compiled it for ARM and it ran smoothly, i forked the repo if anyone else wants to use the arm version (tested on a raspberry pi 4 and RT3200 running 23.05.0)

License?

I don't find any information about code license in this repository.
If you haven't decided yet, imho AGPL would be a good choice :)
Given, of course, that mtk_uartboot is not a derivative work of bypass_util which would make it GPL-3.0 (or later?). I'm not a lawyer, but I wouldn't consider it derivative work in the sense of the GPL.

TX - RX mismatch on mt7988 ?

Hi, in messing with a bananapi r4 and trying to use this tool, I found an interesting interaction between the board and the my serial.

For some reason using the default baudrate values for brom cause a TX -RX mismatch error but using the lowest one makes it work correctly.

Any idea of the cause and how we can bisect this? I notice there were some workaround for some fake serial that required more time...

Problem is that (in theory) my serial is not fake and is even one of the more modern one. It's a CH347. I have verified that the tool works correctly with mt7981 and mt7986.

FIP load is not affected by this problem.

The thing crash at:
https://github.com/981213/mtk_uartboot/blob/main/src/bootrom.rs#L47

TX 215 RX 5

src/bootrom.rs: called `Result::unwrap()` on an `Err` value: Custom { kind: TimedOut, error: "Operation timed out" }

@981213
Hello--me again! Getting another timeout error on MacOS (arm64) similar to my previous issue with the timeout for bl2. Is the bl2 fix you put in place able to apply here as well?

❯ RUST_BACKTRACE=full ./mtk_uartboot --brom-load-baudrate 115200 -s /dev/cu.usbserial-A50285BI -p bl2.bin --aarch64
mtk_uartboot - 0.1.1
Using serial port: /dev/cu.usbserial-A50285BI
Handshake...
hw code: 0x7622
hw sub code: 0x8a00
hw ver: 0xcb00
sw ver: 0x100
Baud rate set to 115200
sending payload to 0x201000...
thread 'main' panicked at src/bootrom.rs:53:53:
called `Result::unwrap()` on an `Err` value: Custom { kind: TimedOut, error: "Operation timed out" }
stack backtrace:
   0:        0x1005b2ad4 - __mh_execute_header
   1:        0x1005c7f30 - __mh_execute_header
   2:        0x1005b1118 - __mh_execute_header
   3:        0x1005b2908 - __mh_execute_header
   4:        0x1005b3c0c - __mh_execute_header
   5:        0x1005b3954 - __mh_execute_header
   6:        0x1005b4054 - __mh_execute_header
   7:        0x1005b3f48 - __mh_execute_header
   8:        0x1005b2f58 - __mh_execute_header
   9:        0x1005b3cd0 - __mh_execute_header
  10:        0x1005cf620 - __mh_execute_header
  11:        0x1005cf91c - __mh_execute_header
  12:        0x100555ce4 - __mh_execute_header
  13:        0x100550d0c - __mh_execute_header
[1]    42170 abort      RUST_BACKTRACE=full ./mtk_uartboot --brom-load-baudrate 115200 -s  -p bl2.bin

[solved] Want to unbrick Linksys E8450, got "timed out" error

@981213
Hello, my Linksys E8450 suddenly unable to bootup.

Got the error below:

F0: 102B 0000
F6: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 0400 0041 [0000]
G0: 1190 0000
T0: 0000 02D5 [000F]
Jump to BL

NOTICE:  BL2: v2.9(release):OpenWrt v2023-07-24-00ac6db3-2 (mt7622-snand-1ddr)
NOTICE:  BL2: Built : 21:45:35, Oct  9 2023
NOTICE:  CPU: MT7622
NOTICE:  WDT: Cold boot
NOTICE:  WDT: disabled
NOTICE:  SPI-NAND: FM35Q1GA (128MB)
ERROR:   BL2: Failed to load image id 5 (-2)

I try to unbrick it with mtk_uartboot, but got errors.

ENV

  • Windows 11 x64
  • Powershell
  • bl2.bin: from owrt 1.1.1, and try your bl2(download from openwrt form)
  • uboot.fip: from openwrt 23.05.2
  • E8450 OpenWrt: v23.05.2
> $env:RUST_BACKTRACE="full"
> mtk_uartboot.exe --brom-load-baudrate 115200 -s COM7 --aarch64 -p bl2.bin -f uboot.fip
mtk_uartboot - 0.1.1
Using serial port: COM7
Handshake...
hw code: 0x7622
hw sub code: 0x8a00
hw ver: 0xcb00
sw ver: 0x100
Baud rate set to 115200
sending payload to 0x201000...
Checksum: 0xdac6
Setting baudrate back to 115200
Jumping to 0x201000 in aarch64...
Waiting for BL2. Message below:
==================================
NOTICE:  BL2: v2.10.0   (release):v2.4-rc0-5845-gbacca82a8
NOTICE:  BL2: Built : 19:21:54, Mar  1 2024
NOTICE:  WDT: Cold boot
NOTICE:  CPU: MT7622
NOTICE:  WDT: disabled
NOTICE:  Starting UART download handshake ...
==================================
BL2 UART DL version: 0x10
Baudrate set to: 921600
thread 'main' panicked at src\bl2.rs:44:53:
called `Result::unwrap()` on an `Err` value: Custom { kind: TimedOut, error: "Operation timed out" }
stack backtrace:
   0:     0x7ff6c58fb3d2 - <unknown>
   1:     0x7ff6c590ca2d - <unknown>
   2:     0x7ff6c58f95d1 - <unknown>
   3:     0x7ff6c58fb1fa - <unknown>
   4:     0x7ff6c58fcbf9 - <unknown>
   5:     0x7ff6c58fc8b5 - <unknown>
   6:     0x7ff6c58fd124 - <unknown>
   7:     0x7ff6c58fcff9 - <unknown>
   8:     0x7ff6c58fba79 - <unknown>
   9:     0x7ff6c58fccc2 - <unknown>
  10:     0x7ff6c5925e07 - <unknown>
  11:     0x7ff6c59262a3 - <unknown>
  12:     0x7ff6c57b777f - <unknown>
  13:     0x7ff6c57b7d66 - <unknown>
  14:     0x7ff6c57b2eff - <unknown>
  15:     0x7ff6c57be386 - <unknown>
  16:     0x7ff6c57bdc9c - <unknown>
  17:     0x7ff6c58f4e72 - <unknown>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.