[Guide] [All-In-One] Redmi 4 Prime (markw): Unlock Bootloader, Flash TWRP, Flash ROM

Modest Mind

Senior Member
Dec 10, 2016
74
104
0
Prishtina
Dear Redmi 4 Prime ¦ Pro user,

I'm not responsible if anything happens to your device. If you execute this procedure properly then you shouldn't face any problems. I tried this procedure at several Redmi 4 Prime ¦ Pro devices (some with original roms and some with fake roms) and every time it worked flawlessly. I used a PC with Windows 10.

Before you proceed please back up all your important data and make sure that your phone battery is charged >80%!!!


A. Prerequisites:

1. Disable driver signature enforcement in Windows

How to do this pls read here: http://en.miui.com/thread-237673-1-1.html

2. Install ADB and Fastboot tools with drivers on Windows

How to do this pls read here: https://forum.xda-developers.com/showthread.php?t=2588979

3. Enable "OEM unlocking" and "USB debugging" in your device

a. Enable Developer Options in: Settings/About Phone/MIUI version. Click on MIUI version seven times
b. Now go to: Additional Settings/Developer Options and check "OEM unlocking" and "USB debugging"
c. Now go to: Additional Settings/Privacy and check "Unknown sources" (just in case you need to install any apps *.apk*)

4. Download recovery (twrp) flashable original Xiaomi roms

Download recovery (twrp) flashable rom China developer and China stable and International stable and put them into your devices internal memory.

http://en.miui.com/download-320.html#463

Why do you want to do this? You can find the answer in Points C. 1. b. or C. 2. b.!

5. Check if your bootloader is locked

a. After successful installation of "ADB and Fastboot" enter the fastboot mode by holding together "Volume Down + Power" and connect your device to your PC via USB cable (best would be the original cable).
b. Go to the folder where you have put the "ADB and Fastboot" and open a command window inside that folder. To do that hold together "Shift + Right Click" on any empty white space inside the folder and then select "Open Command Window Here" or "Open PowerShell Window Here"
c. Enter the terminal command in command line: >>fastboot devices<<

If you don't see your device it means that the drivers weren't installed properly or the device wasn't connected properly. If this happens please reinstall your drivers from Point A. 1. or try these drivers here:

http://xiaomiadvices.com/download-xiaomi-usb-drivers/

d. If you see your device then enter the terminal command in command line: >>fastboot oem device-info<<

If your bootloader is locked, you'll get the following status (or something similar):

…………………………………………………………………….
(bootloader) Device tampered: false
(bootloader) Device unlocked: false
(bootloader) Device critical unlocked: false
(bootloader) Charger screen enabled: false
(bootloader) Display panel:
OKAY [ 0.058s]
finished. total time: 0.063s
………………………………………………………………………

If your bootloader is unlocked, you'll get following status (or something similar):

…………………………………………………………………….
(bootloader) Device tampered: false
(bootloader) Device unlocked: true
(bootloader) Device critical unlocked: true
(bootloader) Charger screen enabled: false
(bootloader) Display panel:
OKAY [ 0.053s]
finished. total time: 0.055s
………………………………………………………………………

6. Request Permission from Xiaomi to Unlock the Bootloader

a. Create a Mi Account: https://account.xiaomi.com/pass/register
b. Sign to Xiaomi and apply for unlocking http://en.miui.com/unlock

You have to give a reason for requesting to unlock the bootloader. I gave following reason on my request:

"I purchased my Xiomi Redmi 4 Prime from the vendor xxx and they have installed a fake (custom) rom. I want to install an original rom from Xiaomi. So please approve my request to unlock the bootloader."

c. Wait for permission. This permission process can last up to 10 days, but you can start the request before you receive your device. If your request is approved then you should receive a message with following content:

"You've been granted the permission to unlock your device (Mi Account xxxx). Donload Mi Unlock Tool At http://en.miui.com/unlock"

After the receipt of the message from Xiaomi for positive approval please:


>>>> Continue with Point B if in your device is installed a fake rom.

>>>> Continue with Point D if in your device is installed an original Xiaomi rom.

How to find out if your rom is original or fake? Please read this: http://en.miui.com/thread-392159-1-1.html


B: Unlock the Bootloader Temporarily (if in your device is installed a fake rom)

Special thanks to @kentaurest for his post at: https://forum.xda-developers.com/android/development/unlocking-t3515252

1. You must enable "OEM unlocking" and "USB debugging" as per point A. 3.
2. Connect the device with PC and allow connection
3. Turn off the device
4. Enter the fastboot mode by holding together "Volume Down + Power" and connect your device to your PC via USB cable (best would be the original cable).
5. Enter terminal command in command line: >>fastboot oem device-info<<
6. Enter terminal command in command line: >>fastboot oem unlock-go<<
7. Enter again terminal command in command line: >>fastboot oem device-info<< (to check if the bootloader is unlocked)
8. Restart the device


