yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
Install Android 9.0 Pie AOSP GSI

Warning

You will loose all your data. Make sure to backup. You are doing this at your own risk. Neither me nor xda is responsible for any bricked devices.

Pre-Requisites

Please read carefully. Any questions which are already answered in OP will be ignored.

If you have a question, not answered in OP read last 2-3 pages. Any questions which are already answered in last 2-3 pages will also be ignored.

Not being rude, but people need to start reading.

Make sure you have unlocked the bootloader.

​

Text Guide

Install Android 9.0 Pie AOSP GSI

1. Download AB Arm64 GSI from link in downloads. Unzip it. Windows users can use Winrar. Mac users can use the Unarchiver.

2. Download and unzip adb & fastboot linked in downloads section.

3. Place the extracted system image (step 1) in platform-tools folder. Rename it to system-arm64.img.

4. Power off phone.

5. Press and hold volume down and power button at the same time. You will now boot into fastboot boot.

6. Connect phone to computer.

7. Windows users open command prompt. Mac/Linux users open Terminal. Navigate to the folder where you unzipped adb & fastboot.

Windows

fastboot devices

Mac & Linux

./fastboot devices

If your device shows up, drivers were installed correctly. If not, then drivers were not installed and you need to install them.

8. Erase System

Windows

fastboot erase system

Mac & Linux

./fastboot erase system

9. Flash Android Pie GSI

Windows

fastboot flash system system-arm64.img

Mac & Linux

./fastboot flash system system-arm64.img

10. Wipe/Factory Reset

Windows

fastboot -w

Mac & Linux

./fastboot -w

11. Reboot

Windows

fastboot reboot

Mac & Linux

./fastboot reboot

11. Profit. Android 9.0 Pie. Rooting might result in broken Wi-fi. So, flash back stock boot.img if your wifi is broken after rooting.

Video Guide

[youtube]2P-EcKMVIt4[/youtube]
​

Downloads

MiUnlock Tool - http://xiaomi-miui-ota-3rdrom.ks3-c...1/3.3.525.23/miflash_unlock-en-3.3.525.23.zip

Latest ADB & Fastboot :- https://developer.android.com/studio/releases/platform-tools

Setup ADB and Fastboot (if above adb & fastboot do not work) - https://www.xda-developers.com/adb-fastboot-any-directory-windows-linux/

Android 9.0 Pie GSI Thread :- https://xdaforums.com/project-trebl...velopment/aosp-9-0-phh-treble-t3831915/page12

Android 9.0 Pie GSI Download Links :- https://github.com/phhusson/treble_experimentations/releases

Winrar (Windows) :- https://www.rarlab.com/

The Unarchiver (Mac):- https://theunarchiver.com/
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
[MENTION=921457]munchy_cool[/MENTION] wow!!!, Thanks man. But sorry but i have to ask, did you try this on your A2 is it working fine without any issues?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
the A2 in the video is mine. I tried it for some time. Camera works, wifi works, sound works, charging works, couldnt check calls and lte as I am at work and cannot have my sim turned off for even a minute. But yes it works.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
much appreciated man!! Reason i asked this is i ****edup my phone before cause of that fastboot boot twrp > set active b slot thing. So my warranty covered me and gave a new phone. lol. BTW what do you mean by "cannot have my sim turned off for even a minute"? Finally it will be great if you can add how to flash back the stock rom as well.. Thanks mate :good:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
not sure how you bricked it but glad you got a new phone.

"cannot have my sim turned off"

So, I have only one sim which is in my work phone. to test LTE, data etc i will have to remove the sim from that phone and put it in the Mi A2. Now, I cannot do that as I cannot have my sim (phone number) turned off for even a minute due to work.

As for going back to stock. Download stock firmware, extract it and replace pie gsi img with system.img from factory firmware zip and you will be back to stock.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
How did i bricked my phone. Simple. First of all no desrepect for any dev, since i did this by my one. What i did was tried to flash unofficial twrp and fastboot set slot b did not worked. Once i reboot it got stuck on a bootloop. i couldn't flash xiaomi stock fastboot zip due to "critical partition flashing is not allowed" and before you asked yes my A2 was bootloader unlocked one. Unlock critical partition thing is not for our devices like for pixel series as far as i know. So simply i couldn't fix it, neither the software guy from my purchased center. That's why im afraid. I know you are besy, but highly appreciate if you can write down how to go back to stock guideline as well. Thanks again :good:
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
did you try fastboot set slot a, and then reboot? that should have fixed it.

As for a guide for going back to stock from Pie.

LIke i said.

dowload fastboot firmware from here.

https://xdaforums.com/mi-a2/how-to/ota-v9-6-5-0-odimife-t3823445

