Usually when building full OTAs for dynamic partition devices the whole partition table is removed and recreated, but in vendorless cases lineageos (and basically any other custom rom) has a patch to disable that functionality and instead just resize the partitions. This, however, breaks the flashing if a new partition is added, because that partition is tried to be resized and, since it doesn't exist, the assert fails. This patch adds another dynamic patch list to remove Oppo partitions or gracefully fail if it already removed (no assert). Signed-off-by: Kuba Wojciechowski <nullbytepl@gmail.com> Change-Id: I1f316c9f16b20324674b55b29f69dfc8c0d642a5
79 lines
2.5 KiB
Python
79 lines
2.5 KiB
Python
# Copyright (C) 2009 The Android Open Source Project
|
|
# Copyright (C) 2019 The Mokee Open Source Project
|
|
# Copyright (C) 2019 The LineageOS Open Source Project
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import common
|
|
|
|
def FullOTA_InstallBegin(info):
|
|
data = info.input_zip.read("RADIO/dynamic-remove-oppo")
|
|
common.ZipWriteStr(info.output_zip, "dynamic-remove-oppo", data)
|
|
info.script.AppendExtra('update_dynamic_partitions(package_extract_file("dynamic-remove-oppo"));')
|
|
return
|
|
|
|
def FullOTA_InstallEnd(info):
|
|
OTA_InstallEnd(info, False)
|
|
|
|
def IncrementalOTA_InstallEnd(info):
|
|
OTA_InstallEnd(info, True)
|
|
|
|
def AddImageOnly(info, basename, incremental, firmware):
|
|
if incremental:
|
|
input_zip = info.source_zip
|
|
else:
|
|
input_zip = info.input_zip
|
|
if firmware:
|
|
data = input_zip.read("RADIO/" + basename)
|
|
else:
|
|
data = input_zip.read("IMAGES/" + basename)
|
|
common.ZipWriteStr(info.output_zip, basename, data)
|
|
|
|
def AddImage(info, basename, dest, incremental):
|
|
AddImageOnly(info, basename, incremental, False)
|
|
info.script.Print("Patching {} image unconditionally...".format(dest.split('/')[-1]))
|
|
info.script.AppendExtra('package_extract_file("%s", "%s");' % (basename, dest))
|
|
|
|
def OTA_InstallEnd(info, incremental):
|
|
AddImage(info, "vbmeta.img", "/dev/block/platform/bootdevice/by-name/vbmeta", incremental)
|
|
|
|
bin_map = {
|
|
'logo': ['logo']
|
|
}
|
|
|
|
img_map = {
|
|
'audio_dsp': ['audio_dsp'],
|
|
'cam_vpu1': ['cam_vpu1'],
|
|
'cam_vpu2': ['cam_vpu2'],
|
|
'cam_vpu3': ['cam_vpu3'],
|
|
'dtbo': ['dtbo'],
|
|
'gz': ['gz1', 'gz2'],
|
|
'lk': ['lk', 'lk2'],
|
|
'md1img': ['md1img'],
|
|
'scp': ['scp1', 'scp2'],
|
|
'spmfw': ['spmfw'],
|
|
'sspm': ['sspm_1', 'sspm_2'],
|
|
'tee': ['tee1', 'tee2']
|
|
}
|
|
|
|
pl = 'preloader_ufs'
|
|
pl_part = ['sda', 'sdb']
|
|
|
|
fw_cmd = 'ui_print("Patching radio images unconditionally...");\n'
|
|
|
|
AddImageOnly(info, "{}.img".format(pl), incremental, True)
|
|
for part in pl_part:
|
|
fw_cmd += 'package_extract_file("{}.img", "/dev/block/{}");\n'.format(pl, part)
|
|
|
|
for img in img_map.keys():
|
|
AddImageOnly(info, '{}.img'.format(img), incremental, True)
|
|
for part in img_map[img]:
|
|
fw_cmd += 'package_extract_file("{}.img", "/dev/block/platform/bootdevice/by-name/{}");\n'.format(img, part)
|
|
|
|
for _bin in bin_map.keys():
|
|
AddImageOnly(info, '{}.bin'.format(_bin), incremental, True)
|
|
for part in bin_map[_bin]:
|
|
fw_cmd += 'package_extract_file("{}.bin", "/dev/block/platform/bootdevice/by-name/{}");\n'.format(_bin, part)
|
|
|
|
info.script.AppendExtra(fw_cmd)
|