Skip to content

Instantly share code, notes, and snippets.

@surfaceflinger
Last active December 20, 2023 04:13
Show Gist options
  • Save surfaceflinger/20457f21929a9345b84c3f663f3dbf4f to your computer and use it in GitHub Desktop.
Save surfaceflinger/20457f21929a9345b84c3f663f3dbf4f to your computer and use it in GitHub Desktop.
Update firmware and install/update GSI on motorola moto g60 (hanoip)
  1. First, download latest stock firmware from lolinet. You probably want those which names begin with RET but tbh I don't know what the difference is between them. Personally, I used RETEU because that's what I had from factory.
  2. Download latest "Light" variant of LineageOS 20 GSI. You can find everything here. "Light" variant has limited compatibility with legacy devices, but it works PERFECTLY on hanoip.
  3. Unpack stock firmware into stock directory.
  4. Unpack GSI into gsi directory and rename it to system.img.
  5. Make sure that you have files structure like this:
nat@blahaj [~/Downloads] ✨ tree
.
├── gsi-update.sh
├── gsi
│   └── system.img
├── stock
│   ├── boot.img
│   ├── bootloader.img
│   ├── BTFM.bin
│   ├── dspso.bin
│   ├── dtbo.img
│   ├── flashfile.xml
│   ├── gpt.bin
│   ├── HANOIP_RETAIL_S2RIS32.32-20-7-5_subsidy-DEFAULT_regulatory-XT2135-2-EUROPE_CFC.info.txt
│   ├── logo.bin
│   ├── radio.img
│   ├── regulatory_info_xt2135_2_europe.png
│   ├── servicefile.xml
│   ├── slcf_rev_d_default_v1.0.nvm
│   ├── super.img_sparsechunk.0
│   ├── super.img_sparsechunk.1
│   ├── super.img_sparsechunk.10
│   ├── super.img_sparsechunk.2
│   ├── super.img_sparsechunk.3
│   ├── super.img_sparsechunk.4
│   ├── super.img_sparsechunk.5
│   ├── super.img_sparsechunk.6
│   ├── super.img_sparsechunk.7
│   ├── super.img_sparsechunk.8
│   ├── super.img_sparsechunk.9
│   ├── vbmeta.img
│   ├── vbmeta_system.img
│   └── vendor_boot.img
  1. In your "work" directory place this script:
#!/usr/bin/env bash
fastboot oem fb_mode_set

base() {
 fastboot set_active $1
 fastboot flash partition gpt.bin
 fastboot flash bootloader bootloader.img
 fastboot flash radio radio.img
}

pushd stock
 base a
 base b

 fastboot --slot=all --disable-verification flash vbmeta vbmeta.img
 fastboot --slot=all flash vbmeta_system vbmeta_system.img
 fastboot --slot=all flash bluetooth BTFM.bin
 fastboot --slot=all flash dsp dspso.bin
 fastboot --slot=all flash logo logo.bin
 fastboot --slot=all flash boot boot.img
 fastboot --slot=all flash vendor_boot vendor_boot.img
 fastboot --slot=all flash dtbo dtbo.img
 fastboot flash super super.img_sparsechunk.0
 fastboot flash super super.img_sparsechunk.1
 fastboot flash super super.img_sparsechunk.2
 fastboot flash super super.img_sparsechunk.3
 fastboot flash super super.img_sparsechunk.4
 fastboot flash super super.img_sparsechunk.5
 fastboot flash super super.img_sparsechunk.6
 fastboot flash super super.img_sparsechunk.7
 fastboot flash super super.img_sparsechunk.8
 fastboot flash super super.img_sparsechunk.9
 fastboot flash super super.img_sparsechunk.10
popd

fastboot set_active a

fastboot reboot fastboot
fastboot delete-logical-partition product_a
fastboot flash system gsi/system.img
fastboot oem fb_mode_clear

chmod +x it and run it!

  1. Once it finishes, you're basically done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment