Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f45a44ee authored by Brint E. Kriebel's avatar Brint E. Kriebel
Browse files

ota: Include full boot images when imgdiff fails

When generating a non-block based incremental, inclue the full boot
image when imgdiff fails to generate a patch. This logic is already
used for block based incrementals.

Change-Id: Idae484ea8c2553a3480961dfa413724e61c52e5f
parent 5a5d96a8
Loading
Loading
Loading
Loading
+30 −22
Original line number Diff line number Diff line
@@ -1249,15 +1249,20 @@ else if get_stage("%(bcb_dev)s") != "3/3" then
    so_far += vendor_diff.EmitVerification(script)

  if updating_boot:
    boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict)
    d = common.Difference(target_boot, source_boot)
    _, _, d = d.ComputePatch()
    if d is None:
      include_full_boot = True
      common.ZipWriteStr(output_zip, "boot.img", target_boot.data)
    else:
      include_full_boot = False

      print "boot      target: %d  source: %d  diff: %d" % (
        target_boot.size, source_boot.size, len(d))

      common.ZipWriteStr(output_zip, "patch/boot.img.p", d)

    boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict)

      script.PatchCheck("%s:%s:%d:%s:%d:%s" %
                        (boot_type, boot_device,
                         source_boot.size, source_boot.sha1,
@@ -1310,9 +1315,15 @@ else

  if not OPTIONS.two_step:
    if updating_boot:
      if include_full_boot:
        print "boot image changed; including full."
        script.Print("Installing boot image...")
        script.WriteRawImage("/boot", "boot.img")
      else:
        # Produce the boot image by applying a patch to the current
        # contents of the boot partition, and write it back to the
        # partition.
        print "boot image changed; including patch."
        script.Print("Patching boot image...")
        script.ApplyPatch("%s:%s:%d:%s:%d:%s"
                          % (boot_type, boot_device,
@@ -1321,9 +1332,6 @@ else
                          "-",
                          target_boot.size, target_boot.sha1,
                          source_boot.sha1, "patch/boot.img.p")
      so_far += target_boot.size
      script.SetProgress(so_far / total_patch_size)
      print "boot image changed; including."
    else:
      print "boot image unchanged; skipping."