g12: actually add the dtb image to the zip
authorJan Altensen <info@stricted.net>
Mon, 16 Aug 2021 16:25:17 +0000 (18:25 +0200)
committerJan Altensen <info@stricted.net>
Mon, 16 Aug 2021 18:36:27 +0000 (20:36 +0200)
Change-Id: I0a601d0fb747b34c1571e996560316777fb9957c

releasetools/releasetools.py

index 46adfb989cc58b060ca1a019c6cdf20017e5dcb8..6f7afbd8c0f94dcf77d9c60dfefae312dfb0facc 100644 (file)
@@ -22,11 +22,13 @@ def AddImage(info, folder, basename, dest):
   common.ZipWriteStr(info.output_zip, name, data)
   info.script.AppendExtra('package_extract_file("%s", "%s");' % (name, dest))
 
-def FlashDtbImage(info):
-  info.script.AppendExtra('package_extract_file("RADIO/dtb.img", "/tmp/dtb.img");');
+def AddDtbImage(info, folder, basename):
+  name = basename
+  data = info.input_zip.read(folder + basename)
+  common.ZipWriteStr(info.output_zip, name, data)
+  info.script.AppendExtra('package_extract_file("%s", "/tmp/dtb.img");' % name);
   info.script.AppendExtra('run_program("/system/bin/dd", "if=/tmp/dtb.img", "of=/dev/dtb", "bs=1k", "count=256");');
 
-
 def PrintInfo(info, dest):
   info.script.Print("Patching {} image unconditionally...".format(dest.split('/')[-1]))
 
@@ -37,7 +39,7 @@ def OTA_InstallEnd(info):
   AddImage(info, "IMAGES/", "vbmeta.img", "/dev/block/by-name/vbmeta")
   if 'RADIO/dtb.img' in info.input_zip.namelist():
     PrintInfo(info, "/dev/dtb")
-    FlashDtbImage(info)
+    AddDtbImage(info, "RADIO/", "dtb.img")
   if 'RADIO/logo.img' in info.input_zip.namelist():
     PrintInfo(info, "/dev/block/by-name/logo")
     AddImage(info, "RADIO/", "logo.img", "/dev/block/by-name/logo")