Browse Categories All Posts
Categories
K
Kai
Post Timeline
This PC
Timeline
Recycle Bin
make system rw android

make system rw android

 if system.img is sparse first unsparse it


file system.img
system.img: Android sparse image, version: 1.0, Total of 460079 4096-byte output blocks in 36 input chunks.


simg2img system.img system.raw.img



# e2fsck -f system.raw.img


resize2fs system.raw.img 5G


e2fsck -E unshare_blocks system.raw.img


resize2fs -M system.raw.img


e2fsck -f -y system.raw.img


info compare

fdisk -l system.img
Disk system.img: 1.72 GiB, 1850331136 bytes, 3613928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

sudo fdisk -l system.raw.img
Disk system.raw.img: 1.76 GiB, 1884483584 bytes, 3680632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

fdisk -l  system.raw.img
Disk system.raw.img: 2.36 GiB, 2532089856 bytes, 4945488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

file system.raw.img
system.raw.img: Linux rev 1.0 ext2 filesystem data, UUID=6958ae8c-fe6c-48cd-9c84-0150f384ce2d (extents) (large files) (huge files)


resizing dynamic partition

needs fastbootd mode

fastboot reboot fastboot


FYLFUC5HCUNVKRLB fastboot usb:1-3
C:/home/k/opt/platform-tools> ./fastboot getvar all
(bootloader) cpu-abi:arm64-v8a
(bootloader) super-partition-name:super
(bootloader) is-logical:ocdt:no
(bootloader) is-logical:mmcblk0boot1:no
(bootloader) is-logical:cache:no
(bootloader) is-logical:tee2:no
(bootloader) is-logical:opporeserve3:no
(bootloader) is-logical:nvdata:no
(bootloader) is-logical:sspm_1:no
(bootloader) is-logical:expdb:no
(bootloader) is-logical:lk:no
(bootloader) is-logical:special_preload:no
(bootloader) is-logical:my_custom:no
(bootloader) is-logical:persist:no
(bootloader) is-logical:scp2:no
(bootloader) is-logical:md_udc:no
(bootloader) is-logical:protect1:no
(bootloader) is-logical:opporeserve1:no
(bootloader) is-logical:tee1:no
(bootloader) is-logical:scp1:no
(bootloader) is-logical:flashinfo:no
(bootloader) is-logical:lk2:no
(bootloader) is-logical:gz1:no
(bootloader) is-logical:logo:no
(bootloader) is-logical:seccfg:no
(bootloader) is-logical:nvram:no
(bootloader) is-logical:recovery:no
(bootloader) is-logical:frp:no
(bootloader) is-logical:spmfw:no
(bootloader) is-logical:boot_para:no
(bootloader) is-logical:cdt_engineering:no
(bootloader) is-logical:otp:no
(bootloader) is-logical:vbmeta:no
(bootloader) is-logical:protect2:no
(bootloader) is-logical:userdata:no
(bootloader) is-logical:proinfo:no
(bootloader) is-logical:para:no
(bootloader) is-logical:opporeserve2:no
(bootloader) is-logical:gz2:no
(bootloader) is-logical:oppo_custom:no
(bootloader) is-logical:metadata:no
(bootloader) is-logical:boot:no
(bootloader) is-logical:mmcblk0boot0:no
(bootloader) is-logical:vbmeta_vendor:no
(bootloader) is-logical:nvcfg:no
(bootloader) is-logical:md1img:no
(bootloader) is-logical:sspm_2:no
(bootloader) is-logical:dtbo:no
(bootloader) is-logical:sec1:no
(bootloader) is-logical:mmcblk0:no
(bootloader) is-logical:super:no
(bootloader) is-logical:vbmeta_system:no
(bootloader) is-logical:vendor:yes
(bootloader) is-logical:system:yes
(bootloader) is-logical:product:yes
(bootloader) is-logical:odm:yes
(bootloader) is-logical:my_product:yes
(bootloader) is-logical:my_engineering:yes
(bootloader) is-logical:my_stock:yes
(bootloader) is-logical:my_heytap:yes
(bootloader) is-logical:my_company:yes
(bootloader) is-logical:my_carrier:yes
(bootloader) is-logical:my_region:yes
(bootloader) is-logical:my_preload:yes
(bootloader) is-logical:my_manifest:yes
(bootloader) is-logical:scratch:yes
(bootloader) battery-voltage:4
(bootloader) treble-enabled:true
(bootloader) is-userspace:yes
(bootloader) partition-size:ocdt:0x800000
(bootloader) partition-size:mmcblk0boot1:0x400000
(bootloader) partition-size:cache:0x1B000000
(bootloader) partition-size:tee2:0x500000
(bootloader) partition-size:opporeserve3:0x4000000
(bootloader) partition-size:nvdata:0x4000000
(bootloader) partition-size:sspm_1:0x100000
(bootloader) partition-size:expdb:0x1400000
(bootloader) partition-size:lk:0x400000
(bootloader) partition-size:special_preload:0x30000000
(bootloader) partition-size:my_custom:0x10000000
(bootloader) partition-size:scp2:0x100000
(bootloader) partition-size:md_udc:0x169A000
(bootloader) partition-size:protect1:0x800000
(bootloader) partition-size:opporeserve1:0x800000
(bootloader) partition-size:tee1:0x500000
(bootloader) partition-size:scp1:0x100000
(bootloader) partition-size:flashinfo:0x1000000
(bootloader) partition-size:lk2:0x400000
(bootloader) partition-size:gz1:0x1000000
(bootloader) partition-size:logo:0x800000
(bootloader) partition-size:seccfg:0x800000
(bootloader) partition-size:nvram:0x4000000
(bootloader) partition-size:recovery:0x6200000
(bootloader) partition-size:frp:0x100000
(bootloader) partition-size:spmfw:0x100000
(bootloader) partition-size:boot_para:0x100000
(bootloader) partition-size:cdt_engineering:0x800000
(bootloader) partition-size:otp:0x2B00000
(bootloader) partition-size:vbmeta:0xC00000
(bootloader) partition-size:protect2:0xFDE000
(bootloader) partition-size:userdata:0xC45CFBE00
(bootloader) partition-size:proinfo:0x300000
(bootloader) partition-size:para:0x80000
(bootloader) partition-size:opporeserve2:0x8000000
(bootloader) partition-size:gz2:0x1000000
(bootloader) partition-size:oppo_custom:0x100000
(bootloader) partition-size:metadata:0x2000000
(bootloader) partition-size:boot:0x2000000
(bootloader) partition-size:mmcblk0boot0:0x400000
(bootloader) partition-size:vbmeta_vendor:0x800000
(bootloader) partition-size:nvcfg:0x2000000
(bootloader) partition-size:md1img:0x6400000
(bootloader) partition-size:sspm_2:0x100000
(bootloader) partition-size:dtbo:0x800000
(bootloader) partition-size:sec1:0x200000
(bootloader) partition-size:super:0x1B4C00000
(bootloader) partition-size:vbmeta_system:0x800000
(bootloader) partition-size:vendor:0x20E24000
(bootloader) partition-size:system:0x96ECA000
(bootloader) partition-size:product:0x20A000
(bootloader) partition-size:odm:0x7BCA000
(bootloader) partition-size:my_product:0x18EF000
(bootloader) partition-size:my_engineering:0x52000
(bootloader) partition-size:my_stock:0x2C5B3000
(bootloader) partition-size:my_heytap:0x486D9000
(bootloader) partition-size:my_company:0x55000
(bootloader) partition-size:my_carrier:0x55000
(bootloader) partition-size:my_region:0x55000
(bootloader) partition-size:my_preload:0x55000
(bootloader) partition-size:my_manifest:0x0
(bootloader) partition-size:scratch:0x5295C000
(bootloader) version-vndk:30
(bootloader) has-slot:ocdt:no
(bootloader) has-slot:mmcblk0boot1:no
(bootloader) has-slot:cache:no
(bootloader) has-slot:tee2:no
(bootloader) has-slot:opporeserve3:no
(bootloader) has-slot:nvdata:no
(bootloader) has-slot:sspm_1:no
(bootloader) has-slot:expdb:no
(bootloader) has-slot:lk:no
(bootloader) has-slot:special_preload:no
(bootloader) has-slot:my_custom:no
(bootloader) has-slot:persist:no
(bootloader) has-slot:scp2:no
(bootloader) has-slot:md_udc:no
(bootloader) has-slot:protect1:no
(bootloader) has-slot:opporeserve1:no
(bootloader) has-slot:tee1:no
(bootloader) has-slot:scp1:no
(bootloader) has-slot:flashinfo:no
(bootloader) has-slot:lk2:no
(bootloader) has-slot:gz1:no
(bootloader) has-slot:logo:no
(bootloader) has-slot:seccfg:no
(bootloader) has-slot:nvram:no
(bootloader) has-slot:recovery:no
(bootloader) has-slot:frp:no
(bootloader) has-slot:spmfw:no
(bootloader) has-slot:boot_para:no
(bootloader) has-slot:cdt_engineering:no
(bootloader) has-slot:otp:no
(bootloader) has-slot:vbmeta:no
(bootloader) has-slot:protect2:no
(bootloader) has-slot:userdata:no
(bootloader) has-slot:proinfo:no
(bootloader) has-slot:para:no
(bootloader) has-slot:opporeserve2:no
(bootloader) has-slot:gz2:no
(bootloader) has-slot:oppo_custom:no
(bootloader) has-slot:metadata:no
(bootloader) has-slot:boot:no
(bootloader) has-slot:mmcblk0boot0:no
(bootloader) has-slot:vbmeta_vendor:no
(bootloader) has-slot:nvcfg:no
(bootloader) has-slot:md1img:no
(bootloader) has-slot:sspm_2:no
(bootloader) has-slot:dtbo:no
(bootloader) has-slot:sec1:no
(bootloader) has-slot:mmcblk0:no
(bootloader) has-slot:super:no
(bootloader) has-slot:vbmeta_system:no
(bootloader) has-slot:vendor:no
(bootloader) has-slot:system:no
(bootloader) has-slot:product:no
(bootloader) has-slot:odm:no
(bootloader) has-slot:my_product:no
(bootloader) has-slot:my_engineering:no
(bootloader) has-slot:my_stock:no
(bootloader) has-slot:my_heytap:no
(bootloader) has-slot:my_company:no
(bootloader) has-slot:my_carrier:no
(bootloader) has-slot:my_region:no
(bootloader) has-slot:my_preload:no
(bootloader) has-slot:my_manifest:no
(bootloader) has-slot:scratch:no
(bootloader) security-patch-level:2099-12-31
(bootloader) vendor-fingerprint:realme/twrp_RMX2185/RMX2185:99.87.36/RQ1A.210205.004/root10031738:eng/test-keys
(bootloader) hw-revision:0
(bootloader) current-slot:
(bootloader) serialno:FYLFUC5HCUNVKRLB
(bootloader) product:RMX2185
(bootloader) version-os:99.87.36
(bootloader) first-api-level:29
(bootloader) slot-count:0
(bootloader) max-download-size:0x10000000
(bootloader) version:0.4
(bootloader) version-baseband:
(bootloader) secure:no
(bootloader) dynamic-partition:true
(bootloader) system-fingerprint:realme/twrp_RMX2185/RMX2185:99.87.36/RQ1A.210205.004/root10031738:eng/test-keys
(bootloader) version-bootloader:unknown
(bootloader) unlocked:yes
all:

