summaryrefslogtreecommitdiffstats
path: root/tools/releasetools
diff options
context:
space:
mode:
Diffstat (limited to 'tools/releasetools')
-rwxr-xr-xtools/releasetools/build_image.py6
-rw-r--r--tools/releasetools/edify_generator.py4
-rwxr-xr-xtools/releasetools/ota_from_target_files15
3 files changed, 20 insertions, 5 deletions
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 15acddc..a615d1a 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -46,12 +46,17 @@ def BuildImage(in_dir, prop_dict, out_file):
prop_dict["mount_point"]])
if "partition_size" in prop_dict:
build_command.append(prop_dict["partition_size"])
+ if "selinux_fc" in prop_dict:
+ build_command.append(prop_dict["selinux_fc"])
else:
build_command = ["mkyaffs2image", "-f"]
if prop_dict.get("mkyaffs2_extra_flags", None):
build_command.extend(prop_dict["mkyaffs2_extra_flags"].split())
build_command.append(in_dir)
build_command.append(out_file)
+ if "selinux_fc" in prop_dict:
+ build_command.append(prop_dict["selinux_fc"])
+ build_command.append(prop_dict["mount_point"])
print "Running: ", " ".join(build_command)
p = subprocess.Popen(build_command);
@@ -75,6 +80,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
common_props = (
"extfs_sparse_flag",
"mkyaffs2_extra_flags",
+ "selinux_fc",
)
for p in common_props:
copy_prop(p, p)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 8c31927..5672b5a 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -165,9 +165,9 @@ class EdifyGenerator(object):
fstab = self.info.get("fstab", None)
if fstab:
p = fstab[partition]
- self.script.append('format("%s", "%s", "%s", "%s");' %
+ self.script.append('format("%s", "%s", "%s", "%s", "%s");' %
(p.fs_type, common.PARTITION_TYPES[p.fs_type],
- p.device, p.length))
+ p.device, p.length, p.mount_point))
def DeleteFiles(self, file_list):
"""Delete all files in file_list."""
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 7e855ce..3dcfbee 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -48,6 +48,10 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
-e (--extra_script) <file>
Insert the contents of file at the end of the update script.
+
+ -a (--aslr_mode) <on|off>
+ Specify whether to turn on ASLR for the package (on by default).
+
"""
import sys
@@ -381,6 +385,9 @@ def WriteFullOTAPackage(input_zip, output_zip):
if OPTIONS.wipe_user_data:
script.FormatPartition("/data")
+ if "selinux_fc" in OPTIONS.info_dict:
+ WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
+
script.FormatPartition("/system")
script.Mount("/system")
script.UnpackPackageDir("recovery", "/system")
@@ -415,15 +422,17 @@ def WriteFullOTAPackage(input_zip, output_zip):
script.AddToZip(input_zip, output_zip)
WriteMetadata(metadata, output_zip)
+def WritePolicyConfig(file_context, output_zip):
+ f = open(file_context, 'r');
+ basename = os.path.basename(file_context)
+ common.ZipWriteStr(output_zip, basename, f.read())
+
def WriteMetadata(metadata, output_zip):
common.ZipWriteStr(output_zip, "META-INF/com/android/metadata",
"".join(["%s=%s\n" % kv
for kv in sorted(metadata.iteritems())]))
-
-
-
def LoadSystemFiles(z):
"""Load all the files from SYSTEM/... in a given target-files
ZipFile, and return a dict of {filename: File object}."""