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]))
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")