use fs_config and file_contexts from target_files
When building images, we want to use the file_contexts and fs_config
data contained in the target_files zip, rather than whatever happens
to be in the current client.
Change-Id: I13df2405898039f5a9b4bb4837147e76b31b068a
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 6be5a52..2ca9316 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -83,8 +83,17 @@
fstab = info_dict["fstab"]
if fstab:
image_props["fs_type" ] = fstab["/system"].fs_type
+
+ fs_config = os.path.join(input_dir, "META/filesystem_config.txt")
+ if not os.path.exists(fs_config): fs_config = None
+
+ fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts")
+ if not os.path.exists(fc_config): fc_config = None
+
succ = build_image.BuildImage(os.path.join(input_dir, "system"),
- image_props, img.name)
+ image_props, img.name,
+ fs_config=fs_config,
+ fc_config=fc_config)
assert succ, "build system.img image failed"
mapdata = None