How to mount AOSP .img files?

前端 未结 2 667
生来不讨喜
生来不讨喜 2021-02-11 02:32

I generate *.img by building AOSP.

Like ramdisk.img,boot.img etc.

I want to mount this file

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-11 02:55

    You cannot mount boot.img file. However you can unpack it's ramdisk.

    The boot.img file contains:

    • ramdisk
    • zImage (kernel binary)
    • dt.img (device tree)

    There is an excellent open source project: mkbootimg_tools at GitHub. You can use it to split the boot.img file and unpack the ramdisk.

    Unpack boot.img:

    mkbootimg_tools/mkboot boot.img boot_unpacked
    

    To unpack system.img you first need to understand what kind of partition is it: run: file system.img

    If you get 'Android sparse image', then you have a sparse image, meaning you need to un-sparse it before mounting: simg2img system.img system_raw.img

    Then you can mount system_raw.img simply by running: sudo mount system_raw.img /mnt/android_sys

提交回复
热议问题