diff options
author | Doug Zongker <dougz@android.com> | 2010-09-15 12:58:04 -0700 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2010-09-15 12:58:04 -0700 |
commit | 45bc6a8e501da82e49ab91ef62e8e6693c8f5141 (patch) | |
tree | 2ed0b4aa7b89527eae824e9f612ec1f784bb72aa | |
parent | 7e1f49a12819f21cfeaf9dd4a8b1ac551125eb83 (diff) | |
download | device_samsung_crespo-45bc6a8e501da82e49ab91ef62e8e6693c8f5141.zip device_samsung_crespo-45bc6a8e501da82e49ab91ef62e8e6693c8f5141.tar.gz device_samsung_crespo-45bc6a8e501da82e49ab91ef62e8e6693c8f5141.tar.bz2 |
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
-rw-r--r-- | releasetools.py | 33 |
1 files changed, 18 insertions, 15 deletions
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 |