make sure  fastboot  getvar is-userspace is yes

fastboot getvar partition-size:system


(bootloader) partition-size:super:0x1B4C00000 = 7,361,249,280 bytes (~6.85 GiB)

super partition is 6.85 gb


system0x96ECA0002,536,841,216~2420 MB
scratch0x5295C0001,389,949,952~1326 MB
my_heytap0x486D90001,221,317,376~1165 MB
my_stock0x2C5B3000748,822,400~715 MB
vendor0x20E24000551,618,560~526 MB



fastboot resize-logical-partition my_heytap 0

fastboot resize-logical-partition my_stock 0


fastboot resize-logical-partition system 3221225472



fastboot flash system system.raw.img


-------------


df  -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/block/dm-1       2.9G  2.3G  657M  79% /
tmpfs                 1.8G  2.0M  1.8G   1% /dev
tmpfs                 1.8G     0  1.8G   0% /mnt
/dev/block/dm-4        25M   25M   76K 100% /mnt/vendor/my_product
/dev/block/dm-5       232K   52K  180K  23% /mnt/vendor/my_engineering
/dev/block/dm-6       236K   32K  204K  14% /mnt/vendor/my_company
/dev/block/dm-7       232K   52K  180K  23% /mnt/vendor/my_carrier
/dev/block/dm-8       236K   32K  204K  14% /mnt/vendor/my_region
/dev/block/dm-9       236K   32K  204K  14% /mnt/vendor/my_preload
/dev/block/mmcblk0p5   59M  196K   59M   1% /mnt/vendor/opporeserve
/dev/block/dm-10      1.2G   56K  1.2G   1% /mnt/scratch
/dev/block/mmcblk0p14  18M  196K   18M   2% /metadata
overlay               1.2G   56K  1.2G   1% /vendor
/dev/block/dm-3       123M  122M  400K 100% /odm
tmpfs                 1.8G     0  1.8G   0% /apex
tmpfs                 1.8G  216K  1.8G   1% /linkerconfig
/dev/block/mmcblk0p44 402M   52K  402M   1% /cache
/dev/block/mmcblk0p16 3.7M  116K  3.6M   4% /mnt/vendor/protect_f
/dev/block/mmcblk0p17  11M   44K   11M   1% /mnt/vendor/protect_s
/dev/block/mmcblk0p13  52M  1.4M   51M   3% /mnt/vendor/nvdata
/dev/block/mmcblk0p12  24M   44K   24M   1% /mnt/vendor/nvcfg
/dev/block/mmcblk0p19  42M  144K   42M   1% /mnt/vendor/persist
none                  1.8G   12M  1.8G   1% /mnt/phh
/dev/block/mmcblk0p45  48G   55M   48G   1% /data
/dev/block/loop6      4.5M  4.5M   28K 100% /apex/com.android.media@300000000
/dev/block/loop7      128M  125M  3.5M  98% /apex/com.android.vndk.v30@1
tmpfs                 1.8G     0  1.8G   0% /data_mirror
/dev/block/loop8      2.3M  2.3M   32K  99% /apex/com.android.resolv@300000000
/dev/block/loop9      5.5M  5.5M   28K 100% /apex/com.android.neuralnetworks@300000000
/dev/block/loop10     5.0M  4.9M   36K 100% /apex/com.android.runtime@1
/dev/block/loop11     8.6M  8.6M   28K 100% /apex/com.android.permission@300000000
/dev/block/loop12     1.6M  1.6M   28K  99% /apex/com.android.os.statsd@300000000
/dev/block/loop13     3.8M  3.8M   28K 100% /apex/com.android.extservices@300000000
/dev/block/loop14     524K  496K   28K  95% /apex/com.android.ipsec@300000000
/dev/block/loop15     232K   92K  140K  40% /apex/com.android.apex.cts.shim@1
/dev/block/loop16     6.3M  6.3M   32K 100% /apex/com.android.cellbroadcast@300000000
/dev/block/loop17     7.5M  7.5M   28K 100% /apex/com.android.adbd@300000000
/dev/block/loop18     4.7M  4.7M   28K 100% /apex/com.android.wifi@300000000
/dev/block/loop19      82M   82M   32K 100% /apex/com.android.art@1
/dev/block/loop20     876K  848K   28K  97% /apex/com.android.tethering@300000000
/dev/block/loop21     808K  780K   28K  97% /apex/com.android.tzdata@300000000
/dev/block/loop22      18M   18M   28K 100% /apex/com.android.media.swcodec@300000000
/dev/block/loop23     3.8M  3.8M   28K 100% /apex/com.android.mediaprovider@300000000
/dev/block/loop24     4.6M  4.5M   28K 100% /apex/com.android.conscrypt@300000000
/dev/block/loop25     336K  304K   32K  91% /apex/com.android.sdkext@300000000
/dev/block/loop26      24M   24M   32K 100% /apex/com.android.i18n@1
/dev/block/loop27      89M   89M   32K 100% /apex/com.android.vndk.v27@1
/dev/block/loop28      89M   89M   44K 100% /apex/com.android.vndk.v28@1
/dev/block/loop29      98M   98M   32K 100% /apex/com.android.vndk.v29@1
/data/media            48G   55M   48G   1% /mnt/runtime/default/emulated
/dev/fuse              48G   55M   48G   1% /storage/emulated



