Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef8f4426 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents 488c598f bdef28f2
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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(
+17 −0
Original line number Diff line number Diff line
@@ -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.