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

Part 4​

CustomAP For Mobile​

From A/B Partition TO AB Partition Device​

For Low spec Computer.

1. Must install 2 Ubuntu subsystem , one with WSL1 , the other with WSL2

2. Edit Sub-partition used WSL2 Ubuntu and exit terminal then copy output file to WSL1 Another Ubuntu >> finish making CustomAP with its.

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

what this group schema have told you?​

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Begin​

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

USE " IMJTOOL" with A/B partition device.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

./imjtool super.raw extract

MMapped: 0x7fa605fa0000, imgMeta 0x7fa605fa1000

liblp dynamic partition (super.img) - Blocksize 0x1000, 2 slots

LP MD Header @0x3000, version 10.0, with 4 logical partitions on block device of 5812 GB, at partition super, first sector: 0x800

Partitions @0x3080 in 2 groups:

Group 0: default

Group 1: main

Name: system (read-only, Linux Ext2/3/4/? Filesystem Image, @0x100000 spanning 1 extents of 3 GB) - extracted

Name: product (read-only, Linux Ext2/3/4/? Filesystem Image, @0xe6700000 spanning 1 extents of 1 GB) - extracted

Name: vendor (read-only, Linux Ext2/3/4/? Filesystem Image, @0x12d500000 spanning 1 extents of 685 MB) - extracted

Name: odm (read-only, Linux Ext2/3/4/? Filesystem Image, @0x158300000 spanning 1 extents of 4 MB) - extracted

>>>>>>>>>>>

sudo ./otatools/bin/lpmake --metadata-size 65536 \

--super-name super \

--metadata-slots 2 \

--device super:6094323712 \

--group main:5535145984\

--partition odm:readonly:4349952:main \

--image odm=./odm.img \

--partition system:readonly:3624173568:main \

--image system=./system.img \

--partition vendor:readonly:718503936:main \

--image vendor=./vendor.img \

--partition product:readonly:1188118528:main \

--image product=./product.img \

--sparse \

--output ./super_new.img

>>>>>>>>>>

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

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

odm.img 4349952

product.img 1188118528

vendor.img 718503936

super.raw 6094323712

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

CustomAP​

For Samsung Mobile​

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

USE " LPUNPACK" with AB partition device.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

./imjtool.ELF64 super.img extract

liblp dynamic partition (super.img) - Blocksize 0x1000, 3 slots

LP MD Header @0x3000, version 10.2, with 14 logical partitions on block device of 3584 GB, at partition super, first sector: 0x800

Partitions @0x3100 in 5 groups:

Group 0: default

Group 1: google_system_dynamic_partitions_a

Name: product_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x100000 spanning 1 extents and 290 MB) - extracted

Name: system_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x12400000 spanning 1 extents and 943 MB) - extracted

Name: system_ext_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x4ec00000 spanning 1 extents and 513 MB) - extracted

Group 2: google_system_dynamic_partitions_b

Name: product_b (read-only, empty) - extracted

Name: system_b (read-only, Linux Ext2/3/4/? Filesystem Image, @0x4d400000 spanning 1 extents and 23 MB) - extracted

Name: system_ext_b (read-only, empty) - extracted

Group 3: google_vendor_dynamic_partitions_a

Name: odm_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x6ee00000 spanning 1 extents and 772 KB) - extracted

Name: vendor_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x6ef00000 spanning 1 extents and 310 MB) - extracted

Name: vendor_dlkm_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x82600000 spanning 1 extents and 340 KB) - extracted

Name: odm_dlkm_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x82700000 spanning 1 extents and 340 KB) - extracted

Group 4: google_vendor_dynamic_partitions_b

Name: odm_b (read-only, empty) - extracted

Name: vendor_b (read-only, empty) - extracted

>>>>>>>>>>

# Get the size of all images

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

odm_a.img 790528

odm_b.img 0

odm_dlkm_a.img 348160

odm_dlkm_b.img 0

product_a.img 304930816

product_b.img 0

super.img 7516192768

system_a.img 1018732544

system_b.img 24203264

system_ext_a.img 537972736