git clone --depth=1 https://github.com/unix3dgforce/lpunpack

cd lpunpack

 

usage: lpunpack.py [-h] [-p NAME] [-S NUM] SUPER_IMAGE OUTPUT_DIR
 	-h, --help show this help message and exit  
-p NAME, --partition NAME Extract the named partition. This can be specified multiple times or through the delimiter ["," ":"]
-S NUM, --slot NUM !!! No implementation yet !!! Slot number (default is 0).
--info, --no-info Displays pretty-printed partition metadata (default: False)
-f {text,json}, --format {text,json} Choice the format for printing info
 
positional arguments:
SUPER_IMAGE OUTPUT_DIR
 

 

python3 lpunpack.py  ../android/ofp/super.img  --info
Slot 0:
Metadata version: 10.0
Metadata size: 1252 bytes
Metadata max size: 65536 bytes
Metadata slot count: 2
Header flags: none
Partition table:
------------------------
  Name: vendor
  Group: main
  Attributes: readonly
  Extents:
    0 .. 1077535 linear super 2048
------------------------
  Name: system
  Group: main
  Attributes: readonly
  Extents:
    0 .. 4432735 linear super 1081344
------------------------
  Name: product
  Group: main
  Attributes: readonly
  Extents:
    0 .. 4175 linear super 5515264
