[Xiaomi Mi 2] djibe89:
[GUIDE/TUTORIAL/HOWTO] Xiaomi Mi 2/2S Stock to Android 11

[GUIDE/TUTORIAL/HOWTO] Xiaomi Mi 2/2S (codename Aries) Stock to Android 11 R / AOSP 11

Complete guide to install Android 11 on your Xiaomi Mi2 (1.5 GHz) or Mi2S (1.7 GHz).

This tutorial only applies to this model, to check the correct version:

in Android, go to Settings > About phone, make sure Device model number is MI 2 or MI 2s.

### If phone is not MI 2/MI 2S, quit this tutorial

Netflix + Disney+ work.

CHANGELOG

v2. Android 11 thanks to tiger-cave + update pack

v1. Initial release

1) WHAT YOU NEED

- djibe Mi 2 pack: https://bit.ly/djibe-mi2-pack

(contains all you need: USB drivers + fastboot & adb + parted + TWRP Recovery 3.6.2_9-0)

ROM ASOP 11.0 by tiger-cave: https://github.com/tiger-cave/local_manifests/releases

or grab Android 10 by Mokee 100: https://xdaforums.com/t/rom-9-0-official-10-nightly-mokee-open-source-android-project.4038401/

Download latest build here: https://download.mokeedev.com/aries.html

Backup is here: https://www.androidfilehost.com/?fid=17825722713688274476

+ BiTGApps Package ARM 11: https://github.com/BiTGApps/BiTGApps-Release/releases

+ XiaoMiTool V2: https://github.com/francescotescari.../download/v20.7.28/XMT2_Win_Setup_20.7.28.exe

2) INSTALL DRIVERS

Go to the folder you unzipped earlier.

navigate to usb_driver_r13-windows > usb_driver.

Right click on android_winusb.inf and select Install. Confirm with OK.

Restart Windows.

3) BACKUP YOUR DATA

Make sure Google/provider account is synchronized.

Backup photos, documents, contacts before going any further (ex: use the backupyourmobile app).

Connect phone to PC, search for all .jpg, .mp3, .mp4 files on your phone and retrieve data.

4) ENABLE USB DEBUGGING

Make sure you have latest MIUI updates.

Go to Settings > About phone > MIUI version: 8.2.1.0

If not, go to System updates.

If no update available: tap 7 times on MIUI version.

Then go to Settings > Additional Settings (System & Device section) > Developer options.

Switch USB debugging ON > Confirm with OK.

Connect phone to PC and Confirm USB debugging from phone.

5) FLASH TWRP RECOVERY

Install and Launch XiaMiTool V2.

Agree to terms.

Choose "My device works normally. I want to mod it"

Select the recognized phone.

Click on Mods, root and twrp > TWRP recovery - twrp-3.6.2_9-0-aries.img > Continue

### If restart to fastboot doesn't work. Shutdown phone. Hold Power + Volume- and release buttons to reveal Fastboot mode.

Phone will boot automatically to TWRP.

6) BACKUP SYSTEM

Now go to Home screen > Backup.

Select System, Data and Boot.

Swipe to Backup and wait during Backup.

Back to Home > Mount.

Using Windows Explorer, access Aries device and copy the TWRP folder from Internal Storage folder to somewhere safe.

7) REPARTITION

System partition cannot contain Android 11 + GApps.

Moreover, Android 11 doesn't know how to use Mi 2's partition layout.

Here we go.

Xiaomi are tough phones like Samsungs. Don't be scared.

Still in Mount > uncheck all partitions to unmount these.

Now open Windows command in my /flash folder (while in flash folder, type cmd in Windows address bar and hit Enter)

Enter command:

adb devices

Command returns Recovery XXXXXXX

### If not, check driver installation.

We send parted on phone.

Enter command:

adb push parted /tmp/

then

adb shell

In shell, commands start with #

Enter:

chmod 755 /tmp/parted

then

/tmp/parted /dev/block/mmcblk0

(We mount internal memory with parted)

In parted, commands start with (parted)

Enter:

unit s

print

Here is your partition layout

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags

1 34s 348193s 348160s fat16 modem

