- Прошиваем Xiaomi с помощью Linux
- Для чего следует «прошивать» телефон и почему я рекомендую делать это с помощью ПК?
- Что такое Fastboot?
- Предупреждение.
- Этап 1. Подготовка к прошивке
- How to Unlock Xiaomi Devices on Linux and Mac
- Requirements
- Linux Users
- Windows and Mac Users
- Troubleshooting
- Final Notes
- Saved searches
- Use saved searches to filter your results more quickly
- IcemanDev/XIAOMI-TOOL-MiFlash-for-Linux-by-IceMan
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- j-jith / miui-fastboot-howto.rst
- [HowTo] Flash Fastboot ROM with Linux
- Muhamed
Прошиваем Xiaomi с помощью Linux
Сразу хочу предупредить, что эта статья нацелена в первую очередь на более или менее разбирающихся в прошивке аппаратов людей. Приведенные ниже инструкции находятся в свободном доступе в сети Интернет, я лишь собрал всё это в одну кучу и немного дополнил своим видением по кое-каким пунктам.
При написании статьи прошивка проводилась с использованием операционной системы Ubuntu 20.04.
Для чего следует «прошивать» телефон и почему я рекомендую делать это с помощью ПК?
В процессе работы различного ПО (особенно если получен root-доступ) в системе накапливаются ошибки, которые в конечном итоге приводят к зависаниям и непредсказуемому поведению аппарата. Также кастомные прошивки и различные патчи, устанавливаемые с помощью модифицированного recovery, могут повредить файлы, которые способна восстановить только прошивка в режиме Fastboot .
Если Вы часто устанавливаете кастомные прошивки, я также рекомендую сначала прошить телефон в режиме Fastboot, а уже затем переходить на другой кастом, чтобы не таскать одни и те же баги из прошивки в прошивку.
Что такое Fastboot?
Fastboot — это режим, позволяющий при помощи ПК «залить» заводскую прошивку в смартфон. В этом случае все файлы перезаписываются на заводские (в том числе и те, которые не перезаписываются кастомными прошивками или официальными прошивками, установленными с помощью модифицированного recovery).
Предупреждение.
Все инструкции, изложенные ниже, Вы можете использовать только на свой страх и риск! У меня всё завершилось успешно и телефон теперь работает как новый, но это не гарантирует Вам такого же результата! Прошивка смартфона должна производиться опытным пользователем, который в случае нештатной ситуации может всё исправить. Если же Вы всё-таки решились прошивать телефон самостоятельно, проверьте аппаратную версию смартфона (китайская или глобальная) и сверьте её с версией прошивки (они должны соответствовать) . Прошивка, используемая в этой статье предназначена для устройств, выпущенных для глобального рынка, имейте это ввиду!
В качестве примера в статье рассмотрена прошивка смартфона Redmi 5 Plus, но эти инструкции подойдут для большинства аппаратов Xiaomi.
Этап 1. Подготовка к прошивке
На официальном сайте ищем прошивку для нашего аппарата:
How to Unlock Xiaomi Devices on Linux and Mac
Owners of Xiaomi devices who want to flash and unlock their devices have the official MiFlashUnlock tool available to them – however, it does not run on Linux. The MiFlashUnlock software can be ran inside Wine or a VM, but there exists a better way.
MiUnlockTool is an unofficial tool based on MiFlashUnlock, which runs natively on Linux (but can also be installed on Mac and Windows). MiUnlockTool is a bridge between fastboot, your Xiaomi credentials, and the Xiaomi server. It retrieves your device info and sends it to the Xiaomi server together with your login token, then checks if you meet all the requirements to receive an unlock key from the server.
The tool will then send the unlock key to your Xiaomi device utilizing a custom build of fastboot. There are no different requirements for receiving an unlock key via MiUnlockTool compared to MiFlashUnlock – you require an authorized Xiaomi account tied to the device through Developer Options.
Requirements
Linux Users
- Download the MiUnlockTool, it comes in a .zip file.
- Open your terminal and CD to the extracted directory.
- In the terminal, type “sudo ./MiUnlockTool.sh”, which will launch the GUI interface. Alternatively, you can use “sudo ./MiUnlockTool.sh username password” for a command-line interface.
Windows and Mac Users
- After extracting the .zip file, launch MiFlashUnlock.bat for a graphical interface.
- Alternatively you can open a command prompt, CD to the extracted directory, and type “MiUnlockTool.bat username password” for a command-line interface.
After you have launched the MiUnlockTool in whatever OS you’re using, connect your Xiaomi device to your computer while it is in Fastboot Mode.
If you launched the GUI mode, follow the on screen directions. If you are using the command-line interface, there won’t be a confirmation request before unlocking, nor will it check if the bootloader is already unlocked.
Troubleshooting
- If you receive permission errors on Linux or Mac when launching the MiUnlockTool, you need to open a terminal and CD to the extracted directory.
- Then grant it 777 permissions using “chmod 777 MiUnlockTool.sh” (or MiUnlockTool.command on Mac), which will set the proper permissions.
- If you have problems launching the tool even with the Sudo command, you can try the command “java -jar bin/MiUnlockTool.jar”.
- If you encounter errors with JavaFX class not being found, you are missing JavaFX library from your package. Check the OpenJFX package on Linux.
Final Notes
This tool is absolutely safe to use, as is the unlock procedure. Your Xiaomi device will not be damaged, even if the MiUnlockTool attempts an incorrect unlock key.
However, Windows users should probably stick to the official Xiaomi unlock tool. Because MiUnlockTool is a third-party copy built more specifically for Linux users, it can have additional bugs, and Windows will not manage the drivers for example. So MiUnlockTool does work on Windows, its just not recommended.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
IcemanDev/XIAOMI-TOOL-MiFlash-for-Linux-by-IceMan
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
FLASH Firmware: 1- Restart the device in fastboot mode; 2- Connect the device to the PC via USB cable; 3- Start the «XIAOMI TOOL» program from the terminal (cd Xiaomi_MiFlash && sudo ./go.sh) and copy the file of the .tgz or .zip firmware inside the «/Xiaomi_MiFlash/XIAOMI-FILE/» folder; 4- Type «1» to start «FLASH Firmware»; 5- Select the firmware file (tgz or zip) and wait for the end of the operation; 6- Select the affected .sh file. The device will restart automatically.
n.b .: For installing firmware in .zip format will be required within the folder «/Xiaomi_MiFlash/XIAOMI-FILE/» the TWRP recovery file in .img format. Two files will be generated: — flash_rom_zip.sh — flash_rom_zip_erase_data.sh The first is not formatting the «userdata» (so it is recommended for update installations) and restarts the device in TWRP mode. The second format the «userdata» (then indicated for total firmware change) and restarts the device in normal mode.
Backup firmware: 1- Restart the device in TWRP mode; 2- Type «2» to start backup and end operations by pressing any key;
flash TWRP: 1- Restart the device in fastboot mode; 2- Connect the device to the PC via USB cable; 3- Start the «XIAOMI TOOL» program from the terminal (cd Xiaomi_MiFlash && sudo ./go.sh) and copy the file of the twrp recovery (.img) inside the «/Xiaomi_MiFlash/XIAOMI-FILE/» folder; 4- Type «3» to start «TWRP flash»; 5- Select the recovery file for twrp (.img); 6- The device will automatically restart in TWRP mode.
flash boot.img: 1- Restart the device in fastboot mode; 2- Connect the device to the PC via USB cable; 3- Start the «XIAOMI TOOL» program from the terminal (cd Xiaomi_MiFlash && sudo ./go.sh) and copy the file boot.img inside the «/Xiaomi_MiFlash/XIAOMI-FILE/» folder; 4- Type «4» to start «flash boot.img»; 5- Select the boot.img file); 6- The device will restart automatically in normal mode.
j-jith / miui-fastboot-howto.rst
@moraisvinny If you can’t find the script, you may have the recovery flash image.
Get your ROM images from https://xiaomifirmwareupdater.com/ (much easier to use than MIUI forums) and make sure to get a Fastboot image for your device.
You sure it will work?
cause i have an mtk chip so its like impossible to recover it after hard bricking
sorry for doubting
@headsets17 I have never used a MTK device. But from what I’ve read online, SP Flash Tool is recommended for flashing MTK devices.
@headsets17 I have never used a MTK device. But from what I’ve read online, SP Flash Tool is recommended for flashing MTK devices.
hey anybody knows if this works?
Successfully tested on Poco F1
Works just fine with POCO F1! And I actually prefer this one!
Work Fine with redmi note 7
lavender
thnx worked fine
on k20 pro(raphaelin)
Thank you so much! Worked fine on Poco F2 Pro
redmi note 7 (lavender), miui12 latest stable eu, works fine and very simple. thanks!
Thank you a lot! Xiaomi Redmi Note 5, worked like a charm.
why wouldn’t it work ,its just a script that uses fastboot directly. MiUi apparently isnt doing anything special
Worked as expected on a Mi9T EEA device. Thanks a lot !
works fine on xiaomi mi5 standard edition, thanks a bunch.
works fine on my Redmi Note 10(sunny) device . thanks ! no sparse crc problem on linux , im glad now my device is no longer bootloop from flashing using win10
Hi, I’m using Poco F1. Suddenly 2 days back, it went black. no led blinking or vibration while charging. Not Switching ON. when connected in pc, its showing as Qualcomm HS-USB QDLoader 9008 (COM5). I’m using stable rom miui till now. What to do? Please help
Hi, I’m using Poco F1. Suddenly 2 days back, it went black. no led blinking or vibration while charging. Not Switching ON. when connected in pc, its showing as Qualcomm HS-USB QDLoader 9008 (COM5). I’m using stable rom miui till now. What to do? Please help
that mean you are in EDL mode , just use fastboot to flash the rom again , miui stable rom maybe i dont know what kind of rom u want so flash it using the script. hope its help you
Does anyone know if one can relock the bootloader after flashing a global ROM to an international device (Snapdragon, not Chinese)? Asking because I would like to switch to Global to EEA.
[HowTo] Flash Fastboot ROM with Linux
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.
Muhamed
Members
Tutorial for flashing/install xiaomi.eu Fastboot ROM’s (Android 12 — MIUI 13) over Linux-Terminal.
First of all we need adb and fastboot. We will get all what we need over android-tools:
Arch Based distros (Manjaro, EndeavourOS, etc.)
sudo pacman -S android-tools
Debian based distros (Ubuntu, Linux Mint, PopOS, etc.)
sudo apt install android-tools
RPM based distros (Fedora, RedHat, Opensuse, etc.)
sudo dnf install android-tools
Download the ROM -> extract -> right click (empty space in folder) -> open in Terminal
1. Connect the phone with USB cable
2. run -> adb devices
3. a windows will pop up on your Xiaomi smartphone -> press yes/ok and «never forget»
4. run -> adb reboot bootloader -> wait few seconds, your phone will reboot in fastboot mode
5. run -> fastboot devices -> you need to see a number (if not switch USB port/cable)
6. with -> ls -> check if u see the firmware files (if not you are in wrong folder)
7. now u got 2 options:
fresh install -> ./linux_fastboot_first_install_with_data_format.sh -> will wipe all data and only for first install
update rom -> ./linux_fastboot_update_rom.sh -> will update without wipe
You need to wait untill you see this:
Finished and Rebooting . This will not happen immediately, just wait untill your phone reboot, than u can close the terminal and disconnect USB cable.
— you can use USB 3.0/3.1 but it’s useless, because all Xiaomi’s only got USB 2.0
— use the original cable, some cable will not work, I use deleyCON USB 3.0 cable and its working with any phone
— some Debian distros need a «sudo», so not «adb devices» but «sudo adb devices», just before any command here sudo .
— don’t touch it, don’t disconnect, just wait untill it reboots
— first boot after flash/install can be 5-10 min. -> just wait and don’t panic
— generally it works on Linux without any issue, any USB port but some cable doesn’t, the original one from the box works always