你已经回答了自己的问题,但我会稍微详细一些。
Android SDK附带了系统映像,例如:
$ cd android-sdk-linux/system-images/android-15/armeabi-v7a/
$ ls *.img
ramdisk.img system.img userdata.img
$ cd ~/.android/avd/<img name>.avd/
$ ls *.img
cache.img sdcard.img userdata.img userdata-qemu.img
尽管如此,不是所有的图像类型都相同:
$ file *.img
cache.img: VMS Alpha executable
sdcard.img: x86 boot sector, code offset 0x5a, OEM-ID "MSWIN4.1", sectors/cluster 4, Media descriptor 0xf8, sectors 2048000 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 3993, reserved3 0x800000, serial number 0x17de3f04, label: " SDCARD"
userdata.img: VMS Alpha executable
userdata-qemu.img: VMS Alpha executable
由于 sdcard.img
没有额外的分区,因此可以直接挂载而不需要偏移参数(例如 -o loop,offset=32256
):
$ fdisk -l sdcard.img
You must set cylinders.
You can do this from the extra functions menu.
Disk sdcard.img: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
$ sudo mount -o loop sdcard.img /mnt/
描述为VMS Alpha可执行文件
的其他图像文件实际上是yaffs2文件。据我所知,它们不能直接挂载,但可以使用两个实用程序unyaffs或unyaffs2进行提取。
$ mkdir extract
$ cd extract
$ unyaffs ../userdata.img
或者
$ unyaffs2 --yaffs-ecclayout ../userdata.img .
注意,还有另一个实用程序称为simg2img
,可以在Android源代码树下的./android_src/system/extras/ext4_utils/
中找到,该程序用于压缩的ext4 img文件。但是,如果错误地应用于yaffs2
图像,则会出现Bad magic
错误提示。