extract the zip file. open images folder. grab system.img. put it in fasboot folder. and in step where we flash pie gsi image, flash the system.img you just pasted in fastboot folder.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
Thanks man. Will try at night. Can't wait ????
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Streect:
MTP doesn't work.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] djmitza222:
It works. Enable it in Developer Tools.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] HTCDevil:
Thank you very much for sharing, i will try it soon

---------- Post added at 10:02 AM ---------- Previous post was at 09:39 AM ----------

No problem on Linux? Simple adb /fastboot installed on Ubuntu

---------- Post added at 10:09 AM ---------- Previous post was at 10:02 AM ----------

Again: which one img do you choose, aonly or ab?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
did you read the OP at all? it's mentioned step 1 which file you need.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] speedunderx:
How to install Gapps?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] soulicro:
Two things:

1) Thank you for the guide! You got yourself another subscriber on YouTube :) This is my first device that supports Treble. From your experience, how stable are GSI ROMs?

2) Update your signature ;)
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
i didnt get time to check that. may have to install some apks. maybe the same apks which are needed for amazon fire tablets to get play store working.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
gsi's are pretty stable, check xda thread for bugs. will update signature soon :)
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] HTCDevil:
About my last question ok, i see on YouTube it is ab. Other question not answered yet. Thanks.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
no problem on Linux.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] HTCDevil:
Great, hope gapps work and camera is mostly Stable. Thank you
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
it does not have gapps. you may have to manually install some apks. try with apks needed for Play Store on amazon fire tablets.

if you figure those out, please let us know.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] balazs312:
Flash unofficial gapps via fastboot?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
please let me know how to do that ..
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
Gapps try

if anyone is on Pie and wants to try Google Apps.

try downloading and installing these 4 apks from apkmirror

1. Google Account Manager

2. Google Services Framework

3. Google Play Services

4. Google Play Store
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] HTCDevil:
I'll try apk made for Mi8 Chinese version, maybe it works

Link: https://ufile.io/nde5h

30 dd
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Anemiq:
I tried it and it gives "Google Services Framework stopped working" error :(
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] HTCDevil:
Damn, maybe it is better install every single app using apk
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] mauley:
Or we would be waiting for a working TWRP before flashing ROMs and other stuff. Seeing a lot of people having problems on this forum.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] bartoloandre98:
is there one in the works?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] mauley:
I'm pretty sure they're at least one or two Devs working on it. Just a matter of time before it gets figured out so will make flashing easier.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Daha3ker:
I believe fastboot flashing unlock_critical will solve the problem. I "unlocked" my bootloader 3 times.

first I ran

fastboot oem unlock

selected yes, then ran

fastboot flashing unlock

then

fastboot flashing unlock_critical

It let me unlock the bootloader each time. I thought it was strange. I guess it is divided up into specific permissions you unlock.

I couldn't get specific permissions after rooting without unlock_critical having been run. I recommend you try it. for some reason you can "unlock" it multiple times. Kinda strange.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
wait,,,what!!!! seriously!!!i'll try and let you know
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
PS. Doesn't work. Only fastboot oem unlock works for our devices
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] soulicro:
Nah... "fastboot flashing unlock_critical" definitely works for our device, because I had to do it in order to restore the stock global ROM. Dunno about "fastboot flashing unlock", though.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
There is no such command as "fastboot flashing unlock_critical" . I tried everything you said and didn't work. Anyone can test this??
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] soulicro:
Yeah, my bad. No underscore. fastboot flashing unlock critical.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] T4Ump:
locking/unlocking:

flashing lock|unlock Lock/unlock partitions for flashing

flashing lock_critical|unlock_critical

Lock/unlock 'critical' bootloader partitions.

flashing get_unlock_ability

Check whether unlocking is allowed (1) or not(0).
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
NO there is no fastboot flashing unlock critical command. See the attachment
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] soulicro:
Check out the post right above yours ?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
fastboot oem unlock should be good to flash any partitions needed by a custom rom.

I think you need

fastboot flashing unlock_critical

to update the bootloader.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Daha3ker:
I have an A2. You need to have the latest Android sdk for fastboot flashing unlock and unlock_critical to work. It is a command that was added recently. The version of fastboot I am using is the one included in android studio. The clockwork mod one is several years out of date, which also seems to be what is included in most downloads.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] P4Block:
The A2, similarly to other phones such as the razer phone, has a bootloader bug. Sometimes, and, tbh, most of the time, the bootloader won't do anything properly and spew dubious messages. Just fastboot reboot bootloader until you can "fastboot getvar all" successfully, then you have a working fastboot and you can unlock critical.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
Well i did download Android Studio and used platform tool to test below command line with flashing. Ultimately im stilling getting same command line error. Im very much like to use/believe/unlock critical partition, however it doesn't work. im done. Thanks guys

