本文介绍如何在Ubuntu18.04上解压缩高通平台Android12L的super.img,并将其挂载到系统中查看内容。
在源码的根目录下,执行如下命令:
bash
out/host/linux-x86/bin/simg2img out/target/product/msmnile_gvmq/super.img super.img_raw
mkdir superimg
out/host/linux-x86/bin/lpunpack super.img_raw superimg/
查看superimg目录下的内容:
bash
zjx@zjx:~/1T/release/superimg$ ls -al
total 4758796
drwxr-xr-x 5 root root 4096 Dec 6 11:26 .
drwxr-xr-x 5 nobody nogroup 4096 Dec 6 11:22 ..
-rw-r--r-- 1 root root 1835712512 Dec 6 11:24 system_a.img
-rw-r--r-- 1 root root 0 Dec 6 11:24 system_b.img
-rw-r--r-- 1 root root 201793536 Dec 6 11:24 system_ext_a.img
-rw-r--r-- 1 root root 0 Dec 6 11:24 system_ext_b.img
-rw-r--r-- 1 root root 2851311616 Dec 6 11:24 vendor_a.img
-rw-r--r-- 1 root root 0 Dec 6 11:24 vendor_b.img
继续解压缩system/system_ext/vendor img文件:
bash
sudo mkdir system
sudo mkdir system_ext
sudo mkdir vendor
sudo mount -o ro system_a.img system
sudo mount -o ro system_ext_a.img system_ext
sudo mount -o ro vendor_a.img vendor
查看system system_ext vendor目录下的内容,即各img解压出来的内容:
bash
zjx@zjx:~/work/$ ls -al system
total 116
drwxr-xr-x. 25 root root 4096 Sep 9 14:31 .
drwxrwxr-x 34 zjx zjx 4096 Dec 6 10:39 ..
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 acct
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 apex
lrw-r--r--. 1 root root 11 Sep 9 14:31 bin -> /system/bin
lrw-r--r--. 1 root root 50 Sep 9 14:31 bugreports -> /data/user_de/0/com.android.shell/files/bugreports
lrw-r--r--. 1 root root 11 Sep 9 14:31 cache -> /data/cache
dr-xr-xr-x. 2 root root 4096 Sep 9 10:05 config
lrw-r--r--. 1 root root 17 Sep 9 14:31 d -> /sys/kernel/debug
drwxrwx--x. 2 zjx zjx 4096 Sep 9 10:05 data
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 data_mirror
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 debug_ramdisk
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 dev
lrw-r--r--. 1 root root 11 Sep 9 14:31 etc -> /system/etc
lrwxr-x---. 1 root 2000 16 Sep 9 14:31 init -> /system/bin/init
-rwxr-x---. 1 root 2000 463 Sep 9 10:05 init.environ.rc
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 linkerconfig
drwx------. 2 root root 16384 Sep 9 14:33 lost+found
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 metadata
drwxr-xr-x. 2 root zjx 4096 Sep 9 10:05 mnt
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 odm
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 odm_dlkm
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 oem
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 postinstall
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 proc
lrw-r--r--. 1 root root 15 Sep 9 14:31 product -> /system/product
lrw-r--r--. 1 root root 21 Sep 9 14:31 sdcard -> /storage/self/primary
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 second_stage_resources
drwxr-x--x. 2 root 1028 4096 Sep 9 10:05 storage
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 sys
drwxr-xr-x. 14 root root 4096 Sep 9 13:54 system
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 system_ext
drwxr-xr-x. 2 root 2000 4096 Sep 9 10:05 vendor
drwxr-xr-x. 2 root root 4096 Sep 9 10:05 vendor_dlkm
PS:工具lpunpack下载请参考:
https://download.csdn.net/download/zhang_jun_xiang/90089807?spm=1001.2014.3001.5501