1import common
2import struct
3
4def FullOTA_InstallEnd(info):
5  try:
6    firmware_img = info.input_zip.read("RADIO/bootloader.img")
7  except KeyError:
8    print "no bootloader.img in target_files; skipping install"
9  else:
10    info.script.Print("Writing bootloader.img...")
11    common.ZipWriteStr(info.output_zip, "bootloader.img", firmware_img)
12    info.script.AppendExtra(
13        'package_extract_file("bootloader.img", "/dev/block/platform/sdhci-tegra.3/by-name/OTA");')
14
15
16def IncrementalOTA_InstallEnd(info):
17  try:
18    source_firmware_img = info.source_zip.read("RADIO/bootloader.img")
19  except KeyError:
20    print "no bootloader.img in source_files; skipping install"
21  else:
22    try:
23      target_firmware_img = info.target_zip.read("RADIO/bootloader.img")
24    except KeyError:
25      print "no bootloader.img in target_files; skipping install"
26    else:
27      if source_firmware_img == target_firmware_img:
28        return
29      info.script.Print("Writing bootloader.img...")
30      common.ZipWriteStr(info.output_zip, "bootloader.img", target_firmware_img)
31      info.script.AppendExtra(
32          'package_extract_file("bootloader.img", "/dev/block/platform/sdhci-tegra.3/by-name/OTA");')
33