commands tried

fastboot flashing get_unlock_ability

fastboot flashing unlock

fastboot flashing unlock_critical

..See for yourself by the attachment
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] jim262:
What about Gapps?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] mauley:
Pretty sure there is no flashing command only flash? Like fastboot flash OEM unlock.

I have never used the command "flashing" in any device when unlocking bootloader
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
you need when you unlocking a pixel device
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Daha3ker:
I just finished a toolkit that may help. here is a link to it.

Mi A2 Toolkit
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] kradNZ:
Try running in cmd.exe instead of power shell. No idea why this would make a difference but I've seen this a few times now.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
Will try but both do the same thing ryt.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] faisal1hd2:
How can i install stock miui camera or google camera???
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] thedisturbedone:
Thank you for the guide. I've purchased my device only a couple of days back. Since this does not have gapps I installed pixel experience 9.0. I have yet to transfer my sim and fully test it out. But so far, things function well.

The downside is no stock camera. Just the basic cam and I don't think camera2 api is enabled so gcam is out of the question too.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] socialexandru:
Are any problems except the cam? I had read some about the flash light permanently on on the front camera? Thanks!
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] sukhman2810:
i have a problem... the notification light is always on how to fix that ??
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
wait for updated gsi.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] thedisturbedone:
Not flash, the notification led. Since I always use Do Not Disturb mode, I have disabled the Led altogether. If it gets stuck, a reboot solves it.

Besides that, I hate that I can't seem to get Magisk working..

Edit: Nvm, got Magisk working with the new update. The fun starts now!

Edit 2: There are minor glitches here and there like things not turning on/off, but nothing a reboot can't fix.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
So the notification led still doesn't work on latest version? How did you install latest magisk? How is smoothness and camera compare to stock rom?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] thedisturbedone:
Notification LED does not work in the version I'm using. But I am yet to test with 3rd party apps such as light flow to see if I can get it to work. For now it just stays on permanently, so I've disabled it completely.

Magisk gave me some trouble. The patched boot image causes wifi to break so I can have only temporary root to apply any build.prop tweaks and revert to the default boot image. I want to try repatching to see if I can get rid of the wifi issue (there's also a fix listed in the thread) but haven't got around to it yet.

Enabled camera HAL3 so I got a variant of gcam working (barely). Can take pics but no portrait mode or dual cam usage. I got footej camera to work and it gives plain photos and some manual controls. Smooth operations in cam, but photos aren't impressive as with stock cam. Definitely doesn't use both cams.

That's a lot of typing. PM if anything else since I'm not using the rom he listed here. And it's not nice.

Edit: I'm currently using a P variant called Benzorom which has some inbuilt customisation features.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
Thanks alot man, sure i'll pm you for more info
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
[MENTION=921457]munchy_cool[/MENTION] how do i go back to stock??
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
Didn't we already have a discussion about this and I asked you to download the stock firmware and extract system.img from there and flash that instead of pie gsi image?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] crazykas:
I was confused. I flashed the ROM today and wanted to go back. Anyway whta I did was flash stock firmware via MiFlashtool twice (because ¹st time i didn't work) and had to format data. Now everything works. Hope this is fine
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
Yes it is.. Just a longer way..
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] hands0m3:
Anyone having wifi problems?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
if you root with Magisk you might have wifi issues.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] hands0m3:
I didn't root

---------- Post added at 08:30 PM ---------- Previous post was at 08:30 PM ----------

I didn't root
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] faisal1hd2:
Tell me the process please. I tried to flash stock rom with miflashtool. but it shows a message - "Flashing is not allowed for critical partition ' like this. Now, what to do?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] 3omarelfouly:
just open cmd and type "fastboot devices" and then when you see your device type "fastboot flashing unlock_critical" and you should see on your phone two options, choose the unlock option and then you will be able to use mi flash
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] faisal1hd2:
Thanks a lot sir. It works ?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
My device got in bootloop. Help please!

Whats up, guys! So, my new Mi A2 arrived and I wanted to use it with android Pie. I followed the tutorial and my device shows up on fastboot devices, but when I run "./fastboot erase system", I end up with the two of the following errors:

Failed to identify current slot

or

Erasing 'system' FAILED (remote: 'unknown command')

Finished. Total time: 0.002s

what happaned is that one time, when I ran "./fastboot erase system", my terminal did stuck for about 2 minutes and I pressed ctrl + c and disconnected my device (yes, I did it). After that, my phone won't turn on. It's looped on boot and it shows android one logo followed by the bootloader warning screen telling me that my bootloader is unlocked.

I tried to run "./fastboot --set-active=a", but i get the error: FAILED (remote: 'unknown command')

I have already redownloaded and reconfigured platform-tools twice, but this remote command keeps on being unknown...