------------------------
  Name: odm
  Group: main
  Attributes: readonly
  Extents:
    0 .. 253519 linear super 5521408
------------------------
  Name: my_product
  Group: main
  Attributes: readonly
  Extents:
    0 .. 51063 linear super 5775360
------------------------
  Name: my_engineering
  Group: main
  Attributes: readonly
  Extents:
    0 .. 655 linear super 5826560
------------------------
  Name: my_stock
  Group: main
  Attributes: readonly
  Extents:
    0 .. 1453463 linear super 5828608
------------------------
  Name: my_heytap
  Group: main
  Attributes: readonly
  Extents:
    0 .. 2373319 linear super 7282688
------------------------
  Name: my_company
  Group: main
  Attributes: readonly
  Extents:
    0 .. 679 linear super 9656320
------------------------
  Name: my_carrier
  Group: main
  Attributes: readonly
  Extents:
    0 .. 679 linear super 9658368
------------------------
  Name: my_region
  Group: main
  Attributes: readonly
  Extents:
    0 .. 679 linear super 9660416
------------------------
  Name: my_preload
  Group: main
  Attributes: readonly
  Extents:
    0 .. 679 linear super 9662464
------------------------
  Name: my_manifest
  Group: main
  Attributes: readonly
  Extents:
    
------------------------
Super partition layout:
------------------------
super: 2048 .. 1079584: vendor (1077536 sectors)
super: 1081344 .. 5514080: system (4432736 sectors)
super: 5515264 .. 5519440: product (4176 sectors)
super: 5521408 .. 5774928: odm (253520 sectors)
super: 5775360 .. 5826424: my_product (51064 sectors)
super: 5826560 .. 5827216: my_engineering (656 sectors)
super: 5828608 .. 7282072: my_stock (1453464 sectors)
super: 7282688 .. 9656008: my_heytap (2373320 sectors)
super: 9656320 .. 9657000: my_company (680 sectors)
super: 9658368 .. 9659048: my_carrier (680 sectors)
super: 9660416 .. 9661096: my_region (680 sectors)
super: 9662464 .. 9663144: my_preload (680 sectors)
------------------------
Block device table:
------------------------
  Partition name: super
  First sector: 2048
  Size: 7327449088 bytes
  Flags: none
