flounder: Add OTA support for vendor specific files

Change-Id: I26ec1095f5cb9b7ff3371c002c4212489153d30d
diff --git a/releasetools.py b/releasetools.py
new file mode 100644
index 0000000..e61a63a
--- /dev/null
+++ b/releasetools.py
@@ -0,0 +1,32 @@
+import common
+import struct
+
+def FullOTA_InstallEnd(info):
+  try:
+    firmware_img = info.input_zip.read("RADIO/firmware.zip")
+  except KeyError:
+    print "no firmware.zip in target_files; skipping install"
+  else:
+    info.script.Print("Writing firmware.zip...")
+    common.ZipWriteStr(info.output_zip, "firmware.zip", firmware_img)
+    info.script.AppendExtra(
+        'package_extract_file("firmware.zip", "/dev/block/platform/sdhci-tegra.3/by-name/OTA");')
+
+
+def IncrementalOTA_InstallEnd(info):
+  try:
+    source_firmware_img = info.source_zip.read("RADIO/firmware.zip")
+  except KeyError:
+    print "no firmware.zip in source_files; skipping install"
+  else:
+    try:
+      target_firmware_img = info.target_zip.read("RADIO/firmware.zip")
+    except KeyError:
+      print "no firmware.zip in target_files; skipping install"
+    else:
+      if source_firmware_img == target_firmware_img:
+        return
+      info.script.Print("Writing firmware.zip...")
+      common.ZipWriteStr(info.output_zip, "firmware.zip", target_firmware_img)
+      info.script.AppendExtra(
+          'package_extract_file("firmware.zip", "/dev/block/platform/sdhci-tegra.3/by-name/OTA");')