[Samsung Galaxy Tab A7 Lite] tom.android:
Part 1​

​

:Step by Step: ​

Create CustomAP framework file For ​

GSI Flashing with Odin.​

by tom.android

Modified from @abg95a

Flash a GSI on the A7 Lite (without TWRP)
​

Update for add loop device in WSL2​

( **will slow-down Win10 )​

[ not recommend if you don't want to modified your system.img ]

>> Check WSL version.​

Open CMD with Administrator

C:\Windows\System32>

wsl --list --verbose

NAME STATE VERSION

Ubuntu-20.04 Stopped 1

----> you are on wsl1

>>> Howto update it to WSL2 if you have installed Ubuntu ?​

C:\Windows\System32>

wsl --set-version Ubuntu-20.04 2

Conversion in progress, this may take a few minutes...

For information on key differences with WSL 2 please visit https://aka.ms/wsl2

Conversion complete.

test after converted .

C:\Windows\System32>

wsl --list --verbose

NAME STATE VERSION

Ubuntu-20.04 Stopped 2

----> Now you are on wsl2

====End Update WSL1 with WSL2 ====​

✓ LINUX Installation​

Ubuntu Subsystem 20.04.5 LTS​

OPEN microsoft store , Select Ubuntu version and click install.

After

Find Where to Stored installation Files.

here: (open windows show hidden file)

FOR WSL1

\Users\username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04LTS_\LocalState

For WSL2 >>>you can access to home directory from windows (Windows 10 build 18342) like this :

\\wsl$

## make a shotcut to desktop (for easy copy and paste , sharing files between WIN and LINUX)

Resources: https://askubuntu.com/questions/759...t-directory-in-windows-subsystem-for-linux-an

====================================

New fresh install with WSL2 >​

Ubuntu 20.04.5 LTS​

>> How?​

Before:

Check win10 with WSL1 or not

C:\Windows\System32>wsl --list --verbose

NAME STATE VERSION

Ubuntu-20.04 Stopped 1

----> you are on wsl1

Howto update to be "WSL2"

1.open windows10 update

setting--windows update---Advanced option = open receive update

After Download Update from Microsoft.

2. open windows system---command promp--Administrator mode

cmd> wsl --update

output

Checking for updates...

No updates are available.

Kernel version: 5.10.102.1 <----wsl2

3. RUN in CMD

wsl --set-default-version 2

Then install Ubuntu.

View attachment 5734295

Test: loop device.

Open Ubnutu terminal

cd /dev

ls -l | grep -v tty

Spoiler content hidden.

(you will saw loop command.)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>​

GET START​

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>​

✓ Get " super.img" from inside Stock AP File​

by Extract (super.img.lz4) file by Windows or Linux.​

For Windows​

Download lz4 for win and extract into C:\AnyName

from https://github.com/lz4/lz4/releases

1) extract "super.img.lz4" from Stock AP Firmware file with 7zip, into lz4 folder.<AnyName>

View attachment 5713663

2) go into folder lz4_win64_v1_9_4 and run CMD

Spoiler content hidden.

lz4 -d super.img.lz4 super.img

copy output " super.img" to uses with Ubuntu at /home/username/

>>>>>>>>>>>>≥>>>>>>>>>>>>>>>>>>>>>>

For Linux:​

✓ launch Ubuntu terminal( console) from Start menu

2.1) Option We can uses LZ4 from linux, process same as (Step 1-2 for wins)

Ubuntu

you can install LZ4 from Ubuntu Console with

sudo apt update

sudo apt-get -y install lz4

or

sudo apt install liblz4-tool

note

lz4 [option] input output

lz4 -d (d= decompress)

lz4 -dc ( c=concatenate )

2.2) Option Extract "super.img.lz4" from Stock AP framework file.

and paste it to /home/username/

2.3)

sudo lz4 -d super.img.lz4 super.img

Spoiler content hidden.

2.4)COMPARE with using "lz4" between Ubuntu and Windows

View attachment 5713679

​

CONCLUSION of Beginning step.​

WE CAN GETS " SUPER.IMG" FROM TWO WAYS , WINDOWS OR LINUX.

( windows from step 1-2 ) or. ( Linux from step 2.1 -2.3)

***We will use 'super.img' to begin our modification.​

​

✓ unpacking super.img​

3.) Turn sparse format To RAW​

Ubuntu

**First of all the super.img file might be in sparse format so we need to make it raw image. By Using "SIMG2IMG"

sudo apt-get update
sudo apt-get install simg2img

Spoiler content hidden.

After install execute this command.

sudo simg2img super.img super.raw

Spoiler content hidden.

✓Extract subpartition out from "SUPER.RAW"​

4) Tool for extract partition. ( very important tool for show "group schema" which used to specific parameter option for lpmake.)

4.1) Download imjtool

http://newandroidbook.com/tools/imjtool.tgz

or download from attach file belows this tutorial (imjtool.zip)

4.2) extract "imjtool" from archive imjtool.tgz to /home/username/

*note for short i renamed it to 'imjtool'

4.3) then give it permission with command

chmod +x imjtool

View attachment 5727517

5) Extract sub partition within our "SUPER.RAW"

By execute this command

./imjtool super.raw extract

It will extract sub-partitions (4 img files ) in the folder "/home/user/extracted"

- system.img

- vendor.img

- product.img

- odm.img

Spoiler content hidden.

✓ Modify Stock "system.img" by Changes with GSI-"system.img"​

6) Choose your favorite GSI. ( Recommend PHH Treble- GSI )

Download from :-

https://github.com/phhusson/treble_experimentations/wiki/Generic-System-Image-(GSI)-list

