releasetools: system_dlkm: add image to dist zip
Bug: 200082547
Test: Manual builds:
1. Set BOARD_USES_SYSTEM_DLKM_PARTITION
2. Set BOARD_PREBUILT_SYSTEM_DLKM_IMAGE to external image
- Check that "m dist" put the system_dlkm image in
out/dist/aosp_cf_x86_64_phone-img-eng.ramjiyani.zip
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
Change-Id: I8b7dd40e178db7fe542253bff19040095847fa57
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index e5c68bc..22c043a 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1835,6 +1835,23 @@
return File(name, data)
return None
+def GetSystemDlkmImage(name, prebuilt_name, unpack_dir, tree_subdir,
+ info_dict=None):
+ """Return a File object with the desired system dlkm image.
+ Look for it under 'unpack_dir'/IMAGES or 'unpack_dir'/PREBUILT_IMAGES.
+ """
+
+ prebuilt_path = os.path.join(unpack_dir, "IMAGES", prebuilt_name)
+ if os.path.exists(prebuilt_path):
+ logger.info("Using prebuilt %s from IMAGES...", prebuilt_name)
+ return File.FromLocalFile(name, prebuilt_path)
+
+ prebuilt_path = os.path.join(unpack_dir, "PREBUILT_IMAGES", prebuilt_name)
+ if os.path.exists(prebuilt_path):
+ logger.info("Using prebuilt %s from PREBUILT_IMAGES...", prebuilt_name)
+ return File.FromLocalFile(name, prebuilt_path)
+
+ return None
def _BuildVendorBootImage(sourcedir, info_dict=None):
"""Build a vendor boot image from the specified sourcedir.