------------------------
Group table:
------------------------
  Name: default
  Maximum size: 0 bytes
  Flags: none
------------------------
  Name: main
  Maximum size: 7325351936 bytes
  Flags: none



python3 lpunpack.py  ../android/ofp/super.img ex  -p vendor 

python3 lpunpack.py  ../android/ofp/super.img ex  -p odm

python3 lpunpack.py  ../android/ofp/super.img ex  -p product  


python3 lpunpack.py  ../android/ofp/super.img ex  -p  my_product,my_engineering,my_stock,my_heytap,my_company,my_company,my_region,my_preload


Filesystem volume name:   vendor
Last mounted on:          /vendor
Filesystem UUID:          6b580801-6b33-5c38-955f-6808a0512ff5
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr dir_index filetype extent sparse_super large_file huge_file uninit_bg dir_nlink extra_isize shared_blocks
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              2400
Block count:              132545
Reserved block count:     0
Free blocks:              407
Free inodes:              63
First block:              0
Block size:               4096
Fragment size:            4096
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         480
Inode blocks per group:   30
Filesystem created:       Thu Jan  1 05:45:00 2009
Last mount time:          n/a
Last write time:          Thu Jan  1 05:45:00 2009
Mount count:              0
Maximum mount count:      -1
Last checked:             Thu Jan  1 05:45:00 2009
Check interval:           0 (<none>)
Lifetime writes:          1 kB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     32
Desired extra isize:      32
Default directory hash:   half_md4
Directory Hash Seed:      aa5a73e4-8248-5467-a274-88a7c0fad1bc
Directories:              85
 Group  0: block bitmap at 2, inode bitmap at 3, inode table at 4
           0 free blocks, 0 free inodes, 19 used directories, 0 unused inodes
           [Checksum 0x222f]
 Group  1: block bitmap at 32770, inode bitmap at 32771, inode table at 32772
           0 free blocks, 0 free inodes, 17 used directories, 0 unused inodes
           [Checksum 0xcf1d]
 Group  2: block bitmap at 65536, inode bitmap at 65537, inode table at 65538
           0 free blocks, 0 free inodes, 20 used directories, 0 unused inodes
           [Checksum 0x8e5c]
 Group  3: block bitmap at 98306, inode bitmap at 98307, inode table at 98308
           0 free blocks, 0 free inodes, 8 used directories, 0 unused inodes
           [Checksum 0x4867]
 Group  4: block bitmap at 131072, inode bitmap at 131073, inode table at 131074
           407 free blocks, 63 free inodes, 21 used directories, 63 unused inodes
           [Checksum 0x7577]


resize2fs vendor.img  5G

e2fsck -E unshare_blocks vendor.img


resize2fs -M vendor.img


e2fsck -f -y vendor.img


fastboot flash vendor vendor.img


android device mapper


ls -l /dev/block/mapper/
total 0
drwxr-xr-x 2 root root 260 2025-05-17 22:39 by-uuid
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 my_carrier -> /dev/block/dm-7
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 my_company -> /dev/block/dm-6
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 my_engineering -> /dev/block/dm-5
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 my_preload -> /dev/block/dm-9
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 my_product -> /dev/block/dm-4
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 my_region -> /dev/block/dm-8
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 odm -> /dev/block/dm-3
lrwxrwxrwx 1 root root  15 2025-05-17 22:39 product -> /dev/block/dm-2
lrwxrwxrwx 1 root root  16 2025-05-17 22:39 scratch -> /dev/block/dm-10
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 system -> /dev/block/dm-1
lrwxrwxrwx 1 root root  15 2025-05-17 22:38 vendor -> /dev/block/dm-0



dmctl list devices
Available Device Mapper Devices:
product              : 252:2
my_product           : 252:4
vendor               : 252:0
system               : 252:1
my_carrier           : 252:7
my_engineering       : 252:5
my_region            : 252:8
my_company           : 252:6
my_preload           : 252:9
odm                  : 252:3
scratch              : 252:10


dmctl table system
Targets in the device-mapper table for system:
0-3680632: linear, 259:10 1081344
3680632-4945488: linear, 259:10 11605280
4945488-6291456: linear, 259:10 5828608


This shows the start sector (0), size (3680632), target type (linear), block device (259:10), and offset (1081344).



dmctl table vendor                                                       
Targets in the device-mapper table for vendor:
0-1077536: linear, 259:10 2048
1077536-1180456: linear, 259:10 7174576


adb shell dd if=/dev/block/dm-1 of=/data/vendor-rw.img

e2fsck -E unshare_blocks /data/vendor-rw.img

dumpe2fs -h vendor.img
dumpe2fs 1.47.0 (5-Feb-2023)
Filesystem volume name:   vendor
Last mounted on:          /vendor
Filesystem UUID:          6b580801-6b33-5c38-955f-6808a0512ff5
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr dir_index filetype extent sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              2400
Block count:              147557
Reserved block count:     0
Free blocks:              2330
Free inodes:              63
First block:              0
Block size:               4096
Fragment size:            4096
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         480
Inode blocks per group:   30
Filesystem created:       Thu Jan  1 05:45:00 2009
Last mount time:          n/a
Last write time:          Sat May 17 22:29:21 2025
Mount count:              0
Maximum mount count:      -1
Last checked:             Sat May 17 22:29:21 2025
Check interval:           0 (<none>)
Lifetime writes:          53 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:              256
Required extra isize:     32
Desired extra isize:      32
Default directory hash:   half_md4
Directory Hash Seed:      aa5a73e4-8248-5467-a274-88a7c0fad1bc
 



avbctl  get-verity                                                    
verity is disabled.


avbctl  get-verification                                                 
verification is disabled.







unpack and repack android boot.img in linux

unpack and repack android boot.img in linux

 

download latest magisk apk 

https://github.com/topjohnwu/Magisk

https://github.com/topjohnwu/Magisk/releases

https://github.com/topjohnwu/Magisk/releases/download/v29.0/Magisk-v29.0.apk

 

extract magiskboot 

libmagiskboot.so from apk using any tool for your arch mine is x86_64

unzip -j Magisk-v29.0.apk lib/x86_64/libmagiskboot.so

 

this is static binary than a .so file rename it and put in $PATH location


mv libmagiskboot.so magiskboot

chmod +x magiskboot


unpacking 

unpack boot.img 

magiskboot unpack boot.img

 

eg:

magiskboot unpack boot-ui2.img
Parsing boot image: [boot-ui2.img]
HEADER_VER      [2]
KERNEL_SZ       [13997124]
RAMDISK_SZ      [917271]
SECOND_SZ       [0]
RECOV_DTBO_SZ   [0]
DTB_SZ          [140627]
OS_VERSION      [11.0.0]
OS_PATCH_LEVEL  [2022-07]
PAGESIZE        [2048]
NAME            []
CMDLINE         [bootopt=64S3,32N2,64N2 buildvariant=user]
CHECKSUM        [23a7cfd44b419927992e5576cab76099992c4561000000000000000000000000]
KERNEL_FMT      [gzip]
RAMDISK_FMT     [gzip]
unknown/unsupported ASN.1 DER tag: 0x00
VBMETA
 

Files

dtb   kernel   ramdisk.cpio
 

