Loading tools/releasetools/common.py +17 −0 Original line number Diff line number Diff line Loading @@ -766,3 +766,20 @@ def ComputeDifferences(diffs): th.start() while threads: threads.pop().join() # map recovery.fstab's fs_types to mount/format "partition types" PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD", "ext4": "EMMC", "emmc": "EMMC" } 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] tools/releasetools/edify_generator.py +3 −7 Original line number Diff line number Diff line Loading @@ -21,10 +21,6 @@ class EdifyGenerator(object): """Class to generate scripts in the 'edify' recovery script language used from donut onwards.""" # map recovery.fstab's fs_types to mount/format "partition types" PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD", "ext4": "EMMC", "emmc": "EMMC" } def __init__(self, version, info): self.script = [] self.mounts = set() Loading Loading @@ -141,7 +137,7 @@ class EdifyGenerator(object): if fstab: p = fstab[mount_point] self.script.append('mount("%s", "%s", "%s", "%s");' % (p.fs_type, self.PARTITION_TYPES[p.fs_type], (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device, p.mount_point)) self.mounts.add(p.mount_point) else: Loading Loading @@ -176,7 +172,7 @@ class EdifyGenerator(object): if fstab: p = fstab[partition] self.script.append('format("%s", "%s", "%s");' % (p.fs_type, self.PARTITION_TYPES[p.fs_type], p.device)) (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device)) else: # older target-files without per-partition types partition = self.info.get("partition_path", "") + partition Loading Loading @@ -223,7 +219,7 @@ class EdifyGenerator(object): fstab = self.info["fstab"] if fstab: p = fstab[mount_point] partition_type = self.PARTITION_TYPES[p.fs_type] partition_type = common.PARTITION_TYPES[p.fs_type] args = {'device': p.device, 'fn': fn} if partition_type == "MTD": self.script.append( Loading tools/releasetools/ota_from_target_files +7 −22 Original line number Diff line number Diff line Loading @@ -76,10 +76,6 @@ OPTIONS.omit_prereq = False OPTIONS.extra_script = None 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.""" Loading @@ -95,19 +91,6 @@ def IsSymlink(info): return (info.external_attr >> 16) == 0120777 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 directories in the system image.""" Loading Loading @@ -328,8 +311,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) boot_type, boot_device = GetTypeAndDevice("/boot", OPTIONS.info_dict) recovery_type, recovery_device = GetTypeAndDevice("/recovery", OPTIONS.info_dict) boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict) recovery_type, recovery_device = common.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 Loading Loading @@ -375,7 +358,8 @@ def WriteFullOTAPackage(input_zip, output_zip): output_zip=output_zip, script=script, input_tmp=OPTIONS.input_tmp, metadata=metadata) metadata=metadata, info_dict=OPTIONS.info_dict) if not OPTIONS.omit_prereq: ts = GetBuildProp("ro.build.date.utc", input_zip) Loading Loading @@ -476,7 +460,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): target_version=target_version, output_zip=output_zip, script=script, metadata=metadata) metadata=metadata, info_dict=OPTIONS.info_dict) print "Loading target..." target_data = LoadSystemFiles(target_zip) Loading Loading @@ -573,7 +558,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): common.ZipWriteStr(output_zip, "patch/boot.img.p", d) boot_type, boot_device = GetTypeAndDevice("/boot", OPTIONS.info_dict) boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict) script.PatchCheck("%s:%s:%d:%s:%d:%s" % (boot_type, boot_device, Loading Loading
tools/releasetools/common.py +17 −0 Original line number Diff line number Diff line Loading @@ -766,3 +766,20 @@ def ComputeDifferences(diffs): th.start() while threads: threads.pop().join() # map recovery.fstab's fs_types to mount/format "partition types" PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD", "ext4": "EMMC", "emmc": "EMMC" } 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]
tools/releasetools/edify_generator.py +3 −7 Original line number Diff line number Diff line Loading @@ -21,10 +21,6 @@ class EdifyGenerator(object): """Class to generate scripts in the 'edify' recovery script language used from donut onwards.""" # map recovery.fstab's fs_types to mount/format "partition types" PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD", "ext4": "EMMC", "emmc": "EMMC" } def __init__(self, version, info): self.script = [] self.mounts = set() Loading Loading @@ -141,7 +137,7 @@ class EdifyGenerator(object): if fstab: p = fstab[mount_point] self.script.append('mount("%s", "%s", "%s", "%s");' % (p.fs_type, self.PARTITION_TYPES[p.fs_type], (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device, p.mount_point)) self.mounts.add(p.mount_point) else: Loading Loading @@ -176,7 +172,7 @@ class EdifyGenerator(object): if fstab: p = fstab[partition] self.script.append('format("%s", "%s", "%s");' % (p.fs_type, self.PARTITION_TYPES[p.fs_type], p.device)) (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device)) else: # older target-files without per-partition types partition = self.info.get("partition_path", "") + partition Loading Loading @@ -223,7 +219,7 @@ class EdifyGenerator(object): fstab = self.info["fstab"] if fstab: p = fstab[mount_point] partition_type = self.PARTITION_TYPES[p.fs_type] partition_type = common.PARTITION_TYPES[p.fs_type] args = {'device': p.device, 'fn': fn} if partition_type == "MTD": self.script.append( Loading
tools/releasetools/ota_from_target_files +7 −22 Original line number Diff line number Diff line Loading @@ -76,10 +76,6 @@ OPTIONS.omit_prereq = False OPTIONS.extra_script = None 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.""" Loading @@ -95,19 +91,6 @@ def IsSymlink(info): return (info.external_attr >> 16) == 0120777 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 directories in the system image.""" Loading Loading @@ -328,8 +311,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) boot_type, boot_device = GetTypeAndDevice("/boot", OPTIONS.info_dict) recovery_type, recovery_device = GetTypeAndDevice("/recovery", OPTIONS.info_dict) boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict) recovery_type, recovery_device = common.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 Loading Loading @@ -375,7 +358,8 @@ def WriteFullOTAPackage(input_zip, output_zip): output_zip=output_zip, script=script, input_tmp=OPTIONS.input_tmp, metadata=metadata) metadata=metadata, info_dict=OPTIONS.info_dict) if not OPTIONS.omit_prereq: ts = GetBuildProp("ro.build.date.utc", input_zip) Loading Loading @@ -476,7 +460,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): target_version=target_version, output_zip=output_zip, script=script, metadata=metadata) metadata=metadata, info_dict=OPTIONS.info_dict) print "Loading target..." target_data = LoadSystemFiles(target_zip) Loading Loading @@ -573,7 +558,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): common.ZipWriteStr(output_zip, "patch/boot.img.p", d) boot_type, boot_device = GetTypeAndDevice("/boot", OPTIONS.info_dict) boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict) script.PatchCheck("%s:%s:%d:%s:%d:%s" % (boot_type, boot_device, Loading