[Moto G 5G Guides, News, & Discussion] Sass86oh:
This is a comprehensive description describing the process of flashing any Android GSI image to the Motorola One 5G Ace (kiev) which will work and should boot so long as the GSI image is in the arm64-ab format. The only thing this guide does not explain is how to set up your computer with the ability to use fastboot and adb in order to flash images to an Android phone using fastboot. This information is different depending on the OS your computer runs so you must have this working already and can issue commands over fastboot and adb currently

Flashing arm64-ab Android GSI Images on the Motorola One 5G Ace (kiev)

1.) Unlock your bootloader: Go to moto bootloader unlock site found here:

https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a

- You need to make a Motorola account and sign in enter your unlock code after running:

fastboot oem get_unlock_data

- Follow the directions on how to submit the code you get back from running the command. Use the scrubbing tool to strip the code and submit it in the “can my device be unlocked” box, if you can unlock the required unlock code will be emailed to the address used to create your Motorola online account.

- Use the following command to unlock your bootloader:

fastboot oem unlock XXXXX (code received by email from Motorola replaces the XXXXX)

2.) Once bootloader is unlocked phone will be wiped and you'll need to setup the device again and then enable USB Debugging by tapping Build Number under About Phone in Settings 7 times to unlock Developer Options in System entry under Settings.

- Back out of About Phone then choose System and you'll find Developer Options there, enter Developer Options and scroll down to USB Debugging and enable it. Connect your device to your computer using the usb c cable used to charge it.

*** This should bring up an authorization prompt on your device which must be allowed if you have not already done so in order to flash images over fastboot ***

3.) Create a new empty folder on your desktop and rename it to kiev_gsi

- Download your carriers current firmware from Lolinet’s Firmware Repo found here:

lolinet mirrors - firmware, software, iso etc.

lolinet mirrors - powered by h5ai

mirrors.lolinet.com

- Choose the firmware for your devices variant. Mine is from Xfinity Mobile in the United States so my device uses the COMCAST firmware variant. or RETUS stands for Retail United States, this version would be used if you bought the device directly from Motorola in the United States. RETEU: Retail Europe... RETIN: Retail India... RETCA: Retail Canada... RETBR: Retail Brazil... and so on)

- If you aren't sure which firmware your device uses then you can use LMSA recovery software (https://support.lenovo.com/in/en/downloads/ds101291) and install it on Windows in order to download the proper firmware archive automatically for your device.

* Run software following the install completion

* Select the Rescue option in the top menu then choose Phone in the next window

* Enter the IMEI of your device in the box that appears then hit search and then OK in the popup box

* Click the Download button to begin downloading the proper firmware archive for your device

* Firmware will be located in C:\ProgramData\LMSA\Download\RomFiles\

- Once you have the firmware folder downloaded and unzipped using either method listed above copy and paste all of the files found inside the firmware folder into the kiev_gsi folder you created on the desktop.

*** The firmware archive will contain the following files ***

View attachment 5436371

4. IF YOU WAT TO ROOT FOLLOW THIS STEP OTHERWISE YOU CAN SKIP IT.

- Install the latest version of Magisk Manager.apk on the phone from here:

Releases · topjohnwu/Magisk

The Magic Mask for Android. Contribute to topjohnwu/Magisk development by creating an account on GitHub.

github.com

* Copy the boot.img file from kiev_gsi folder on the desktop to your android download folder

* Use Magisk Manager to patch the boot.img file (patched image will be in phones download folder)

* Copy the patched boot.img to the kiev_gsi folder on the desktop and rename it magisk.img

5. IF YOU WANT TO INSTALL TWRP FOLLOW THIS STEP OTHERWISE YOU CAN SKIP IT.

- Download h3xmind’s UNOFFICIAL TWRP Recovery for The Moto One 5G Ace from here:

https://xdaforums.com/t/recovery-unofficial-twrp-3-5-2_10-for-moto-g-5g-kiev.4289775/

- Rename the .img file that was downloaded to twrp.img and move it to your kiev_gsi folder on your desktop.

6. Obtain an Android GSI in the arm64-ab format (Any arm64-ab Android GSI should work)

*** arm64-ab IS THE PROPER GSI FORMAT FOR THE MOTOROLA ONE 5G ACE SO ALWAYS USE THIS FORMAT ***

- For this guide I’m using the HavocOS Team’s Official Android 10 Phh-Treble Based GSI with GAPPS found here:

https://sourceforge.net/projects/havoc-os/files/arm64-ab/Havoc-OS-v3.12-20201230-Official-GApps-arm64-ab.img.xz/download

- Unzip the GSI from .img.xz format so that we have a .img based file and rename it to havoc.img and then move it to the kiev_gsi folder on the desktop

7. Download kusti420’s product_gsi image file from here:

https://xdaforums.com/attachments/product_gsi-img.5371179/

- Move the product_gsi.img to the kiev_gsi folder on the desktop

8. We should now have a folder named kiev_gsi that’s located on our desktop with the following files present inside of it:

View attachment 5436389

9. Execute the following commands with android device connected to computer in fastboot mode from terminal or command prompt depending on OS youre using

cd

# Press Space key after cd command above then drag kiev_gsi folder from desktop into terminal window and press Enter key

adb reboot bootloader
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot flash recovery recovery.img
fastboot reboot fastboot

# Wait for device to reboot into fastbootd mode)

fastboot flash product product_gsi.img
fastboot erase system

# Name GSI whatever you want instead of havoc.img in next command

fastboot flash system havoc.img

# Only run the next two commands if you want to install TWRP.

fastboot flash recovery_a twrp.img
fastboot flash recovery_b twrp.img

# Only run the next command if you want to root the GSI you're flashing.

fastboot flash boot magisk.img
fastboot -w
fastboot reboot

10. To flash a new GSI image after you've setup your device using this guide replace havoc.img with the new GSI you want to use. Well call it system.img to give an example.

- Add system.img to kiev_gsi folder

- point terminal to kiev_gsi folder

adb reboot bootloader
fastboot flash recovery recovery.img
fastboot reboot fastboot
fastboot erase system
fastboot flash system system.img
fastboot -w

# Flash TWRP back for use with new GSI

fastboot flash recovery twrp.img

# Root new GSI

fastboot flash boot magisk.img
fastboot reboot

11. To flash stock firmware back to phone copy flashfile.sh script attached below into kiev_gsi folder on your desktop and point terminal to the kiev_gsi folder then run the following command from terminal

sh ./flashfile.sh

Credits:

h3xmind for his TWRP Recovery for Motorola One 5G Ace: https://xdaforums.com/t/recovery-unofficial-twrp-3-5-2_10-for-moto-g-5g-kiev.4289775/

topjohnwu for his Magisk Manager and root via boot patching used here: https://xdaforums.com/f/magisk.5903/

kusti420 for his steps on flashing GSI Images on devices with dynamic Super partitions: https://xdaforums.com/t/how-to-flash-gsis-on-devices-with-dynamic-super-partition.4256667/

kusti420 again for his product_gsi image used to root after flashing gsi: https://xdaforums.com/t/tutorial-magisk-on-gsi-on-devices-with-dynamic-partition.4311045/

HavocOS Team for their HavocOS Android 10 arm64-ab GSI: https://havoc-os.com/device#arm64-ab

phhusson for PHH-Treble Vanilla Images: https://xdaforums.com/t/aosp-10-0-2019-12-06-quack-phh-treble.3992559/

Team Win Recovery Project for providing h3xmind with the ability to port an unofficial TWRP build to the Motorola One 5G Ace