kernel are gzipped for MTK device so decompress it and replace and repack it 


repacking

magiskboot repack boot.img boot-new.img

it takes new files from pwd



xfwm4 themeing

xfwm4 themeing

 
left-active.xpm
left-inactive.xpm

right-active.xpm
right-inactive.xpm

bottom-active.xpm
bottom-inactive.xpm
bottom-left-active.xpm
bottom-left-inactive.xpm
bottom-right-active.xpm
bottom-right-inactive.xpm

top-left-active.xpm
top-left-inactive.xpm
top-right-active.xpm
top-right-inactive.xpm


close-active.xpm
close-inactive.xpm
close-prelight.xpm
close-pressed.xpm


hide-active.xpm
hide-inactive.xpm
hide-prelight.xpm
hide-pressed.xpm



maximize-active.xpm
maximize-inactive.xpm
maximize-prelight.xpm
maximize-pressed.xpm
maximize-toggled-active.xpm
maximize-toggled-inactive.xpm
maximize-toggled-prelight.xpm
maximize-toggled-pressed.xpm


menu-active.xpm
menu-inactive.xpm
menu-prelight.xpm
menu-pressed.xpm



shade-active.xpm
shade-inactive.xpm
shade-prelight.xpm
shade-pressed.xpm
shade-toggled-active.xpm
shade-toggled-inactive.xpm
shade-toggled-prelight.xpm
shade-toggled-pressed.xpm


stick-active.xpm
stick-inactive.xpm
stick-prelight.xpm
stick-pressed.xpm
stick-toggled-active.xpm
stick-toggled-inactive.xpm
stick-toggled-prelight.xpm
stick-toggled-pressed.xpm


title-1-active.xpm
title-1-inactive.xpm
title-2-active.xpm
title-2-inactive.xpm
title-3-active.xpm
title-3-inactive.xpm
title-4-active.xpm
title-4-inactive.xpm
title-5-active.xpm
title-5-inactive.xpm



xpm format 

XPM image is made of different sections, the values that describe the format of the image, the colors that compose the image, the pixels

A character is assigned to each color of the image (if the image has more colors than available charaters, then more than a single character can be assiged to a colors). If a color symbol is specified, the given color will be ignored and replaced by the corresponding color in the color symbol table.

To get the gtk colors applied to your theme, you need to edit the XPM files and add the proper color symbols to the color definition table. 

 

 

Header/Format Section

This section defines the image dimensions, number of colors, and characters per pixel.

