android system.img 解压

1. android (ICS)模拟器里的system.img

用unyaffs工具,可以解压出system目录文件

参考:http://blog.csdn.net/tuhuolong/article/details/6397085

2.MTK android ICS 或 GB 编译出的system.img

用simg2img工具,转换后,可以挂载成ext4分区。

参考:http://hi.baidu.com/love_yuoyuo/item/0aceeb8ad6f1a9c0ef083d8a

3.mlogic android ICS编译出的system.img

还没有找到解压的方法。

通过查看编译脚本,可以发现,打包工具被amlogic做了更改:

device/amlogic/f16ref/BoardConfig.mk

# Recovery
TARGET_USE_AMLOGIC_MKYAFFS_TOOL := true
TARGET_AMLOGIC_MKYAFFSIMG_TOOL := mkyaffsimage4K.dat
TARGET_AMLOGIC_KERNEL := $(PRODUCT_OUT)/uImage
TARGET_AMLOGIC_RECOVERY_KERNEL := $(PRODUCT_OUT)/uImage_recovery

build/core/config.mk

ifeq ($(TARGET_USE_AMLOGIC_MKYAFFS_TOOL),true)
MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/$(TARGET_AMLOGIC_MKYAFFSIMG_TOOL)
else
MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)
endif   # TARGET_USE_AMLOGIC_MKYAFFS_TOOL == true

build/core/Makefile

ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
## generate an ext image
# $(1): output file
define build-systemimage-target
    @echo "Target system fs image: $(1)"
    $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
endef

else # INTERNAL_USERIMAGES_USE_EXT != true

## generate a yaffs2 image
# $(1): output file
define build-systemimage-target
    @echo "Target system fs image: $(1)"
    @mkdir -p $(dir $(1))
    $(hide) $(MKYAFFS2) $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
endef
endif # INTERNAL_USERIMAGES_USE_EXT

$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
    $(call build-systemimage-target,$@)

INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)

$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
    @echo "Install system fs image: $@"
    $(copy-file-to-target)
    $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)

systemimage: $(INSTALLED_SYSTEMIMAGE)

以上是编译systemimage的脚本。可以大概看出,systemimage基本上要么是ext格式,要么是yaffs格式。

只不过有些厂家把yaffs打包格式做了修改,所以导致不能用unyaffs工具解包的情况。

上面的是没有定义EXT格式的,所以用的是yaffs的打包工具。而MTK的则定义了EXT4格式,所以采用的是make_ext4fs(源码:system/extras/ext4_utils/)的打包工具。

脚本如下:

# eMMC support
ifeq ($(MTK_EMMC_SUPPORT),yes)
TARGET_USERIMAGES_USE_EXT4:=true
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false
endif




你可能感兴趣的:(android system.img 解压)