sparse image and not sparse image

android的system.img分为两种,
一种是raw ext4 image,其特点是完整的ext4分区镜像(包含很多全零的无效填充区),可以直接使用mount进行挂载,因此比较大

$ file system.img
system_raw.img: Linux rev 1.0 ext4 filesystem data, UUID=xxxx(extents) (large files)

另一种是sparse ext4 image,是一个非常普通的dat文件。由于它将raw ext4进行稀疏描述,因此尺寸比较小(没有全零的无效填充区)

$ file system.img
system.img: data

simg2img的位置在“out/host/linux-x86/bin/simg2img”
simg2img源码的位置在“system/core/libsparse”

//sparse image转化成为ext4的raw imge
Usage: simg2img <sparse_image_files> <raw_image_file>

//ext4的raw image to sparse image
Usage: img2simg <raw_image_file> <sparse_image_file> [<block_size>]

参考文章
Android中system.img的两种格式及其相互转换方法

原文链接:https://blog.csdn.net/luckywang1103/article/details/77776456

原文地址:https://www.cnblogs.com/aspirs/p/14904571.html