summaryrefslogtreecommitdiffstats
path: root/tools/releasetools
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-09-22 10:12:54 -0700
committerDoug Zongker <dougz@android.com>2010-09-22 10:17:31 -0700
commitf2ab290550d6f1b1ea9bab91eb4c3c77ceeb5df4 (patch)
treed9d7eb1bfc426df3dcfd5995c79db830854bfa9c /tools/releasetools
parent539db3b845bba83b6e1340818b19f7581c3b6bc0 (diff)
downloadbuild-f2ab290550d6f1b1ea9bab91eb4c3c77ceeb5df4.zip
build-f2ab290550d6f1b1ea9bab91eb4c3c77ceeb5df4.tar.gz
build-f2ab290550d6f1b1ea9bab91eb4c3c77ceeb5df4.tar.bz2
accommodate both new and old target-files when creating incrementals
(cherry-picked from gingerbread.) Change-Id: I925bf122b0012302a85c0b6f04cca48eb694b0c4
Diffstat (limited to 'tools/releasetools')
-rwxr-xr-xtools/releasetools/ota_from_target_files47
1 files changed, 24 insertions, 23 deletions
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index b963531..2f65058 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -79,6 +79,10 @@ OPTIONS.extra_script = None
OPTIONS.aslr_mode = True
OPTIONS.worker_threads = 3
+# TODO: this is duplicated from edify_generator.py; fix.
+PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD",
+ "ext4": "EMMC", "emmc": "EMMC" }
+
def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest
value. Returns 'default' if the dict is empty."""
@@ -98,6 +102,18 @@ def IsRegular(info):
symlink."""
return (info.external_attr >> 28) == 010
+def GetTypeAndDevice(mount_point, info):
+ fstab = info["fstab"]
+ if fstab:
+ return PARTITION_TYPES[fstab[mount_point].fs_type], fstab[mount_point].device
+ else:
+ devices = {"/boot": "boot",
+ "/recovery": "recovery",
+ "/radio": "radio",
+ "/data": "userdata",
+ "/cache": "cache"}
+ return info["partition_type"], info.get("partition_path", "") + devices[mount_point]
+
class Item:
"""Items represent the metadata (user, group, mode) of files and
@@ -325,23 +341,8 @@ def MakeRecoveryPatch(output_zip, recovery_img, boot_img):
common.ZipWriteStr(output_zip, "recovery/recovery-from-boot.p", patch)
Item.Get("system/recovery-from-boot.p", dir=False)
-
- fstab = OPTIONS.info_dict["fstab"]
- if fstab:
- # TODO: this is duplicated from edify_generator.py; fix.
- PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD",
- "ext4": "EMMC", "emmc": "EMMC" }
-
- boot_type = PARTITION_TYPES[fstab["/boot"].fs_type]
- boot_device = fstab["/boot"].device
-
- recovery_type = PARTITION_TYPES[fstab["/recovery"].fs_type]
- recovery_device = fstab["/recovery"].device
- else:
- # backwards compatibility for target files w/o recovery.fstab
- boot_type = recovery_type = OPTIONS.info_dict["partition_type"]
- boot_device = OPTIONS.info_dict.get("partition_path", "") + "boot"
- recovery_device = OPTIONS.info_dict.get("partition_path", "") + "recovery"
+ boot_type, boot_device = GetTypeAndDevice("/boot", OPTIONS.info_dict)
+ recovery_type, recovery_device = GetTypeAndDevice("/recovery", OPTIONS.info_dict)
# Images with different content will have a different first page, so
# we check to see if this recovery has already been installed by
@@ -480,8 +481,6 @@ def GetBuildProp(property, z):
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
source_version = OPTIONS.source_info_dict["recovery_api_version"]
target_version = OPTIONS.target_info_dict["recovery_api_version"]
- partition_type = OPTIONS.target_info_dict["partition_type"]
- partition_path = OPTIONS.target_info_dict.get("partition_path", "")
if source_version == 0:
print ("WARNING: generating edify script for a source that "
@@ -596,8 +595,10 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
- script.PatchCheck("%s:%sboot:%d:%s:%d:%s" %
- (partition_type, partition_path,
+ boot_type, boot_device = GetTypeAndDevice("/boot", OPTIONS.info_dict)
+
+ script.PatchCheck("%s:%s:%d:%s:%d:%s" %
+ (boot_type, boot_device,
source_boot.size, source_boot.sha1,
target_boot.size, target_boot.sha1))
so_far += source_boot.size
@@ -637,8 +638,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
# contents of the boot partition, and write it back to the
# partition.
script.Print("Patching boot image...")
- script.ApplyPatch("%s:%sboot:%d:%s:%d:%s"
- % (partition_type, partition_path,
+ script.ApplyPatch("%s:%s:%d:%s:%d:%s"
+ % (boot_type, boot_device,
source_boot.size, source_boot.sha1,
target_boot.size, target_boot.sha1),
"-",