欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

安卓图像文件格式

最编程 2024-03-13 11:26:01
...

1、raw ext4 image

file system.img

system.img: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)

即:raw image,用file命令查看:它是完整的ext4分区镜像(包含很多全零的无效填充区),可以直接使用mount进行挂载,因此比较大(一般1G左右)

2、sparse ext4 image

file system.img

system.img: data

即simg,很普通的dat文件。由于它将raw ext4进行稀疏描述,因此尺寸比较小(没有全零的无效填充区,一般在300到500M之间)


如果完整的进行过一次Android的编译,默认会将simg2img当作主机工具编译出来 ,命令路径:vm_linux/output/tcl_android/mt5882_cn_android/rel/android/kk-4.x/out/host/linux-x86/bin/simg2img,但默认是不会编译img2simg的

android本身提供了源代码工具在两者之间转换,源代码位于:

system/core/libsparse/simg2img.c // 将sparse image转换为raw image;

system/core/libsparse/img2simg.c // 将raw image转换为sparse image;
simg2img <sparse_image_files> <raw_image_file>
img2simg <raw_image_file> <sparse_image_file> [<block_size>] 

安卓的转换工具在out目录下:

out/target/product/sc171/obj/PACKAGING/otatools_intermediates/otatools/bin/simg2img