[updater]: Add support for radio image upgrade on eMMC devices.

Change-Id: Ia8e23d7d66b5d95fbb276865a742d334caa3128f
This commit is contained in:
Shashank Mittal 2011-08-23 20:04:15 -07:00
parent 5bd122e2d9
commit e984d204fa
1 changed files with 44 additions and 7 deletions

View File

@ -18,6 +18,13 @@
import common
import re
def GetRadioFiles(z):
out = {}
for info in z.infolist():
if info.filename.startswith("RADIO/") and (info.filename.__len__() > len("RADIO/")):
fn = "RADIO/" + info.filename[6:]
out[fn] = fn
return out
def FullOTA_Assertions(info):
AddBootloaderAssertion(info, info.input_zip)
@ -43,17 +50,35 @@ def CheckRadiotarget(info, mount_point):
info.script.AppendExtra('assert(qcom.set_radio("%s"));' %
(p.fs_type))
# map qcom partitions with filenames
QCOM_MOUNT_MAP = { "NON-HLOS.bin": "modem",
"rpm.mbn": "rpm",
"sbl1.mbn": "sbl1",
"sbl2.mbn": "sbl2",
"sbl3.mbn": "sbl3",
"tz.mbn": "tz",
"emmc_appsboot.mbn": "aboot",
"radio.img": "radio"}
def InstallRadio(radio_img, api_version, input_zip, fn, info):
fn2 = fn[6:]
fn3 = "/sdcard/radio/" + fn2
common.ZipWriteStr(info.output_zip, fn2, radio_img)
if api_version >= 3:
info.script.AppendExtra(('''
if (fn2.endswith("ENC") or fn2.endswith("enc")):
info.script.AppendExtra(('''
assert(package_extract_file("%s", "%s"));
''' %(fn2,fn3) % locals()).lstrip())
else:
fstab = info.script.info.get("fstab", None)
if fn2 not in QCOM_MOUNT_MAP:
return
if QCOM_MOUNT_MAP[fn2] not in fstab:
return
info.script.WriteRawImage(QCOM_MOUNT_MAP[fn2], fn2);
return
elif info.input_version >= 2:
info.script.AppendExtra(
'write_firmware_image("PACKAGE:radio.img", "radio");')
@ -64,17 +89,29 @@ assert(package_extract_file("%s", "%s"));
def FullOTA_InstallEnd(info):
if info.files == {}:
files = GetRadioFiles(info.input_zip)
if files == {}:
print "warning sha: no radio image in input target_files; not flashing radio"
return
enc_file = "false";
info.script.UnmountAll()
for f in info.files:
info.script.Print("Writing radio image...")
info.script.Print("Writing radio image...")
for f in files:
if (f.endswith("ENC") or f.endswith("enc")):
continue
radio_img = info.input_zip.read(f)
InstallRadio(radio_img, info.input_version, info.input_zip, f, info)
CheckRadiotarget(info, "/recovery")
for f in files:
if (f.endswith("ENC") or f.endswith("enc")):
radio_img = info.input_zip.read(f)
InstallRadio(radio_img, info.input_version, info.input_zip, f, info)
enc_file = "true"
if (enc_file == "true"):
CheckRadiotarget(info, "/recovery")
return