summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/ota_from_target_files
diff options
context:
space:
mode:
Diffstat (limited to 'tools/releasetools/ota_from_target_files')
-rwxr-xr-xtools/releasetools/ota_from_target_files58
1 files changed, 19 insertions, 39 deletions
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index f838c22..3dcfbee 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -52,10 +52,6 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
-a (--aslr_mode) <on|off>
Specify whether to turn on ASLR for the package (on by default).
- -S (--file_context) <file>
- the file contexts configuration used to assign SELinux file
- context attributes
-
"""
import sys
@@ -92,7 +88,6 @@ OPTIONS.omit_prereq = False
OPTIONS.extra_script = None
OPTIONS.aslr_mode = True
OPTIONS.worker_threads = 3
-OPTIONS.selinux_fc = None
def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest
@@ -266,15 +261,13 @@ def CopySystemFiles(input_zip, output_zip=None,
substitute=None):
"""Copies files underneath system/ in the input zip to the output
zip. Populates the Item class with their metadata, and returns a
- list of symlinks as well as a list of files that will be retouched.
- output_zip may be None, in which case the copy is skipped (but the
- other side effects still happen). substitute is an optional dict
- of {output filename: contents} to be output instead of certain input
- files.
+ list of symlinks. output_zip may be None, in which case the copy is
+ skipped (but the other side effects still happen). substitute is an
+ optional dict of {output filename: contents} to be output instead of
+ certain input files.
"""
symlinks = []
- retouch_files = []
for info in input_zip.infolist():
if info.filename.startswith("SYSTEM/"):
@@ -292,9 +285,6 @@ def CopySystemFiles(input_zip, output_zip=None,
data = substitute[fn]
else:
data = input_zip.read(info.filename)
- if info.filename.startswith("SYSTEM/lib/") and IsRegular(info):
- retouch_files.append(("/system/" + basefilename,
- common.sha1(data).hexdigest()))
output_zip.writestr(info2, data)
if fn.endswith("/"):
Item.Get(fn[:-1], dir=True)
@@ -302,7 +292,7 @@ def CopySystemFiles(input_zip, output_zip=None,
Item.Get(fn, dir=False)
symlinks.sort()
- return (symlinks, retouch_files)
+ return symlinks
def SignOutput(temp_zip_name, output_zip_name):
@@ -388,26 +378,23 @@ def WriteFullOTAPackage(input_zip, output_zip):
AppendAssertions(script, input_zip)
device_specific.FullOTA_Assertions()
+ device_specific.FullOTA_InstallBegin()
script.ShowProgress(0.5, 0)
if OPTIONS.wipe_user_data:
script.FormatPartition("/data")
- if OPTIONS.selinux_fc is not None:
- WritePolicyConfig(OPTIONS.selinux_fc, output_zip)
+ 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")
script.UnpackPackageDir("system", "/system")
- (symlinks, retouch_files) = CopySystemFiles(input_zip, output_zip)
+ symlinks = CopySystemFiles(input_zip, output_zip)
script.MakeSymlinks(symlinks)
- if OPTIONS.aslr_mode:
- script.RetouchBinaries(retouch_files)
- else:
- script.UndoRetouchBinaries(retouch_files)
boot_img = common.GetBootableImage("boot.img", "boot.img",
OPTIONS.input_tmp, "BOOT")
@@ -450,17 +437,13 @@ def LoadSystemFiles(z):
"""Load all the files from SYSTEM/... in a given target-files
ZipFile, and return a dict of {filename: File object}."""
out = {}
- retouch_files = []
for info in z.infolist():
if info.filename.startswith("SYSTEM/") and not IsSymlink(info):
basefilename = info.filename[7:]
fn = "system/" + basefilename
data = z.read(info.filename)
out[fn] = common.File(fn, data)
- if info.filename.startswith("SYSTEM/lib/") and IsRegular(info):
- retouch_files.append(("/system/" + basefilename,
- out[fn].sha1))
- return (out, retouch_files)
+ return out
def GetBuildProp(property, z):
@@ -499,9 +482,9 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
info_dict=OPTIONS.info_dict)
print "Loading target..."
- (target_data, target_retouch_files) = LoadSystemFiles(target_zip)
+ target_data = LoadSystemFiles(target_zip)
print "Loading source..."
- (source_data, source_retouch_files) = LoadSystemFiles(source_zip)
+ source_data = LoadSystemFiles(source_zip)
verbatim_targets = []
patch_list = []
@@ -570,6 +553,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
script.Print("Verifying current system...")
+ device_specific.IncrementalOTA_VerifyBegin()
+
script.ShowProgress(0.1, 0)
total_verify_size = float(sum([i[2].size for i in patch_list]) + 1)
if updating_boot:
@@ -605,6 +590,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
script.Comment("---- start making changes here ----")
+ device_specific.IncrementalOTA_InstallBegin()
+
if OPTIONS.wipe_user_data:
script.Print("Erasing user data...")
script.FormatPartition("/data")
@@ -671,7 +658,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
script.ShowProgress(0.1, 10)
- (target_symlinks, target_retouch_dummies) = CopySystemFiles(target_zip, None)
+ target_symlinks = CopySystemFiles(target_zip, None)
target_symlinks_d = dict([(i[1], i[0]) for i in target_symlinks])
temp_script = script.MakeTemporary()
@@ -680,7 +667,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
# Note that this call will mess up the tree of Items, so make sure
# we're done with it.
- (source_symlinks, source_retouch_dummies) = CopySystemFiles(source_zip, None)
+ source_symlinks = CopySystemFiles(source_zip, None)
source_symlinks_d = dict([(i[1], i[0]) for i in source_symlinks])
# Delete all the symlinks in source that aren't in target. This
@@ -714,10 +701,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
to_create.append((dest, link))
script.DeleteFiles([i[1] for i in to_create])
script.MakeSymlinks(to_create)
- if OPTIONS.aslr_mode:
- script.RetouchBinaries(target_retouch_files)
- else:
- script.UndoRetouchBinaries(target_retouch_files)
# Now that the symlinks are created, we can set all the
# permissions.
@@ -764,14 +747,12 @@ def main(argv):
OPTIONS.aslr_mode = False
elif o in ("--worker_threads"):
OPTIONS.worker_threads = int(a)
- elif o in ("-S", "--file_context"):
- OPTIONS.selinux_fc = a
else:
return False
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:k:i:d:wne:a:S:",
+ extra_opts="b:k:i:d:wne:a:",
extra_long_opts=["board_config=",
"package_key=",
"incremental_from=",
@@ -780,7 +761,6 @@ def main(argv):
"extra_script=",
"worker_threads=",
"aslr_mode=",
- "file_context=",
],
extra_option_handler=option_handler)