[Samsung Galaxy Tab A7 Lite] javadahut:
I recently finished installing a rooted GSI on my T220. I don't post very often so this format is going to be rough. While the steps are still fresh in my mind, I am providing what worked for me in case they can help someone else.

Prereq:

I have already upgraded my T220 to the latest release below, unlocked my bootloader (detailed steps are covered elsewhere in the forum), and installed Magisk.

I used Debian Linux for all steps except ODIN which was Win11. I mention this because I tried a couple steps below on my Windows box and they failed.

Both lz4 & simg2img can be installed using apt on debian.

Step 1:

Download latest Samsung release using Bifrost (https://github.com/zacharee/SamloaderKotlin):

PDA/CSC/CP/AP

T220XXS2CWA6/T220OXM2CWA6/T220XXS2CWA6/T220XXS2CWA6

Android 13

Security: 2023-01-01

Release: 2023-02-17

Step 2:

Extract AP file from downloaded zip.

Step 3:

Copy AP_T220XXS2CWA6_T220XXS2CWA6_MQB61601712_REV00_user_low_ship_MULTI_CERT_meta_RKEY_OS13.tar file to T220 and patch tar file using Magisk.

Magisk patches boot.img & vbmeta.img and spits out another tar file: magisk_patched-25200_XXXXX.tar. Copy this back to your linux machine.

Step 4:

Extract the super.img.lz4 file from the magisk_patched-25200_XXXXX.tar and decompress it:

tar -xvf magisk_patched-25200_rOeaE.tar
lz4 -d super.img.lz4 super.img

Step 5:

Convert Android sparse images to raw images & extract the image files from super.img:

lpunpack as referenced in multiple other posts didn't work for me. After some searching, I came across this post: https://xdaforums.com/t/customap-2022.4473159/#post-87204333 which talks about an alternative tool to extract called imjtool.

I dl'd imjtool from http://newandroidbook.com/tools/imjtool.tgz as indicated in the post.

Save the super.raw file, we're going to need it again later.

sudo simg2img super.img super.raw
imjtool.ELF64 super.raw extract

The extraction gave me four image files in an extracted directory:

odm.img

product.img

system.img

vendor.img

Go ahead and delete the system.img, we're going to replace it.

Step 6:

Download your GSI file and extract system.img

I used Google's, but there are others:

There's a GSI list here for other options:

Generic System Image (GSI) list

Notes about tinkering with Android Project Treble. Contribute to phhusson/treble_experimentations development by creating an account on GitHub.

github.com

Generic System Image releases | Platform | Android Developers

developer.android.com

Android 13 QPR2 (Beta)

Date: February 1, 2023

Build: T2B3.230109.002

Build type: experimental

Security patch level: January 2023

Google Play Services: 22.46.17

ARM64 aosp_arm64-exp-T2B3.230109.002-9523436-98a648ca.zip

Extract system.img from the dl'd zip and copy system.img into the extracted directory with all the other images (step 5)

Steps 7 & 8 are from another post in the forum: https://xdaforums.com/t/guide-t220-t225-flash-a-gsi-on-the-a7-lite-without-twrp.4456821/

Step 7:

Get the size of all partitions and the size of the original super.raw

stat -c '%n %s' *.img

odm.img 4349952
product.img 1234505728
system.img 1890627584
vendor.img 640036864

stat -c '%n %s' ../super.raw
../super.raw 6023020544

8. Repack super.img (this step is a copy/paste from https://xdaforums.com/t/guide-t220-t225-flash-a-gsi-on-the-a7-lite-without-twrp.4456821/)

Code:

lpmake --metadata-size 65536 \

--super-name super \

--metadata-slots 2 \

--device super:ORIGINAL_SUPER_IMG_SIZE \

--group main:SUM_OF_ALL_PARTITIONS_SIZES \

--partition odm:readonly:ODM_PARTITION_SIZE:main \

--image odm=./odm.img \

--partition product:readonly:PRODUCT_PARTITION_SIZE:main \

--image product=./product.img \

--partition system:readonly:SYSTEM_PARTITION_SIZE:main \

--image system=./system.img \

--partition vendor:readonly:VENDOR_PARTITION_SIZE:main \

--image vendor=./vendor.img \

--sparse \

--output ./super_new.img

Replace ORIGINAL_SUPER_IMG_SIZE, SUM_OF_ALL_PARTITIONS_SIZES, ODM_PARTITION_SIZE, PRODUCT_PARTITION_SIZE, SYSTEM_PARTITION_SIZE, VENDOR_PARTITION_SIZE with the values you obtained in step 7.

Read lpmake docs for a more detailed expalation of the args used above:

partition_tools - platform/system/extras - Git at Google

My actual command:

sudo ../otatools/bin/lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:6023020544 --group main:3769520128 --partition odm:readonly:4349952:main --image odm=./odm.img --partition product:readonly:1234505728:main --image product=./product.img --partition system:readonly:1890627584:main --image system=./system.img --partition vendor:readonly:640036864:main --image vendor=./vendor.img --sparse --output ./super_new.img

Step 9:

Compress super_new.img and rename:

lz4 -B6 --content-size super_new.img super.img.lz4

Step 10:

Replace the super.img.lz4 in the magisk_patched-25200_rOeaE.tar file and copy to the Win11 ODIN box.

Step 11:

Put your T220 into Download Mode

Flash the updated GSI_magisk_patched-25200_rOeaE.tar that contains the new super.img.lz4 file in the AP slot using ODIN.

A couple of notes:

I did get a warning in DL Mode while flashing, but it hasn't seem to impact anything so far.

sw rev check fail super fused 2 > binary 0

I had to do a factory reset on my first boot.

Hope this helps someone.