UP | HOME

# ON MERLIN’S BEARD

Let’s say, hypothetically, you have a Xiaomi Redmi Note 9 (codenamed Merlin), and we would assume that it’s broken in a way that it shows the Xiaomi logo only then reboots/shuts-down, your first solution would be “Oh let’s take it to a repairshop, they would fix it” but why do so when you could fix it at home, alone, with the help of this little guide.

## Axioms :

We will assume the following things :

- You have a Redmi Note 9…or any Redmi, but some steps WILL vary ever so slightly.
- The phone at least gives a sign of life, the Xiaomi logo is well enough.
- You have a PC, preferably running the second best OS known to mankind, Linux !!!. If you are not running Linux, a good start is Ubuntu (we will assume the usage of a Debian-based distro here, if you use anything other than them, you are probably smart enough to figure this shit yourself)
- You have a good USB-C cable.
- You have a working brain.

## Step Uno : Downloading the required files and the medkits :

### android-tools :

    sudo apt update
    sudo apt install android-tools-adb android-tools-fastboot

### mtkclient and it’s dependencies :

#### Dependencies :

    sudo apt install python3 git libusb-1.0-0 python3-pip

#### Grab the files :

    git clone https://github.com/bkerler/mtkclient
    cd mtkclient
    pip3 install .

#### Install rules :

    sudo usermod -a -G plugdev $USER
    sudo usermod -a -G dialout $USER
    sudo cp mtkclient/Setup/Linux/*.rules /etc/udev/rules.d
    sudo udevadm control -R

and do NOT forget to reboot, otherwise you will face errors.

### Fastboot image :

Personally, I prefer to use a custom ROM for these XIMI phones, but since this is a fool-proof guide, we will use the latest Global fastboot image, note that the difference between Global , EEA (European Economic Area) , Turkish , Russian and Taiwan ROMS are little though the Global version is most of the time behind the other ones in terms of updates , but the biggest one comes with the Chinese one, it’s more polished, runs faster, but is filled with Chinese-only apps, and does not have Google services (which is a huge W for me). But at the end of the day, it’s up to you!

We will be using this one https://xiaomifirmwareupdater.com/miui/merlin/stable/V13.0.2.0.SJOMIXM/ which is the Global version of miui. Make sure to scroll all the way Down and download the one with Type: Fastboot, it will be larger in size, but it’s the one we need. Use any mirror that you want, and wait patiently for it to download. Once it finishes, extract it to a folder, it’s a big archive so it will take time.

### Meanwhile, mtkclient :

While waiting for your download to finish, go to your mtkclient folder and run this command:

    python mtk_gui

this should bring up the GUI client, if it doesn’t, replace python with python3. Once it’s running, make sure your phone is powered-off, and plug the USB-C cable into your PC While holding both the Up and Down volume buttons until you see a change in the GUI app. If you notice a red error message on the console which will be running in the background, relaunch using sudo.

Now explore the app but do NOT touch anything with the word Write or Erase, also the ones with Read are useless for you, what is important is looking for the Unlock bootloader button, click on it, and wait until it’s okay, then remove your phone from the cable. aaaand we shoould be done for this part.

### The Fun Part :

Once the fastboot image is downloaded and extracted, go to the folder and look for this file flash_all_except_storage.sh this will be the one you would need.

DO NOT EVER EVER EVER, UNDER ANY CASE, TOUCH A FILE THAT HAS THE WORD LOCK IN IT.

Once you located this file, open a terminal there, and give it exec permissions. Or in other words :

    chmod +x ./flash_all_except_storage.sh

and now take your phone again and now Power it on while holding the Vol DOWN button, keep that position until you see a fastboot screen, or a Russian robot rewiring the organs of it’s victim.

Once you see it, plug the phone to the pc, and run

    sudo fastboot devices

sudo might not be needed for you, but i dont know why, it never worked for me without sudo (probably the rules step)

Once you see your device in there, it means it recognized it, go again to the folder with flash_all_except_storage and run it

    sudo ./flash_all_except_storage.sh

### Waiting :

This step takes a lot of time, so be sure to let your pc in a place where you don’t risk accidentally moving your phone and disconnecting it. DO NOT CLOSE THE TERMINAL, once it’s finished, it should reboot automatically and voila !! good as knew, and you might even keep your local files if you provide your password

## Edge cases :

- If the initial setup (after the reboot) doesn’t work, try the flash_all.sh file instead.

Author: Crystal for my sloth

Created: 2024-04-12 Fri 19:51