Skip to content

Instantly share code, notes, and snippets.

@szkrd
Created August 10, 2021 16:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save szkrd/beb8b2a9486022e7a7eccb88eea5dc86 to your computer and use it in GitHub Desktop.
Save szkrd/beb8b2a9486022e7a7eccb88eea5dc86 to your computer and use it in GitHub Desktop.
Xiaomi Redmi 4x unlock, lineage install and root

Unlock Xiaomi Redmi 4X (santoni) and install Lineage OS via sideloading

So far the most useful documentation was at Lineage's Redmi section, random "mobile enthusiast" sites were "not very good" and youtube videos are to be avoided like the plague.

Files needed

  • SDK platform tools from android.com
  • mi flash unlock gui tool (miflash_unlock-en-5.5.224.24.zip)
  • newest twrp for device (twrp-3.5.2_9-0-santoni.img), from twrp site
  • lineage OS main image (lineage-16.0-20210210-nightly-santoni-signed.zip)
  • lineage google apps (open_gapps-arm64-9.0-nano-20210810.zip)
  • lineage su (addonsu-16.0-arm64-signed.zip)

Steps

  1. install android platform tools (for adb and fastboot utilities) and a universal adb driver
  2. enable developer tools on phone (devtools, usb debugging, unlock boot etc.)
  3. create mi account
  4. on phone link mi account (you must have an active sim card)
  5. power off
  6. enter fastboot mode using power on + volume down
  7. use "mi flash unlock" gui app (requires mi account) to unlock the bootloader
  8. fastboot oem device-info to see if the fastboot connection is okay (when in doubt, reboot; that's how IT works, remember?)
  9. fastboot flash recovery <twrp.img> to install twrp bootloader
  10. fastboot boot <twrp.img> to reboot into twrp
  11. now you are in twrp
  12. select wipe -> format data (formats drive)
  13. select advanced wipe -> select cache and system
  14. sideload zip files: advanced -> adb sideload
  15. on PC use adb sideload <image.img>
  16. do this for lineage, gapps and su
  17. reboot (first boot will take quite a while)

Troubleshooting

  1. "this devices is for ." error: the downloaded twrp is too old, are you using a fresh one from their official site?
  2. remote dtb not found error: try using another usb port and reboot back to twrp
  3. boot stuck at logo, nothing is happening: just boot into fastboot instead, probably your system is unbootable, but that's okay (unless it isn't)
  4. you can always check the connection to the PC/phone via adb devices for "normal" boot and fastboot devices in fastboot mode
  5. booting into twrp with power + volup + voldown doesn't work: just boot into fastboot and then use the fastboot boot <twrp.img> cli command to boot into twrp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment