• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Guide] How to flash a Generic System Image on the Moto G Stylus

Search This thread
After a couple weeks of on and off searching the internet, I finally got a couple GSI ROMs from the treble forum to boot up; so I'm posting this guide in hopes it saves somebody else all the searching

A couple things to note:

  • You and only yourself are doing this at your own risk. Unlocking your bootloader voids warranty
  • Have your stock images ready to flash in case of a brick
  • You must have an unmodified boot.img installed, the Moto REALLY doesn't like clean booting with a modified boot.img. I've tried every combination in magisk when patching a boot.img (keep & remove DM-Verity/Encryption) with no success on Stock and a GSI
  • Most things should work fine, text are reported to not work unless you change your network mode to 3G
  • Android 10 brought two fastboot modes to the game. Bootloader and Fastbootd. Since the Moto uses dynamic partitions we have to use fastbootd for this.
  • The Moto is 64-bit and uses A/B partitions so use arm64 A/B images
  • Lastly, BACK UP YOUR DATA, you will lose your data

Requirements


Instructions:


Boot into fastbootd
Code:
adb reboot fastboot
Install the vbmeta.img
Code:
fastboot --disable-verification flash vbmeta vbmeta.img
Erase the system partition
Code:
fastboot erase system
Install the GSI of your choice
Code:
fastboot -w flash system GSI.img


If you get an error about resizing the partition run this command and try again
Code:
fastboot delete-logical-partition product_#

Replace # with a or b depending on what slot you're flashing to​
Reboot and finish
Code:
fastboot reboot

You might boot into a screen that says to factory reset, do it and it should boot fine. It might happen another time or two (if it keeps happening, you've bootlooped, flash your stock images)


Recover/Back to Stock:

If your device bricked or you just want to go back to 100% stock, you can download the smart recover tool from here:
https://support.lenovo.com/us/en/downloads/ds101291

Recover Tool not working?
You can download the firmware from here:
Retail:
https://forum.xda-developers.com/mo...t/stock-rom-motorola-g-stylus-retail-t4104451
Metro:
https://forum.xda-developers.com/mo...30-80-64-3-t4138681/post83146807#post83146807

- Bricked devices are usually recoverable if they can still get into fastboot
 
Last edited:
Advanced Tips:
(Anytime you see # in a code box, replace with a or b depending on what slot you want)

- Since the Moto uses a A/B layout it's possible to have two different ROMs installed, but with no decryption it's not possible to share data between them, you have to factory reset every time you want to switch
- I personally like to have slot_a as a stock backup and slot_b set as active for flashing, make sure you flashed the bootloader to slot_b before switching slots

- You can flash or erase a specific slot if desired
Just put the slot after the partition name​
Code:
fastboot erase system_#
Code:
fastboot --disable-verification flash vbmeta_# vbmeta.img

- You can change your current active slot with
Code:
fastboot --set-active=#

- Its helpful to use adb to dd some partitions on stock ROM like system and vendor, to make it easier going back to stock/fixing bricks:

Full Instructions here: https://forum.xda-developers.com/pr...si-porting-tools-android-auto-script-t4089193

- Requires Root

System:
Code:
dd if=/dev/block/mapper/system_# of=/storage/emulated/0/Download/system.img
Vendor:
Code:
dd if=/dev/block/mapper/vendor_# of=/storage/emulated/0/Download/vendor.img
Product:
Code:
dd if=/dev/block/mapper/product_# of=/storage/emulated/0/Download/product.img
VBmeta:
Code:
dd if=/dev/block/by-name/vbmeta_# of=/storage/emulated/0/Download/vbmeta.img
Boot:
Code:
dd if=/dev/block/by-name/boot_# of=/storage/emulated/0/Download/boot.img
 
Last edited:

SnowStruk

Member
Jul 2, 2020
6
4
New Hampshire
Thank you for this guide. I was just able to install Phh's latest AOSP FLOSS (v221) GSI using your guide. Also, my data, SMS, and phone calls all worked. My device is on t-mobile.

The only issue I see so far is that the overlay for the punch hole camera is not correct. The time is currently behind the punch hole camera.
 
  • Like
Reactions: DMedina559
Thank you for this guide. I was just able to install Phh's latest AOSP FLOSS (v221) GSI using your guide. Also, my data, SMS, and phone calls all worked. My device is on t-mobile.

The only issue I see so far is that the overlay for the punch hole camera is not correct. The time is currently behind the punch hole camera.
Hmm I'm on T-Mobile/Metro too. Maybe I was just doing something wrong, glad you found it helpful though! ?
 

SnowStruk

Member
Jul 2, 2020
6
4
New Hampshire
Hmm I'm on T-Mobile/Metro too. Maybe I was just doing something wrong, glad you found it helpful though!

Upon further testing, receiving text messages is not working correctly. I am not receiving new text messages, until a reboot of the device then they all come in at once. Then to receive more text messages I need to do another reboot.

Inbound and outbound calling works. LTE data works as well.
 

mrbubs3

Senior Member
Jan 29, 2011
224
65
New York
Upon further testing, receiving text messages is not working correctly. I am not receiving new text messages, until a reboot of the device then they all come in at once. Then to receive more text messages I need to do another reboot.

Inbound and outbound calling works. LTE data works as well.

Did you capture logs of your SMS app/rcs service?
 

SnowStruk

Member
Jul 2, 2020
6
4
New Hampshire
Did you capture logs of your SMS app/rcs service?

So the issue appears to be more intermittent. It seems if I wait long enough the text messages may come in on their own. I usually have to wait 2-4 hours, however I just did another test this morning where I sent two test text messages, and I received one after about 5 minutes, and it has now been 30+ minutes and I still have not received my second text message.

Here are the logs from the Silence app.

https://1drv.ms/t/s!AjI_xrwAxdGkqOla3nr6b7WvVDqzcg?e=RTSIvw

Right around 9:45 I received one of the two text messages that I sent around 9:40.

Also, here are the adb logs in case they help.

https://1drv.ms/t/s!AjI_xrwAxdGkqOlb6CkRMzgSucZAvg?e=n8Bf5j
 

JimmyJurner

Senior Member
Dec 4, 2016
184
47
OnePlus 9
OnePlus 9 Pro
Every time I try to flash a system omg it fails at the 3rd portion. Am I doing something wrong?
 

Attachments

  • 20200712_192657.jpg
    20200712_192657.jpg
    265.2 KB · Views: 228

JimmyJurner

Senior Member
Dec 4, 2016
184
47
OnePlus 9
OnePlus 9 Pro
Yess you want to use fastbootd

You're using an Android 10 image right? I can't think of anything else unless it's a driver or a fastboot install issue, but I doubt it is

Yes. I've tried almost every one of these. They all work on my other phones but this one keeps getting the same error. I'll try a different computer and let ya know the results.
 

Attachments

  • Screenshot_20200713-092451.jpg
    Screenshot_20200713-092451.jpg
    176.6 KB · Views: 509
Yes in fastbootd.

Did you try running the command to delete the partition? I had to do that step for it to work for me.



so run that 1st?


fastboot delete-logical-partition product_a
fastboot: usage: unknown command delete-logical-partition

Thats whats coming up.
Update your ADB. I just realized minimal adb hasn't been updated since 2018. Use the one I linked in the first post. It's a minimal adb & fastboot directly from google
 
  • Like
Reactions: JimmyJurner

SnowStruk

Member
Jul 2, 2020
6
4
New Hampshire
So the issue appears to be more intermittent. It seems if I wait long enough the text messages may come in on their own. I usually have to wait 2-4 hours, however I just did another test this morning where I sent two test text messages, and I received one after about 5 minutes, and it has now been 30+ minutes and I still have not received my second text message.

Here are the logs from the Silence app.

https://1drv.ms/t/s!AjI_xrwAxdGkqOla3nr6b7WvVDqzcg?e=RTSIvw

Right around 9:45 I received one of the two text messages that I sent around 9:40.

Also, here are the adb logs in case they help.

https://1drv.ms/t/s!AjI_xrwAxdGkqOlb6CkRMzgSucZAvg?e=n8Bf5j

I was able to find a reliable workaround to the SMS issue for now. I went into Settings -> Network & Internet -> Mobile Network and changed my Preferred network type from LTE to 3G and now all my text messages come in right away.

Is anyone else with a GSI having SMS issues? I am wondering if I can change some APN settings to get it work reliably with LTE being the preferred network.
 
  • Like
Reactions: DMedina559

JimmyJurner

Senior Member
Dec 4, 2016
184
47
OnePlus 9
OnePlus 9 Pro
I was able to find a reliable workaround to the SMS issue for now. I went into Settings -> Network & Internet -> Mobile Network and changed my Preferred network type from LTE to 3G and now all my text messages come in right away.

Is anyone else with a GSI having SMS issues? I am wondering if I can change some APN settings to get it work reliably with LTE being the preferred network.
I changed the apn to T-Mobile and was no change. Had to switch to hspa to get it working
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    After a couple weeks of on and off searching the internet, I finally got a couple GSI ROMs from the treble forum to boot up; so I'm posting this guide in hopes it saves somebody else all the searching

    A couple things to note:

    • You and only yourself are doing this at your own risk. Unlocking your bootloader voids warranty
    • Have your stock images ready to flash in case of a brick
    • You must have an unmodified boot.img installed, the Moto REALLY doesn't like clean booting with a modified boot.img. I've tried every combination in magisk when patching a boot.img (keep & remove DM-Verity/Encryption) with no success on Stock and a GSI
    • Most things should work fine, text are reported to not work unless you change your network mode to 3G
    • Android 10 brought two fastboot modes to the game. Bootloader and Fastbootd. Since the Moto uses dynamic partitions we have to use fastbootd for this.
    • The Moto is 64-bit and uses A/B partitions so use arm64 A/B images
    • Lastly, BACK UP YOUR DATA, you will lose your data

    Requirements


    Instructions:


    Boot into fastbootd
    Code:
    adb reboot fastboot
    Install the vbmeta.img
    Code:
    fastboot --disable-verification flash vbmeta vbmeta.img
    Erase the system partition
    Code:
    fastboot erase system
    Install the GSI of your choice
    Code:
    fastboot -w flash system GSI.img


    If you get an error about resizing the partition run this command and try again
    Code:
    fastboot delete-logical-partition product_#

    Replace # with a or b depending on what slot you're flashing to​
    Reboot and finish
    Code:
    fastboot reboot

    You might boot into a screen that says to factory reset, do it and it should boot fine. It might happen another time or two (if it keeps happening, you've bootlooped, flash your stock images)


    Recover/Back to Stock:

    If your device bricked or you just want to go back to 100% stock, you can download the smart recover tool from here:
    https://support.lenovo.com/us/en/downloads/ds101291

    Recover Tool not working?
    You can download the firmware from here:
    Retail:
    https://forum.xda-developers.com/mo...t/stock-rom-motorola-g-stylus-retail-t4104451
    Metro:
    https://forum.xda-developers.com/mo...30-80-64-3-t4138681/post83146807#post83146807

    - Bricked devices are usually recoverable if they can still get into fastboot
    2
    Advanced Tips:
    (Anytime you see # in a code box, replace with a or b depending on what slot you want)

    - Since the Moto uses a A/B layout it's possible to have two different ROMs installed, but with no decryption it's not possible to share data between them, you have to factory reset every time you want to switch
    - I personally like to have slot_a as a stock backup and slot_b set as active for flashing, make sure you flashed the bootloader to slot_b before switching slots

    - You can flash or erase a specific slot if desired
    Just put the slot after the partition name​
    Code:
    fastboot erase system_#
    Code:
    fastboot --disable-verification flash vbmeta_# vbmeta.img

    - You can change your current active slot with
    Code:
    fastboot --set-active=#

    - Its helpful to use adb to dd some partitions on stock ROM like system and vendor, to make it easier going back to stock/fixing bricks:

    Full Instructions here: https://forum.xda-developers.com/pr...si-porting-tools-android-auto-script-t4089193

    - Requires Root

    System:
    Code:
    dd if=/dev/block/mapper/system_# of=/storage/emulated/0/Download/system.img
    Vendor:
    Code:
    dd if=/dev/block/mapper/vendor_# of=/storage/emulated/0/Download/vendor.img
    Product:
    Code:
    dd if=/dev/block/mapper/product_# of=/storage/emulated/0/Download/product.img
    VBmeta:
    Code:
    dd if=/dev/block/by-name/vbmeta_# of=/storage/emulated/0/Download/vbmeta.img
    Boot:
    Code:
    dd if=/dev/block/by-name/boot_# of=/storage/emulated/0/Download/boot.img
    2
    Aren't the gsis prerooted? I didn't test all if them but 3 of them I downloaded phhusson superuser APK and it worked.
    The latest build of linage I tried didn't have root but most should be

    Magisk also has the hide feature which makes it more preferable

    Sent from my Moto G Stylus using XDA Labs
    1
    Thank you for this guide. I was just able to install Phh's latest AOSP FLOSS (v221) GSI using your guide. Also, my data, SMS, and phone calls all worked. My device is on t-mobile.

    The only issue I see so far is that the overlay for the punch hole camera is not correct. The time is currently behind the punch hole camera.
    1
    i have the same issue rebooted into the wrong slot after flashing a new boot image and now my nscreen just stays black i can turn it off and on i know cuz when i do it while plugged into a pc i get the windows sound when you connect a device cant get it into recovery though or fastboot I NEED HELP PLEASE

    I just found a blankflash zip on lolinet.com for sofiar and sofiap. Try that.