2 348194s 349217s 1024s sbl1

3 349218s 350241s 1024s sbl2

4 350242s 352289s 2048s sbl3

5 352290s 354337s 2048s rpm

6 354338s 356385s 2048s tz

7 356386s 357409s 1024s DDR

8 357410s 365601s 8192s aboot

9 365602s 367649s 2048s misc

10 367650s 373489s 5840s logo

11 373490s 375049s 1560s m9kefs1

12 375050s 376609s 1560s m9kefs2

13 376610s 376611s 2s m9kefsc

14 376612s 393215s 16604s bk1

15 393216s 394775s 1560s m9kefs3

16 394776s 524287s 129512s bk2

17 524288s 585727s 61440s boot

18 585728s 616447s 30720s recovery

19 616448s 638975s 22528s bk3

20 638976s 655359s 16384s ext4 persist

21 655360s 2752511s 2097152s ext4 system

22 2752512s 3538943s 786432s ext4 cache

23 3538944s 10878975s 7340032s ext4 userdata

24 10878976s 61071326s 50192351s ext4 storage

It may be slightly different.

Save this partition layout (copy paste text and save it).

I repeat: Save this partition layout (copy paste text and save it).

Save this partition layout (copy paste text and save it) :)

Now, still with (parted), we recreate the partition layout.

I start with partition 21 system, 22 being cache.

If you are not like this, post a message.

Enter commands:

rm 21

rm 22

rm 23

rm 24

mkpart physical ext4 655360s 3655360s

mkpart physical ext4 3655361s 4441793s

mkpart physical ext4 4441794s 61054722s

mkpart physical ext4 61054723s 61071326s

name 21 system

name 22 cache

name 23 userdata

name 24 storage

quit

sync

Disconnect and reconnect phone.

To check phone is still recognized:

adb devices

Then:

adb shell

Commands start with # (again, we are in shell).

Type and wait during operation:

mke2fs -t ext4 /dev/block/mmcblk0p21

mke2fs -t ext4 /dev/block/mmcblk0p22

mke2fs -t ext4 /dev/block/mmcblk0p23

mke2fs -t ext4 /dev/block/mmcblk0p24

e2fsck -f /dev/block/mmcblk0p21

resize2fs /dev/block/mmcblk0p21

Show new partition layout with fdisk (slightly different):

fdisk -l /dev/block/mmcblk0

(You can still do the same with parted: /tmp/parted /dev/block/mmcblk0 > unit s > print)

Now system (part 21) is ~1400M, cache 384M, userdata ~20G and storage a few M.

exit

Disconnect phone.

8) FLASH AOSP 11

Go to Mount > check Data partition and connect phone.

From Windows: copy ROM + GApps (+ Magisk, optional) to the same phone's Internal Storage folder.

Back to TWRP: go to Install > aosp-11*.zip

Then go to Wipe > Advanced Wipe > Resize File System > Swipe to Resize.

Go to Reboot > recovery

Baxk to recovery, go to Install > flash bitgapps*.zip.

9 ) DEVELOPER MENU

Open Settings menu > About Phone.

Tap on the "Build number" entry seven times. You should be notified, that the developer settings are now active.

Now go to Settings menu > System > Advanced Developer settings.

Scroll down and change transition and animation scales to x 0,5 for smoother animations.

You can install GBoard or Swiftkey to change the keyboard.

That's it.

Enjoy,

djibe

Thanks: tiger-cave, Mokee team, @GuaiYiHU, Francesco Tescari, @stradfred, TWRP team

----------

Boot to Recovery

Like a Samsung, hold Power + Volume+ until logo is displayed and release buttons.

Back to stock

MIUI 9.2.2.0 Global Stable ROM from https://flashxiaomi.com/download-install-miui-rom-for-xiaomi-mi-2s-all-miui-firmwares/

Downloads for : Xiaomi Mi2 | AndroidFileHost.com | Download GApps, Roms, Kernels, Themes, Firmware and more. Free file hosting for all Android developers.

Download GApps, Roms, Kernels, Themes, Firmware, and more. Free file hosting for all Android developers.

androidfilehost.com