https://github.com/grinn-global/mtk-flash
A command-line utility for flashing raw images to MediaTek devices
https://github.com/grinn-global/mtk-flash
brom cli debian embedded fastboot firmware iot rust
Last synced: 4 days ago
JSON representation
A command-line utility for flashing raw images to MediaTek devices
- Host: GitHub
- URL: https://github.com/grinn-global/mtk-flash
- Owner: grinn-global
- License: apache-2.0
- Created: 2025-06-27T13:22:43.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2026-01-08T17:29:18.000Z (5 months ago)
- Last Synced: 2026-05-30T14:26:04.437Z (23 days ago)
- Topics: brom, cli, debian, embedded, fastboot, firmware, iot, rust
- Language: Rust
- Homepage:
- Size: 136 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# MTK Flash
 
**MTK Flash** is a command-line utility for flashing raw images to MediaTek devices, supporting MediaTek Boot ROM communication, Download Agent upload, and Fastboot flashing with image splitting.
## Building
1. Install dependencies:
```sh
sudo apt install -y rustc cargo build-essential
```
2. Build the project:
```sh
cargo build --release
```
The compiled binary will be located in the `target/release` directory:
```
./target/release/mtk-flash --help
```
Alternatively, a precompiled binary is available on the [Releases](https://github.com/grinn-global/mtk-flash/releases) page.
## Usage
1. Add your user to the `dialout` group:
```sh
sudo usermod -aG dialout $USER
```
2. If you want to use the automatic boot into download mode functionality, you also need to set up udev rules for the GPIO chip:
```sh
sudo cp data/90-mtk-flash.rules /etc/udev/rules.d/
sudo udevadm control --reload && sudo udevadm trigger
```
3. Log out and log back in to apply the group membership. Alternatively, you can run `newgrp dialout` in the terminal to apply the changes immediately.
4. Use the tool with the correct serial device path:
```sh
mtk-flash \
--da lk.bin \
--fip fip.img \
--img emmc_sparse.img \
--dev /dev/ttyACM0
```
### Arguments
```sh
mtk-flash --da [--fip ] [--img ] --dev [--gpio ]
```
- `--da `: Path to the Download Agent image.
- `--fip ` *(optional)*: Path to the Firmware Image Package image.
- `--img ` *(optional)*: Path to the system image.
- `--dev `: Serial device path.
- `--gpio ` *(optional)*: Path to the GPIO chip device for controlling power, reset and download mode.
- `--preserve-boot1` *(optional)*: Do not erase `mmc0boot1` after flashing FIP. This is useful for boards/setups where `mmc0boot1` stores u-boot environment (for example, stable MAC addresses) that should be preserved.
## Troubleshooting
If you encounter issues, ensure that:
- The device is connected and recognized by the system.
- You have the necessary permissions to access the serial device.
- The specified paths to the images are correct.
## License
This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE.md) file for details.