6.1) Extract Downloaded archive & Replace "system.img" with your GSI img

(rename it to system.img over-written the old file.)

Spoiler content hidden.

6.2 )

Move all img files (6.1)

from /home/username/extracted folder into /home/username/

7.) Get each partitions file size.

we can do it by:

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

:- do it for all partitions files.

7.1

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

Exam output---system.img 308 951 4496

7.2

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

Exam ouputt----vendor.img 718 503 936

7.3

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

Exam output----product.img 118 811 8528

7.4

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

Exam output----odm.img 434 9952

7.5 ***size of the "original super.raw"

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

Exam output----super.raw 609 432 3712

Spoiler content hidden.

✓ Repacked modified sub-partition back​

8) Repacked new super.img.

8.1 fill in "img partition size" formular (parameter) to your prepared command below

explanation:

Spoiler content hidden.

explanation:

Prepared command "LPMAKE" parameter

sudo ./otatools/bin/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

Note:

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.

====================

8.2

Download & extract : OTATOOLS to /home/username/

here:

Google Drive - Virus scan warning

drive.google.com

**We only want to use "lpmake" from its.

*** If you have a problem when used command " sudo ./otatools/bin/lpmake --metadata-size 65536 \ bra bra bra

Error message: Command not found.

Do this...

chmod +x otatools/bin/lpmake

or

chmod -R +x otatools

> exit terminal and Login Back again

Spoiler content hidden.

8.3) execute prepared formular (8.1) with this command

Note: Numeric are my Example only.

1. Fix partition size ( odm + product + vendor )

434 9952 + 118 811 8528 + 718 503 936 = 1,910,972,416 + (new system.img )= Sum of all 4 partition.

2. Fix All partition ( super.raw) = 609 432 3712

***DO NOT COPY!!***

explanation:

sudo ./otatools/bin/lpmake --metadata-size 65536 \
--super-name super \
--metadata-slots 2 \
--device super:6094323712 \
--group main:5000486912\
--partition odm:readonly:4349952:main \
--image odm=./odm.img \
--partition product:readonly:1188118528:main \
--image product=./product.img \
--partition system:readonly:3864137728:main \
--image system=./system.img \
--partition vendor:readonly:718503936:main \
--image vendor=./vendor.img \
--sparse \
--output ./super_new.img

Spoiler content hidden.

✓Compress repacked modified new super.img​

9) Compress the repacked super_new.img

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

10). Compress the clean vmbeta.img

Download Clean vbmeta.img from Google

https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img

lz4 -B6 --content-size vbmeta.img vbmeta.img.lz4

Win10

(From Attachment download.)

11). Down& Extract "tar-md5-script-tool.zip" to C;\

11.1 extract all *.img.lz4 files (from AP Stock) to. C:/ tar-md5-script-tool folder

12) Replace

super.img.lz4 and

vbmeta.img.lz4

|

in tar-md5-script-tool dir

|

with your repacked and compressed

super_new.img.lz4 (rename it to super.img.lz4)--->output from step 9

and the clean compressed

vbmeta.img.lz4. ------> output from step 10

Spoiler content hidden.

13) Run Win Batch File For Packing Custom AP file (tar.md5) for Odin

Run batch.bat in tar-md5-script-tool folder

[You will find the " AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5"

in the temp-folder subdir]

***Don't Rename​

View attachment 5709033

14) Final Flashing with ODin

...14.1) Device must installed Stock Firmware. (No root)

* No bad critical conditions happened when you are on STOCK ROM.

... 14.2) OEM Unlock [Developer options] must gray out but

. enable on position.

... 14.3) KG State Must be "Checking state" status.

( if kg state = Broken ) = you must have goto flash Pure stock firmware

again and this time uses ONLY "CSC" factory reset

. *NO used Home_CSC

After finished odin fashing must connected internet, check "kg status"

again )

...14.4) Flashing all files at once, don't ignored any slot.( AP+BL+CP+CSC)

except USERDATA

(Odin will shrink non-slot data size automatically)

...14.5) After Device reboot

(1st) show android robot - remove old system

(2nd) Due to new vbmeta.img has changed from stock , tab will reboot to

Recovery menu , you must select its factory reset menu manually.

...14.6) Click Magisk icon app to update

" Upgrade to full Magisk to finish the setup. Download and install"OK

- Magisk app will not reboot but update itself. But if you open app

again it will asked to reboot for addition upgrade.

View attachment 5713979

>AP SLOT : AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5

>BL Slot : BL Stock.md5

>CP SLOT: CP Stock.md5

>CSC Slot: CSC Stock.md5 ------> (Don't uses HOME_CSC)

>USERDATA Slot: magisk_boot_vbmeta_patch.tar

✓ How to create Magisk patch for boot.img + vbmeta.img

extract (vbmeta.img.lz4 + boot.img.lz4) from your AP Stock

create compress one file xxx .tar with 7zip

move (vbmeta.img.lz4 + boot.img.lz4).tar (xxx.tar) to tab a7 lite

install magisk.apk on you tab a7 lite

patch the tar file. (with magisk manager)

result magisk-patch file at Tab a7 :-Download folder.

Recommend: Default R/W GSI " by Nazim"​

My Examples

https://xdaforums.com/t/6-prerequisites-for-tab-a7-lite-gsi-installation.4503647/#post-87550627

If you can't booted "VNDK Lite" variant but want to uses mount Read/Write .

Part3 -Create CustomAP Tutorial.

https://xdaforums.com/t/part3-custo...ead-only-to-read-write.4523089/#post-87775999