Allow flashing a squashfs system image

Change-Id: Ic51d11274784a8d2e9d57d5f0b821ebc89680e5a
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 777a91a..18e80db 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -251,6 +251,14 @@
       build_command.append(fc_config)
     elif "selinux_fc" in prop_dict:
       build_command.append(prop_dict["selinux_fc"])
+  elif fs_type.startswith("squash"):
+    build_command = ["mksquashfsimage.sh"]
+    build_command.extend([in_dir, out_file])
+    build_command.extend(["-m", prop_dict["mount_point"]])
+    if fc_config is not None:
+      build_command.extend(["-c", fc_config])
+    elif "selinux_fc" in prop_dict:
+      build_command.extend(["-c", prop_dict["selinux_fc"]])
   elif fs_type.startswith("f2fs"):
     build_command = ["mkf2fsuserimg.sh"]
     build_command.extend([out_file, prop_dict["partition_size"]])
@@ -319,6 +327,8 @@
   d["mount_point"] = mount_point
   if mount_point == "system":
     copy_prop("fs_type", "fs_type")
+    # Copy the generic sysetem fs type first, override with specific one if available.
+    copy_prop("system_fs_type", "fs_type")
     copy_prop("system_size", "partition_size")
     copy_prop("system_verity_block_device", "verity_block_device")
   elif mount_point == "data":