C. Ditch the Fake Rom and Install the Xiaomi Original Rom

1. International Stable or China Stable

If you don't intend to permanently unlock the bootloader, install TWRP and install a custom rom (lineage etc.) but you still want to ditch the fake rom and install a Xiaomi original rom then:

a. Fastboot Method:

+ Download the original rom "China stable" or "International stable" here: http://en.miui.com/a-234.html and (important: the downloaded rom must have the extension *.tgz*) put it into separate folder (say "RM4 Pro") and unzip it.
+ Download the MiFlash tool here http://en.miui.com/thread-281979-1-1.html and follow instructions how to install it.
+ Enter fastboot mode by holding together "Volume Down + Power" and connect your device to your PC via USB cable (best would be the original cable).
+ Start the MiFlash tool, click "Select", find the folder "RM4 Pro" and click on the desired rom. Now click "Refresh" and you should see the rom in the MiFlash tool. Now click "Flash" and wait until the rom is installed.

If for any reason the Fastboot Method does not work try another MiFlash tool. If it still does not work because your PC does not recognize the other MiFlash tool as well then please try also the Recovery Method.

b. Recovery Method

See also Point A. 4. So I assume you have put into your devices internal memory the recovery (twrp) flashable rom China stable or International stable. Now execute the procedure in Point E and when you have an workable twrp installed in your device do not restart the phone but install the twrp flashable rom International or China stable as per procedure described in Point F!

2. China Developer

If you intend to unlock the bootloader, install TWRP and install custom rom (lineage etc.) you need the original China developer rom:

a. Fastboot Method:

+ Download the China developer rom here http://en.miui.com/a-234.html and (important: downloaded rom must have the extension *.tgz*) put it into separate folder (say "RM4 Pro") and unzip it.
+ Download the MiFlash tool here http://en.miui.com/thread-281979-1-1.html and follow instructions how to install it.
+ Enter fastboot mode by holding together "Volume Down + Power" buttons and connect your device to your PC via USB cable (best would be the original cable).
+ Start the MiFlash tool, click "Select", find the folder RM4 Pro and click on the desired rom. Now click "Refresh" and you should see the rom in the MiFlash tool. Now click "Flash" and wait until the rom is installed.

If for any reason the Fastboot Method does not work try another MiFlash tool. If it still does not work because your PC does not recognize the other MiFlash tool as well then please try also the Recovery Method.

b. Recovery Method

See also Point A. 4. So I assume you have put into your devices internal memory the recovery (twrp) flashable rom china developer. Now execute procedure in Point E and when you have an workable twrp installed in your device do not restart the phone but install the twrp flashable rom China developer as per procedure described in Point F!


D: Unlock the Bootloader Permanently (if in your device is installed original Xiaomi rom - developer or global or China stable)

1. You must enable "OEM unlocking" and "USB debugging" as per point A. 4.
2. Connect your Xiaomi account with your device: Developer Options/Unlock Status
3. Download Mi Unlock Tool here: http://en.miui.com/unlock
4. Enter the fastboot mode by holding together "Volume Down + Power" and connect your device to your PC via USB cable (best would be the original cable)
5. Start the Mi Unlock Tool
6. Enter your eMail and your password of your Mi Account
7. Connect you device to your PC and start the unlock procedure
8. Follow the unlock tool instructions until the unlock procedure is finished
9. Reboot your device

