aboutsummaryrefslogtreecommitdiff
path: root/releasetools.py
diff options
context:
space:
mode:
Diffstat (limited to 'releasetools.py')
-rw-r--r--releasetools.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/releasetools.py b/releasetools.py
new file mode 100644
index 0000000..56cbe0d
--- /dev/null
+++ b/releasetools.py
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2022 The LineageOS Project
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+import common
+import re
+
+def FullOTA_InstallEnd(info):
+ OTA_InstallEnd(info)
+ return
+
+def IncrementalOTA_InstallEnd(info):
+ OTA_InstallEnd(info)
+ return
+
+def AddImage(info, basename, dest):
+ path = "IMAGES/" + basename
+ if path not in info.input_zip.namelist():
+ return
+
+ data = info.input_zip.read(path)
+ common.ZipWriteStr(info.output_zip, basename, data)
+ info.script.AppendExtra('package_extract_file("%s", "%s");' % (basename, dest))
+
+def OTA_InstallEnd(info):
+ info.script.Print("Patching firmware images...")
+ AddImage(info, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo")
+ AddImage(info, "vbmeta.img", "/dev/block/bootdevice/by-name/vbmeta")
+ AddImage(info, "vbmeta_system.img", "/dev/block/bootdevice/by-name/vbmeta_system")
+ return