[Xiaomi Redmi 4 Prime Guides, News, & Discussion] Modest Mind:
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://xdaforums.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 [MENTION=3140882]kentaurest[/MENTION] for his post at: https://xdaforums.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 [MENTION=6083514]Anik_khan[/MENTION] for his great work. I'm just coping his great work and adapting it a bit to fit this guide.

https://xdaforums.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: