This guide is for you
What you will need:
1. USB cable is of decent quality (not the one on which the connection is lost at the slightest movement)
3. The device defined somehow Device Manager
4. The latest version of MiFlash
5. MIUI firmware developer for fastboot here
6. Adb and fastboot installer here
If the primary boot loader (placed directly on the SoC - unkilled) can't pass control to the secondary and applied loader, the interface starts to restoration device: 9006 or 9008 mode. They differ in that the 9006 mode if the device gets lost only access to the application Loader (what we call the fastboot). It all sections of the devices are mounted in the OS and we can edit files on them or record RAW data.
In 9008 mode, you can get into if partition and entire chain bootloader (secondary and applied loader) is dead. From it anything useful we can not do: just go back to the 9006 mode (in fact in this case, have access to a low-level operations, but to describe them does not make sense). For this purpose, the device is sent to the programmer (MPRG8974.mbn) flash secondary loader (8974_msimage.mbn), after which the smartphone reboot in 9006 mode.
Restore stock partion
If device hangs on Mi logo and cant flash via fastboot / problems after re-partition / defined as QHSUSB_BULK
On a device located in fastboot write in the console:
fastboot erase aboot fastboot reboot
Phone will remain a black screen in the Device Manager, the new device will be Qualcomm HS-USB Diagnostics 9006/9008, and Windows about 7 new flash devices. Simply close all offers their formatting. Reboot the PC (required on Windows 10, or sections will not be able to unmount when flash).
MiFlash Run as Administrator, click the button "Refresh", this will be a new device like this
Choose the folder with the firmware, click the button "Flash". After ~ 160 seconds, the firmware is completed, to restart, hold the power button.
If in MiFlash nothing appeared
1. Make sure that the device appears in the Device Manager, if not:
1) Connect the USB cable to the motherboard (ie "behind")
2) Put the device on charge for at least two hours and try again
Device in 9008 mode
Here things can be a little tricky, but it depends only on your particular case.
It may be necessary short-circuit test points
Possible errors in MiFlash
EE: Access is denied. (0x80070005: Dismount volume ...)
AA: Restart your laptop, connect the device to a different usb port
EE: Reached the end of the file. (0x80070026: Receiving hello packet)
AA: Need a short-circuit of the test-points, change the cable, use a different computer