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

Unverified Commit 14f0bd0d authored by Brint E. Kriebel's avatar Brint E. Kriebel Committed by Michael Bestas
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 90027907
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
@@ -1681,16 +1681,20 @@ else if get_stage("%(bcb_dev)s") != "3/3" then
      size.append(vendor_diff.largest_source_size)

  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.source_info_dict)

      script.PatchCheck("%s:%s:%d:%s:%d:%s" %
                        (boot_type, boot_device,
                         source_boot.size, source_boot.sha1,
@@ -1740,9 +1744,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,
@@ -1751,9 +1761,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."