sm6150-common: releasetools: Make firmware assertions region specific

Change-Id: Idfe58815a2623a29a81d23ee7e8d7d75aff967f2
This commit is contained in:
Arian 2021-07-15 19:46:11 +02:00
parent 9dcfed3a3f
commit 2df667662f
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9

View File

@ -53,11 +53,12 @@ def OTA_InstallEnd(info):
return
def AddBasebandAssertion(info, input_zip):
android_info = input_zip.read("OTA/android-info.txt")
m = re.search(r'require\s+version-baseband\s*=\s*(.+)', android_info)
android_info = input_zip.open("OTA/android-info.txt")
for line in android_info.readlines():
m = re.search(r'require\s+version-baseband\s*=\s*(.+)', line.decode('utf-8'))
if m:
modem_version, firmware_version = m.group(1).rstrip().split(',')
if (len(modem_version) and len(firmware_version)):
cmd = 'assert(xiaomi.verify_baseband({0}) == "1" || abort("ERROR: This package requires firmware from MIUI {1} or newer. Please upgrade firmware and retry!"););'
info.script.AppendExtra(cmd.format(modem_version, firmware_version))
hwc, modem_version, firmware_version = m.group(1).rstrip().split(',')
if (len(hwc) and len(modem_version) and len(firmware_version)):
cmd = 'assert(getprop("ro.boot.hwc") == "{0}" && (xiaomi.verify_baseband("{1}") == "1" || abort("ERROR: This package requires firmware from MIUI {2} or newer. Please upgrade firmware and retry!");) || true);'
info.script.AppendExtra(cmd.format(hwc, modem_version, firmware_version))
return