static char *image_name[] = {
  "W H N C PP",  // Format string
  ...
};
 
  • W = Width (in pixels)

  • H = Height (in pixels)

  • N = Number of colors in the color table

  • C = Characters per pixel (usually 1, but can be more for many colors)

  • PP (optional) = Hotspot coordinates for cursors (e.g., 1 1 for a pointer)

     

    Color Table

    Each color is defined by a line mapping a character sequence to a color value.

    Format:
    "KEY c COLOR s SYMBOL"

    • KEY = Character(s) representing the color (length = C from the header).

    • c COLOR = Defines the color (can be #RGB, #RRGGBB, rgb:RR/GG/BB, or color names like red).

    • s SYMBOL (optional) = Symbolic color name (e.g., foreground, background). If specified, the actual color is replaced by the system's theme color.

       

      "  c #FFFFFF s background",  // White, uses GTK theme's background
      "X c #FF0000 s foreground",  // Red, uses GTK theme's foreground
      ". c none",                  // Transparent
       

      Pixel Data

    Each line represents a row of pixels, where each character corresponds to a color key from the table.
    Example for a 3x3 image:

 

 "   ",
" X ",
"   "

 

Color Symbols

  • By using symbolic names (e.g., s background), the color dynamically adapts to the system/theme (useful for GTK+/Qt theming).

  • Example: If your GTK theme uses dark mode, s background might resolve to #222222 instead of the hardcoded #FFFFFF

     

    Transparency

    Defined with c none (no color)

 

Multi-Character Keys

If the image has >94 colors (ASCII printable chars), C (chars per pixel) increases (e.g., 2 for AA, AB, etc.).

 

 Comments

XPM files can include C-style comments (/* ... */).

 

 

 /* XPM */
static char *example_xpm[] = {
  "4 4 2 1",       // 4x4 pixels, 2 colors, 1 char per pixel
  "  c #000000",   // Black
  ". c #FFFFFF",   // White
  "    ",
  " .. ",
  " .. ",
  "    "
};

 

This draws a 2x2 white square centered in a 4x4 black canvas.

 

GTK+ Theming with XPM

To make icons adapt to the user's theme:
Replace hardcoded colors with symbolic names (e.g., s foreground).

 

Common Symbolic Color Names


Gtk Color pickup

As you have no doubt noticed when using Xfwm4's default theme, the theme uses the colors of the current Gtk theme. Colors for an XFWM theme can be defined in the theme's themrc file. If they are not defined there, they are picked up from the current Gtk theme. The following colors are used:

Name Gtk value Description
active_text_color fg[selected] Text color on title for active window
inactive_text_color fg[insensitive] Text color on title for inactive window
active_text_shadow_color dark[selected] Shadow color for active window's title
inactive_text_shadow_color dark[insensitive] Shadow color for inactive window's title
active_border_color fg[normal] Very rarely used usually set to black
inactive_border_color fg[normal] Idem
active_color_1 bg[selected] Background color for active title
active_color_2 bg[normal] Background color for active window
active_hilight_1 light[selected] Lighter color for active title for 3D look
active_hilight_2 light[normal] Lighter color for active window
active_mid_1 mid[selected] Slightly darker color for active title
active_mid_2 mid[normal] Slightly darker color for active window
active_shadow_1 darkselected[] Darker color for active title for 3D look
active_shadow_2 dark[normal] Darker color for active window
inactive_color_1 bg[insensitive] Background color for inactive title
inactive_color_2 bg[normal] Background color for inactive window
inactive_hilight_1 light[insensitive] Lighter color for inactive title for 3D look
inactive_hilight_2 light[normal] Lighter color for inactive window
inactive_mid_1 mid[insensitive] Slightly darker color for inactive title
inactive_mid_2 mid[normal] Slightly darker color for inactive window
inactive_shadow_1 dark[insensitive] Darker color for inactive title for 3D look
inactive_shadow_2 dark[normal] Darker color for inactive window

The Gtk values “fg” and “bg” are defined in the gtkrc file of the current Gtk theme. Please notice that the values “dark”, “light” and “mid” can not be defined in the gtkrc but are computed (dark = 0.7 * bg, light = 1.3 * bg, mid = 0.5 * (dark + light)). The symbols get replaced by the actual color values at runtime so that the window border can inherit Gtk theme colors automatically, unless they are defined in the themerc.

To use the defined colors in the XFWM theme, the XPM files have to be edited. Since XPM files are plain text, they can be edited with your favorite text editor.

Ensure the color table includes mappings like:


"X c #000000 s foreground",  // Uses theme's text color
"o c #FFFFFF s background",  // Uses theme's base color
 
 

 

for i in {1..5}; do 
  ln -sf title.png "title-$i-active.png";
  ln -sf title.png "title-$i-inactive.png"; 
done
 
 
svg

 
 title.svg
<svg width="40" height="32" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="aero-gradient" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#f0f7ff" />
<stop offset="50%" stop-color="#d2e0f7" />
<stop offset="100%" stop-color="#b0c0e1" />
</linearGradient>
</defs>
<rect width="40" height="32" fill="url(#aero-gradient)" />
</svg>

 
 
 for i in {1..5}; do 
  ln -sf title.svg "title-$i-active.svg";
  ln -sf title.svg "title-$i-inactive.svg"; 
done
 

 

borders 

for f in left right  top-left top-right; do
ln -sf border.svg $f-active.svg
done

 
for f in bottom bottom-left bottom-right; do
   ln -sf border-h.svg  $f-active.svg
done


 

for f in left right  top-left top-right; do
ln -sf border-i.svg $f-inactive.svg
done

 

for f in bottom bottom-left bottom-right;
 do   ln -sf border-h-i.svg  $f-inactive.svg
done
 

 

 

xpm

 

title.xpm

/* XPM */
static char * title_xpm[] = {
"8 30 2 1",
"     c None",
".    c #FFFFFF s  active_color_1 ",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"};

 

title-inactive.xpm

 same as title.xpm just color change from active_color_1 to inactive_color_1

 


 

for i in {1..5}; do 
  ln -sf title.xpm "title-$i-active.xpm";
done 
 
for i in {1..5}; do 
  ln -sf title-inactive.xpm "title-$i-inactive.xpm"; 
done  

for f in left right  top-left top-right bottom bottom-left bottom-right ; do
ln -sf border-inactive.xpm  $f-inactive.xpm
done

 

for f in top-left top-right left right  bottom bottom-right bottom-left  ; do 
ln -sf border.xpm  $f-active.xpm
done

 

src

https://wiki.xfce.org/howto/xfwm4_theme

https://naive-many.com/bk3.VG0EPH3EpevCb/mMVUJlZgDD0-3yMZj_Ai3IM-TrUizVLGT/cVyIMuD/cNx/NSTccq