system_ext_b.img 0

vendor_a.img 325787648

vendor_b.img 0

vendor_dlkm_a.img 348160

vendor_dlkm_b.img 0

>>>>>>>>>>

./bin/lpmake --metadata-size 65536\

--device-size=4294967296\

--metadata-slots=3\

--group=google_system_dynamic_partitions_a:2222931968\

--partition=odm_a:none:700416:google_system_dynamic_partitions_a\

--partition=product_a:none:266579968:google_system_dynamic_partitions_a\

--partition=system_a:none:1363767296:google_system_dynamic_partitions_a\

--partition=system_ext_a:none:359391232:google_system_dynamic_partitions_a\

--partition=vendor_a:none:232493056:google_system_dynamic_partitions_a\

--image=odm_a=./odm_a.img\

--image=product_a=./product_a.img\

--image=system_a=./system_a.img\

--image=system_ext_a=./system_ext_a.img\

--image=vendor_a=./vendor_a.img\

--group=google_system_dynamic_partitions_b:24563712\

--partition=odm_b:none:0:google_system_dynamic_partitions_b\

--partition=product_b:none:0:google_system_dynamic_partitions_b\

--partition=system_b:none:24563712:google_system_dynamic_partitions_b\

--partition=system_ext_b:none:0:google_system_dynamic_partitions_b\

--partition=vendor_b:none:0:google_system_dynamic_partitions_b\

--image=odm_b=./odm_b.img\

--image=product_b=./product_b.img\

--image=system_b=./system_b.img\

--image=system_ext_b=./system_ext_b.img\

--image=vendor_b=./vendor_b.img\

--sparse \

--output ./super.new.img

>>>>>>>>>>>>

Most information can be obtained from the previous imjtool. Some of the flags to take note of are:

--metadata-slots: same as imjtool’s output

--device-size: for most phones, 4GB should be enough (4*1024^3 = 4294967296 bytes). It’s okay to leave some extras

--group: format of <name>:<size>. The size should be the sum of all sub-partitions under the group

--partition: format of <name>:<attributes>:<size>[:group], attrs must be ’none’ or ‘readonly’.

--image: for each partition, specify a corresponding image file

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

odm_a.img 790528

odm_b.img 0

odm_dlkm_a.img 348160

odm_dlkm_b.img 0

product_a.img 304930816

product_b.img 0

super.img 7516192768

system_a.img 1018732544

system_b.img 24203264

system_ext_a.img 537972736

system_ext_b.img 0

vendor_a.img 325787648

vendor_b.img 0

vendor_dlkm_a.img 348160

vendor_dlkm_b.img 0

./bin/lpmake --metadata-size 65536\
--device-size=4294967296\
--metadata-slots=3\
--group=google_system_dynamic_partitions_a:2222931968\
--partition=odm_a:none:700416:google_system_dynamic_partitions_a\
--partition=product_a:none:266579968:google_system_dynamic_partitions_a\
--partition=system_a:none:1363767296:google_system_dynamic_partitions_a\
--partition=system_ext_a:none:359391232:google_system_dynamic_partitions_a\
--partition=vendor_a:none:232493056:google_system_dynamic_partitions_a\
--image=odm_a=./odm_a.img\
--image=product_a=./product_a.img\
--image=system_a=./system_a.img\
--image=system_ext_a=./system_ext_a.img\
--image=vendor_a=./vendor_a.img\
--group=google_system_dynamic_partitions_b:24563712\
--partition=odm_b:none:0:google_system_dynamic_partitions_b\
--partition=product_b:none:0:google_system_dynamic_partitions_b\
--partition=system_b:none:24563712:google_system_dynamic_partitions_b\
--partition=system_ext_b:none:0:google_system_dynamic_partitions_b\
--partition=vendor_b:none:0:google_system_dynamic_partitions_b\
--image=odm_b=./odm_b.img\
--image=product_b=./product_b.img\
--image=system_b=./system_b.img\
--image=system_ext_b=./system_ext_b.img\
--image=vendor_b=./vendor_b.img\
--sparse \
--output ./super.new.img