Hello everyone,
I recently had to flash a stock firmware file from Xiaomi (.tgz) and being primarily a Linux user I was quite disappointed by the fact that the company only provides a flashing tool for Windows.
Either way, I booted into Windows and flashed it. I had a look at the logs later and apparently their flash tool is just a front-end to fastboot, and looking at their firmware archives I noticed there were some .sh files in there, and guess what, they're scripts which do the exact same things their Windows scripts do! So I decided to try to use them to flash the firmware on Linux and, sure enough, after ~10 minutes the device was successfully flashed.
Here's what I did, as always I don't take responsibility for bricked devices, try this at your own risk:
1. unpack the archive
2. cd to the archive directory
3. grant run permissions
(in my case I was interested in flash_all.sh, I think you can follow the exact same procedure with whichever script you want, though I haven't tested it)
4. get your device id
you'll get something like this
you're interested in the first column, so in my case d82c2d3
5. run the script
at this point the flashing process should start and if everything went good your phone should reboot in a few minutes.
You might need to prepend the commands in point 4 and 5 with sudo.
Also, I don't know if every firmware archive has these .sh files, but it would seem logical. By the way, let me know if this is common knowledge and my googling just sucks as I couldn't find anything related to it...
I recently had to flash a stock firmware file from Xiaomi (.tgz) and being primarily a Linux user I was quite disappointed by the fact that the company only provides a flashing tool for Windows.
Either way, I booted into Windows and flashed it. I had a look at the logs later and apparently their flash tool is just a front-end to fastboot, and looking at their firmware archives I noticed there were some .sh files in there, and guess what, they're scripts which do the exact same things their Windows scripts do! So I decided to try to use them to flash the firmware on Linux and, sure enough, after ~10 minutes the device was successfully flashed.
Here's what I did, as always I don't take responsibility for bricked devices, try this at your own risk:
1. unpack the archive
Code:
tar -xf <archive_name>.tgz
2. cd to the archive directory
3. grant run permissions
Code:
chmod +x flash_all.sh
4. get your device id
Code:
fastboot devices
Code:
List of devices attached
d82c2d3 fastboot
5. run the script
Code:
./flash_all -s <device_id>
at this point the flashing process should start and if everything went good your phone should reboot in a few minutes.
You might need to prepend the commands in point 4 and 5 with sudo.
Also, I don't know if every firmware archive has these .sh files, but it would seem logical. By the way, let me know if this is common knowledge and my googling just sucks as I couldn't find anything related to it...