It’s very straight forward to mount an Android image file (such as vendor.img or system.img) locally on your Linux machine. You need to:

  1. Convert the Android Sparse Image (.img) file to a standard image file.
  2. Mount the standard image file locally.

To convert the Android Spare Image file, the simg2img command is used, e.g.

 ./out/host/linux-x86/bin/simg2img ./out/target/product/som_mx8q/vendor.img ./out/target/product/som_mx8q/vendor.img_raw

This raw image file can then be mounted to the filesystem:

$ mkdir /tmp/mount
$ sudo mount -t ext4 -o loop ./out/target/product/som_mx8q/vendor.img_raw /tmp/mount/
$ ls /tmp/mount
app  bin  build.prop  default.prop  etc  firmware  lib  lib64  lost+found  overlay  ueventd.rc  usr