It's a bit hard for
newcomers to do all these when they want to start using the xiaomi eu rom, so after some of us were talking about making a guide for all these for mi 10 (because it may require a kinda special process) I decided to actually make one. Tjis may save you some time. This works ~as of
17-1-2021 and applies for
mi 10 Umi (many parts
may apply for mi 10 ultra, maybe mi 10 pro and
other devices). I've also put many tips you might find usefuld in the end of the guide.
If you don't understand any terms please search them beforehand. (I'm ~not responsible for any damage that you may and may not do to your phone).
Contents:
- Setting up
- Unlocking bootloader
- Flashing the rom (clean flash, deletes data) and installing magisk
- Clearing out some issues and misunderstandings about twrps (extra, but very good info)
- Setting up magisk and passing safety net
- Installing and setting up EdXposed-Riru
- Extra notes:
1)Lucky Patcher (LP)
2)Safe mode
3)New twrp
4)Backing up
5)Managing files - total commander
6)Dual apps - island
7)Kill background apps - greenify
8)Monitor battery - gsam battery monitor
9)Migrate playlists
10)Care of battery charging - AccA
11)Changing SELinux status -the SELinux switch
So here we go:
Setting up
1)Install the
drivers from this site
https://flashxiaomi.com/xiaomi-mi-10-usb-driver/, they will probably prove to be helpful for what we're gonna do
Qualcomm drivers:
http://www.mediafire.com/file/mclznqmya1s5i8c/qualcomm_driver.zip
Adb driver:
https://dl-ssl.google.com/android/repository/latest_usb_driver_windows.zip (as you may see, when intstalling this driver there are options to install
bootloader and
composite adb interface drivers, install them too)
2)Install latest
minimal adb https://androidmtk.com/download-minimal-adb-and-fastboot-tool
Unlocking bootloader
(It deletes your data, first backup app data from previous phone or the same phone with helium backup, backup apks with a simple backup app, move files to pc and check for anything left):
(Check this guide
https://fossbytes.com/how-to-unlock-bootloader-on-xiaomi-devices-using-mi-unlock-tool/)
For ~"
quicker"
download of roms use a
download manager, like
fdm:
https://www.freedownloadmanager.org/
1)Download
mi unlock tool:
en.miui.com
2)Make a
Xiaomi account, add a working number, log in from the phone and enable Find My Device.
3)Authorize Mi Unlock in the developer settings
4)Connect the phone to pc with usb debugging and oem unlock on and open mi unlock tool.
5)Apply for unlocking bootloader
6)Wait ~
1week (don't sign out of your mi account from the phone and keep the sim of the phone number you used to put it back in when you'll unlock it)
7)Connect the phone to pc with usb debugging and oem unlock on, open mi unlock tool and this time try to unlock the bootloader.
You're probably done!
Flashing the rom (clean flash, deletes data) and installing magisk
1)Due to
encryption issues, you have to only
boot into the twrp, not flash it, and remove pins/passwords (just temporarily
disable security locks etc.).
Get the latest twrp (3.4.2b-1206)
https://androidfilehost.com/?fid=17248734326145679752 (check this thread
https://xiaomi.eu/community/threads...f-relevant-recovery-in-one-place.57730/unread)
Also get the latest
beta rom and the
magisk files (
https://github.com/topjohnwu/Magisk): magisk manager canary veresion ("debug.apk") from
https://github.com/topjohnwu/Magisk (
https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk)
magiskbeta.zip and
magisk uninstaller (currently from
https://github.com/topjohnwu/Magisk/releases).
If you want to go
extreme and magisk is already installed delete it from the app (to ~prevent any problems, but flashing a rom ~deletes it anyways).
Deleting magisk ~usually
deletes its
modules as well. To
back them up, go from twrp or root file manager to
data/adb and copy ~everything, maybe apart from
magisk.db and the
magisk and
service.d folders, to an
external drive (if you copy them to internal storage, the may be deleted with magisk again). Probably an
outdated link:
https://forum.xda-developers.com/t/export-magisk-module-list.3897552/
Otherwise, don't delete it, flash the new beta update,
boot normally and
then reflash magisk. (This will probably
keep the
modules.) Tnx
@geoorg.
2)
New magisk versions allow to
flash magisk manager in
twrp without any
other companion
app/zip. To do this
change the
extension of the
app from "debug.apk" to "debug.zip" which will
allow twrp to be able to
flash it. (
https://www.xda-developers.com/install-magisk-manager-without-separate-zip/)
3)Put phone into
fastboot mode (after power off, boot up pressing volume down and power button) and connect phone to pc.
4)Unpack the twrp rom in the folder minimal adb is installed and open minimal adb.
Enter
fastboot devices command, then enter
fastboot boot "twrp filename.img" command
5)Wait ~
2mins to boot into twrp.
6)
The wiping:
a)Go to wipe tab->advanced
b)Wipe cache, davlink/art and data
c)Go back and wipe data (deletes apps + app data)
d)Do factory reset (deletes apps + app data)
(For updating roms in the future, just wipe cache and davlink)
7)Get a flash drive
Put inside the rom.zip the magisk manager "debug"/magisk.zip (and magisk uninstaler.zip)
8)Connect it to the phone with otg.
9)Go to install tab and flash the rom from the otg storage
10)Do step 6) again ( for a "full wipe" when going from stable to beta or from stock to beta, for updating roms in the future, just wipe cache and davlink)
11)Flash the magisk.zip file
12)Wipe cache and davlink
13)From advanced tab, go to file manager and delete the folder /data/system/
package_cache
14)Wipe cache and davlink
15)Reboot
Yay, well done! It may take a while.
(Set up google/mi accounts and the phone)
Clearing out some issues and misunderstandings about twrps (extra, but very good info)
In this guide I went a bit
overkill with the twrp process. So I'll try to write here some
extra info and alternative steps ~using the material
@Iain_B gave me:
After the beginning of
November 2020, there started to be conflict problems
between Mi 10 (umi) and TWRP (and some other mi 10 phones). This was largely due to
Xiaomi changing their
kernel codes which in turn affected the encryption process.
After 11 November 2020, to avoid Boot loops, it was important to use a different and stable TWRP. This stable TWRP, after 18 November 2020, was included automatically with each new ROM installation. This is an unofficial version of TWRP - 3.4.0 (LittleTurtle2333). This stable twrp is ~no longer included in the roms since 21.1./7, but you may want to flash it, since the new one that comes with the rom ~still can't do ~anything.
Because this is based on an
earlier version of TWRP, it
does not decrypt data. It also initially
loads up in Chinese. To go into
English, click on the 2nd to bottom button on the right, and then click on the globe option, and choose English.
Because it does not decrypt your data, the only option to install the beta ROM is through USB-OTG, as I did on the steps before.
Also since it can't decrypt data, using
mtp or creating
nandroid backups with this rom may fail or create corrupted files. It's ~
not tested.
It's probably much safer/better to use the newer, but unstable twrps.
About the
new unstable twrps
There are
2 versions (I ~can't find the old) with the newer being
TWRP 3.4.2b-1206.
You can ~
only boot (NOT flash) into them from
Fastboot. It takes about a minute to load and may take a short time for you to be able to input your pattern (not password).
Yep, it may decrypt data, but you input ~only a pattern. (I ~just don't use any locks.)
The fastboot
command:
fastboot devices
(~just to know the pc recognises the phone)
fastboot boot [temp-TWRP-recovery.img]
boots ~only using that recovery temporarily, and ~does not touch the recovery partition. Once you exit from this recovery, it ~disappears from memory.
With that twrp you ~can:
1)Use
MTP; transfer the rom.zip to the internal storage and flash it
2)Use
otg (maybe a bit safer); that's ~what I did in the steps of this guide before.
3)Perform
nadnroid backups. From what Iain told me you can ~do a full backup:
Tick ~all the boxes, except maybe the 'cache'. When restoring, ~everything comes back; data, icons, widgets - ~all in the exact same position. The ~only thing is (which is understandable) ~all of the secure apps, eg. bank, have to be re-registered - but they are ~still there.
Btw, ota
may no longer work with mi 10 (~not tested)
Also some extra info about
phone encryption here (it turns out full-disk encryption that ~existed on android 5-9 ~no longer exists in android 10+):
https://source.android.com/security/encryption
Setting up magisk and passing safety net
For old magisk versions: 1)Install magisk canary app https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk
2)It may ask to give it root access, do it.
1)Open the magisk manager (canary) app, go to
modules and install
busybox for android ndk (needs reboot afterwards). Busybox is very powerful and many root apps needed actually, so it might be a good idea to have it anyways.
2)
Hide your Magisk (get Google Pay etc. working):
a) Enable your app installation over USB in your developer settings on your phone.
b) Go into your
Magisk Manager Settings and click "
Hide Magisk" under the "
Manager" category, there enter an alternative name for your Magisk. (A random, but goo looking one might be better)
c) After installing the hidden Magisk manager, go into its settings and enable "
MagiskHide" under the "
Magisk" category.
d)If you have any apps that shut down/don't want your phone to be rooted, go to superuser tab->magisk hide and add those apps (like CoD:Mobile etc.).
e)Reboot and the check if you pass safety net (if not try to delete cache of google services and google play and reboot).
EDIT: The next
steps 3-4 may actually no longer be needed, ~due to Framework-level key attestation blocking used in 21.1.13/14 and newer betas:
https://xiaomi.eu/community/threads/21-1-13-14.59414/page-9#post-584901
If you fail safety net, you may want to try them (or if ~for some reason you want to change your device model name).
3)Go to modules and install
MagiskhideProps (needs reboot afterwards)
4)
Set up magisk props and magisk hide (check this guide:
https://xiaomi.eu/community/threads...ues-with-magisk-also-cts-profile-match.58555/) what it does is to change the device name of your phone to be undetected
a) Download and install
Termux(any terminal editor for android) from Google Play
b). Type "
su" hit enter,
c) Open up Termux and grant root/superuser access.
d) then the "
props" command and hit enter
e) After MagiskHide-Props loaded successfully, type "
2" to choose "
Force BASIC key attestation"
f) Type "
c" and hit enter for activating the option.
g)Select a device name for your phne (it ~just mustn't be the one your device has, just type your device name and add "Eu" in the end.
Type "
y" and hit enter for activating the option.
h) Type "
y" and hit enter to reboot your phone.
i)Check if you pass safety net, if not, try one more reboot and/or delete cache of google services and google play and reboot.
Installing and setting up EdXposed-Riru
Edxposed may not always work or it may cause some other problems.
Nandroid backups recommended.
There are some reports that you should do the steps in a different way etc., but this ~worked for me.
(If you want check these guides:
)
1)
Install "EdXposedManager-4.5.7.apk" (the
canary version):
https://github.com/ElderDrivers/EdXposedManager/releases (scroll a bit down and you may find the app).
2)Go to
magisk->modules and find the
riru module. Install it.
3)Go to
edxposed manager app->canary tab-> framework tab and
install the
Yahfa drivers (
sandhood drivers might brick it, if yahfa drivers brick your device, you may want to try sandhook). I think you can also find the drivers from magisk, from github and from
https://ci.appveyor.com/project/ElderDrivers/edxposed/build/artifacts.
EDIT: As of 18/1/2021, there's ~only one version called "master" and ~no the other 2 driver names (at least in canary), it seems to be working. ~Get this and not the old ones.
4)Open
EdXposed Manager > modules
5)
Turn on "EdXposed Manager" and reboot.
6)Because you may
fail safetynet follow these steps:
a)Open
Edxposed Manager > settings > scroll to
framework section.
b)Turn on
"app list mode", "force hook modules" and
"pass safetyNet".
c)Open
Edxposed Manager > applications.
d)Turn on
"google play services" and
"google service framework" (this adds them to whitelist/blacklist)
or use turn on
"android system" and
"system ui" (I've actually added CoD:M too).
e)Reboot
Extra notes:
1)
Lucky Patcher (LP) may put the phone into
bootloop if you give it root access (at least in android 11). Thanks to
@geoorg, I managed to make it semi-work with root access. Before you try anything, please
do a nandroid backup to resotre you device in case you brick it. It took me ~15 mins to backup and ~15 mins to restore. If I hadn't done this it may have taken me much much more (note that I ~was using instructions and ~still bricked it many times). So the link to geoorg's post:
https://xiaomi.eu/community/threads/21-1-6-7.59279/post-583781
I tried a bit different methods so there you are:
I had
LP installed already, then I installed
Edxposed and then I
set up LP.
1)
Install Edxposed as described previously.
2)Go to LP and
give it
root access.
3)Go to
toolbox->Patch to android
4)
Untick "only patch dalvik-cache" and
tick "use the magisk module to apply the patch".
5)Now, because it ~can't start doing the patch without something to patch select
"disable signature verification in the package Manager".
What it actually tries to patch ~
doesn't work though (the signature disabling), but it seems that
somehow LP becomes stable after this.
If you run the test for
patch, you'll probably see it
fails in ~everything. What
we ~want though is the
LP magisk module which ~is
created after the patch.
If you want you ~can
remove that
signature verification patch from ~the same settings again as it ~doesn't do anything.
If the phone
bootloops afterwards,
boot to
twrp and
delete "data/adb/modules/luckypatcher".
Notice that the
LP module ~should be deleted before any rom update. (~Just follow the previous steps to install it.)
6)Now
LP might be stable. Though it might be a
good idea to
enable the
LP edxposed module from edxposed.
7)
Turn on "Lucky Patcher" from
Edxposed modules tab and reboot.
8)Open
lucky patcher > toolbox > Xposed settings and turn on the first 2 options,
if you find them, because, probably, depending on the support of the drivers they might not show up. I updated my yahfa drivers on 17/1/2021 and they appeared.
9)
LP ~still can cause the phone to bootloop though. Installing ~any app (either as a downgrade or a patch disabling permissions to some of your own apps, etc.)
will bootloop the phone (this may and may not happen after you open this new app). So to prevent this:
10)Go to
LP settings->Apks installer operating mode and select
"Don't use root for Apks insaller". But you're ~not done yet.
11)
For patching apps (like removing not privacy friendly permissions to some of your own apps, etc.)
when selecting menu of patches select ~only the "Create Modified APK file", create your patched app and then
install the app from you file manager (by finding the path of the apk)
, not LP! If you chose
any other option, ~since
LP has root access, it ~will
install the app by itself (doesn't even ask for permission) and you' ll probably
brick the
device. Also probably any other action that might require
apk install through LP will probably
brick the device.
12)As a final step
enable draw on other apps for it.
(LP might be a time bomb for some users...)
13)If you also want, set the
selinux status to
permissive instead of
enforcing. The way of doing this is described later. It ~gives "more" access to apps, but might
expose your phone even more. Turning it on ~didn't prevent any bootloop from LP.
Notice: some may actually be able to install apks directly from LP without bricks. Well, it probably depens on the support of the device and the drivers. Though bootloops may be caused.
If you want to
use it very
safely ~just don't give it root access and enable draw on other apps for it.
If you have already bricked the device you may wanna try these methods (check this post:
https://xiaomi.eu/community/threads/20-12-28-29.59085/post-581529):
Method 1)
Flash the same rom again on top of the other, it may retain almost everything.
Method 2)
Boot into safe mode (reboot the phone and after the mi logo dissapears press the volume down button)
Unistall LP from settings
Note: this will probably remove icons from your launcher.
Check this post for how to enter safe mode:
https://xiaomi.eu/community/threads/20-12-28-29.59085/post-581398
Method 3)
Factory reset from twrp, it will probably delete apps and app data. Note that some apps you have installed, though a bit rare, might not be on google play anymore, but on third party stores, so you might have to install them from there
Method 4)
Factory reset from twrp + same rom flash
Method 5)
The
nuke... Factory reset from and wipe data as well from twrp. If you want reflash the rom as well.
(These methods actually may be useful went trying to fix other app or rom related issues as well.)
2)
To enter safe mode: (
https://xiaomi.eu/community/threads/20-12-28-29.59085/post-581398)
Safe Mode (This is
not the "Recovery mode" or the "Fastboot mode" )
In case your phone shows a lot of errors and you cant handle them because there are a lot of pop up windows or you want to deinstall something from magisk as example ... try the "safe mode" only some important standard apps will be loaded:
- Power off your Android device and then power it on. You can also use the Reboot or Restart option.
- You will see the Powered by Android logo and MI logo on the boot screen, If they disappear and the Screen ist black, press and hold the Volume Down key down so long till system ist loaded
- The System will load and you will see a watermark... Safe mode
- Deinstall the app with the error / analyze the root cause of the issue and so on ...
- Reboot the phone to get off the "safe mode"
- Perhaps after loading you have to disable AirPlane Mode
3)After each rom install,
the old twrp is flashed on your phone, but as said before it's ~the stable one that ~can't dedcrypt data, thus you have to boot into the new twrp the way it was described before (check also the extra info ~right after the rom flashing section above). the
new twrp is installed, but it's
almost completely non functional, you should probably try to enter twrp by using the fastboot boot method.
4)
Backing up:
There are some options:
a)
Nadnroid backups (from twrp). You can ~do a full backup:
Tick ~all the boxes, except maybe the 'cache'. When restoring, ~everything comes back; data, icons, widgets - ~all in the exact same position. The ~only thing is (which is understandable) ~all of the secure apps, eg. bank, have to be re-registered - but they are ~still there.
b)Using
Titanium Backup (TB) to backup
app data (can't restore apk, only data) and
another app to backup apks, like
backup and restore
(
https://play.google.com/store/apps/details?id=com.keramidas.TitaniumBackup&hl=en
https://play.google.com/store/apps/details?id=mobi.infolife.appbackup)
c)Using
swift backup to backup
app data and apks
(
https://play.google.com/store/apps/details?id=org.swiftapps.swiftbackup&hl=en)
d)Using
migrate app to backup
apks and app data
(
https://play.google.com/store/apps/details?id=balti.migrate&hl=en
https://play.google.com/store/apps/details?id=balti.migrate.helper
https://play.google.com/store/apps/details?id=balti.migrate.flasher)
e)Using
twrp to make
nandroid bakups (no root)
f)Using
helium (no root) to backup
app data (can't restore apk, only data) and
another app to backup apks, like
backup and restore.
(
https://play.google.com/store/apps/details?id=com.koushikdutta.backup
https://play.google.com/store/apps/details?id=mobi.infolife.appbackup)
g)
Using miui's native backup process to backup app data and apks (my device->backup and restore). If find it to work kinda well with backing up the
launcher and the
wifi settings.
5)For
managing moving files (during backups) you may want to use
total commander (and give it root access).
(
https://play.google.com/store/apps/details?id=com.ghisler.android.TotalCommander, check it's plugins as well)
It can ~retain the last modfied date, explore root and apps, connect to pc with lan, make your device ftp server, unzip zips etc.
6)For
dual apps use
island app, it deos its job ~very well (if you install it and then isnatll magisk, it's gonna be installed in island app too).
(
https://play.google.com/store/apps/details?id=com.oasisfeng.island&hl=en)
7)To
kill background apps, you may want to use
greenify apart from the miui settings
(
https://play.google.com/store/apps/details?id=com.oasisfeng.greenify)
8)To
monitor battery you may want to use
gsam battery monitor (you can give it root access, if you go to apps usage app, select an app and wait a little).
(
https://play.google.com/store/apps/details?id=com.gsamlabs.bbm&hl=en)
9)To
migrate playlists from pc get the music files and put the inthe same folders that they are on pc, get the playlist.m3u files, edit them by fixing the paths (remember to change "\" to "/")
10)To take
care of battery charging check the app
AccA (you ~can find it in
magisk too as Acc and use it with a terminal editor, but ehh).
Github:
https://github.com/MatteCarra/AccA
App on F-Droid:
https://f-droid.org/packages/mattecarra.accapp/
Extra
info about Li-Ions/LiPos:
https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries/
11)
Changing SELinux status between
Enforcing and
Permissive (note; it may expose your device even more to threats) using the
"the SELinux switch":
a)Get the
zip of this app (the .zip, not the .m5d):
https://androidfilehost.com/?w=files&flid=203152
(XDA:
https://forum.xda-developers.com/t/app-tool-2-0-official-the-selinux-switch.3656502/)
b)Flash it through
twrp
c)Reboot and find/open the app
d)Give it
root access
e)Tick the
notification box
f)Select the mode/status you want
More
info about SELinux:
https://forum.xda-developers.com/t/app-tool-2-0-official-the-selinux-switch.3656502/
https://androidmore.com/set-selinux-permissive-android/
https://access.redhat.com/documenta...anging-selinux-states-and-modes_using-selinux
https://serverfault.com/questions/371409/selinux-how-to-change-to-permissive-mode-without-a-reboot
This guide contains knowledge and parts from the xiaomi.eu forum (and other sites).
It ~couldn't be made without the help of many many people. I might not remember all of them, but
HUGE THANKS TO:
@Iain_B
@gkalen
@katerpanne
@RainerReinfall
@Poney70
@geoorg
@Camerado
@the developer team
And many other people!
Please feel free to continue this thread!!!