From 45bc6a8e501da82e49ab91ef62e8e6693c8f5141 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 15 Sep 2010 12:58:04 -0700 Subject: fix two crespo OTA package bugs 1) don't need to write the radio partition if the radio is unchanged 2) using wrong variable when incremental package includes bootloader Change-Id: I59c5d42aba835314a76d5be66c8ac13e76b96bbf --- releasetools.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'releasetools.py') diff --git a/releasetools.py b/releasetools.py index aa3786a..39352ef 100644 --- a/releasetools.py +++ b/releasetools.py @@ -56,7 +56,7 @@ def IncrementalOTA_InstallEnd(info): if source_bootloader_img == target_bootloader_img: print "bootloader unchanged; skipping" else: - common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img) + common.ZipWriteStr(info.output_zip, "bootloader.img", target_bootloader_img) info.script.Print("Writing bootloader...") info.script.WriteRawImage("bootloader", "bootloader.img") @@ -69,21 +69,24 @@ def IncrementalOTA_InstallEnd(info): try: sf = common.File("radio.img", info.source_zip.read("RADIO/radio.img")) - diff = common.Difference(tf, sf) - common.ComputeDifferences([diff]) - _, _, d = diff.GetPatch() - if d is None or len(d) > tf.size * common.OPTIONS.patch_threshold: - # computing difference failed, or difference is nearly as - # big as the target: simply send the target. - tf.AddToZip(info.output_zip) - info.script.Print("Writing radio...") - info.script.WriteRawImage("radio", tf.name) + if tf.sha1 == sf.sha1: + print "radio image unchanged; skipping" else: - common.ZipWriteStr(info.output_zip, "radio.img.p", d) - info.script.Print("Patching radio...") - info.script.ApplyPatch( - "MTD:radio:%d:%s:%d:%s" % (sf.size, sf.sha1, tf.size, tf.sha1), - "-", tf.size, tf.sha1, sf.sha1, "radio.img.p") + diff = common.Difference(tf, sf) + common.ComputeDifferences([diff]) + _, _, d = diff.GetPatch() + if d is None or len(d) > tf.size * common.OPTIONS.patch_threshold: + # computing difference failed, or difference is nearly as + # big as the target: simply send the target. + tf.AddToZip(info.output_zip) + info.script.Print("Writing radio...") + info.script.WriteRawImage("radio", tf.name) + else: + common.ZipWriteStr(info.output_zip, "radio.img.p", d) + info.script.Print("Patching radio...") + info.script.ApplyPatch( + "MTD:radio:%d:%s:%d:%s" % (sf.size, sf.sha1, tf.size, tf.sha1), + "-", tf.size, tf.sha1, sf.sha1, "radio.img.p") except KeyError: # failed to read SOURCE radio image: include the whole target -- cgit v1.1