Edit: Some users are reporting that the latest version of the bootloader unlock tool (http://en.miui.com/unlock) is not working for them. I tried myself also the unlock tool "miflash_unlock-en-2.2.624.14" on several devices (Redmi 4 Prime, Redmi Note 4, Mi5, Mi5s ) and every time it unlocked the devices. Here download link: https://mega.nz/#!JhZVhTpC!k-CH3dG0ukHQs4BSAhP1pvwmV4GG2QAsQAfvzprqW1g


E: Install the TWRP Recovery

(until we have an official twrp for markw published at: https://twrp.me/Devices/)

Special thanks to @Anik_khan for his great work. I'm just coping his great work and adapting it a bit to fit this guide.

https://forum.xda-developers.com/android/development/unofficial-twrp-3-0-2-0-recovery-redmi-t3550074

1. Your bootloader must be temporarily (see point B.) or permanently (see point D.) unlocked
2. Enter fastboot mode by holding together "Volume Down + Power"
3. Download "twrp-3.0.3-0-markw.img" (from here: https://build.twrp.me/twrp-3.0.3-0-markw.img) and Lazy Flasher (from here: https://www.androidfilehost.com/?fid=529152257862700328) and put them into a dedicated folder
4. Copy Lazy Flasher in your internal phone memory
5. Go to the folder where you have put the twrp-file. Now open a command window inside that folder. To do that hold together "Shift + Right click" on any empty white space inside the folder and then select "Open Command Window Here" or "Open PowerShell Window Here"
6. Enter the terminal command in command line: >>fastboot flash recovery twrp-3.0.3-0-markw.img<<. Attention: Do not restart your device!
7. Boot into recovery (3 possible methods)
+ by entering terminal command in command line: >>fastboot boot recovery.img<<, or
+ by holding together "Volume Up + Power" until you see the MI logo, release "Power" button but keep pressing "Volume Up” until you see the recovery, or
+ by holding together "Volume Up + Volume Down + Power" until you see recovery
8. Now flash the Lazy Flasher
9. You can now reboot (if your bootloader is permanently unlocked) or wipe the fake rom and install China developer rom (See also Points C. 1. b. or C. 2. b.).


F. Install Lineage or Resurrection Remix (or any other custom rom like: xiaomi.eu || mi-globe.com etc.)

Once you have a workable twrp installed on your device you can enter recovery mode and install custom roms like Lineage, Resurrection Remix etc.

1. Download the desired rom (https://download.lineageos.org || http://www.resurrectionremix.com || https://xiaomi.eu || https://mi-globe.com etc.) and put it into device's internal memory
2. (in case you want to have root on your device) Download "addonsu-arm64-signed.zip" (for Lineage: download.lineageos.org/extras) or latest SuperSU (for xiomi.eu please download from chainfire.eu) and put it into device's internal memory
3. Download Google Apps ARM64, Pico, Nano etc. at opengapps.org and put them into device's internal memory. No need for GApps for xiomi.eu or mi-globe.com as they have GApps already integrated.
4. Enter recovery mode:
+ by holding together "Volume Up + Power" until you see the MI logo, release "Power" button but keep pressing "Volume Up" until you see the recovery, or
+ by holding together "Volume Up + Volume Down + Power" until you see recovery
5. Wipe: Dalvik / Art Cache; System; Data; Cache; (be careful, don't wipe internal storage!)
6. Go back to main twrp screen and install the rom, install Google Apps 7.1 ARM64, install "addonsu-arm64-signed.zip" (in case of Lineage) or the latest SuperSU (in case of xiomi.eu). Mi-globe.com roms are already rooted so no need to flash SuperSU.
7. Reboot. That’s it, you are done.

If my guide helped you pls click "thanks" and enjoy your phone. :fingers-crossed:
 
Last edited:

doragasu

Senior Member
Jun 15, 2011
134
9
0
No matter how many times I try getting permission from http://en.miui.com/unlock, the webpage does not work for me. Tried with Firefox, Chrome and even with Internet Explorer. After I login, a chinese message appears. According to Google Translate, the message says:

"Account system upgrade, temporarily unable to register, will be the identity of visitors to visit..."
 

Modest Mind

Senior Member
Dec 10, 2016
74
104
0
Prishtina
No matter how many times I try getting permission from http://en.miui.com/unlock, the webpage does not work for me. Tried with Firefox, Chrome and even with Internet Explorer. After I login, a chinese message appears. According to Google Translate, the message says:

"Account system upgrade, temporarily unable to register, will be the identity of visitors to visit..."
Strange, because couple of days ago I got another approval on my second email-address and my second cell number. I just tried the link http://en.miui.com/unlock with both of my email-adresses and everything works fine. Maybe you should try registering with another email-address from another provider like: [email protected] or [email protected] etc. and another cell number.
 
Last edited:

Hypnotizing

New member
Apr 17, 2017
1
0
0
So is the china developer rom necessary to unlock the bootloader?, i have the official global rom and i get an error flashing the developer one (flash tz error)
 

Ilir ILIRI

New member
Apr 18, 2017
4
1
0
So is the china developer rom necessary to unlock the bootloader?, i have the official global rom and i get an error flashing the developer one (flash tz error)
Have you tried to unlock the bootloader with your existing original global rom? If you couldn't unlock the bootloader and you couldn't install the developer rom with fastboot or recovery method then I guess you should consider your official global rom as "fake" rom and perform the steps as described in points B and C in this guide to install the developer rom and then go ahead with the rest.
 
Last edited:

1cawk

New member
May 1, 2017
1
1
0
Just wanted to add: for those who want to switch the capacitive touch buttons around (if you have root privileges):

On the phone, enable root privileges to apps. This is to be switched back after changing the keys around

• File manager (use the default with lineageos)
• Settings > General > Access > Extended
• /system/usr/keylayout/generic.kl
• Switch 139 with 158 and vice versa
 
  • Like
Reactions: mnbpt

doragasu

Senior Member
Jun 15, 2011
134
9
0
Tried again today, and I was able to get approval to unlock the bootloader. It just took a pair of hours to receive the confirmation SMS. But I am stuck again :(

I launch MI Unlock tool, log in, the driver is properly installed, I click the unlock button, and when it reachs 50%, it errors saying the device is already unlocked:



But it happened since the first try, it does not look that the phone is unlocked. How can I know for sure?

Anyway I tried continuing with the tutorial at step E, just in case it is unlocked. I enter fastboot, flash twrp (it looks successful) but when I try entering the bootloader, depending on the method I get:
- fastboot boot recovery.img: does not work, since recovery.img image is not provided. If I replace recovery.img by twrp image, I get a black screen (by the way, fastboot on PC errors with message "FAILED (status read failed (Too many links))".
- Volume UP + Power method: service menu. If I press "recovery" in the menu, I get a black screen (I have to reboot keeping power button pressed about 10 seconds).
- Volume UP + Volume Down + Power: Black screen again.

I suppose the black screens are normal and the problem is that unlocking is failing, but why???

EDIT: Didn't see the fastboot command to check if bootloader is unlocked. I have done it and I have confirmed that bootloader is NOT unlocked :(
 
Last edited:

doragasu

Senior Member
Jun 15, 2011
134
9
0
OK, flashed the official chinese ROM using fastboot method, and now it goes a bit further, but unlock is still failing, now with message "Binding time is too short, less than 72 hours":



What does this mean? Must I wait 72 hours before trying again?

Also the official ROM has no google play... Is there a way to flash gapps without root? I suppose there is not, but asking just in case...

---------- Post added at 05:53 PM ---------- Previous post was at 04:59 PM ----------

Nevermind, got it working. I downloaded an older version (v1.1) of the MI unlock tool, and it unlocked the bootloader perfect!

Now it's time to test some roms!!!
 

ttheodorou

Senior Member
Apr 7, 2010
361
107
63
OK, flashed the official chinese ROM using fastboot method, and now it goes a bit further, but unlock is still failing, now with message "Binding time is too short, less than 72 hours":



What does this mean? Must I wait 72 hours before trying again?

Also the official ROM has no google play... Is there a way to flash gapps without root? I suppose there is not, but asking just in case...

---------- Post added at 05:53 PM ---------- Previous post was at 04:59 PM ----------

Nevermind, got it working. I downloaded an older version (v1.1) of the MI unlock tool, and it unlocked the bootloader perfect!

Now it's time to test some roms!!!
had the same problem. found the same solution. here unlocker v1.11 mayb op should add problem / solution to the post
 

Andariyel

Member
Sep 19, 2015
9
0
1
Hannover
Hi
I buy a Redmi 4 Pro and flash TWRP but everytime adb say all is fine but when i boot in to the TWRP the i become a Black Screen with a white handy and cable. I try a lot of TWRP from xda from here but its always the same. I try to find a solution by google but nothing. I dont want a new rom or so i just want root. I unlocked the Bootloader this has worked fine.
Android-Version 6.0.1 MMB29M
MIUI-Version global 8.2 Stable 8.2.4.0 (MBEMIDL)

I've done it. If somebody have the same problem after you flash the recovery press power+volume up directly from the fastboot screen then it will works.
 
Last edited:

Escapius

New member
May 24, 2017
1
0
0
wiped internal storage.

Guys, i accidentally wiped internal storage.
Now the phone says it has no sd card. Can't use the camera, download files or create folders.
What should i do?

THank you very much!
 

Modest Mind

Senior Member
Dec 10, 2016
74
104
0
Prishtina
Guys, i accidentally wiped internal storage.
Now the phone says it has no sd card. Can't use the camera, download files or create folders.
What should i do?

THank you very much!
Enter recovery mode (how to do that, see Section E, Point 7), connect your PC and transfer files (roms, gapps, addons, apps etc.) into your phone....
 

N1ck474

Senior Member
Aug 19, 2015
1,018
290
103
Faenza
I do unlock , root and twrp
Now i want to flash global rom, and i want to locked bootloader again. What must i do? Thanks foe answer:)
[64bit PC needed]
With MiFlash and Fastboot mode, install all Fastboot drivers for your Redmi, install MiFlash Tool beta, download the Fastboot ROM from en.miui.com and select "clean all and lock)
You lose all data and relock your bootloader.


Sent from my markw using XDA Labs

---------- Post added at 02:03 PM ---------- Previous post was at 02:03 PM ----------

[64bit PC needed]
With MiFlash and Fastboot mode, install all Fastboot drivers for your Redmi, install MiFlash Tool beta, download the Fastboot ROM from en.miui.com and from MiFlash select "clean all and lock"
You lose all data and relock your bootloader.

Sent from my markw using XDA Labs