Merge "releasetools: system_dlkm: add image to dist zip" am: ef8f4426ef

Original change: https://android-review.googlesource.com/c/platform/build/+/1958309

Change-Id: I5e13518b347c96c0bfc5edad6bc5488978bd5191
This commit is contained in:
Treehugger Robot 2022-01-25 20:23:32 +00:00 committed by Automerger Merge Worker
commit e97ae10d73
2 changed files with 31 additions and 0 deletions

View file

@ -761,6 +761,7 @@ def AddImagesToTargetFiles(filename):
has_boot = OPTIONS.info_dict.get("no_boot") != "true"
has_init_boot = OPTIONS.info_dict.get("init_boot") == "true"
has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true"
has_system_dlkm = OPTIONS.info_dict.get("system_dlkm") == "true"
# {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm, system, system_other}.img
# can be built from source, or dropped into target_files.zip as a prebuilt blob.
@ -831,6 +832,19 @@ def AddImagesToTargetFiles(filename):
if output_zip:
init_boot_image.AddToZip(output_zip)
if has_system_dlkm:
banner("system_dlkm")
system_dlkm_image = common.GetSystemDlkmImage(
"IMAGES/system_dlkm.img", "system_dlkm.img", OPTIONS.input_tmp, "SYSTEM_DLKM")
if system_dlkm_image:
partitions['system_dlkm'] = os.path.join(OPTIONS.input_tmp, "IMAGES", "system_dlkm.img")
if not os.path.exists(partitions['system_dlkm']):
system_dlkm_image.WriteToDir(OPTIONS.input_tmp)
if output_zip:
system_dlkm_image.AddToZip(output_zip)
else:
logger.error("Couldn't locate system_dlkm.img; skipping...")
if has_vendor_boot:
banner("vendor_boot")
vendor_boot_image = common.GetVendorBootImage(

View file

@ -1835,6 +1835,23 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
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.