Android中system.img的两种格式及其相互转换方法
来源:互联网 发布:python webservice 编辑:程序博客网 时间:2024/06/15 11:43
搞Android的同学经常会接触到system.img。但是该文件经常以两种格式出现:raw和sparse。
一种是raw ext4 image,即经常说的raw image,使用file观察它:
如果完整的进行过一次Android的编译,默认会将simg2img当作主机工具编译出来,放在out/host/linux-x86/bin/simg2img处。
这样就会编译出out/host/linux-x86/bin/img2simg。
欢迎转载,但是请注明出处:http://weibo.com/howellzhu
其特点是完整的ext4分区镜像(包含很多全零的无效填充区),可以直接使用mount进行挂载,因此比较大(一般1G左右)。
$ file system.imgsystem.img: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)信息非常明确了。
另一种是sparse ext4 image,即经常说的simg,使用file观察它:
$ file system.imgsystem.img: data就是说是一个非常普通的dat文件。由于它将raw ext4进行稀疏描述,因此尺寸比较小(没有全零的无效填充区,一般在300到500M之间)。
android本身提供了源代码工具在两者之间转换,源代码位于:
system/core/libsparse/simg2img.c // 将sparse image转换为raw image;system/core/libsparse/img2simg.c // 将raw image转换为sparse image;
但默认是不会编译img2simg的,我们可以手工进行编译:
$ . build/envsetup.sh$ lunch aosp_hammerhead-userdebug$ make img2simg_host
这样就会编译出out/host/linux-x86/bin/img2simg。
如果要将system.raw.img转换为system.simg:
$ img2simg system.raw.img system.simg
为了方便没有源代码的同学,这里提供img2simg的下载路径:
http://download.csdn.net/detail/howellzhu/8399215
对于simg2img,到处都可以找到了,还有windows版本的,这里就不提供了。
使用方法:
$ simg2img <sparse_image_files> <raw_image_file>$ img2simg <raw_image_file> <sparse_image_file> [<block_size>]
欢迎转载,但是请注明出处:http://weibo.com/howellzhu
2 0
- Android中system.img的两种格式及其相互转换方法
- Android中system.img的两种格式及其相互转换方法
- Android中system.img的两种格式及其相互转换方法
- Android中system.img的两种格式及其相互转换方法
- Android中system.img的两种格式及其相互转换方法
- 修改android的system.img文件方法
- android中system.img的打包过程
- android中system.img的打包过程
- MySQL中毫秒值和日期的指定格式的相互转换及其时间函数
- Android中 Bitmap和Drawable相互转换的方法
- Android中整型和字符串相互转换的方法
- Android中 Bitmap和Drawable相互转换的方法
- Android中 Bitmap和Drawable相互转换的方法
- # android中dp与px的相互转换工具方法
- Android中 Bitmap和Drawable相互转换的方法
- Android中 Bitmap和Drawable相互转换的方法
- Android中 Bitmap和Drawable相互转换的方法
- Android 中 Bitmap 和 Drawable 相互转换的方法
- 给大家推荐个超棒的SSH and telnet client工具:putty!
- ZOJ 1049 &&HDU 1065 I Think I Need a Houseboat
- Ubuntu12.04 64 编译 vrippack
- Linux显示各栏位的标题信息列
- [30天轻松掌握JavaWeb视频]-调整虚拟机大小
- Android中system.img的两种格式及其相互转换方法
- <<3D游戏编程大师技巧>> Raiders 项目配置
- Weka 3: Data Mining Software in Java
- NYOJ_6
- 跨域请求
- javaweb种常见错误分析
- HDU 2204 Eddy's爱好 容斥
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo
- leetcode-----------Longest Substring Without Repeating Characters