I'm using Ubuntu.

thx anyway!

I'll try to do the process tomorrow with another cable and another computer. Wish me luck! I'll tell here if it worked
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
using old fastboot. get latest from link in OP.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
I'm using version 28.0.1 of platform-tools, wich is the one from the link. I have tried to use another computer, but adb and fastboot fails to find my device. Also tried with other cables. On my computer, only fastboot recognizes it, but I can't do anything. I think I lost my device... :(

Every command I try to use returs errors like FAILED (remote: 'unknown command') or it fails to identify current slot or that the device does not support slots

Also tried to flash those images:

Android 8.1.0 [V9.6.9.0.ODIMIFE]: h ttp://bigota.d.miui.com/V9.6.9.0.OD...53f18f370a.tgz

Android 8.1.0 [V9.6.10.0.ODIMIFE]: h ttp://bigota.d.miui.com/V9.6.10.0.O...2aeda83301.tgz

but I get "Missmatching image and device"
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
are you sure you have the Mi A2? and your firmware is for Mi A2. That message tells me and you, that you have a mismatch in image and firmware. dont flash it or you may have a bricked device.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
Yes. Xiaomi Mi A2 128GB 6 GB of RAM. I got those images from this post: h ttps://xdaforums.com/mi-a2/how-to/fastboot-xiaomi-mi-a2-fastboot-images-t3824849

And I think I do have a bricked device anyway. That's my first android and I had it for just like 1 hour :laugh:

My bootloader is unlocked and when the system used to work, I had USB Debugging enabled

It looks like adb is not working (but it is installed), because ./fastboot devices shows me my phone, but adb devices shows me nothing...
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
adb works with device booted into Android.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
so, it means I have no android on my device, wich means my phone is bricked?? Sorry, I'm new in this world

and if it's possible, i'll be able to fix my phone with only fastboot, right?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] ukakhmedoff:
I have issue with wift on any android 9 firmwares: it isn't turning on
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
Just an update: I am trying to flash this ROM http://en.miui.com/download-353.html . I downloaded it, and extracted it on my platform-tools folder. I don't get the mismatching error, but i got stuck on "sending 'bluetooth_a' (524 KB)...". My terminal is on that screen for a looong time.

ps.: I'm using a 2.0 usb port
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] EkineX68:
Hi everyone,

I have an issue with my phone, the fingerprint sensor is not proposed as a lock way.

Someone can help me please ?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] djmitza222:
1. Download MiFlashTool (latest version)

2. Download Minimal ADB and Fastboot

3. Extract the entire ROM to a folder (including the .bat files and Images folder)

4. Connect phone to PC in fastboot mode

5. Open Minimal ADB and Fastboot and type "fastboot oem edl" without quotes. Phone screen must be off at this step.

6. Open MiFlashTool, browse to the folder with the ROM, in the bottom right corner select flash_all, hit refresh and then flash. If you get an error, disconnect the phone, reconnect, hit refresh and flash.

7. When everything turns to green, disconnect the phone and press the power button for at least 10 seconds. Your phone should work again as normal
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
thanks for your help, but I use linux and there is no MiFlashTool. Tomorrow I'll try the test point method on college, cause there I'll have access to a windows pc. I have already tried to flash on windows, but as the device was in loop, I had no way to trust the computer. Tomorrow I'll give an update. Thanks to everyone who is trying to help me!
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] :
If I flash a GSI ROM, can I lock the bootloader on my Mi A2 ?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
dont lock your bootloader while on a custom rom.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Mr.Nice.ba:
Is there any GSI ROM that can be used as daily driver. Tried several builds of Pixel Experience, LOS, AOSP and FP sensor do not work on any of these ROMs. I saw on youtube that some people have pretty stable gsi builds with minor bugs, fp also work. When I tried same builds with same stock firmware (august build), for me FP and WiFi still do not work. What am I doing wrong? Even PE 8.1 gsi build have no FP reader in settings.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
Whats up, guys, i managed to unbrick my device using this post https://xdaforums.com/mi-a2/help/test-to-short-to-flash-locked-device-t3828765 longstory short: i had to open it, connect the testpoints and mi flash tool did the rest of the job
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] munchy_cool:
how did you brick your device?
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] zemariolac:
I was trying to do that tutorial you made. I don't know why, but it looked like fastboot was not working well. When I tried "fastboot erase system" i had error messages. One time I didn't get any errors, but my terminal got stuck and nothig happened. After a long time, I disconnected my phone and when I turned it on, my device was in bootloop and fastboot couldn't do anything. Only the test point method unbricked my phone.
[Xiaomi Mi A2 / 6X Guides, News, & Discussion] johnsci911:
I Brick mine too

Do y have a link for the miflash or instructions?

I do the longer method of restoring stock rom on my device