参考资料:
https://github.com/munjeni/super_image_dumper
https://gist.github.com/Systemad/0dd94142e73c7338b3b369ba1a628f5a
步骤:
从super分区 提取 可些的system.img
cd /data/local/tmp chmod 755 superunpack.arm64_pie ./superunpack.arm64_pie /dev/block/bootdevice/by-name/super 1
挂载 system_a.img
mount -t ext4 system_a.img system 如果上面,unpack不加1选项,system分区是只读的, mount是需要加 ro选项 mount -t ext4 -o ro system_a.img system
修改
删除,替换文件
写回
cd /data/local/tmp mv superrepack.arm64_pie superrepack chmod 755 superrepack stop ./superrepack /dev/block/bootdevice/by-name/super system_a sync -------------------- stop dd if=/dev/block/bootdevice/by-name/super of=/data/local/tmp/super.bin conv=notrunc /data/local/tmp/superrepack /data/local/tmp/super.bin system_a rw sync dd if=/data/local/tmp/super.img of=/dev/block/bootdevice/by-name/super conv=notrunc sync
在Linux系统也可修改 super.img 镜像
e2fsck -fy -E unshare_blocks system.ext4 -f Force checking even if filesystem is marked clean -y Assume "yes" to all questions -v Be verbose -E extended-options
superunpack 不加 1选项,或者 lpunpack 或者 imgtool都提取的read only的image
/usr/sbin/e2fsck -f system_a.ext4 /sbin/resize2fs system_a.ext4 4G /usr/sbin/e2fsck -fyv -E unshare_blocks system_a.ext4
挂载
# mount -t ext4 -o loop,rw system_a.ext4
修改
修改后重新检查
e2fsck -f
改成可写的分区
mount -o remount,rw / mount -o remount,rw /system_ext mount -o remount,rw /product mount -o remount,rw /vendor mount | grep dm-
使用方法
adb push superrepack.arm64_pie /data/local/tmp adb shell su cd /data/local/tmp mv superrepack.arm64_pie superrepack chmod 755 superrepack stop ./superrepack /dev/block/bootdevice/by-name/super system_a sync reboot