don't require some OTA features
Make the following things optional:
- kernel command lines for bootable images
- radio images
- bootloader assertions
These are not all (yet?) defined for some new devices.
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 033ba22..3463745 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -90,11 +90,15 @@
assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,)
assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,)
- cmdline = open(os.path.join(sourcedir, "cmdline")).read().rstrip("\n")
+ fn = os.path.join(sourcedir, "cmdline")
+ if os.access(fn, os.F_OK):
+ cmdline = ["--cmdline", open(fn).read().rstrip("\n")]
+ else:
+ cmdline = []
p = Run(["mkbootimg",
- "--kernel", os.path.join(sourcedir, "kernel"),
- "--cmdline", cmdline,
- "--ramdisk", ramdisk_img.name,
+ "--kernel", os.path.join(sourcedir, "kernel")] +
+ cmdline +
+ ["--ramdisk", ramdisk_img.name,
"--output", img.name],
stdout=subprocess.PIPE)
p.communicate()
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 1ac035a..307ca4f 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -310,13 +310,11 @@
info = input_zip.read("OTA/android-info.txt")
m = re.search(r"require\s+version-bootloader\s*=\s*(\S+)", info)
- if not m:
- raise ExternalError("failed to find required bootloaders in "
- "android-info.txt")
- bootloaders = m.group(1).split("|")
- script.append("assert " +
- " || ".join(['getprop("ro.bootloader") == "%s"' % (b,)
- for b in bootloaders]))
+ if m:
+ bootloaders = m.group(1).split("|")
+ script.append("assert " +
+ " || ".join(['getprop("ro.bootloader") == "%s"' % (b,)
+ for b in bootloaders]))
def IncludeBinary(name, input_zip, output_zip, input_path=None):
@@ -343,8 +341,12 @@
script.append("format BOOT:")
script.append("show_progress 0.1 0")
- common.ZipWriteStr(output_zip, "radio.img", input_zip.read("RADIO/image"))
- script.append("write_radio_image PACKAGE:radio.img")
+ try:
+ common.ZipWriteStr(output_zip, "radio.img", input_zip.read("RADIO/image"))
+ script.append("write_radio_image PACKAGE:radio.img")
+ except KeyError:
+ pass
+
script.append("show_progress 0.5 0")
if OPTIONS.wipe_user_data: